Legacy Code

The first days on a new project are always exciting. I initially spent a lot of time thinking about how the rules of the game will have to change, and my instinct was to write the server code first, because that is what I already know and feel comfortable with.

The first obvious question is what language I want to write this in. I have gotten a lot of complaints from people that Eressea is written in C, but I am very happy with that choice, especially since I have gotten to a point where everything high-level is now written in Lua. I am very comfortable with that language mix (C plus Lua), it is very portable, and I already have great tools to work with it that I know inside out. In short, I see no good reason to throw 18 years of experience by the wayside, just to try another language. Especially since I’m not likely to collaborate on this project, but plan to write all of it myself.

I have two code bases that I can work from. On the one hand, there is Eressea, which is a super complex game with a lot of rules that I am not going to need. The code quality is really great, it has tests, but stripping away all the layers of rules that won’t make it into a “mobile” game is going to be a lot of work.

On the other hand, there is my incarnation of Atlantis 1.0, which is super simple, and free of cruft, but the code is not as great, does not have a lot of tests, and I would miss a lot of the conveniences I built into Eressea over the years, like the order structure that replaces the crazy string parsing in Atlantis. It has a slightly better build system, and the Lua code is in a shared library, while Eressea just embeds Lua in the main executable.

My conclusion at the end of the day was that I will probably start from scratch, and import the good bits that I need from either game. That means the Atlantis build system, new types for objects, regions, etc. that reflect the reduced complexity of the rules, and any useful utilities that I built into Eressea. I guess that also means that I will have a third code base to maintain, and I should be looking out for the second system effect.

Most of all though, my conclusion is that all of this server code needs to wait until I know the rules of the game. To find out what those are, I am looking at other games for inspiration, and have come up with a few basic traits that I want the game to have, but the real constraints will come from the client UI. I have never worked much on the client side of my games, so this time, I am going to start there. My next post is going to be about the technology decisions for that.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.