; JoinNetGame Example ; ------------------- ; JoinNetGame joins a named game on a known IP address directly, ; skipping the StartNetGame dialog. It returns 1 on success. ; ; Run the HostNetGame example in another copy of Blitz3D+ FIRST, ; then run this program - it joins the host over loopback. Print "Looking for 'demo game' on 127.0.0.1 ..." status=JoinNetGame("demo game","127.0.0.1") If status=1 Then Print "JoinNetGame returned 1 - joined the game!" ; Create our player; the host is notified that we joined guest=CreateNetPlayer("Guest") Print "Playing as '"+NetPlayerName$(guest)+"'" ; Message type 100 tells us about players already in the game start=MilliSecs() While MilliSecs()-start<3000 If RecvNetMsg() Then If NetMsgType()=100 Then Print "Found player '"+NetPlayerName$(NetMsgFrom())+"' in the game" EndIf Delay 10 Wend StopNetGame Print "Left the game" Else Print "JoinNetGame returned "+status+" - no 'demo game' found." Print "Start the HostNetGame example in another copy first," Print "then run this example again while it is listening." EndIf Print "" Print "Press any key to close the example" WaitKey End