🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Authorative Setup Client Prediction 100% Wrong

Started by
23 comments, last by hplus0603 7 years, 2 months ago

Ok I think the best approach currently is to rewind on the server to the time of press and inside the package the client sends to the server containing the timestamp to rewind to, I simply crypt this area of the message or something like that. I can't find any other solution other then rewinding on the Server.

Advertisement

But this could be so easily hijacked from a hacker. As an example have 2 characters Race a given distance. The Hacker could now hijack the timestamp of the package and just instead of saying it was at 500 could change it to 450. Now the Server rewinds to 450 and lets the hacker run 50 ms earlier then the other. The hacker will always win.

Keep in mind that your communication channel is typically sequenced (guaranteed to be so if using TCP), so as long as you enforce that timestamps coming from the client are monotonically increasing, the client can never really execute a one-off rewind attack that way.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Encryption doesn't solve the problem, it just makes it a little harder for a hacker to figure out what you're doing.

For your hypothetical racing game, you can reject inputs that are for "before" the race begins. Another point to note is that even without a rewinding feature, a hacker has an advantage as they can estimate the ping and send the "start running" command to arrive the instant the race is due to start.

My understanding of serious e-sports games is that the device is provided by the tournament organiser, at least in the last few rounds where the large prize money is.

Synergi, you're overthinking it. Every prediction system is, by definition, going to be a little bit wrong sometimes. There is no solution to that. All you can do is mitigate the problem, which usually means correcting the client a small amount if and when the server reports that its movements were somehow wrong.

Networking and game design are closely related and there are always trade offs involved. If you're making a competitive game and the single press of a button determines the outcome (e.g. your race example), then you might want to forgo responsiveness and let the server decide when the button was pressed. If that makes your game feel too unresponsive, you can try hiding the latency with client side prediction/animation/sounds. But you could also go for another design, where the outcome is not determined by a single button press. If you need to maneuver through some track and other players can interact with you, it becomes less attractive to send some input in the past, because it requires the cheating client to not have given any input until that point in time (doing so would prevent the server from accepting the past input since all packets are sequenced) and it binds them to that choice which might make reacting to other events impossible.

For a game like Smite, I can image that movement allows for some rewinding to make that feel as responsive as possible, but the use of abilities may not.

Another point to note is that even without a rewinding feature, a hacker has an advantage as they can estimate the ping and send the "start running" command to arrive the instant the race is due to start.

Ideally you want this to be in the game by default, the client's simulation should run a little bit ahead of the server. The added benefit is that your server will have to do less rewinding and forward simulations, which can be costly (processing wise) depending on the type of game.

Not a single Tutorial Like GafferGames, MPDev, ... was able to explain me what I'm doing wrong


It's not the role of tutorials to tell you what you're doing wrong.
It's the job of your own debugging to tell you what you're doing wrong.
Clearly state what you believe "right" is, and why.
Now, add asserts to your code, and breakpoints in the debugger, and print statements, and other barriers that will let you prove where you get it "right" and where you get it "wrong."
Once you see what is wrong, work your way backwards from proven-right points in time to see where you diverge.

Yes, this may require you to add more data "on the side" to verify against, such as logs of "data I reveived at time X with position Y" to look through.
That's fine. You can remove this before you ship. (In fact, typically, you'll have a "develop" versus "ship" code switch to do this.)
enum Bool { True, False, FileNotFound };

Server rewinding to account for player's ping spike is a terrible idea imo. If a player has unstable network condition, he/she should not expect a smooth gameplay.

An invisible text.

Server rewinding to account for player's ping spike is a terrible idea imo. If a player has unstable network condition, he/she should not expect a smooth gameplay.

Don't have to be spikes at all, simulations will diverge even with best connections out there. Unless you have lock-step, you either need to have rewinding or continuously correct clients. For some games (e.g. FPS), it's imperative to have rewinding for them to be 'playable'.

I wouldn't say you need server rewinding. If the client somehow becomes divergent from the server then usually I'd just drag the client back into place.

For some games (e.g. FPS), it's imperative to have rewinding for them to be 'playable'.


I wouldn't say you need server rewinding


I think you mean different things. I think Mussi means server rewinding when doing hit checks, similar to the Counter-Strike model.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement