TNet BASIC Release!

BlitzMax Forums/BlitzMax Programming/TNet BASIC Release!

Tibit(Posted 2005) [#1]
TNet-BASIC is now released!

What is TNet?
TNet is a Multiplayer Module to BlitzMax, much like BlitzPlay. It gives you a set of easy to use commands so that you can implement multiplayer into your games with less work and better result. TNet is free for non-commercial use, see the TNet Site for more info.

Example Code

Host
TNet_HostTCP( 8080 ) 'Or TNet_HostUDP( port )
While Not KeyHit(KEY_ESCAPE)
   TNet_Update()
   If TNet_NewClient() TNet_SendTCP( 9,"Welcome, You are now connected", TNetID )'Send Back
   If TNet_Receive( 3 ) TNet_SendUDP( 9 ,"Hi you too!", TNetID )
Wend 
Client
 
Graphics 300,300,0
Your_IP$ = "Host IP Here!" 'Ex 127.0.0.1
If Not TNet_JoinTCP( Your_IP$, 8080 ) Print "Cannot Find Host"; End
While Not KeyHit(KEY_ESCAPE)
	TNet_Update()
	TNet_DrawClientList()
	If TNet_Receive( 9 ) Print "Received: "+TNetData
	'Below: Send a Msg of Type 3 to All
	If KeyHit( Key_Space ) TNet_SendTCP( 3, "Hi!" )
	Flip;Cls
Wend 
What'is New?The newest and biggest addition is TCP support. You can now send a message either as UDP or TCP. You still only need one port. It works (at least for me) without any problems so far, to wildly mix the two.

Next thing is the new name policy (after feedback). All TNet commands now start with TNet_ and all TNet globals (there is only a few) start with TNet.

The packing commands have been given a speed up + bugfixes.

WriteFlagsToByte is now called TNet_WriteFlags and should support up to 13 flags instead of just 8.

I'll update the site later on. (No example should work right now unless you alter them). I'll also add some more documentation. If there is any area that you want a better coverage in (tutorials or examples), please suggest.

Prediction is not in yet. That will be my next step along with sync object. As always, any questions, comments or suggestions are welcome!


BlitzSupport(Posted 2005) [#2]

Prediction is not in yet. That will be my next step along with sync object.


This is the bit I'm really looking forward to seeing!


Jeroen(Posted 2005) [#3]
yes! Me too!

Great work!


Filax(Posted 2005) [#4]
Really good the TNet_XXXX :) more visible :)


Leiden(Posted 2005) [#5]
Wow this looks awesome, keep up the good work!


Beaker(Posted 2005) [#6]
Nice work.