Server outage

Posted by

So this was an interesting development, right after the launch of the game! It seems there was a "minor" App Engine outage a little while ago that affected the War Worlds server. Here's a graph of the "milliseconds per request" as reported by App Engine:

That big spike in the middle is the outage. We jumped from an average of about 600ms per request to over 12 seconds! It was reported on the App Engine status dashboard, too:

I guess these things happen, but it was a bit annoying that it was right after the app was launched! For the most part, App Engine has been rock solid during my testing (thanks Murphey's Law), so I'm going to stick with it for now, but apologies to anyone who was affected by this!

On the importance of reporting crashes, and the "Don't keep activities" developer option

Posted by

I've just posted a new version of War Worlds to the App Store, which fixes a number of bugs that were found in the initial release of War Worlds. You should be getting it in the next day or so.

Firstly, I just want to say a big thank you to everyone who reported a crash in the initial release of War Worlds. Please continue to report all crashes you have and even non-crash bug reports (you can either email me, or post them to our Google+ community).

Being a small developer, I don't have a large QA department or a swath of devices with which to test the game so I rely on users to report bugs using the "Report" feature. This feature is actually pretty amazing: you can type a comment and the report shows up immediately in my developer console along with the comment. I can see the top crashes that people are reporting, it gives me the exception that happened and the stack trace and usually I can pinpoint exactly what the problem is in a couple of minutes.

Being the very first release, there were a couple of nasty bugs which I probably should have picked up myself in the first place. I'd like to take a moment to describe what I learned in the process.

OutOfMemory Errors

The first one was a lot of OutOfMemory errors. This would manifest itself as crashes while you were trying to move fleets, crashes when switching between starfield view and solarsystem view and crashes while just scrolling around the starfield view.

It kind of surprises me, even on relatively new hardware, how little heap space you get to allocate bitmaps and so on. One of the features of the game (which I described in quite a bit of detail in an earlier series) is the ability to generate unique planet and star images for every single planet and star in the game.

In retrospect, I probably should have realised this was going to be a bit of a memory hog: a unique image for each star that gets rendered in the starfield view can quickly add up to lots of images. I had a caching system in place so that only visible stars would be loaded, but that caused a bit of stuttering as stars would be loaded and unloaded as you scroll around.

I had already implemented a feature to disable the unique star and planet image generation and just use a spritesheet of pre-generated ones, it was just that by default, it was generating the unique images. The "solution" here was to switch that option off by default. In reality, it doesn't really affect the look of the game all that much. I'd say the only time you'd notice it is with the "terran" style planets anyway. You certainly don't notice it on the starfield view.

Exceptions while building

I have not quite gotten to the bottom of this one, but I've added code that should mitigate the problem for the most part. This seems to be related to the issue I describe below (saving the best one for last), but essentially there were some issues with the build queue getting out of sync with the server and the client not finding what it was expecting to find there.

Exceptions when resuming activties

I'm probably a little OCD in the way I use my Android. Normally, when I leave an application, I use the "Recent Applications" button to force-close all of the running apps.

 

This view sets off my OCD and I always end up closeing the applications as soon as I've finished with them. And War Worlds was no exception!

But it seems like I might be somewhat alone in this kind of behaviour. I was getting a lot of crashes where things were null which I wasn't expecting them to be null, and the only explanation I could come up with is that Android was unloading my activities (and hence, sometimes, the process) so all my static variables would be null the next time the activity was resumed.

Don't Keep Activties

Testing this is actually kind of hard, because Android will normally unload activties at fairly random times. However, an option in the Developer Settings, "Don't keep activties" (formally "Immediately destroy activities") lets us simulate what happens by having Android not keep Activties around after you're finished with them.

Enabling this setting on my test device, I was pretty quickly able to reproduce the issues and (hopefully) fix them.

A Warning

Just closing off with a quick warning about the "Don't keep activties" setting. Remember: this setting is specifically designed for developers who want to debug situations like the one I described above. It's not for normal use.

I've seen a number of places on the web suggesting that turning "Don't keep activties" (or "Immediately destroy activties") on will result in "better performance". I can't stress enough how utterly horrible this advice is. I can tell you right now that the vast majority of the switching you do between activties is between activties that are already loaded. If you enable that setting then every time you switch activties, it has to reload all the data it had. You might save yourself a couple of MB of memory, but it'll be at the expense of activty-switching speed.

More bug fixes on the way

Posted by

It's been a very busy couple of days for me! The alpha release of War Worlds has gone a lot better than I could have hoped, with so many downloading and playing the game, I'm really over the moon!

However, there have also been quite a few bug reports, and that makes me very sad :( I'm working my way through the crash reports and bug reports that people have been sending me (thank you so much to every one who has reported a bug!) and I have a new update posted to the Play Store today.

Android 2.2

Users on Android 2.2 were getting a crash on the very first screen because I was using the method SharedPreferences.Editor.apply() which was only added to Android 2.3. Unfortunatly, the "old" Android that I've been using (an old Nexus One) was running 2.3 so I never noticed this problem.

OutOfMemory errors

It seems the fixes I made yesterday fixed the majority of OutOfMemory errors I was seeing, but there were still a few more reported even on that version. I've made some further changes that should reduce those even more but if you have an older device or you believe you're still affected, one way to improve the situation is to set the "Starfield Detail" setting to "Solid black (fastest)" this will not only make rendering the starfield faster, it will also reduce the memory footprint quite a bit. Of course, it doesn't look quite as good, unfortunately.

I might add a check in the code for devices with relative small heap sizes and automatically set that setting, but I'll see how the crash reports go after today's update.

Pressing "back" from a popup while updates were in progress

This one is a little unfortunate, but after you queue up a build, the game fires off an AsyncTask to actually update the server with your request. If you press "back" to dismiss the dialog and then "back" again to dismiss the activty, then when the AsyncTask completes, it will crash because the dialog it was expecting to dismiss no longer exists.

The "fix" is to disable the "back" button while that async task is still running. I say it's "unfortunate" because I'd rather a more elegant solution that let you cancel the dialog if you want to but also not to crash, but for now "not crashing" is the most important. I'll revisit this feature when I've got a bit more time to investigate it properly.

Misc

I've also fixed a number of additional NullPointerExceptions and a few other bug reports from users (for example, if you had the "Starfield detail" setting to "Solid Black" you would get a "hall of mirrors" effect as you scroll around the map). Thanks to every one who reported a crash and bug, you're helping to make the game better with every update!

 

The beginnings of an actual game

Posted by

So I’ve finally got combat to a point where it’s functioning reasonably well. What I’d like to do now is show off the first few steps you’ll take when you initially install the game, as it currently stands. Keep in mind, these screenshots are pre, pre alpha quality and there’s a lot of tuning and tweaking to be done.

First Minutes

When you start up the game for the first time, you’re asked to log in. We use a Google Account to authenticate with the server, so you’ll have to select which one you want to use:

Log in screen

Once logged in, you need to set up your empire. Currently, the only thing we need is a name (though I’m thinking there may be more settings you can adjust at a later time, such as your icon, colours and whatnot):

Empire setup screen Welcome screen

Once your empire is set up, you get to the Welcome Screen. If you exit the game and come back later, the Welcome Screen is where you come in. It contains a “message of the day”, where I can put notices and announcements of in-game happenings.

There’s a couple of options you can adjust from the “options” screen, mostly to do with graphics details and stuff. But that’s not interesting, so I’ll skip it. Clicking on Start Game you’re taken to the game proper:

This is an important screen, so I’ll take a minute to describe the features. At the top, you see the main starfield. This is what all the “action” happens, so to speak. At the very centre of the starfield, you can see our “home” star, Thamon. The fact that we have a colony on this star is indicated by our empire’s purple shield and name next to it. The ships icon with “Collectors (11)” next to it indicates that we have 11 ships parked at this star.

Under the starfield is the chat window, currently disabled because I haven’t got it working yet.

The bottom pane contains a bunch of details about the currently-selected star: a list of planets on the left, a list of ships on the right, as well as an Intel. button and View button, which we’ll get to in a minute.

At the very bottom of the screen, is the name of our empire, “Collectors”. To the left of that a little indicate will show whenever there is network activity. To the right of the empire name is our current bank balance, $500. Then the Sit. Rep. and Empire buttons (which we’ll get to in a minute).

Initial Colony

Tapping on the View button, or on one of the planets, will bring up the Solarsystem view:

Solarsystem view

Another important screen that I’ll take a minute to describe. At the top of the screen is a representation of the solar system itself. You can see all of the planets (7, shown here, is the maximum number of planets a solar system can have). There are different kinds of planet, Terran (“earth-like”), Desert, Radiated and so forth.

Congeniality indicator

You can tap a planet to select it, and this will show a small indicator, which I call the “congeniality” of the planet. There’s three factors to congeniality: population, farming and mining. Population is an indication of the maximum population the planet can support. Farming and mining show how well that planet will support farming or mining (we’ll see this in a little more detail when we look at focus).

The bottom pane shows details about the currently selected planet on the left and a couple of “universal” buttons on the right (there’ll be more here eventually...). The planet details include the population (currently 99 here), under that is the current focus indicator.

Focus

Looking a little closer at the focus indicator, you can see there’s four things we can “focus” on. From top-left to bottom-right: Population, Farming, Mining and Construction. Initially, your colony starts off with everything equally focused. You can see under the population focus, the “-0 / hr” indicator, which says our population is changing by “-0” per hour. Under the farming indicator, it has “+9 / hr” which indicates our colony is producing 9 units of food per hour, and under mining it has “+8 / hr” indicating 8 units of minerals per hour.

Focus and congeniality combine to determine the actual output of the colony. Basically, it’s defined as:

output = population * focus * (congeniality/100)

So if we plug in the numbers we see here for farming, we get 99 * 0.25 * (39/100) = 9.7, which the game rounds down to +9.

Clearly, it’s important then to have your colony’s population at it’s maximum. So the first thing we’ll do is adjust the focus. We don’t really care about construction for now, nor do we particularly care about mining (which is really only needed when constructing) so we’ll ramp up the population focus and farming focus. Click the Focus button to bring up the window to adjust like so:

Focus dialog

With our focus now set at something that’s a little more useful, we turn our attention to the other planets. When you start the game, you’re given a Colony Ship (which you’d see if you tap the Fleet button). The Colony Ship is a single-use ship that lets us colonize planets.

So we’ll go through the planets looking for something suitable (i.e. high population congeniality and high-ish mining/farming, at least that’s what important at this stage of the game).

When we’ve found such a planet, we tap Colonize and new colony is created on the new planet:

A new colony

By default, new colonies have a population of 100. Again, we’ll want to adjust the focus here to maximize the population. If you look up at the top-right of the window, you can see the current store level. This shows how much food and minerals are stored in your colonies on this star system.

Store

Initially, your stores max out at 500 (meaning you can’t go above 500 minerals and 500 food), but you can increase that by building silos (we’ll look at buildings shortly). In terms of food, though, there’s usually not much point having huge stores of food, so it’s a good idea to adjust your farming focus so that it’s only +5 or 10 or so overall. That way, you can focus on other things (like increasing population, or construction).

Scouting

So our colonies are now doing OK, it’s time to look around at the nearby stars. If we go back to the starfield view, we can scroll around a bit and tap on other stars to get an idea of what’s around. Here’s two nearby stars that look interesting:

Adaglerdie Thurim

They’re “interesting” in the sense that they have planets which can support large populations and have decent farming/mining congeniality. If you’re keen-eyed, you might notice that some of the planets here are marked “Native”. That means there’s a “native” population, which may not have the capability of inter-stellar travel, but will pose a bit of a threat if we just try to land a colony ship there.

So the first thing to do is send a scout there to scope out what’s what. To do this, we tap on the Empire button in the bottom-right. This brings up the Empire view, which consists of an Overview tab and Colonies tab:

Overview tab Colonies tab

The Overview tab is perhaps a little sparse at the moment. On the Colonies tab, we can see the two colonies we have on Thamon. And the important Fleets tab:

Fleets tab

We only have a single fleet at the moment, of Scouts (remember we had a Colony Ship, but it was destroyed when we colonized the second planet). Sending ten scouts at a planet is a bit of a waste, so we’ll split it up, into a fleet of 9 and a fleet of one. Tap the Split button:

Split fleet dialog Moving a fleet

We can then select the one scout and tap Move to order it to move to one of the stars we’re interested in. Here we see the first use for cash in the game. It will cost $127 to move this fleet of scouts to Thurim. That’s fine, so we tap Move and the order is given.

Order is given

You can see the ship is currently executing the order, and it’ll take 59 minutes to arrive. We’ll do the same again for the other planet (that is, split the 8 remaining Scouts and send one off to Adaglerdie).

So that’s pretty much all we can do for now, until those fleets arrive at their respective destinations.


Scout Reports

If we come back before the ships have arrive, here’s what we woudl see in the starfield view while they’re in transit:

Scouts in transit

After a while, then, they’ll arrive and we’ll get a notification to that effect:

Notifications

You see that we actually got two notifications: one that the scout arrived (and was under attack), and another when it was destroyed. Scouts cannot fight, so they’re inevitably destroyed if there are enemy ships about, but luckily for us, the scouts can transmit a report before they’re destroyed!

When we go back into the game, we can see there’s now no sign of those two Scouts:

There’s two ways we can see the report they left behind before they were destroyed. One is via the “Situation Report", which you get to by tapping the Sit. Rep. button:

Situation Report

The sitrep is where every “significant” action in the game is recorded. So when a building or fleet is constructed, when a fleet completes a move or is destroyed, etc. Here you can see an entry for each star when the Scout arrived, and when it was destroyed. So one way to get the report the scout left is to tap the Move Complete record for the scout (tapping the Fleet Destroyed entry would bring up the combat report, which we’ll get to later).

Another way to get the scout’s report is to select the star you’re interested in and tap the Intel. button. Either way, you’ll see the scout report. Here’s the two reports for the two stars:

Thurim scout report Adaglerdie scout report

Preparing for battle

We can see there’s a few enemy fighters on each planet, so we’ll have to build our own fighters to take them down. The first thing to do is go back into our solar system and adjust the focus a bit to give a little bit of priority to building:

Solar system view, adjusted the focus

You can also see our population has increased a bit since the last time we were here. That’s great!

Next we tap the Build button to bring up the build view. Let’s have a look at the Ships tab:

Ships tab

Here you can see the “Required” field is all red for the ships, indicating we don’t have the required Shipyard. We’ll need that first, and it’s available on the Buildings tab:

Buildings tab Building a Shipyard

Tapping on the shipyard brings up the confirmation window where we can see an estimate of the time it’ll take to build, as well as the resources required and a quick description of what the building actually does.

The time to build is only an estimate (in fact, it assumes you have an infinite supply of minerals with which to build), so it’s usually under-counting the actual time. We can see that when we tap Build and go to the Queue tab:

Queue tab

We can see it’ll actually take ten hours to build. So let’s come back then.


Building fighters

Shipyard is complete Ship now available

We’ll get a notification when construction is complete, and after we come back, we can see that the ships are now available to build (all requirements are green). If you recall, there were about 60 ships on Thurim, split across four fleets. We’ll play it safe and build 100 fighters to take them on, so we tap on the “Fighter” row and drag the slider across to build 100 ships:

Building fighters 100 fighters take a while to build

It’s going to take a while to build those fighters. This brings us to another use for cash in the game: accelerating builds. If you tap on the fighters in the queue, you bring up a “progress” dialog where you can either cancel the build, or accelerate it.

Build progress dialog Cost to accelerate this build

Accelerating the build reduces the time by half, and the cost is proportional to the amount of resources required. As you can see, this one will cost $1374 to accelerate, which is more than we currently have.

Getting Cash

Which brings us to the next point: how do you obtain cash?

There’s two main ways (currently) to get cash. The first, is by purchasing it directly (though that’s not implemented yet). The other, and by far the most common way, is by collecting taxes.

To collect taxes, we go back to the starfield view and tap the Empire button again. On the Colonies tab, we see a Collect button at the bottom:

Collecting taxes

Taxes build up in your colonies over time, until you collect them. The rate the amount of collected tax increases is proportional to the population of the colony. This early in the game, you don’t have many colonies (and the population is small) so you don’t get a whole lot of taxes. It’s certainly not enough to accelerate our build of those fighters, so we’ll have to leave the game for another day and come back again later.


We’ll get a notification when construction is complete, and we can come back and see what’s happened.

100 fighters construction complete Make sure their stance is Agressive

We can see the new fleet is at the star Thamon, so we’ll tap on it and make sure it’s stance is set to “Aggressive” (which means, “attack enemy fleets on sight”). Then we can tap on Move and order it over to Thurim.

Ordering the fleet into position

As with the scouts, it’ll take some time. You might notice that fighters will move slower than scouts (Colony Ships move slowest of all) so it’ll take a bit longer this time to arrive.

We should also start construction of another fleet with which to attack Adaglerdie. But in any case, we now have to wait for the fleet to arrive at Thumin.


When it does arrive, we’ll get a notification that it’s arrived and then we’ll get another notification to say that it’s been victorious or it was destroyed. In this case, it was victorious. Back in the game, we can tap on Sit. Rep. to bring up the situation report, and then on either the Move Complete or Fleet Victorious record to bring up the Combat Report:

Round 1 Round 5

So combat was over after 5 rounds (each round lasts one minute). The combat report contains the complete history of the battle (who fired at whom, how much damage was done, etc). You can see by Round 5, there was only one Native fleet left, with only 5 fighters. Our fleet still had 51 fighters so when we both fired, we wiped out that last remaining fleet.

What’s next?

So that’s combat, and the first few things you’ll do in the game. Obviously from here you’ll want to actually start expanding your colonies, moving out to further stars and so on.

The game is still not ready, in my opinion, for an alpha release. The main things missing are the ability to destroy enemy colonies (i.e. once you’ve wiped out the fleets around a star, what happens to their colonies? Do we have a different kind of ship that lets you attack ground forces? Do the colonies just get destroyed when there’s no enemy fleets left? etc.

Also we obviously need more types of fighters, the ability to build upgrades, planetary defenses and so on.

However, I think once the ability to attack colonies is in place, we’re in a good position to start getting a few people who are interested in playing the game. Stay tuned!

A small diversion on the user interface

Posted by

The combat system in War Worlds is coming along slowly but surely. It’s actually taking quite a bit longer than I was hoping, and that’s a shame because I don’t really have much to show until it’s largely in place.

But one thing I like to do when working on something that takes a long time is to break up the monotony with smaller tasks that I can finish in less than a day, just to keep myself motivated.

To that end, I’ve been working a bit on the UI for War Worlds, trying to nail down a cohesive “style” for the whole game. As it says right on the home page, I’m no designer, so I want to make sure the style is easy for me to actually build.

For example, here’s a couple of in-game screenshots showing of the new “dialog” style:

Fleet Split dialog

Accelerate Build dialog

It’s not 100% perfect (there’s a lot of alignment and padding issues for example), but I think it’s a start. One thing I’ve noticed is that I think it’s actually kind of similar to Google’s Ingress:

Ingress Screenshots

I will say that I was doing this style before Ingress was released, though :)

As I said, I’ve tried to make the style easy for me as the designer/developer and to that end I took a few short-cuts:

  • Most of the UI elements are just stock Holo: edit fields, sliders and so on,
  • The bits that are custom are all just simple lines and shades of blue,
  • A lot of elements are re-used (i.e. the buttons have the top-left and bottom-right corners chopped off, and that “theme” is used by the dialogs, drop-down lists and so on.)

I’ve thought about getting the help of a “real” designer, but the problem with that sort of thing is I’m not sure how to go about payments. At this stage I really don’t want to pay anything at all, because the game is already very much in the red (mostly hosting costs for this blog) and I don’t want to get any more in the red than I have to. I also wouldn’t want there to be any question about future payments in case the game becomes successful (not very likely, I know). To that end, any designer I do get would need to be paid a fixed price up-front.

So I think for now, I’ll just stick with my crappy art skills. If I ever make enough money off the game to be able to afford a proper designer, then I can revisit the idea of a professional taking a shot. Unless someone feels like doing some pro-bono work!