by TacticalCoder · 4y ago · 0 comments
Now Warcraft III, which came out only three years later, had a fully deterministic game engine and, for replay files, only saved players inputs. Hence the Warcraft III save file, even for entire games, were tiny. And there were several websites where you could download and replay save files from other people, including from famous matchups. Fun times: I'd exchange my best games with my brother, as email attachments IIRC. We'd then watch each other's games and make comments.
IIRC Microsoft's first Age of Empire, which came out in 1997, already used a deterministic game engine so there was already an AAA title who used that technique when StarCraft came out in 1998.
There is a major drawback to save files which rely on the deterministic nature of the game: what happens when the determinism changes? I don't mean due to bugs; I mean intentional modifications to the game's behaviour through patches. Either these changes will break old replays and saves, or the game needs to carry around multiple simulation versions.
You bring up Age of Empires. This is a small problem in the current AoE2 competitive scene. Yes, AoE2 has a competitive scene – the game has been re-released twice in the past decade, and still enjoys the attention of competitive play, including sponsored tournaments (e.g., the Red Bull Wololo series). Microsoft are attempting to give the game the same treatment as other modern, competitive titles, which means frequent balance patches, and occasional injections of new content (DLC). Unfortunately, each one of these updates breaks old save games and replays, which, as you point out, rely on the deterministic nature of the engine. It means that any casting/commentating of games must happen within relatively short order of them being played, and that the only reliable distribution format for old games is... screen recordings. I'd much rather a less space-efficient save format (or at least having the option to convert deterministic replays into a fully self-sufficient archive format) than having to discard native recordings of great games by the wayside in favour of videos.
StarCraft actually let you save replays which were just player inputs - which begs the question why save games couldn’t do this, but I digress - and I clearly remember attempting to watch a replay after a major game update and seeing it fall apart after a few minutes.
The replay was of a 40 minute game. It ran fine for the first few minutes, then I’m not sure what went wrong but suddenly all the characters stopped moving (except the automated mining drones) and the game just stayed like that for the next 30+ minutes.
Replays weren't added until 1.08[1] so it may have changed sometime post launch, but I'd have thought because it means you have to run the sim to get to the eg. 30 minute mark where the save is, and even on modern machines running remastered that takes quite a while. A more constrained machine from the times wouldn't be able to do the x16 speed fast forward used today.
The problem is floating point calculations on different processors. Maybe in the 90's that wasn't such an issue, but good luck now. Plus, if you don't need a physics engine, maybe you can stay in integer space.
That would explain small deviations at first, and getting bigger by time.
For example a game like Braid also chose not to use a deterministic engine for that reason.
> Originally we were quite afraid of Floating point operations discrepancies across different computers. But surprisingly, this hasn't been a big problem so far (knocking on the table). We got away with implementing our own trigonometric functions.
Haha, I'd be surprised if they used floats at all in a 90's game. Fixed point were popular.
Edit: this is it https://www.youtube.com/watch?v=HrUF-LFTs-A
The whole talk is very relevant to anyone interested in this topic.
A 3D engine in fixed point (which I never fully finished) gave me a lot of headaches. So glad all those devices have proper floating point and a gpu's.
I usually don’t bother since I don’t care about the whole replay and don’t want to wait. But it’s handy when you want to learn the strategy of somebody better than you that you just played against.
Civilization 7.9.9D was my favorite custom back in the day :)
That's interesting. I wonder why the other poster say the replay functionality would turn into nonsense at some point.
Now if the game is deterministic and multiplayer works by only sending user inputs around, why the save / continue feature wasn't implemented that way?
In any case I love to read about how these games worked!
Your only interpreter for the data is the entire game engine. By design it's going to use most of the power of the target hardware, so cannot run faster. Ie, 30 minute load time if you had played 30 min.
- a huge part is going to go to rendering, which you don't need to do if you only care about the end state
- in many games, the simulation runs at a much lower frame rate than the game, so perhaps you see the game animated at a silky smooth 60 fps but internally the sim runs at a fraction. 10 and 5 fps for the sim are common.
- some sim architectures may allow you to run the sim at a variable frame rate and still generate deterministic results. So (ideally) you tell the sim to run a single step of 30 mins and you get the end result. In practice of course variable steps will be limited to much less, but Supercell mentioned reducing their server sim cpu costs by 80-90% with this kind of trick.
All added up with reasonable guesses for a well optimized case: 30 mins of sim run at 1 sim tick per second of game time, where sim ticks take say 2ms, could take 3.6 seconds to sim, not 30 minutes.
In other words, as usual it's all about tradeoffs.
The ideal system would be similar to what we have with video algorithms. Every so often we draw out the full data needed for the existing state, then from then on-wards is just diffs until the next key frame is reached.
Also, it's fairly tricky to make the deterministic replay works. SC definitely do that for network play, but the risk is arguably higher for saving. StarCraft there were lots of synchronization issues even at very last minutes of its beta due to unexpected non-determinism which is probably because the game engine was not designed with that in mind. IIRC, the game would simply shutdown the session in a such case. But if it's from the save file, you don't have a way to detect that so the save file is going to be in a corrupted state with no hope of recovering. In the case of WC3, the engine has been written with lessons learned in the hard way so it should be capable of handling this problem more elegantly.