Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / Game Design & Programming / Lag and twitch games Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
kaz

December 25, 2004, 08:46 PM

I'm currently designing a network playable freeware 2D game.

I've been sitting here trying to design an algorithm to keep players in my game relativly in sync with eachother. I've come to the conclusion that rtt/2 won't give me a very accurate estimation of the one-way propigation delay from one machine to another.

I've also thought about using NTP to sync up the time on the client and server, but I can't find any NTP c libraries out on the net for win32.

Does anyone know a good algorithm I can use to sync-up the client and server times? How do the new-age games of today do it (Quake1/2/3, HL1/2, UT, etc..)?

 
Joćo Filipe Henriques

February 17, 2005, 08:04 PM

Actually, synching-up 2 computers over a network is an old problem, and there are many different approaches to it. However, there is a specific solution for twitch games that I think is interesting; besides, I think that there's really no better way to deal with the problems this solves.

You have to admit that the data won't be transfered instantly no matter how fast the connection is. This delay is a bit inconstant with all the problems involving transfer over wires and stuff, and inconstant delays are what annoys players so much - in a twitch game you're supposed to be accurate to the milisecond. So it's wise to introduce a constant delay for every action that a player takes. If this time compensates for most fluctuations in transfer time, you have a pretty solid system - the players will feel like the game is not so responsive but it's generally easier to get used to than inconstant lag. The implementation is simple, whenever you send a packet, it should contain a timestamp for when to activate it, 200ms from then or so. I've seen some docs from the creators of Age of Empires and Age of Mythology, they used this in their games, and I'm surprised it wasn't used much in other games. These are strategy games but you can see its benefits for twitch games, like I pointed above. There's more to this, and I'd like to see some discussion of this technique... I hope it helps!

 
This thread contains 2 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.