Game Archival

In the next WarLight release (1.08), games that have been finished for more than 10 days will be archived. For the most part, this doesn’t change anything — archived games are still available in your My Games page just like they were before and you can still read all of the chat and view all of their history. This is just a change to the way WarLight stores finished games internally, so if you’re not interested in learning how WarLight works behind the scenes you can stop reading now.

The WarLight database

Today, WarLight is powered by a single PostgreSQL database that houses all games, chat, history, etc. I’m a huge fan of Postgres, and it’s worked very well for WarLight. However, being a relational database, there are limits to how far you can scale. Currently, the WarLight database is closing in on 30 gigabytes, and anyone who’s ever worked with big relational databases knows that it’s no fun. (ever tried to add a new column to a many-GB table? While ALTER TABLE is running, your site is down!)

One option to alleviate this is to delete old games. While some games certainly could be deleted without much of a fuss (those that got voted-to-end or real-time games), in general I really enjoy taking trips down memory lane and looking up old games. I think keeping games around is a really fun feature, so this isn’t my favorite option.

Instead, I set out to design a system that will allow WarLight to grow without needing to delete games. Postgres works great while games are in progress and queried and updated frequently, however WarLight can’t just be backed by a single monolithic database forever.

Enter the Archive Database

When games have been finished for more than 10 days, the archiver will remove it from the main Postgres database, compresses it and store it in the archive database, which is powered by MongoDB. Mongo is great for an archive, since it allows for changing your schema without needing downtime.

Impact

I said above that this change mostly won’t impact players. However, there are a few small changes:

  • You can’t chat in archived games. Remember games aren’t archived until 10 days after they’re complete, so that should be plenty of time to say your ggs and do any post-game discussion. All of the game’s chat is still available to read, you just can’t say anything new.
  • If a game still has unread chat when it’s archived, it won’t show up as having unread chat on the My Games page. The chat is still available if you open the game, it’s just not shown on the My Games page. Hopefully players who go 10 days without reading the chat aren’t likely to ever read the chat anyway.
  • The default filter on the My Games page is changing from All Games to Active Games. If you really want your default to be All Games again, feel free to change it back. The reason it’s changing is just because the All Games query is getting more expensive to run since it has to query the archive, and most of the time players really just want to see their active games anyway.

Hopefully these aren’t too big of a deal for anyone. At some point in the future, expect a policy on abandoned in-progress games so they can be archived, too.

WarLight Roadmap

I’m currently finishing up the 1.08 release which has the archive system and a few improvements that will be announced soon. Once that’s done, there are two things on my mind:

1. New ladders! Due to the influx of new members lately, hopefully we can support one or two new ladders. Look for a poll soon on what ladder types you’d join.
2. Resume work on the iPhone and Android versions of WarLight. I hope to get the Android version caught up to the iPhone version so that it can be released to members for early testing. Android is nice in that there’s no limit to how many testers you can have, unlike the iPhone version which has to be restricted to a select audience.

5 thoughts on “Game Archival”

  1. Does it have any influence to invite list? I mean, I know that before I had some players with 30+ games together, now the order is different and on the top of the list (sorted by games together) I have somebody with 9 games together. The other players don’t disappear (well, at least I think so, can’t tell for sure) , they just have less games with me. Is this intended or a bug?

  2. I think it doesn’t remove anybody from my invite list, I just have “0 games together” with some of them, probably with those that I haven’t played in few last days.
    I found another issue connected with Game Archival: when I tried to change my favorite games, I couldn’t choose those that finished more than few days ago, EXCEPT the ones from tournaments. Even the games I had previously as my favorite disappear from the list.

    1. Hmm odd. Favorite games is supposed to be working, but you’re right it’s not showing archived games. I’ll make sure this gets fixed in the next release – thanks for reporting it!

      1. Edit: the games from the tournaments I could choose as a favorite were only from the ones that hadn’t finished yet. Does it mean that tournaments games are archived only after whole tournament ends?

        I’m really impressed by the amount of effort and attention You put into this game to make it better, I’m happy I could help a bit :)

Leave a Reply

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


*