Jump to content
  • Advertisement
  • entries
  • comments
  • views

Old Code

Sign in to follow this  


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.

Sign in to follow this  


Recommended Comments

"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).

Share this comment

Link to comment

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.



Share this comment

Link to comment

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.

Share this comment

Link to comment

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".

Share this comment

Link to comment

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)

Share this comment

Link to comment

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

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!