My idea for a network library

BlitzMax Forums/BlitzMax Programming/My idea for a network library

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.

How did you mean for the interface of the network lib to be?

This is how I do it now in simplified pseudo code:

Your Local Input.
If KeyDown(KEY_LEFT) P\Left = 1 else P\Left = 0
SendKeys(P\Up,P\Down,P\Left,P\Right)

Your received data of other players.
Each Msg
P = MsgFrom
P\Up = GetKeys(1)
P\Down = GetKeys(2)
P\Left = GetKeys(3)
P\Right = GetKeys(4)
del msg
next

Do you think I could add another interface on top of that, so that it can be even more simple to implend multiplayer? I mean the "user" (of the Netlibrary) can use a more intuitive command?

I had this idea from your idea =)

SyncKey( PLAYER1_MOVE_LEFT_KEY ) ' Creates a sync
SendKeys() 'Sends all your keys to all others

UpdateNet() 'Get message/sync

Each Player
If NetKeydown(KEY_LEFT)'Has this client this keydown?
'If it is a local player then it calls the normal
KeyDown()
'if the key is not in sync?
'All clients must sync the same keys right?
Endif
next

The is there a problem when you have more than 1 player on each client connected or AI players?