6 ms·
Although I don't work in games anymore, I was recently thinking about peer-to-peer multicasting input events for prediction purposes, but using the client-serve
by bick_nyers 5y ago
Although I don't work in games anymore, I was recently thinking about peer-to-peer multicasting input events for prediction purposes, but using the client-server model for actual gameplay. That way you get low-latency movement prediction, with all of the perks of running a server (namely anti-cheat). When networking fast-paced games, proper prediction implementations can make or break the experience imo.
Edit: You can P2P the game state if you want, you just have to make sure it's usable for those with poorer internet connections (since you are sending/receiving much more data, position/velocity vectors etc. as opposed to just key presses, per number of players).
- remram 5y agoYou phrase it as being the best of both worlds, but it kind of seems like the worst to me: you still need a central server without which the game stops, and which needs to be powerful enough to run the entire simulation, and on top of that every client also needs to run the full simulation (costs CPU), receive the entirety of inputs from everyone (costs bandwidth), and makes wallhacks possible since the whole state is known. This seems very costly just to hopefully get faster prediction (for those clients that are close together, and whose NAT is not too broken for P2P to work). That information would also not be authoritative, since the simulation on the far-away central server is still the authority, so I'm not even sure how much it would actually help.
- bick_nyers 5y agoHaven't considered the wall hacks, that's a good point. Still though, I think you could mitigate this with a few different techniques. The CPU cost is largely there anyways, as you are updating everything on the client from the server anyways. Any games that rely more heavily on physics will have more work to do to simulate yes, although basic gravity/velocity calculations with some linear interpolations thrown in is very lightweight, even when talking about 100 players. Bandwidth is quite small, how much data does it take to send a single key stroke? A number of bytes really, multiply by 100 players, multiply by say 2 or 3 keystrokes at the same time, multiply by 60 frames per second, and you still get a very reasonable (dare I say negligible?) amount of bandwidth. The point is not for it to be authoritative whatsoever, the point is to not have to wait on two round trips from the server to get location data from your opponents, but try to do it in one round trip. If your connection to your opponent is lower latency/more stable if done through the server, then that should be the fallback of course. Movement prediction/smoothing happens even to your own personal character, even on a good, low ping connection to the server, the good games just know how to hide it effectively, but you often still get people complaining about hit registration. There is no perfect model outside of everyone having amazing internet connections.