Hacker News new | past | comments | ask | show | jobs | submit login

Per the infamous Age of Empires multiplayer write-up (I think?), never use independently random code. Everything should be key-based pseudorandom.

Much easier to sync keys and play forward vs syncing at every Rand call.




What keeps the client from peeking at the next few values and scheduling actions to line up with 'good rolls'?


It depends on game/implementation but client wouldn't really roll dices on their sides. Someone shooting a bullet that does 5-10 damage would tell server to shoot bullet and server would reply "you did 7 damage"

Especially on an mmo, there is no point telling a player that his next fireball spell will also trigger a "random chance to put a burn status on target". The client would start casting a fireball, which takes a second to cast and in that 1 second duration the server would decide what is the damage and if the spell is going to apply burn and by end of 1 second, you would get that information so you can see the damage values and burn icon on enemy

It is better to keep clients dumb if possible


Presumably nothing! But I imagine it was might have been impractical, given lockstep method is kind of predicated on "Do it because you can't afford to only compute and transmit from a central node."

In the era it was used, server chips weren't really a thing. So it was really just "the current decent CPU."



It was linked to in that one. Pretty sure this is it: https://www.gamasutra.com/view/feature/131503/1500_archers_o...

It's also a fascinating historical artifact of "when internet play meant orders of magnitude higher latency and jitter... as a base assumption."

Per memory, there's a bit where they've ferreted out all the sources of randomness, except one. And any source of randomness corrupted the downstream calculations, as they used global random generators.

There was some reason they couldn't just trace calls directly.

It turned out there was a line of code somewhere that said something like "if {rare condition} then rand.next {to figure out where to place an ornamental rock/tree}."


That was specifically related to their networking/syncing architecture -- deterministic lockstep simulation -- in which every client is running their own local instance of the simulation, and the only thing being passed around are interactions with the simulation.

So everyone has to have the same results and calculations at all times, because there's no authoritative simulation.

It's a common architecture for RTS's (interactions are far less numerous than individual entities) but not for general multiplayer games due to issues like everyone must be on the same timestep at all times -- so a single slow player slows everyone down. See https://gafferongames.com/post/deterministic_lockstep/

If you have an authoritative server, so the client is mostly a presentation/view of current game state, you don't need to be as careful about maintaining game state/randomness, since there's only one source of randomness (your authoritative server)

Ofc, if in an mmo you have multiple authoritative servers, you're back to the same problem, though I believe the more common solution is to have 1 server - 1 universe, and you just have more game instances (shards/servers) to connect to


There's a reason there were no complex-state MMOs at that time -- there simply wasn't the residential bandwidth to perform continual full state updates (latency aside).

E.g. grid & turn-based vs 3-D free-motion worlds

They say they specifically made the deterministic lockstep choice because it was the only option that (a) allowed the multiplayer gameplay they wanted and (b) fit within the computing and network resources of the time.


AoE uses classic lockstep simulation, as far as I remember. For a variety of reasons, most importantly, latency, this approach is not usable for genres other than strategy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: