Developer diary

Alien Blitz 3d: performance, engine issue, brightness, random bug


I made a few tests on PC with vsync disabled, 720p, MSAA 2x, and max FPS, here’s what I got:

  • Laptop, Linux, Intel card: 120 fps (needs vblank_mode=0 to disable vsync)
  • Laptop, Linux, Nvidia card (GTX 660M): 250 fps
  • Laptop, Win 7, Intel card: 140 fps
  • Laptop, Win 7, Nvidia card (GTX 660M): 650 fps
  • Old computer, Win 7, Nvidia card (GTX 280): 1 000 fps
  • Netbook eee Pc, Win Xp, Nvidia card (ION): 60 fps (maybe an hardware limit, not sure)
  • Mac mini, Mac OS, Intel card: 20 fps

These results are quite interesting:

  • I didn’t expect my old computer to have such an high framerate (the card was good when I bought it, but it’s at least 6 years old now)
  • Alien Blitz is working on my eee pc… I really didn’t expect that, it can hardly play a 720p video and yet Alien Blitz works at 60fps
  • Results between different cards/OS can’t be compared, when running at an higher framerate than the screen refresh rate fps does not mean anything (but fps can be used to compare performance between two game versions on the same card/OS)
  • It is not playable on my Mac mini, but it is so slow to do anything that it doesn’t surprise me. It’s not meant for playing game (it’s not even OpenGL 1.2 compatible apparently)

This is good news as it means the game works smoothly on a 6 years old computer and even on netbooks. Minimum requirement is something supporting OpenGL 1.2 I guess, dual core or more is preferable.


Engine issue

Alien Blitz is the first game I made seriously and it has a major issue since the beginning: it can only run at a fixed framerate.

Usually when developing a game the engine will run at a variable rate and all calculations are based on a delta time (time between last frame and current). In Alien Blitz the physics can run with a delta time but not the AI and some other calculations.

So the engine can only run at fixed rate of 15hz, 30hz, or 60hz

On mobile the engine runs at 15hz and uses position interpolation to render at 30fps, on PC the engine runs at 30hz and uses position interpolation to render at 60 fps.

Problem appears with multi core (separating engine & rendering):

  • Mono core: engine & rendering are synced, engine is run every 2 frames, if frame rates drops the engine will also slow down
  • Multi core: engine & rendering are not synced, if frame rates drops engine will still run smoothly (preventing slow mode), rendering issues can appear because a frame might be rendered while calculation is in progress.

The major problem with multi core appears on the mecca model as it’s the one the camera follows, it makes some strange movements every few frames. To solve this problem I exported a few engine stuff (camera & player movement) on the rendering engine some time ago.
Basically what you see on screen is the “supposed” position of the player, it’s virtual until the engine really computes it and checks if it is valid (you can see that when colliding walls, when you release movement key player will be sent back a bit farther from the wall)

Up to now it was working nicely in 2d on mobile as usually the lag will either affect fps and engine or just the engine. So everything will slow down, or just the monsters (making it a bit easier for player, so it’s ok this way).

In 3d and on PC (where framerate is higher) the engine usually runs at a very stable 30hz and the framerate might eventually slightly vary (if lots of effects on screen, or anything else). So it means player movements might slow down a little while monsters remain at correct speed, which is of course a problem.

So to avoid that I made a few changes to the engine, camera & player movements now use a dynamic framerate (using delta times), and voilà ! everything is working fine, and it also means I can let the user decide framerate in the option file. Acceptable values are between 30 and 60fps, more than 60fps is useless as engine won’t make calculations for these extra frames (and it will even be worse than 60fps), and below 30fps it will look bad. I might at some point make the interpolation delta dependent to get 120fps, but it’s not a priority.

It works ok but it’s just a workaround, my next engine (based on current one, voxel terrain and classic models) will be using dynamic framerate from the beginning.



Brightness option is back, but it will only be available for 3d mode

(50%, 100% and 200%)

capture_2014-07-26_16-35-01_0827_Alien_Blitz_ capture_2014-07-26_16-33-50_0212_Alien_Blitz_ capture_2014-07-26_16-35-25_0354_Alien_Blitz_

It can be changed at any time in the options.


Random bug

There is a random bug that seems to appear more on some levels. The problem is that it’s completely random and there’s absolutely no log displayed. The JVM will just stop, no exception thrown, no throwable, no core dump, nothing. It’s exactly as if a System.exit() was called, except the only ones that can be called in my game are surrounded by log entries so I know it’s not them.

It’s very hard to debug it as it’s random, yesterday it happened 5 times in a row on the same map, but didn’t happen anymore after restarting eclipse. I don’t think it’s an eclipse problem because I would get some logs at some points… I’m lost, I even tried switching from Java 6 to Java 7, but no luck.

I also checked memory and graphical memory but both are stable @ around 100mb each, so it’s definitely not the problem.

One strange thing is that this bug appeared after I upgraded my system (xubuntu 13.10 to 14.04, I did a fresh install), it might just be a coincidence though.

Read more

Alien Blitz 3d: keyboard, option screen, key/controller configuration, lighting, misc


As a lot of things in Alien Blitz keyboard support was done quite a long time ago when the game was pure java. So it was heavily generalized to support all engines I went through (java applet first, java desktop, slick2d, and finally LibGdx).

I’ve cleaned up everything and now keyboard support is only done through LibGdx, makes things easier to maintain.

I’ve also simplified key mapping, there can only be one key per action now. By default it will be WASD keys to move except in France and Belgium where it will be ZQSD (only if the locale for the keyboard is fr_FR or fr_BE at first run, so it should be ok for nl_BE).
Detecting AZERTY/QWERTY configuration is quite difficult in Java so it might not work very well on some systems (seems to work fine under Windows, but under a French/Belgium Linux it will always think the keyboard is AZERTY if that’s the system one even after using setxkbmap for some reasons).


Option screen

Option screen has been simplified on Android, it just displays a few options. But a new button has been added to go to the Advanced options with more options than before.

On PC clicking options will go directly to the advanced options.


Most of the options are applied immediately except for MSAA, font & language.


Key/controller configuration

The key & controller customization is now a lot better than before (Snorms), and works a lot better:

capture_2014-07-25_11-17-24_0614_Alien_Blitz_ capture_2014-07-25_11-17-28_0126_Alien_Blitz_

New configuration is applied directly after confirmation.



Again more work done on lighting, mostly changed shaders for model rendering so that lighting used there is the same as on terrain. So now models are correctly lighted.

I’ve also added some effects on items, the one that can be pick up (life is not 100%, boxes,…) are full light to be more visible.

capture_2014-07-25_11-25-21_0211_Alien_Blitz_ capture_2014-07-25_11-25-40_0298_Alien_Blitz_



Changed a lot of small things:

  • Control help screen if 3d and/or PC has been changed
  • Added a controller help screen on first map if controller is plugged in
  • Cleaned up some debug tools
  • Changed some particle effects that were not rendering well
  • Resizing window, switching to full screen, changing resolution
  • Reduced MSAA to 2x by default, can be changed in the options

My to-do is now almost empty, it means I can now do some more tests to fill it up with smaller cosmetic stuffs and bug reports.


Read more

Alien Blitz 3d: new weapon screen, options, timer, dyslexic font, control camera with gamepad

New weapon screen

The weapon screen has been changed, it is now quicker to equip and upgrade weapons




Options have been changed from xml file to json file, this is much easier to read/write serialize/unserialize with LibGdx.

All options will be lost with next update, which does not really matter as this is very easy to re-set them.

And this change will allow me to add a lot more easily a lot of small options that I don’t want to include in the UI (advanced stuff, speed running and such).



Timer has been improved, I was wondering if I should use a real time timer or a engine cycle count timer, basically the timing difference is on how they handle micro-lags.

Let’s say that at some point the computer lags for some reason (avast wake up and slows down everything a bit for a few seconds for example) and make the game slow down. Real time timer will include this lag but not engine timer. Engine time is good for speed running I think but then some cheaters could exploit that to play in “slow motion”.

As I’m not really sure which timer to use I will use both, all times will be saved in both formats. But only one timer will appear on screen, I think it will be selectable in the config file, but for the default option I might ask some speed runners what they think about it.


By default time will not be visible on screen, player will have to change the config file. In this screen shot you can see what will happen when timers are visible (bottom left corner). The top timer is the level timer, the bottom one is the global timer.

Level timer

Level timer starts after level loading, and is stopped at the end of the level. It will continue when in the in-game menu, but not when the window looses focus or the pause key is pressed.

It will replace current timer for best time, and will be saved along global timer split.

Global timer

Global timer starts when the player first click the Play button, it is saved when exiting game. If the player restarts the game this timer will restart immediately when main menu is visible.

It will automatically save times (split) in a file at different point in the game:

  • When a level is started
  • When a level is won, along with level timer, level name, difficulty and completion percentage
  • When a level is lost

It is easy to get the total completion time just by looking at the global time at the end of last level.

These splits are visible in the statistics window (by clicking the mecca avatar on the main screen, and also in the options)


Auto split (external program)

I tried to see if it was possible to send a command to WSplit to tell it to split, but couldn’t find one. So I’ve decided to add the possibility to simulate a key press when ending a level. It will be available only by editing config file.

It means that if you use WSplit or any other program and have one split per level then the game can automatically split for you.


Dyslexic font

I found the OpenDyslexic font project some time ago, I don’t have dyslexia myself so I don’t know if this font can really help people with dyslexia, but as it doesn’t cost me too much to add this as an option I’ve decided to give it a try.


It doesn’t seem to help so much to me, but I can’t say. It’s not much but I hope it can help people with dyslexia. It will be available in the advanced options.


Control camera with gamepad

It is now possible to move camera using the second analog stick on your controller (if any), it will act exactly as right clicking with your mouse.

It will only be available on PC as accelerometer is used on mobile to move camera.

Read more

AlienBlitz 3d: lighting, in-game font, textures


I finally dropped the tests on making all lights dynamic because I can’t get some good vertex lights parameters and it makes lots of artefacts around borders.

It’s no big deal for current dynamic lights as they are usually small, move fast, and have a short life time. But for permanent lights it just doesn’t fell right.

But it made me change a few things with dynamic lights, and corrected some bugs, so that’s good.

I’ve completely changed again how lights are calculated to try to have more shadows and more colors(as I think it is what was looking good with dynamic lights). New light calculation looks better, and it is quicker than before (barely noticeable, but still better than the opposite) and uses a bit less memory/graphical memory.

capture_2014-07-21_11-53-38_0230_Alien_Blitz_ capture_2014-07-21_11-54-30_0239_Alien_Blitz_


In-game font

Current release of Alien Blitz uses a very specific font system (drawing text):

  • Fixed sized bitmap font inspired by Ubuntu font
  • Specific drawing routines (drawing fonts with accents, centering, align font,…)

I’m quite please with this code as it’s working nicely and can handle accents and such , but it’s a pain to maintain.

This font is just used in-game, the UI is using LibGdx font system. So I decided to change the in-game font to LibGdx too. I didn’t expect this to be easy, but interfacing the LibGdx system into the current one was very easy, mainly because we used almost the same function calls structure.

So now all fonts are rendered using LibGdx:

  • Directly converted TTF font
  • Using Fairfax font, like the UI
  • Using 36px font, dynamically scaled (best results)


I was quite surprised to see that it was looking a lot better to use scaled 36px font rather than 12px font for small font.

The only downside is that I was rendering a few font elements to Pixmaps and LibGdx font cannot (and will not) do that… So I have to rewrite some code.



Some more work done on textures:

  • Wall textures have more contrast
  • Floor textures that had not been worked on before have been changed (less contrast)
  • Some tiny adjustements


capture_2014-07-21_14-42-46_0015_Alien_Blitz_  capture_2014-07-21_14-48-02_0728_Alien_Blitz_





Read more

Alien Blitz 3d: more dynamic lights

More dynamic lights

I tried something today: changing one type of light (fire lamp) to dynamic lighting

Here are the results (before/after)

capture_2014-07-20_00-32-02_0686_Alien_Blitz_ capture_2014-07-20_00-32-14_0279_Alien_Blitz_

capture_2014-07-20_00-27-53_0059_Alien_Blitz_ capture_2014-07-20_00-29-23_0286_Alien_Blitz_

It makes updating dynamic lights a bit longer, but not by that much… And it sure looks different:

  • current lights have an additive and a multiplicative component, whereas dynamic lights just have an additive component (which means I would have to create fake “black” lights to render dark areas, which are a pain in the ass to manage)
  • Current lights are smoothen, making shadow on cubes less visible

I don’t know which one I prefer, I could tweak them both to my liking I guess… but having dynamic lights could be very nice as I could activate them only when player sees them (making the room “appear” when the player enters in it)

I have to do more tests… but it sure is something interesting

Read more

Alien Blitz 3d: poison/napalm drops, path finding, smoother physics, mouse cursors, screen borders

Poison/napalm drops

Poison and napalm drops will now set the player or monster on fire/poison from farther away. And they now deal damage to monsters by a percent (33 to 50% of monster’s life in 5 seconds) and not by a fixed value.

It means poison and napalm barrels are now more useful from a strategic point of view, chances are increased that they will indeed deal damage to surrounding monsters.



Path finding

When a monster can not shoot at the player it will:

  • Go through a direct path (straight line) if a path exists
  • Or execute a A* algorithm to see if a path exists to the player

Path finding was removed on mobile for performance reasons, code was still present in the game, but it was not working anymore, so I corrected it and it seems fine now.

So now monsters will sometimes (depends on monsters & level) execute a A* algorithm to try to find a way to the player (when player is not visible). A* has also been re-enabled on Android, but it is less likely to occur and can not happen more than once every 10 seconds.

Currently the monster will just try to reach the current player location wherever he is (cheating…), so I’ve added 2 other solutions:

  • Try to reach the last “safe” location where the player was (a safe location is just somewhere with absolutely no obstacle and on a flat terrain), it will increase chance for A* to work
  • Or try to reach the last “seen” player location (different for each monster), chances are it will bring the monster closer to the player and the monster is less cheating using this solution.

It means now monsters will move more to try to reach the player especially on PC.


Smoother physics

Lots of stuff that had been “simplified” for mobile/isometric are now more smoother on PC: corpse falling, rock dropped by first boss, ammo drop falling,…


Mouse cursors

Mouse cursors are back, there are a bit less than before, and I made them bigger. There are 3 cursors

  • A simple arrow for the menus
  • A sight when player can shoot
  • A reloading animation when the current weapon is reloading


They won’t appear on mobile, even if a mouse is plugged in, as mouse is not used (it just acts as a finger tap).


Screen borders

I’ve added 2 effects for the game, 2 borders that will appear on the screen

  • Small one (red): when life is low or when player took high damage (displayed for a few frames)
  • Big one: when player is poisoned (green) or in fire (yellow)

They will be available everywhere (classic/3d, PC/mobile)

capture_2014-07-18_22-36-24_0524_Alien_Blitz_ capture_2014-07-18_23-11-42_0773_Alien_Blitz_

Read more

Alien Blitz 3d: 60 fps, Android/iOS, mobile/PC differences, corrected dynamic lighting

60 fps

I’ve finally enabled 60 fps on PC, it just changes a few things:

  • Everything is rendered at 60 fps
  • Bullets position is updated at 60hz
  • No more bullet position interpolation
  • Camera movement is a bit smoother

Basically all bullets movements are smoother, nothing else change as nothing else goes fast enough to be noticeable.

It really feels nice, it’s very hard to say if something is running at 30 fps or 60 fps just by looking at it… it just feels nicer and smoother when playing at 60fps, especially now that there are dynamic lights (they make bullets more visible).


Android / iOs (aka “I’m just stupid”)

Something funny happened today, I noticed a line in my code:

public static final boolean    FORCEMONOCORE                = true;

I had completely forgotten that at some point I disabled multi core support (can’t remember why, a temporary test I guess). It means for the past few weeks Alien Blitz 3d was only using one thread (instead of 2).

So I re-ran a test on my iPod touch, and it is now a lot more playable ! (maybe not on more complex levels though) I can’t test on the Xperia S, but I guess it will also make it playable. It makes no change on Xperia Ray as it’s a mono-core device.

This is very good news because I can now think again about 3d on mobile!


Mobile / PC differences

So far I think differences between PC and mobile will be

  • Better graphical engine
    • 60 fps
    • More particles & effects
    • Dynamic lights
  • Smarter monsters
    • Better path finding (was disabled on mobile for performance issues)
    • More “dynamic” monsters (move more often, won’t “sleep” when player is far away,…)
  • Level editor
    • Based on old engine (isometric) in a first time
    • Online level sharing and downloading (with a simple account & rating system, nothing huge)


Corrected dynamic lighting

All glitches with dynamic lighting have been corrected, and it is also now multi-core compatible (wasn’t before)

So I’ve added more sources for dynamic lights:

  • Buttons on/off
  • Keys
  • Check points
  • Napalm and Poison drops (from barrels or weapons)
  • Bullets
  • Monsters when shooting

It looks nice

capture_2014-07-17_20-40-02_0948_Alien_Blitz_ capture_2014-07-17_20-36-31_0355_Alien_Blitz_ capture_2014-07-17_20-35-24_0377_Alien_Blitz_ capture_2014-07-17_20-28-47_0495_Alien_Blitz_




Read more

Alien Blitz 3d: 3d lighting, maps, smoother lights, dynamic lights

3d lighting

In Alien Blitz lights are computed and saved in 2d, it means some parts are lighted even though they shouldn’t, and lights don’t fade vertically on the walls.

I tried to switch to 3d lighting (first screen is current, 2d, second screen is 3d)

capture_2014-07-15_19-42-04_0881_Alien_Blitz_ capture_2014-07-15_19-43-55_0260_Alien_Blitz_

It makes everything more accurate and darker… but it doesn’t change that much otherwise (especially in default view, it’s a bit more noticeable in FPS view though). On most levels (with low height differences) it isn’t even noticeable… But it makes way more time to compute and takes way more memory, so I won’t keep it.

The good thing is that it made me realize the glitche happening in 2d lighting (the right wall should not be light that much) and so I’ve correct it.



Some new works on most maps:

  • Added locked door at start of levels, to “show” where the player came from
  • Added unlocked door at end of levels, to “show” where the player must go
  • When player come from/go to a an island it will mostly be sand now, I didn’t like the way the decks where done previously


No light cache

On Android lights are pre-calculated, I have a tool on my computer that will compute all lighting and save all lights parameters in  a cache file (it reduces loading time by a factor 2).

On PC loading time is not really an issue, so lights are now computed every time the level start, it will reduce a lot map file size as cache is not needed anymore (map files are around 100kb now).


Smoother lights

Up to now only surface facing top had lights smoothen, so I’ve added other faces too (before/after, check left wall)

capture_2014-07-16_13-23-11_0579_Alien_Blitz_ capture_2014-07-16_14-00-31_0486_Alien_Blitz_

It’s not a huge difference, but that’s the small things…


Dynamic lights

That’s quite a huge part, up to now lights were pre-calculated and stored in a 2d map. Then when computing vertexes lights are taken into account and sent to the shader part. It is kind of light mapping, but simplified.

This part will always stay the same, but I’ve now added some dynamic lights, those are lights that can be created/moved/destroyed at any moment.

I’ve decided to do them differently, these lights are rendered on a texture (2d top view texture), and this texture is then passed to the voxel shader. I don’t know if it’s the best approach performance wise, it seems pretty good so far but it will require more testing (and optimizations…)

And for this special event I will try to publish a WebM video (might not work on Internet Explorer… but who cares?):

It seems better than GIF (file is around 50 times smaller than its gif equivalent, and it has a better quality)

This feature is of course a work in progress, there are a few glitches (lights that sometimes can’t blend, lights are in front of missiles because of position interpolation,…) but it’s a good start in my opinion.


Dynamic lights will only be available on PC and in 3d

Read more

Alien Blitz 3d: more work on textures, MSAA, Speedrun

More work on textures

I tried multiple things to render textures better today…

Using 16px textures instead of 32px


It makes everything smoother, less sharp, but of course details are lost in the process

Activating linear filtering on 16px textures


Everything is even more smoother, maybe a bit too mucj

Activating linear filtering on 32px textures


Difference is hardly noticeable (compared to original 32px/nearest filter), certainly because textures almost appear at their original size most of the time.


It needs more testing, 16px might be better for low resolutions, but I still prefer 32px (with filtering), I think I will just have to do some more tiny adjustments to contrast and colors to get something better



I’ve decided to activate MSAA, it’s very easy with Libgdx


It doesn’t change anything for textures, but walls appear a lot better, no more aliasing. It will be default option I think.

Only problem is in 1st person view mode, artifacts appear (2nd image)


I don’t know why there are artifacts, I guess I will just disable MSAA in 1st person (if possible), as it’s just a small mod for the game it doesn’t matter that much.

I have different results depending on the graphical card and OS:

  • Laptop, Linux, integrated intel card: 8 samples max
  • Laptop, Linux, nvidia card (bumblebee) : can’t enable MSAA
  • Laptop, Windows, nvidia card: ok (tested 8 samples only)
  • Desktop, Windows, nvidia: ok (tested 8 samples only)
  • Mac mini, Mac OS, intel card: ok (tested 8 samples only)

I have no idea why the nvidia card can’t enable MSAA on my laptop under Linux… maybe a configuration issue, an issue on Libgdx/lwjgl, or an issue on the Linux driver…



I love watching speedruns (, I tried myself to do some Doom 2 UV Max runs but it’s too time consuming, so I never went very far, but I included some speedrun achievements and references in Alien Blitz.

I also tried to speedrun Alien Blitz, it’s working pretty well, first episode can be completed very easily, then others are harder as weapons are not upgraded enough and player level is quite low, but it’s definitely possible.

I will have to make a better tool to calculate time, current time (that you can see by clicking the mecha image on the main screen) is just the number of frames spent to complete each level. I was thinking to include a real time timer that begins the first time the play button is clicked, that runs all the time except during loading time and file save, and that can be displayed all the time on screen if needed (just the time, nothing else, speedrunners are used to have WSplit or other tools to compare their personal time).

Currently there are 10 SR and 10 TAS achievements (excluding bosses achievements), they are based on old times and I’m not even sure they are possible to complete anymore. So I’ve decided to clean up all this, now there will be 20 any% achievements (just complete the level as fast as you can) and no 100% achievements (too boring to complete).

To get the expected time you might have to use some glitches, death abuse,…

Read more

Alien Blitz 3d: camera auto zoom, move camera with mouse, reducing contrast on textures

Camera auto zoom

Now that Alien Blitz is in 3d it is a lot easier to play with camera zooming.

So I tried to find a good way to automatically zoom the camera, I want it to zoom when in small areas and unzoom in open areas. So basically the game will compute the distance to the nearest wall in 4 direction + the current direction the player is facing, then it will take an average and zoom/unzoom smoothly accordingly.

capture_2014-07-13_09-45-56_0635_Alien_Blitz_playing_episode3_e03m03_ capture_2014-07-13_09-46-23_0973_Alien_Blitz_playing_episode3_e03m03_

So the camera will almost always be correctly zoomed in/out.


Move camera with mouse

I’ve added back a feature from Snorms: right click to move mouse around and view farther

A view when not clicking (and looking west):


Same view but right clicking on the right part of the screen:


It’s just a small feature, but it can really help, I will try to implement something similar when using a gamepad, with right stick.

Of course you can’t view very far this way, except when using a rifle or another weapon with sight.


Reducing contrast on textures

All textures in Alien Blitz are hand-made, I made them quite some time ago, there are a few very specific textures (doors, water, lava, poison,…) and others are generic textures.

There are 33 generic textures, all separated in different images (it’s an old format, hence the unused space) in a generic color

tex001 tex002 tex003

Then an automatic process is used to apply different colors using a palette:


(the top-right object is the reference color, other objects are the different color I want)


A problem I have in 3d is that contrast is too strong, and when camera is moving it kinda hurts the eye, so I changed the palette file to reduce all contrasts, and regenerated the textures.


capture_2014-07-14_12-29-09_0745_Alien_Blitz_playing_episode3_e03m09_ capture_2014-07-14_12-47-58_0461_Alien_Blitz_playing_episode3_e03m09_

It’s better now, but it needs more tests of course. And I’d like to keep the wall textures a bit more sharp…

Read more