TNet Multiplayer Release Update

BlitzMax Forums/BlitzMax Programming/TNet Multiplayer Release Update

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Thanks,
I was away last week so that's why I haven't replied.


will this be competing with the "official" network modules (when/if they come out)?


The official network module called GNet is already out, as well as the sockets code, see the official documentation. It could need a little more work, but it's done. I would say TNet-BASIC is competing to GNet. TNet-Advanced will be aimed for more serious developers, it will not be harder to use it will only contain more features. And will be out of league with GNet.


Excuse my ignorance of how Max works but is there a way of interating through a type's structure or would the programmer have to create a function or method for this to occur?


Direct answer would be: Programmer have to use functions and import a "unreal_network_module.bmk" file, which you can modifiy if you want to.

Syncobjects will be implemented into your game with the help of some functions.

Here is an example:
'This is your create method for an object you want to sync.
	Function Create()
	
			Local P:Probe = New Probe
			P.Control = AI 'On this computer
			P.Local_ID = CreateSyncObject()'<--- NETWORK CREATE SYNC OBJECT
			UpdateSyncObject( [ Int(P.X), Int(P.Y) ,P.Dir, P.Armor, P.Energy], P.Local_ID )	
	
	EndFunction


This is for sending actions, could be keypresses.
If KeyDown(Key_Up) SetActionOn( 0,Local_ID ) Else SetActionOff( 0,Local_ID )
If KeyDown(Key_Down)  SetActionOn( 1,Local_ID ) Else SetActionOff( 1,Local_ID )
If KeyDown(Key_Left) SetActionOn( 2,Local_ID ) Else SetActionOff( 2,Local_ID )
If KeyDown(Key_Right) SetActionOn( 3,Local_ID ) Else SetActionOff( 3,Local_ID )


In your objects update method you would have this, decide which fields you want to send. These fields will be sent to the other clients and applied to their remote sync-objects. You can control the sending interval at which these updates are sent.
UpdateSyncObject( [ Int(X), Int(Y) ,Dir, Armor, Energy] ,Local_ID )


This is how you receive the data from others. This should be run in objects that are remote controlled. Means If SyncUpdate Recieved then
If SyncUpdate( Net_ID, Local_ID )	TNetApplyUpdate( X, Y, Dir, Armor, Energy )	

If TNetKeySync( Net_ID, Local_ID )	SetActions( Up, Down, TLeft, TRight)