I'm writing a simple distributed quiz game intended to work as follows.<br><br>A referee process waits for two player processes to join the game. <br>Once the players have joined, the referee sends the players questions, and the players <br>
respond with answers. The first player to correctly answer N questions is the winner.<br><br>My initial approach was to get dummy messages flowing on a single erlang node.<br>To see that this is working, I write to the console upon receipt of messages, as <br>
seen below, in the main loop of a player process.<br><br>loop(Nickname)-><br> receive<br> {_From, stop} -><br> io:format("~p:: ~p received stop msg ~n", [?MODULE, Nickname]), <br> player_stopped;<br>
<br> {From, {question, N} } -><br> io:format("~p:: ~p received question ~p~n", [?MODULE, Nickname, N]), <br> From ! {self(), {answer,N} },<br> loop(Nickname);<br><br> Other -><br>
io:format("~p ~p received unknown msg ~p~n", [?MODULE, Nickname, Other]),<br> loop(Nickname)<br> end.<br><br>Everything worked as expected on a single node, so my next step was to get things working<br>
across multiple nodes. I created a referee node and two player nodes, each running its<br>respective process. The messages flow correctly, but all the terminal io happens in<br>a single console, the one associated with the referee node.<br>
<br>My question is how to get player output written to the console of the corresponding <br>player node? Eventually I want the nodes to run on separate computers, and the<br>console output (questions) to be read by actual players, so I need the output to go to<br>
the right place.<br>