There comes a time in everyone’s life when their computer dies unexpectedly. To be honest, I should be glad I’ve lasted twenty-odd years of computing without it ever happening. Every machine I’ve discarded has been because I wanted more power, not because they were from life untimely ripped.
Alas, it happened a few weeks ago to dear old Helios (named for the AI in Deus Ex), about 4 and a half years into his projected 5 to 6 year lifespan. This is the story of his death… and his resurrection.
When I was looking for pointers on how to do saving and loading, I was frustrated at the lack of depth in the tutorials that I found. I couldn’t find anything that went beyond explaining PlayerPrefs and serialisation. I mean, yes, duh, I have to read and write the data — but how should I structure it? How should I find it? What’s the best way to put it together again? What did you see?!
Thus, having recently finished a fully armed and operational saving and loading system in my own game, Exon, here is a complete run-down of how it works and why. Although I would expect saving and loading to be personal to the architecture of a particular game, I feel like I’ve ended up with a very flexible and generic system, so hopefully this dump will give future people a decent idea of how to approach this most important of features. Plus some reassurance — it’s actually not that scary!
So, I’ve been fairly quiet recently because 1) developing saving and loading systems has been a long invisible slog and 2) I’ve been replaying Morrowind (oops).
But with all the data that comprises a “campaign” in Exon being successfully written to disc, it was finally time to start trying to load it. Since I’ve told you the story of decomposing the world into text files in more than enough detail, it’s time to begin the story of reconstructing it…
According to this blog, I last played Morrowind a whopping seven years ago. How can a game linger on in your mind for such periods of time? By all means, it’s a massive game and so is best reconsumed after long breaks, but even across such gulfs it is never far from my mind.
Well, for whatever reason, those thoughts bubbled closer and closer to the surface and I could resist no more. I got out my old GOTY edition CDs, lay the printed map on the desk beside me, and stepped into Vvardenfell once again…
I hadn’t seen the 1998 Godzilla film pretty much since it came out. I went to the cinema at the time of course, by that point already being a committed fan of the big G’s Japanese adventures from their spurious showings on Channel 4 at one in the morning, but beyond that I have little memory of whether or not I actually enjoyed it. I certainly didn’t get it on video, and kept instead returning to the few Toho films I’d managed to tape off the TV.
In hindsight, though, I realise how much this film coloured my desire to see Godzilla 2014 before the event. When I fell in love with the original Godzilla, I fell in love with his moves, his friends and his enemies — the tail-slaps, the atomic heat breath, Anguirus, Rodan, Mothra, King Ghidorah, Gigan, Mechagodzilla, the Japanese Self-Defence Force…
98 had none of these. They gave him no opposing monster, no atomic breath, and even the American army lacked any fun bonus tech like maser tanks and space rockets. Alas it is not merely a poor excuse for a Godzilla film — it’s a bad film, full stop. It’s a bad monster movie, a bad action movie, and a bad disaster movie. It has aged horrendously. So as with all such things… Chris McPhail and I had a podcast chat about that!
I’ve been playing proper Dungeons & Dragons for more than six months now, in a staggering display of a-regular-group-of-adults-actually-happening-regularly (albeit through the magic of the internet). While we’re playing the latest edition (5th), the familiar bestiary summons constant reminders of my first foray into that world — the classic computerised 2nd edition adventures that are Baldur’s Gate and its sequel.
(Actually, my very first foray was accidentally getting a Drizzt book out of the library; I just thought it was a generic fantasy adventure novel, I didn’t know any better. When I got Baldur’s Gate and made the connection I was like “huh???”)
Thus I chose to eschew the most productive time of the year to play somebody else’s video games, and spent the post-crimbo haze burning through the Baldur’s Gate saga. (Though to be fair, as I’m pretty much note-for-note rebuilding the Infinity Engine dialogue system for Exon, it most definitely counted as research.)
Playing the two games back-to-back, I was struck by one major contrast between them: the respective presence and then utter absence of “wilderness” areas.
Right, so my last dev diary was mostly theoeretical — how can one ensure every prefab and pre-placed object in Unity has a unique identifier that can then be associated with saved data and used to reassemble the game world later.
Having implemented said indexing mechanisms, there are a few gotchas to report, but it is overall working as advertised. Which means I have begun phase two: actually writing the data out.
When I decided that procedural generation was too much bother for not enough gain and switched over to hand-crafting scenarios, I figured that was the worst of my development headaches gone. After all, the more data that is static, the less you have to worry about while the game is actually turned on.
Then I realised that you’re still going to die a reasonable amount of times during the game. Then I realised that although the levels will be individually smallish, they’ll still be quite open.
What does death plus openness equal? Why, my dear, it means I must let you save and load your game, because fuck losing all that progress (to death or dinner).