Thanks Andres, I will fix those in the next update :)
Here is a simple chat program for Blitzmax:
It uses the TNet Multiplayer Library and shows how you can quickly set up a client-server game and send messages.
I'm sorry for the lack of comments but I consider it pretty selfexplainatory. Feel free to ask any questions about the example and I will improve it.
Here is a simple chat program for Blitzmax:
It uses the TNet Multiplayer Library and shows how you can quickly set up a client-server game and send messages.
Import Truplo.TNet_Advanced Graphics 300,300,0 Const HostPort = 44444 Const CHAT = 1 ' Message Type for Normal Chat Messages Local WantToHost = True ' True to Host Select WantToHost Case True If TNet_HostUDP( HostPort ) = False RuntimeError "Port "+HostPort+" already in use!" Case False Local IPofHost$ = "127.0.0.1" ' Use 127.0.0.1 to connect to yourself If TNet_JoinUDP( IPofHost$, HostPort ) = False RuntimeError "Cannot find host!" EndSelect Repeat ' -------------- -L -O -O -P ------------------- Local Message$ TNet_Update() If KeyHit( KEY_1 ) Message = "Hello" If KeyHit( KEY_2 ) Message = "Hi" If KeyHit( KEY_3 ) Message = "Greetings" If KeyHit( KEY_4 ) Message = "Yo" ' If any Key was hit then send a message to everyone who is connected: If Message Then TNet_Send( CHAT, Message ) 'Chat TNet_Receive( CHAT ) 'Updates the Global TNetData Variable DrawText "Last Received: "+TNetData,20,200 DrawText "Use keys 1-4 to send messages. ",10,20 'Draws each Client and their Latency TNet_DrawClientList(10,50) Flip;Cls Until KeyDown(Key_Escape) ' -------------- -L -O -O -P -------------------
I'm sorry for the lack of comments but I consider it pretty selfexplainatory. Feel free to ask any questions about the example and I will improve it.