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.

Modernizing Eressea

Due to circumstances beyond my control, I’m finding myself “between jobs” again. This sucks, because I really liked the most recent product I was working on, and was finally enjoying work again. Job hunting sucks.

Instead of sitting on the couch, watching Ghibli films and feeling sorry for myself, I have decided to use my time off to finally put Eressea on some more solid feet, making it more accessible.

What that means for me is:

  1. I want future games to fall more on the strategic end of the scale. There are already three active games that cater to the role players, and the hard-core strategy players are problematic, so I want to give them a separate game to play.
  2. The game will have a friendlier client. No more textual orders, no more dependency on the JRE, no more email.
  3. I am going to approach this with the goal of creating a commercial product.
  4. There will be a mobile version as well as a desktop version of the client. 

To keep myself honest, and make sure I don’t get distracted along the way, I am going to try and update this development blog three times a week, whether I feel that there was progress or not.

Javascript auto-complete

I’ve seen a number of questions on Stack Overflow wondering how to implement auto-complete in Javascript with large dictionaries. There are bad ideas (using jquery’s autocomplete with an enormous list of words embedded in the page), and there are people who have the right idea (do this in a web service), but no ready-to-use solutions. So I built one.

My proof of concet (American wordlist, 99K words) is currently up at http://enno.kn-bremen.de/prefix.html. That’s my Raspberry Pi doing the heavy lifting so your browser doesn’t have to.

The basic architecture here is a small bit of jQuery code that calls out to a web service written in C with the FastCGI library. The C program uses an implementation of DJB’s critbit tries for storage of the dictionary, which is fast enough to make response times almost instantaneous, and because it’s a long-running process, there is no startup cost for reading the dictionary from disk for each request.

If you’re curious about the code, the meat of the service lives in https://github.com/badgerman/fastcgi/blob/master/complete.c and the trie is an older project of mine at https://github.com/badgerman/critbit.

Feel free to use the code for whatever you want, and if you implement this in your own project, I’d appreciate hearing about what you made 🙂

List of Games that I beat in 2014

2014 was a pretty meagre year for video games, and even though I finally managed to play 60% of my Steam library, I didn’t finish a lot of games:

  • The Cave
  • Kentucky Route Zero, Act 3
  • Space Quest III (replayed)
  • Gone Home
  • The Stanley Parable

That’s three advenutre game and two “non-games”, and you’ll notice there are no mobile games. Can you even beat those?

Best Of 2014

This has been a crazy year. Since everybody else is making best-of lists, I decided to throw together some personal highlights myself.

Edit: It doesn’t seem to matter how many times I edit them, Tumblr always loses the captions on these images. Sigh.

Edit^2: It appears that 10 images are the limit for a gallery? No room for the best TV show, then (Babylon 5, which I only discovered this year, late as always).

GMail’s “Other Contacts”

The plot thickens…

Google has a limit of 25,000 contacts per account. And while I only have 179 contacts in my address book, there is an additional “Other Contacts” address book that GMail uses to store anybody you have ever had a conversation on Gmail with. After being a loyal Gmail user for 10+ years, this had filled up my quota something good.

So now, when my Android phone has a new contact that I added, and syncs with my Google account, it silently drops any new address book entry in favor of the existing 25K junk addresses. Silently, during a background synchronization.

For reasons beyond my ken, 22K of these contacts were for “Ticketmaster Custoemr Support”. There is no way that I have had this many interactions with Ticketmaster in my life, so I think there must be some additional error in Google’s contact storage.

TL;DR: Android suffers terribly from being ties to a Google account. I would buy a better phone today if there was one, and I am more sad than ever about the Microsoft takeover of Nokia.