Square II update

I made an update to Square II to improve installation & deployment (it now has a nice installer and uninstaller that were made using NSIS), and balanced gameplay by removing the different level sizes and tuning the level size that was most fun. Also, completing lines of blocks in a single color now gives 5 x points, which is much more intuitive. It’s quite fun to play now, to go ahead and have some fun!

Top-2 of my favourite games

Even though I do not play that many games anymore, there are a couple of them which I still find time to play around with. Instead of all-time-consuming and never ending games such as Civilization these days I like games which I can easily hop in and out to suit the moments in which I have time to game a bit. Additionally, I love games that are more skill than luck based, as developing skill gives a certain pleasure.

There are two games that I keep coming back to these days, which I recommend to anyone in for unique & fun indie games:

King Arthur’s Gold (KAG)
For me KAG is the ultimate game for short play sessions (sometimes taking way longer than planned though). There’s always a KAG match going on which I can hop into and join the fray. Battles are chaotic, unpredictable, and a heck of a lot of fun. Its a great and rare mix of creation (building castles) and satisfactory destruction (blowing up castles).

KAG is a multiplayer deathmatch game played with up to 32 players. Build castles and wage war on the enemy team as a Knight, Archer or Builder in a fully destructible medieval world. (from KAG website)

Kerbal Space Program (KSP)
Another game with a huge creative element is KSP. The game can be summed up by: building rockets is awesome! The game has a lot of character, and is a lot of fun to play around with. Building a rocket that gets a Kerbal on the moon and back is quite challenging but also exciting and fun. It offers a wonderful experience of exploring new and dangerous worlds (danger mostly lies in gravity, the bastard). Its not even finished yet, but already there’s nothing quite like KSP.

KSP is a game where the players create and manage their own space program. Build spacecraft, fly them, and try to help the Kerbals to fulfill their ultimate mission of conquering space. (from KSP website)

Signed your app? Don’t forget the key…

Okay, I just learned a valuable lesson: do not forget your key. Yesterday I updated eXo and created a new APK for uploading to the Play Store. However, while creating this APK I noticed I forgot the password for the key store! Now that is really nasty, as the app key from this keystore is needed to publish an update to my aop to the store. The only solution: publish a “new” app. I updated all the links, sorry for the confusion!

On the positive side, this has been added & updated:
- Fixed sector selection window background & scrollbar
- Added ship cap (shown in bottom, red if reached) to avoid melting computers
- Improved clarity of infrastructure & production indicators on star

Simple logging

I’ve started learning OpenGL through following the ArcSynth tutorial series (there’s a nice Java implementation of the examples made by ra4king). As part of learning OpenGL and learning how to work with LWJGL I’ve been working on making a simple framework on which to build my OpenGL experiments, and later hopefully some nice games for desktop computers. Part of this framework is a simple logging class which I’m going to share here in case someone has use for it.

What are the requirements for this logging class?

  • A simple, easy to maintain piece of code, no dependencies.
  • Write info, warning, or error messages along with the exact time of occurrence.
  • Write the full stack trace when an exception occurs.
  • Logfile rotating: avoid filling op storage space by limiting maximum logfile size. A backup will be made of the current log when the size is reached, and this backup will be overwritten by the next backup.

Please note that there are all kinds of frameworks that do this logging for you, but I like to write my own code for such simple tasks, and avoid dependencies on external libraries if I can. Here’s some example output, showing my OpenGL framework failing on display initialization:

The nice thing of such logging is that I can get an immediate idea of where the problem occurred in my code (nl.bas.lib.AbstractGame line 92 in the initDisplay method), which makes debugging a lot easier. I can also see that cleaning up after the error occurred went well.

The class I use to do this logging is quite simple. I’ll go through it part by part, starting at the beginning:

The logger contains three static fields: a file to write the logging messages to, a maximum size for the log file, and a date formatter for the logging message timestamps. These fields, and the methods of the Logging class are static to ensure that they are accessible from anywhere in the application. The fields are set in the initialization method that must be called on startup:

After initialization messages may be logged, using a couple of logging methods:

Note that the error logging function has two versions: one that also writes a stack trace (Throwable is used here instead of Exception, as this also allows logging of Errors). The logging methods make use of a write method that writes output to the file:

These methods make use of the neat new Java 7 try-with-resources syntax that ensures that the output streams get closed correctly. The write methods take two steps: check if the logfile has become to big (checkRotate) and then write the log message to the file in a single write statement. The second one also writes the stack trace of the throwable to the file. Rotating the logfile is the last part of the Logging class:

And that’s it! In my code I try to follow the ‘throw early, catch late‘ approach, meaning I want the exceptions to be thrown as close to the point where things actually go wrong as possible, and catch them as late as possible. Here’s the way I do the catching, as an example:

This is the main entry point of my games (called directly from the main method). I log a couple of generic things here, like the different phases of the application: startup and shutdown. Additionally I catch the exceptions occurring in the application at the last possible moment, just before we return control to the operating system. This ensures that we handle exceptions in a consistent way, always logging them and showing a clear error message to the user. The Sys.alert method is a LWJGL method for showing a simple error dialog.

Here is the full class code, I hope you find some use for it:

Some usage tips:

  • Make sure to call Logging.initialize(fileName, maxSizeKb) at the start of the application (for example in main).
  • Although writing to the log is pretty fast, you should avoid calling it every frame as this would significantly slow down your game.
  • Write to the log in specific exceptional situations, e.g. on initialization or when cleaning up, so you can see what steps go well and what steps cause errors.
  • This implementation is not thread-safe (I think), so if you use multithreading pay attention :-)

Uploaded eXo beta to Android play store

I just uploaded a beta version of eXo to the Android play store. It doesnt have a promo video yet, but that will come. It may take a while until the game is available for download.

Here’s some things I have planned:
- Star capture sound
- Different empire ship graphics
- Ship cap with indicator (e.g. 5 ships per star)
- Tune difficulty
- Polish, add help screen(s)

Working on eXo release

I’m currently (in between a trip to Paris, work and other things) preparing a first public release of eXo. My plan is to launch a more-or-less open beta, get some feedback, dan then launch the final version. There will be two versions: a free one that has full functionality and an ad in the main menu, and a paid one (for about $1.49 I think) without an ad for people who want to support development.

Releasing a game is a bit more involved than I expected, though. I want to prepare some screenshots and a short promo movie. However, I’ve not made any movies before now so theres a bit of learning involved. Recording gameplay is pretty doable using Fraps, and editing should be easy using the free Microsoft Movie Maker. However, its still some work, so please have some patience ;-)

eXo nearing completion

After a lot of hard work, two major feature creep extermination projects and some polishing eXo is finally shaping up to what I wanted it to be in the first place: an accessible, action-oriented snappy space strategy game for Android & Windows! Most of the features are implemented:
- Four difficulty settings ranging from easy to a near-impossible extreme mode
- A wide range of hand-designed maps (still designing these) offering a variety of challenges
- Easy controls: send your fleets on the way with a single tap!
- Star bases that improve production, provide some defense, and allow faster travel. Using starbases gives you an advantage over the AI that you must exploit fully to win on the harder levels
- Accessible yet challenging tactical gameplay
- Sound effects & music
- Polishing: a nice-looking title screen, options menu, easy-to-use game saving & loading

I made some animated GIFs to give an impression of the current state of the game:

A circular star map

Making levels: generator or editor?

Most games need some kind of “levels”, each of which gives the player a setting in which to play the game and which usually has a beginning and an end. A series of well-designed levels then keeps the game interesting since it offers variety and a sense of progression. For eXo the levels consist of galactic sectors containing stars and other empires to fight. Currently these levels are basically all pretty much alike, even though they are randomly generated. To get to a progression or variety of levels, I see two approaches:

  1. make a complex star map generator that is able to generate a wide range of different star maps
  2. make a star map editor that I can use to design a set of star maps myself

Naïvely thought, option 1 seems like the best effort-to-results ratio: just write a single generator and I have an infinite supply of levels. However, after playing around with different approaches, I think that the truth is not so simple: building a good level generator is hard. Good levels are interesting, challenging the player with a new and fresh setting each time, and give a sense of progression. In addition, the levels should not have glitches, such as stars that are too close or too far apart. In the end this makes generating star maps really hard and a lot of work. So for now I am working on a star map editor instead that I can use to create a set of cool maps as a kind of “campaign” mode. Maybe I’ll add a random map generator later.

When to fancify your game

That is the question: to fancify or not to fancify? After implementing a good selection interface for eXo and polishing it a bit I now turned to working on a couple of things that make the game look nicer. For example, I’m using LibGDX’s scene2d ui ‘Action’ features to animate the menus in the game and make them move in and out of the screen. I’ve also added some simple explosion-effects for when two ships meet and do combat. But this got me thinking: isn’t this just another variety of feature creep or rebrand itch? After all, working on fancy graphical effects is not working on the core game, which isn’t finished yet. It comes pretty close to procrastination: avoiding doing a job by turning to all kinds of side jobs.

Why procrastinate in my hobby? The main reason for that is the goal I set myself: to really complete a game and publish it. Just fooling around with some experiments is easy to do; really polishing a game is much harder. It takes longer before I get some satisfaction from having a new feature implemented or having something look cool. That makes procrastination more likely.

The last streak of crosses on my calendar has only run for four days. After that I had a day full of work and social responsiblities which left no room for working on my game. And the day after that I just played King Arthur’s Gold (great little game by the way, play it!) for a while and didn’t do any development even though I could. After that it’s been on-and-off. But today I’m starting a new streak, and I’m printing out a neat little calendar to record them in, instead of the improvised one I have on my paper notepad. Let’s see if I can beat my previous highscore of 4!