MHeasell / rwe

Robot War Engine - Real-time strategy game engine compatible with Total Annihilation
https://www.robotwarengine.com/
GNU General Public License v3.0
115 stars 16 forks source link

Generate and use random numbers deterministically, with shared seed for multiplayer #172

Closed KevinHake closed 10 months ago

KevinHake commented 10 months ago

TLDR; I'm just creating this as documentation that this actually might never be needed:

We (@OskarPedersen and @KevinHake) discussed in #170 how the generation of random wind speed and duration is actually local for each player in OTA... it doesn't seem to be synced at all. That means at the start of the game, player A might start with windspeed 2 and player B with windspeed 20.

Assuming nobody is cheating with an unfair hacked rng ("weighted dice"), one could argue it's more fair if the wind is exactly the same for each player. On the other hand, the actual difference is small; over even a fairly short time, the differences average out, and the end experience isn't far from having "local" wind.

The more I think about it, there's not really much benefit to a more complicated system that synchronizes wind.

Some thoughts: If the random seed were instead known and recorded:

If cheating is the main concern, really the most secure way is to have the whole simulation on a separate neutral server, with peers only communicating the actions they want to perform. In which case the clients are mostly dumb and random numbers wouldn't even be used by the clients (with server code using a local rng just like we have now).

Going totally off base: wind /could/ be implemented more similarly to metal, where the map location defines wind characteristics spatially (you can imagine wind being more effective on a mountain vs in a valley). Whether that added gameplay complexity actually makes the game more fun and interesting is an unknown, whereas the implementation complexity is certainly high. Also it would be a hard departure from TA gameplay and definitely not in the spirit of the RWE project.