if you have downloaded the full 2D car example zip, in the AppGameKit code (main.agc) you should see something like this (it's a little specific due to car rotations and velocity etc...):
NGP_SendMovement(networkId, POS_X, 1, (cos(carAngle)* Tween#)*carSpeed*UseBoost)
NGP_SendMovement(networkId, POS_Y, 1, (sin(carAngle)* Tween#)*carSpeed*UseBoost)
For 3D, it's easier : maintain the velocity at 1 and assume your movement adds or subs 1 unit per frame on X axe (at 60fps but will be adapted with Tween# variable) :
if GetRawKeyState(37) // LEFT arrow
NGP_SendMovement(networkId, POS_X, 1, -1.0 * Tween#) // -1.0 on X
endif
if GetRawKeyState(39) // RIGHT arrow
NGP_SendMovement(networkId, POS_X, 1, 1.0 * Tween#) // 1.0 on X
endif
You should do this for Y and Z axes too, depending on the keys you want (just replace the constant POS_X by POS_Y or POS_Z.
Do not move your local "object/mesh" yourself at this time in these statements ... there is an event "NGP_on
LocalPlayerMoveUpdate" to do this which make local reconciliation :
/*************************************************************************************************/
/* When the local client has moved on the server (After Prediction and Server Reconciliation) */
/*************************************************************************************************/
function NGP_onLocalPlayerMoveUpdate(iNetID, UpdatedMove as NGP_Slot)
SetObjectPosition(myPlayerObjectID,UpdatedMove.Slot[POS_X] ,UpdatedMove.Slot[POS_Y],,UpdatedMove.Slot[POS_Z])
endfunction
the others clients will update their positions on your screen with the event "NGP_on
NetworkPlayerMoveUpdate" :
/********************************************************************/
/* When another client has moved on the server (After internal interpolation) */
/********************************************************************/
function NGP_onNetworkPlayerMoveUpdate(iNetID, ClientID as integer, UpdatedMove as NGP_Slot)
// resolve the other player ObjectID
otherClientObjectID = GetNetworkClientUserData( iNetID, ClientID, 1) // Assuming you have push the player object ID in slot 1 of the network Userdata when he just connected (see the NGP_onNetworkPlayerConnect event in the same file)
// move the other player Object with the X,Y,Z Slots
SetObjectPosition(otherClientObjectID,UpdatedMove.Slot[POS_X] ,UpdatedMove.Slot[POS_Y],,UpdatedMove.Slot[POS_Z])
endfunction
As you can see, you have only to add the use of the slot POS_Z for 3D
and in 3D you will often need to interpolate rotations too ... so, for object rotations, do the same things with NGP Slot ANG_X,ANG_Y,ANG_Z (NGP_SendMovement() and the moveUpdates events). You have a second set of Slot (POS_X2,POS_Y2,POS_Z2,ANG_X2,ANG_Y2,ANG_Z2) if your objectID (or vehicle) has a second element (think about a tank (1) with a turret/canon (2) for example)
when i will have time i will update the multiplayer server (i've made some little fixes for precision and stability) and will add a 3D simple example
tell me if you need other informations