very general packet data question
i''m making a sort-of racing game, and was wondering what type of information i should send to all the other players. i''ve been thinking it''s either the user inputs from the players, or the asolute position/orientation of the players.
if i sent the user inputs, they could be fed into the player class, and through the physics engine, but not every packet could be retreived which would lose synchronization.
on the other hand, if i sent direct position/orientation, synchronization concerns are not that serious, but they can''t really be fed through the physics engine very well, because the info sent over IS the new vector assignmnent for position orientation.
(planning on using winsock, and am using open gl, c++, windows95)
some suggestions gladly appreciated, or like, links to some good articles. i have all the ones from this site already.
a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Send *both* the position and velocity (and maybe the acceleration) from the server to each client periodicly. There won''t be too many cars on a given track so the packet won''t be too large. The physics engine on the clients could use the velocity and position to ''guess'' the position of the cars in the future. You could, perhaps, have some AI code on the client which controls the cars until the next update packet comes in.
The clients could send key-press info back to the server, which then decides what to do with a given car. An update packet is then sent out to all clients.
Hope that helps,
Peter
The clients could send key-press info back to the server, which then decides what to do with a given car. An update packet is then sent out to all clients.
Hope that helps,
Peter
position, orientation, linear and angular velocity and linear and angular acceleration. the last two are needed in case of packet loss (that way you can predict where the remote cars are going to be at the next frame). those have to be transmitted as often as possible. you may or may not want to also send status packets (damage, police pursuit, lap entered, crash/car reset, whatever) on event basis. if you don''t, that will reduce the traffic somewhat (pardon the pun), but you might have synchronization issues in case of packet loss (i.e. if the prediction misfires, you might end up with different types of damage to the same car on different clients, etc).
i''m by no means a network programmer, so take this with a grain of salt.
--
Float like a butterfly, bite like a crocodile.
i''m by no means a network programmer, so take this with a grain of salt.
--
Float like a butterfly, bite like a crocodile.
--Float like a butterfly, bite like a crocodile.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement