keyboard picture

Pre-Launch Panic attacks

This article is from a unity developer explaining how the stress invades him just before releasing his game. He is giving some useful tips on how to handle with bad feedbacks. The title is not accurate because some tips are more general and concern the whole developing process but he has definitely some good points. The article mentions the software Spine which I already heard about months ago because it was made with LibGDX. I am pretty sure that Spine is really useful but for the moment I am dealing my animations without it as I want to keep my game with a “pixel” look and feel.

Mark brown youtube channel

I just discovered this guy when i was reading a test about the new Zelda ([FR]). His channel is pure gold for an indie game dev. The guy is analyzing top hit video games (zelda series, doom, mario …) on a particular domain: gameplay, music, difficulty etc. Currently, there are 48 videos available grouped in a list he calls “Game maker’s toolkit“. These videos gave me a lot of new ideas and make me realize the importance of certains aspects in my games.

There is also a set of videos called Boss keys on how Zelda dungeons were build over all episodes.

How to code and release the damn game

I really like Orange pixel. First, the guy has developed a lot of good games since 2004 like Meganoid or Heroes of Loot for android. He shares all his progress on his blog and some articles concerned directly his life as an indie game developer. This article explains how he is choosing which game to work on, how much time he think it will take him to release it and why depending on the money of this game can motivate someone. For him, it is the key difference between an hobby and pro dev and can explain some choice done during development.

So finally i have tackled this nasty bug in my game which bed-bug-exterminator-hmakes all my animations really weird when using a tool like a shotgun… it was very difficult to find it because there was a mix of action cleaning stuff with states check routines and, at the end, my code was really difficult to understand.
So to track it, I have refactored a lot of code in order to make me understand what happened. The final code is still complicated and I am not satisfied with it but at least I can now continue to implement ranged attacks.
The cool thing is that to track the bug, I am now able to decrease/increase the speed of the game with a keyboard shortcut. I am sure this would help me a lot for future bug tracking.

All this thing make me realise that it is very difficult to debug a game because of the real-time process:

  • you can’t really use breakpoint because they will stop the process on every frame.
  • you could use a conditional breakpoint to reach a bad state. You will be able to see the context but you will not be able to track all the history.
  • forget to log every step, you will have zillions lines of logging where it will be difficult to find any relevant information.
  • some would tell me to unit tests but as I explained above, it so dependent on the context that it is difficult to reproduce it.

I don’t know how real game studio are working but I am sure some technics (that I don’t know) exist.

So what is a bitmap font?

Simple bitmap font image

Simple font image

Every game developer has face it during the development: Display a text in the game to show damages or a conversation between two characters. For performance reason, standard fonts (understand TTF ) are not used directly. The preferred way is to use a bitmap font: it is a big image containing all characters used to display a text for a predefined size. The image (a png  file) is linked with a text file with the extension fnt  describing where each character is located in the image and give all necessary information to display the text. (base height, interline, …).

Continue reading

It is very easy with LibGDX to implement a screenshot feature within your game. The idea is to create an array of bytes where each byte represent a pixel color, and them, line per line, fill the array sequentially with pixels color values. Then return as a Pixmap this array and use  PixmapIO.writePNG  to write the file on the file system.

Continue reading

In my last post, I explained how I have setup my LibGDX game project to use Scala. No doubt it’s working but if you follow my procedure, you will face the same wall as me: it is unusable in an IDE, or at least in IDEA Intellij: no error displayed when typing, no error displayed when opening a file… The only way to see compilation errors is to ask for a full rebuild of the project each time you modify something…

So who is the culprit?

  • Scala-plugin? Scala support in IDEA Intellij 14.1 is quite good for a new project. It is not as advanced as Java is but time will make the plugin for Scala better i have no doubt on this.
  • Gradle? When launching a build with Gradle, everything compile smooth.  I have tested both desktop and android version and nothing is wrong.
  • Gradle with Scala in IDEA? Gradle is working well in IDEA for java projects but Gradle with the Scala plugin in IDEA seems not really supported. It is working but its working badly. [EDIT] Hopefully, someone from twitter help me to fix the issue: just clean your .idea config folder, upgarde Intellij/Scala plugin/Gradle to their last version and re-import projects: all issues are gone.[/EDIT]

So I decide to have a look to SBT as this is the preferred build tool for Scala projects. Scala plugin in IDEA is supporting SBT and it can’t be worse that Gradle + Scala.

I use a gitter template found on github and get a really simple project with a structure similar to the one i have with Gradle: core, desktop, android, ios. After compiling and checking that the sample project is working properly, i moved my game code in core/src/main/scala and modify two things in the Scala build task all-platforms/build.scala :

  • add the local maven repository:
  • add a new dependency for my personal game framework:
    • add a new parameter in versions.sbt :
    • Modify all-platforms/build.scala  to add this new dependency:

SBT compilation from command line is working well. If you import the project in IDEA, all is running smoothly. Changing library versions in versions.sbt  and refresh the SBT project in IDEA works perfectly like a Maven or a Gradle project.

So my advice for a Scala project is: forget Gradle and Maven and focus on SBT.



When Scala came out few years ago, i was really impressed how you can do amazing things with so few line of codes. I was particularly impressed by the collection framework and all the lambda that was not possible until Java 8.

I start to read a book to learn basis and read articles on the web and in my opinion, this language could be the next language to move on.

Professionally, i got the opportunity to work with AKKA, an Agent framework developed in Scala: this gave to me my first occasion to play seriously with it.

But things goes on and projects required me to stay on plain old java dev.

Last week, Expedia has organized three days of conferences and workshop to let techies talk together and exchange ideas on tools and frameworks they are using. I was surprised that many teams were using Scala for their development, at least for the testing part through ScalaTest. During these three days, i have followed two 3-hours workshops – Scala 101 and Scala 201- which remind me how i found clever this language.

So i asked myself: how can i move to Scala, but this time for real?

To learn a new language, books are ok but you should use it for you day to day job in order to capture its philosophy and understand with real use case its strength and its weakness.

So i decided to move my current personal project to Scala: my Cthulhu Android game. Sounds difficult: first its an android app. Hopefully, i am using LibGDX so this should help me to move things out because i am not relying on android SDK. Second, i am using Gradle and Scala projects prefer using SBT.

So after few search on internet, some changes which were not working, it was not so complex to add Scala in my application:

  • Rename in the core project – the one with all the logic –  the src/main/java directory to src/main/scala. The plugin will allow you to mix Java and Scala files in this repository. I recommend you to do this to avoid compilation issues (which language is compiled first?)
  •  modify the gradle build file:
    • change plugin to apply plugin: 'scala'
    • add scala dependency
    • tweak scala plugin for better performance:
    • You will need to add Scala dependency in android module otherwise APK will not contain Scala library

The APK is bigger because of the Scala jar (+1.8Mo) but the game runs has if it was coded with java code. And that’s normal because Scala objects are compiled to java bytecode.

Some advices:

  • You can mix Java and Scala stuff pretty easily in order to move to Scala on some identified scope. Prefer classes with no inheritance to make thing simpler. Test your app to see if all is running well and then refactor bigger piece of code.\
  • You will not code properly in Scala because lot of things are different. Indeed you will code like in java but with some Scala words. But that’s ok: you will make mistakes, you will learn and you will change the way you code.
  • Try to make things working first and not search for beauty: when you mix java and Scala code, you will see some ugly code like MyClass$.MODULES in the java code when you want to get an instance of a case class. This is normal and until all is move to Scala this will not disappear. Don’t hesitate to create additional method to facilitate mixing things. This code will be removed at the end

In order to avoid issues to IDE make sure:

  • to clean .idea config folder
  • upgrade Intellij and Scala plugin to the last versions
  • upgrade gradle to 2.4.x+
  • re-import from scratch project in IntelliJ

adsGoogle Ads (aka AdMobs) is one of the most well known ad system used by developers to make some money with free apps/games. But other solutions exist and can be real alternatives.

I used to have some problems with revenues from Google Ads so i made some research and discovered App Flood.
The documentation on services proposed were clear and the “how-to” guide looked very clear and simple. So i decided to give a try to AppFlood in one of my LibGDX game.
After a quick registration on the web site to register my app and get my keys, i started implementing the API in my code. I was well surprised to see how much all is working out of the box and all the options proposed (banner, video ads, revenue on APK installation).
But how integrate an adsystem with a libgdx application?
Indeed with libgdx, the android application is just a wrapper to your main application in order to run it on android devices.
The adsystem should be plugged on the android layer through the application manifest
So first, add the required library in your android project:

  • Download somewhere the jar (as it will not be available on maven central repo)
  • and add the dependency:

Then following App flood doc, modify your AndroidManifest file:

The idea is to have a callback in your “core” code in order to call the ads system when you need to (for example screen transition).
So just create a simple interface for this in core module:

Modify your main application class to allow android application to registered the ad system:

Then implements this class in your Main android activity. Don’t forget to call the registering method on the main application.

Then whenever you decider you just have to call the method showAds() from your core code but dont forget to check if an ads system was registered otherwise you will get a NullPointerException

Sounds easy no?

Just finished to implement a new hostile arc vision detection for my monsters. The new algorithm is more realistic because it takes care of where the monster is looking and if there is no solid objects between him and the hostile. It is now possible to hide behind a wall and attack the monster on his back without being detected.

I used LibGDX intersect utilities and some angle computations.