Quote:Original post by ravyne2001
Without very robust mechanisms in place, hoping that 2 or more clients simply passing input between each other will stay in sync is crazy.
It's what RTS games have done for a decade, and it works, so it can't be that crazy. You just have to make sure your simulation is deterministic (it's particularly useful to isolate the simulation from the renderer, and might be handy to avoid any floating point in the simulation code depending on what environments you're going to run in), and make sure that no player simulates a turn until they're sure they've received all the inputs from every other player from that turn, and that's about it.
Quote:Aside from that, p2p systems are ripe for cheating. If I'm only recieving input, I can ignore inputs that cause my character harm, or generate false inputs that cause you harm. Someone could hack their client to not take damage and to launch multiple attacks with no reload time, for instance. If there's no authoritative entity to call them out, then how can they be stopped?
The inputs need to be at a slightly higher level - it would be "player has activated the 'try to attack' event", not "player has successfully attacked" and definitely not "player has caused 63 points of damage to the other player". (It doesn't need to be at the level of keystrokes and mouse coordinates, but it should be an intermediate level between the GUI (which isn't trusted to only allow valid commands, particularly since you can press buttons to e.g. train units just before the simulation has caught up with the point where you ran out of money) and the simulation itself (which buffers all the commands, sends them over the network, and then processes them all by checking for sensibility and performing the world updates).)
That stops the problem of faking incorrect inputs - when the only data sent over the network is equivalent to what a player can perform by using their keyboard and mouse, nobody can perform actions that would otherwise be impossible. And if you ignore some inputs from other players, your copy of the game will go out of sync and that'll be detected and you'll get disconnected from the game. The main possibility for cheating comes from the fact that every player has knowledge of everything in the game, so they could do something like remove the fog of war and see what their enemy is doing, and you just have to avoid that by protecting the client code in some way (and kicking any obvious cheaters from your network).