Archived

This topic is now archived and is closed to further replies.

Tew

UDP - Synchronization of Shots

Recommended Posts

I'm working on a little 2dtank game with multiplayer. When I fire a shot I send data to the other players telling them I did =) The problem is that the shot on the other player computers are some Milillisecs behind the one on the computer the shot was fired "from". (if you get the problem) In some cases this shot can hit a player seen thru the player fired but not seen by the player hit. Becase of this I send Armor/Sheild so when a shot misses on one comp but not the other the health is still same on both computers. My question is : Is there a way this can be solved by timeing of some sort? How do they do this in FPSGames? btw I would prefer to not use anysort of deadreconing but any suggestions are welcome.

Share this post


Link to post
Share on other sites
Obviously, if you can fire a shot at tank #1 and hit it on your screen and miss it on the other you need better position prediction.

Instead of sending positions, send delta''s, so the other pc can GUESS where the other tank will be even if it didnt receive a new position update.

Also, having authorative clients is a bad thing, imagine a hacker sending packets about his super tank that killed all other tanks.

Share this post


Link to post
Share on other sites
> How do they do this in FPSGames?

In FPS games a server is used (C/S topology), which is responsible for computing collisions, projectile trajectories, shield decreases on hit, destruction, etc. The client send in movement and weapon trigger commands and the server bounces back its position and the position of potentially visible ennemies at regular intervals (about 10 - 20 times per sec) along with the results (exploded missile, killed ennemies, etc). Cheating and paradigm shifts are minimized. To smooth out the visual jagness of player movements induced by network lag, dead reckoning algorithm can be used.

In RTS games such as Age of Empire, each computer manages the entire simulation (peer topology) and commands are issued and registered in a lock-step manner with a granularity of 150 to 200 ms and with an overstep of 2 (commands issued the current frame are commited 2 frames in the future from the current one). It is assumed that all computers will be in sync as they use the same map, same initial positions, same random number sequences, and commit the commands in sync.

-cb

Share this post


Link to post
Share on other sites
RTS:

http://www.gamasutra.com/features/20010322/terrano_01.htm

"Real-Time Strategy Game Programming Using MS Direct X 6.0", Mickey Kawick


FPS:

http://www.gamasutra.com/features/19990903/lincroft_01.htm

http://www.gamasutra.com/features/19970829/obrien_01.htm

http://www.gamers.org/dEngine/quake/QDP/qnp.html

-cb

Share this post


Link to post
Share on other sites