4
votes

I'm planning out a physics-based competitive multiplayer game, written in Java. It will involve plenty of collision detection and fluid simulation, which I want to do client-side for server load reasons. Each player has control of one vehicle, which can be simulated fairly independently from the others.

The accepted answer in Multiplayer billiards game physics simulation (simulate server-side!) is completely impractical in my case. Simulating just a few vehicles will eat up much of the resources of a mid-range PC.

I am thinking of letting the clients simulate their own vehicles, with the server broadcasting their results to other clients and mediating collisions. Cheating will be prevented to some degree by using the server's spare CPU to do occasional physics audits. Clients won't know when they are being audited because they are sending the required state anyways.

What would you do? This project will be just for fun, so I won't lose anything if people do cheat.

1
This is already a solved problem and there are white-papers on it online. Basically: you can only trust the server, but yet the client should deliver an "accurate experience" to the player(s).user166390
Also, "simulating just a few vehicles will eat up much of the resources of a mid-range PC" makes it sound like a sub-par approach/implementation is being used for the physics :(user166390
@pst I have to give some trust to the clients. The combined physics load is simply too much for one server to handle. A client can breach its trust, but only until the next audit (when it is kicked). As for the "sub-par" implementation: let's just say the vehicles are made of hundreds of thousands of blocks, in user-defined configurations.user1354999
If your vehicles are hundreds of thousands of blocks and the physics cannot be simplified or otherwise handled in other resolutions then I yield as the awesomeness of the system blows my mind.user166390
You probably should do sanity checks on the server and trust the players for the detailed calculations. This will prevent serious cheating but not completely stop it.Philip Whitehouse

1 Answers

1
votes

Under the conditions you mention, something that you could do to decrease the load on the server is to have each client simulate its own vehicle, plus one or more random ones, that change randomly at intervals.

This can lower the number of server resources needed to audit, allowing your audits to be more frequent. If you get discrepancies in the numbers reported by different players, your server can check who is cheating (the audited or the auditor). If you have each player's variables computed by two or more other players, chosen at random and changed at sufficiently frequent intervals, you decrease the possibilities of players teaming up to cheat.

If you are coding your server under a Java (JVM) environment, a library that can help you a lot in distributing computations is Akka.