Network sync problems

BlitzMax Forums/BlitzMax Beginners Area/Network sync problems

spacerat(Posted 2007) [#1]
Hey again
In have encountered some problems with networking which I can't seem to track down. Basically I have a server running in a console, and clients. The player movement calculation on the server and client is the same and they both use delta timing, however when the client moves, it's player snaps forwards. I am sure that the server is running faster than the client, but is this a problem? I would think that delta timing would sort that out, but perhaps not.

So What do you suggest I do to try and find the problem? Has anyone encountered this beefore? Do I need to clarify myself?


Jake L.(Posted 2007) [#2]
Sounds like you have to interpolate the player between the last known position and a predicted one (or between the last two known positions).

See this article for further details.

Jake

PS: You need to login to gamasutra. If you're not registered yet, do so! It's free and a valuable source of information.


spacerat(Posted 2007) [#3]
Ok I have found the issue, but it just opens even bigger questions. The issue is that delta timing seems to be screwing up. I have this code (from the code archives in fact)
Type Delta
	Global Time:Float
	Global TimeDelay:Float
	Function Start() 
		TimeDelay = MilliSecs() 
	End Function
	Function Update() 
		Time = (MilliSecs() - TimeDelay) 
		TimeDelay = MilliSecs() 
	End Function
End Type

This works perfectly for a friend of mine, and I imagine most other people, but for me it is being inconsistent for me. It usually seems to work for the client (a Graphical Minib3D app) but the server is returning strange results when I check the deltatime variable, such as:
2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 
-2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 
-2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 
-2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 -2.00000000 
-2.00000000 -2.00000000 -2.00000000 -1.00000000 
-1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 
-1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 -1.00000000 
-1.00000000 -1.00000000 


How is it even possible to get a negative value from this? Is there something wrong with Millisecs() in console applications?


DavidDC(Posted 2007) [#4]
I'm pretty sure MilliSecs() returns an int, not a float

Are you sure delta time is the way to go with networking? I always thought you capped the logic frame rate and used fixed steps. But I've never tried it so I may be way off-base here!

- David