Show HN: Civ 1 period accurate decompilation (github.com)
The reconstructed source builds with what i'm pretty sure is the original Microsoft C compiler and toolchain. It produces a byte-for-byte match with the original executable, aside from a four-byte correction for what appears to be a patch applied after linking. So it should be pretty close to how the original game was made; although it can't be said that this is the "original source code".
I've also used that source to create a modern build of the game, in the `reciv` repository.
Like most people, I'm in two minds about the benefits and downsides of LLMs. This work also builds on OpenCiv1, which probably deserves most of the credit - not only did I direct the LLM to use that work; but it was almost certainly in the training data.
Qualms aside - I couldn't resist having a look inside one of my all-time favourite games. There's a few attempts at Civ 1 including recent LLM ones. But i'm not aware of any that publicise the resulting source code.
6 comments
[ 1.7 ms ] story [ 16.6 ms ] threadIt's probably a couple of months of intermittently using £15pm subscriptions between OpenAI, Anthropic and Google; nowhere near maxing them out.
MSC 5.1 is a relatively simple compiler; and there's lots of prior art on Civ 1. I've set them off on a slightly more obscure and recent game now; so we'll see how well they manage on that!
Regarding legality - IANAL so perhaps we'll see. I just wanted to see how the sausage was made.
Interestingly; the way that MSC51 and LINK 5 lay out the binary depends on identifier names. There's also length restrictions due to memory limitations. So although the names aren't going to be historically accurate; the possibilities are at least bounded!
source https://github.com/awkto/civ-wasm
play in browser https://awkto.github.io/civ-wasm/ you will need to provide your own game files in a zip
I actually started decompiling civ1 a few weeks ago but gave up. so this was like a surprise and a gift.