Old Code

Published July 30, 2016
Advertisement

Last week I rediscovered a 12 year old game project I was working on. I decided to look at it and write a blog about it.

Here's a summary:

Part 1: Archaeology - The rediscovery and an overview of the repository structure
Part 2: First look at the code - I open the door and peek inside, outlining the high level structure or concepts - it's a look back in time to GameDev.net in 2004 (Enginuity era)
Part 3: PhysFS & Entities - I remove the dependency on PhysicsFS to get the game starting. I explore the Entity structure and find dragons.
Part 4: Compile Times - I start cleaning up the code and apply some header discipline to drastically improve compilation times
Part 5 - It lives! - I get the game running and stare into face of a resurrected monster. I find that a lot of the systems and mechanics are no longer present or functional - as a result, the 'game' isn't a game at all anymore and won't be without significant work.
Part 6 - Cleanup - I start the cleanup of dead systems, removing a bunch of obviously unused junk. I extricate the smart pointer system in favour of a cleaner more deterministic ownership model.
Part 7 - You didn't need it - I start to remove everything else that has no material benefit to the current feature set in the game. The goal is to keep only the code that is useful. A *lot* of code is removed.
Part 8 - Journey's End - I remove the final thorn in the code, the entity system, keeping only what is needed. I realise that there's no more to remove.

It's been a fun journey and the current result is arguably the code that should have been written 12 years ago. A great lesson in not over-engineering things for the sake of it and evolving as you go. It's also a view into the past and a realisation that you can learn and change a lot in 12 years.

I'm pondering what to do next. The codebase is still "old", but improving it will result in writing a lot of new code. I may modernise it a bit and then keep going. Not decided yet. I hope you enjoy reading.

8 likes 8 comments

Comments

JTippetts
"I bet that looking in the code I find an inheritance graph for entities that starts with a class called Entity and ends with Manta, likely with some abstraction of Ship somewhere in the middle."

This line reminds me just SO MUCH of my old Golem source code...

It's been a fun read of your write-up so far. I'll finish reading tonight when I get home from work. Fun to re-discover old projects (and cringe over choices your 12-year-younger self made).
July 31, 2016 11:29 AM
evolutional

Fun to re-discover old projects (and cringe over choices your 12-year-younger self made).

I think the thing that baffles me most is how broken I was willing to leave things. These days I'll ensure I keep things *running*, even if they're turd inside. Over-designing and over-engineering is a habit I've mostly broken, but back then it was in full force. And yeah, I made some really dumb tech choices back then too.

:rolleyes:

July 31, 2016 05:36 PM
JTippetts

I would like to see you carry on with this thing. In a way it's a shame the project was already in the midst of a refactor, with so much stuff missing and broken. I'd like to see more of how you refine the design and the code from what it was. As it stands now, so much of the broken stuff you excised was stuff that would have to be added back in, in some form or another, and it would be interesting to see how "modern Oli" does it, while still trying to hold true to what's left of the vision that "back-then Oli" had.

You should finish this and write about it as you go.

August 01, 2016 02:33 AM
evolutional

The best part will be in 2028 when I sit back and re-read these blogs and look at my fixed code then redo it all again after another 12 years of experience. Or more realistically say "oh, he hand coded it, how twee".

August 01, 2016 09:23 PM
evolutional

Wow!

August 02, 2016 07:47 AM
bisthebis

Very interesting read. I wonder how I will look at my code in 10 years. (I'm already horrified by what I did last year, so it might be dreadful :D)

August 02, 2016 06:10 PM
Brain

A great read, thanks for sharing your insights... Don't let Past You drag you back :)

August 03, 2016 12:23 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement