Game Server status monitor page

Posted by

After various outages and problems we've had in the last week or so (which seems to have improved after moving to a faster server, yay!) I decided to add a small status page to the website where you can go and check whether the server is down for everybody, or if maybe it's just something local to you. So now if you visit, you'll see something like this:

Here you can see we have a brief outage last night when I accidentally detactched the disk which had the database on it (whoops!) but the good thing about this new status page is that it also emails me when it can't contact the server (or when the server returns an error).

The way it works is, every 5 minutes, I do a request to the game. The request does a bit of database reads, a bit of CPU and a bit of database writes. This will hopefully test everything that normal requests will do, so that it gives a good indication of what you can expect from the actual game server. Then it displays the last 24 hours in this nice graph format. At some point, I might start doing more historical data as well, but for now at least, the last 24 hours is it.

One interesting point here is the spikeyness of the response times. It seems like there's a bit of a spike in activity around midnight (Sydney time: all the times are local, and I'm in Sydney), which is OK, but I'm not sure what's causing the spikes at the other times, which all seem to happen fairly regularly... something to investigate!


Posted by

The wormholes have landed!

There's a couple of things that have changed to support Wormholes. Firstly, you'll notice you need to update your Shipyard to level 2 before you can build the Wormhole Generator ship:

Once you've upgraded your shipyard, you can build a Wormhole Generator:

As you can see, it's pretty expensive, but not prohibitively so. Once built, you need to move the generator to a piece of empty space that's not too close to an existing star. If you try to select a spot that's too close, you'll get a red circle like below indicating you need to choose a different area:


If there's no red circle, you're good to go. Click move and wait.

Managing your wormhole

Once the wormhole is in place, it doesn't actually do anything until you "tune" it to a destination wormhole. Open up the new wormhole and click on "Tune Destination". You'll see a list of all the other wormholes your alliance owns:

You can see at the bottom of this dialog is an indicator of the time it will take to tune. The very first time you tune a wormhole, the tuning time is instant. After that, tune time is 2 hours for the next tuning, then 4 hours, 9 hours, 16 hours and so on. After two weeks, the tuning time resets to 2 hours.

If the wormhole is tuning, you cannot send fleets through it, and you'll get an indicator of how long is left before the tuning completes.

Once the wormhole is tuned to a destination, you can send fleets through it by selecting them at the bottom and clicking "Enter". Travel through a wormhole is instant and you can use the "View Destination" button to switch to the destination wormhole.

Behaviour of fleets with allies

Another important change in this update is the one you can see in the picture above. Fleets which belong to empires in your alliance will not attach each other. This means you can now seen troop to re-enforce your buddies, but it also means you can send fleets through your wormholes without worrying about whether your allies will attack you or not.

Note that if you leave an alliance, your wormholes may still be tuned to their wormholes (and vice versa), so that's definitely something to be aware of!

Unicode support in MySQL is ... 👎

Posted by

For the last few days, I've been getting some strange error reports from the War Worlds server. Messages like this:

java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\xB8. ...' for column 'message' at row 1
   at com.mysql.jdbc.SQLError.createSQLException(
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(
   at com.mysql.jdbc.MysqlIO.sendCommand(
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
   at com.mysql.jdbc.ConnectionImpl.execSQL(
   at com.mysql.jdbc.PreparedStatement.executeInternal(
   at com.mysql.jdbc.PreparedStatement.executeUpdate(
   at com.mysql.jdbc.PreparedStatement.executeUpdate(
   at com.mysql.jdbc.PreparedStatement.executeUpdate(
   at com.jolbox.bonecp.PreparedStatementHandle.executeUpdate(
   . . .

Now, that string which MySQL complains is "incorrect" is actually the Unicode codepoint U+1F638 GRINNING CAT FACE WITH SMILING EYES, aka 😸 -- a perfectly valid Emoji character. Why was MySQL rejecting it? All my columns are defined to accept UTF-8, so there should not be a problem, right?

When is UTF-8 not UTF-8?

When it's used in MySQL, apparently.

For reasons that completely escape me, MySQL 5.x limits UTF-8 strings to U+FFFF and smaller. That is, the "BMP". Why they call this encoding "UTF-8" is beyond me, it most definitely is not UTF-8.

The trick, apparently, is to use a slightly different encoding which MySQL calls "utf8mb4" which supports up to 4-byte UTF-8 characters.

So the "fix" was simple, just run:

ALTER TABLE chat_messages
   MODIFY message TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

And so on, on basically every column in the database which could possibly include characters outside the BMP. But that's not enough! You also need to tell the server to use "utf8mb4" internally as well, by including the following line in your my.cnf:

​character-set-server            = utf8mb4

Now presumably there is some drawback from doing this, otherwise "utf8mb4" would be the default (right?) but I'll be damned if I can figure out what the drawback is. I guess will just moniter things and see where it takes us. But as of now, War Worlds support Emoji emoticons in chat messages, yay!


Abandoned stars and new players

Posted by

It seems to be very common that people will install a game, play it for 5 minutes, decide it's not for them and then uninstall it (or just never play it again anyway).

For many games, this isn't a problem. But not so in War Worlds: if a player creates an empire, they'll be assigned a star in the universe, and then that star will be occupied forever - or at least until someone else comes along and wipes it out. The other problem it causes is that people will tend to start very far away from active players, which makes for a rather boring game.

What is an abandoned star?

Before we can do anything about them, it's a good idea to define exactly what an abandoned star is.

Basically, I have defined an "abandoned star" as any star where the empire has not logged in for 2 or more weeks, and this is the only star they have colonized.

Looking through the database right now, there are 5,887 stars which match the above criteria, which is quite a lot!

What to do about abandoned stars?

The next question is, what do we want to do about them? Before today, we did nothing: they just sat there waiting to be attacked and colonized by someone else.

But starting from today, abandoned stars will be elligible for new players to start on.

There's a few extra criteria before we'll start a new player on an abandoned star, however. The main one is that an abandoned star must be > 200 parsecs from any non-abandoned stars. Many of the abandoned stars in the game are surrounded by established players, and it wouldn't exactly be fair to star a new player off in the deep end like that.

So now, when a new player starts the game, we first look for an abandoned star more than 200 parsecs from an existing player, and only if we don't find one will we star the new player on a brand new star.

My hope is that, over time, the game world will fill out a bit more closely and we won't have vast spances of space where nobody is playing any more.


Posted by

In the next update of War Worlds, I'm planning to add a "wormhole" feature. Here's a brief overview of how I see wormholes working in the game.


You'll build a ship, called a wormhole generator, which will be a single-use ship (and quite expensive). Then, to actually create the wormhole, you'll select a location on the starfield for the wormhole generator to travel to and deploy the wormhole.

The ship will be quite expensive and time consuming to build, and there will also be restrictions on how close you can deploy the wormhole to other wormholes and also to stars. The way I see it, it should not be possible to build more than one wormhole between any single group of stars (see the mockup below for what I mean).

The wormhole will then appear on the starfield for anybody to see, and you can send ships to it like you send them to stars (i.e. via the move command).

Using the Wormhole

Below are some mockups for how the wormhole will look in the game, once constructed and deployed.


On the left, we see the starfield screen, with a wormhole selected. I'd love to have the wormhole itself animated and rotating, I guess we'll see how my art skills are :)

On the right, you see the "detail" screen for the wormhole. In the top-left, it shows you the destination of the wormhole, how far it is, how much it costs to send a ship and so on. In the top-right, you have various actions for the wormhole itself. You can change it's name (this is used to identify destination wormholes) and you can change the wormhole's destination (more on this in a minute).

On the bottom left, you have the list of ships that are currently at this wormhole. When you select a ship, on the right you'll have the usual options, like merge, split, move etc. You'll also have a special "Enter Wormhole" button that will cause the selected ship to enter the wormhole.

Wormhole Destination

The "destination" of a wormhole is another wormhole. When you first deploy a wormhole, the wormhole will have no destination and you won't be able to send any ships through it. When you click on the "Set Destination" button, a list of all the wormholes own by you and your alliance is brought up, and you can choose which wormhole will be the destination from that list.

Wormholes are one-way, so the destination wormhole may have an entirely different destination. In this way, your alliance could build a "highway" of sorts, with wormholes in a giant loop through all your empires.

Changing the destination of a wormhole takes time, and costs credits. When the wormhole is first deployed, setting the destination is instant, but after that, each new destination takes longer to "tune" (e.g. the first change takes 2 hours to tune, the next change takes 4 hours, 8 hours and so on). If you leave a wormhole tuned to a single destination for 7 days without changing, then the tune time resets to 2 hours. This is to encourage you to set up a coherent network of wormholes and plan ahead, rather than just setting them up willy nilly and changing them as you please.

Sending a ship through the wormhole will cost credits. It will be a fixed cost per ship based on the distance to the destination (longer jumps will cost more). It'll still be cheaper to use the wormhole (and obviously faster, too) than to move directly.

Wrap Up

Now, this sort of update takes time. Don't expect this in the next week or two :) In the meantime, I have a few bugfixes that I want to push out.

One important one is a change to the way ships from empires in the same alliance work. Currently, if you belong to the same alliance, and you send ships to each other's stars, they'll attach each other. In order for wormholes to be usable by the whole alliance, however, that's going to have to change. So expect an update shortly which will stop ships from the same alliance trying to attach each other.