Live data from Hacker News

1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

gamedeveloper.com

151–160 of 189 posts

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#151
post #70

Earlier quoted context omitted.

The 28.8 was more than enough for me to place the article in time.

If you're old enough to know what 28.8 means

I actually remembered a tidbit that will show my age as well. The first 28.8Kbps modem in the house was bought by my dad and he told me not to tell my mom that he got it because it cost around $500.

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#152

Seeing stuff like this on here fills me with nostalgia. I basically learned to code thanks to a few helpful and extremely patient IRC members in the Spring RTS engine[1] community (some of whom I spot in these comment sections on occasion - hi!), and deterministic lockstep simulation for online play was one of the first ideas that totally blew my mind when I learned about it ("b-but that means all the "random" number…

Hedgewars also uses deterministic lockstep. But due to the floating point problem, the main developer elected to write custom fixed point math instead. It works since the game doesn't use a lot of physics.

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#153
post #142

Seeing stuff like this on here fills me with nostalgia. I basically learned to code thanks to a few helpful and extremely patient IRC members in the Spring RTS engine[1] community (some of whom I spot in these comment sections on occasion - hi!), and deterministic lockstep simulation for online play was one of the first ideas that totally blew my mind when I learned about it ("b-but that means all the "random" number…

The random numbers I understand, because I’ve used a similar principle to make tests deterministic. The trick is to make the same number of calls to the generator and use the same seed. The floats are really thorny though, differing subtly across CPUs. Did they just rely strategically on rounding? Make heavier use of integers?

Ditto - I use them to generate infinite mocks in GraphQL for local dev and staging: http://www.blankenship.io/essays/2022-11-30/

The id of the node acts as the deterministic seed. Really handy when building views that slice and dice data, it feels like you’re interacting with a database.

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#154

What I find interesting about the lockstep approach described here is it seems a lot of modern RTS games still use the same approach, even though the bandwidth calculations have changed radically. When developing my own RTS game I was able to fairly straightforwardly get 1000 units in combat to live stream using about 50 KiB/s bandwidth, which is nothing these days: https://www.construct.net/en/blogs/ashleys-blog-2/r…

Did those units shoot? What happens when there is a few thousand projectiles in the air, fired by those 1000 units? What about map deformations? What about map wide physic simulations, like springs tsunami water sim or the lava flows of a volcano, changing directions?

You don't need to track every projectile, you just need to know that player 1's unit 33 started shooting at player 2's unit 45.

You can encode that very compactly. 2 bytes for each unit ID, source and destination. So 1000 units would be just around 4K, if they all start shooting at the same time.

After that, you can rely on that in most RTS games how units shoot is deterministic.

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#155
post #150

Earlier quoted context omitted.

Don't use floats (it wasn't a 3D game) or if you have to, make sure every float is derived from an integer that's kept in sync. And don't do anything that affects simulation state based on those floats.

Age of Empires 2: Definitive Edition consistently de-syncs when playing across a M1 Mac (using Windows 11 Arm or Crossover) and an x86 machine, and I suspect the difference in floating point behavior described here is the culprit: https://developer.apple.com/documentation/apple-silicon/addr...

Doesn't sound unlikely.

LHC@Home had big issues[1] with AMD and Intel machines giving very different results to the same work unit. They traced it down to the exp() function behaving different, and ended up using a library[2] for anything more fancy than basic arithmetic.

[1] https://lhcathome.web.cern.ch/sites/default/files/OPENshort....

[2]: https://github.com/SixTrack/crlibm

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#156

As someone who fixes up old games in my spare time, and Age of Empires II being one of them, I'll provide a bit of trivia about the game's internals: - The AI system is not part of the deterministic simulation. This was surprising to me, and after contacting one of the original programmers it was explained that it was due to a desynchronization bug that the "AI and network programmers weren't able to fix it in time".…

Sending state updates every 200ms made my spidey sense tingle. Most industrial control systems of the 90s would work on continuous 200ms polling through the network. Mostly RS485 links at 9600 baud. The thing is that this is perfectly reasonable if your network infrastructure is known. If you have fixed bandwidth and deterministic packet sizes, then you can do math and know what the behavior will be. Determinism is g…

Certainly true for local and/or controlled networks, however over the public internet where you're competing for bandwidth with many others over limited (and sometimes already congested-) links it's a rather questionable choice.

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#157
post #90

Earlier quoted context omitted.

Shame that. Sutra is a word all on its own. Gamasutra was a nifty name. It works. One day sex positive triple-breasted feminist whores of Eroticon Six are all the rage the next you're sunsetting harmless Sanskrit puns. Y'all strange.

Misogyny isn't cool nor wanted here

[dead]

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#158

As someone who fixes up old games in my spare time, and Age of Empires II being one of them, I'll provide a bit of trivia about the game's internals: - The AI system is not part of the deterministic simulation. This was surprising to me, and after contacting one of the original programmers it was explained that it was due to a desynchronization bug that the "AI and network programmers weren't able to fix it in time".…

How are you able to work on the game? Are you employed to do so? Do you reverse engineer? Or has the source leaked?

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#159

Earlier quoted context omitted.

IRL it was not simple. The game usually worked, but occasionally things would go out of sync. The biggest downside is mentioned in the article: If one person lags, everyone lags. In an 8-player game, the chance that at least one person lags was pretty high. I used to play on the Mac version of GameRanger, a small community. That was 2008, when reliable internet wasn't as common. Players had personal reputations, and…

That's not intrinsic to this style of netcode, though. Company of Heroes, for instance, just keeps the game running and your input is delayed until you can communicate it to the server. You'd generally want an authoritative server to accomplish this. Having it also execute the inputs prevents most cheating, too.

> You'd generally want an authoritative server to accomplish this

That makes it very different from this model in my eyes. You wouldn't have every client running the game in sync. The AoE devs had this dilemma and chose the other path.

Re: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

#160

Earlier quoted context omitted.

It is, in fact, inherent to this model. While there will be some tolerance threshold as to how far behind in the simulation a machine may fall, it still must be rather conservative (generally a few seconds), as elsewise the context (state-) sensitive inputs start frequently failing -- if I issue a command given at world-state time t , will it be meaningful/valid at state t2 ? The answer is where you get your threshol…

If it's not valid, just throw it out! I've built and licensed a time traveling variant of this model (GGPO style) and spent years with thousands of concurrent users playing my games. And they operated just as I describe. Company of Heroes is more of a traditional AoE style and will happily queue up unit orders for a minute or more while it attempts to reconnect or catch up.

You could probably build something better than what the AoE2 remake has now. I don't know if it'd be viable in 1998, though. Wasn't like today's constantly self-updating games; each patch risked fragmenting the community, and they only released like 2 patches across 15 years of activity. They chose something simple that'd work well enough without having to tweak it. And old PC specs, and no dedicated servers. You said it's better to disadvantage laggers than to punish everyone, but that requires some balancing to ensure it's fair enough. AoE model is always fair and can be lag-free.

Yes it relies on the players trusting each other a little to avoid extreme lag, but there are plenty of ways to ruin this kind of game besides lagging. It's not like CoD where a few useless teammates won't make a big difference, while it didn't have automated ranked play like Csgo. (but the recent DE remake does, and yes it needs better netcode)

Time-traveling netcode... I know Slippi does this, and it works great.

Post reply on HN