How to synchronize movements
Hello! I'm currently designing the movement system for my multiplayer game. I want to be sure that there is no visible lag for the client, but also to avoid cheating. My first try was for the client to send its next position, and for the server to check that it is possible for the client to arrive there in the timeframe. If not, the player is violently teleported backward. But in order to avoid the anti-cheat system to be triggered at the first late paquet, I allow a grace delta. This means that the client could cheat by going slightly faster, if the network conditions are good. Having looked on Internet about the problem, I found an article that described the system used by Valve. To simplify: the client and the server both use the same timeframe, and the client sends the user commands, and process them at the same time. There is almost no divergence, and the server just has to forcemove the character when it gets a bit far from what it has calculated. But I'm not terribly happy with this solution: I think that my graphics should be decoupled from this user input: the client and the server would probably process input at 20 or 30 inputs per second, maybe less, but I want to be at least at 60 fps. This means having a separate thread for input and graphics, and interpolating the graphical object's position as the graphics would update a lot more faster than the input. Seems overkill! Any opinion on this?
I'd take a look at dead reckoning.
Essentially, you calculate direction and velocity. This would give you a projected path. As long as the client hasn't deviated much from the path, the server is happy. When the client DOES deviate outside a threshold, then the server needs to validate if this is a good movement, and if so, it needs to recalc the direction and velocity and establish a new threshhold.
thats the jist of it, and i'm sure someone out there can say it better...
Essentially, you calculate direction and velocity. This would give you a projected path. As long as the client hasn't deviated much from the path, the server is happy. When the client DOES deviate outside a threshold, then the server needs to validate if this is a good movement, and if so, it needs to recalc the direction and velocity and establish a new threshhold.
thats the jist of it, and i'm sure someone out there can say it better...
This subject is actually covered in my Canonical Game Loop article -- look for the EXTRAPOLATE/INTERPOLATE part.
enum Bool { True, False, FileNotFound };
Quote:
Original post by hplus0603
This subject is actually covered in my Canonical Game Loop article -- look for the EXTRAPOLATE/INTERPOLATE part.
The fact that the author in that article states that windows 98/me are 16bit operating systems worries me a bit.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement