My first character for my Cthulhu game was supposed to be The Adventurer. But i didn’t like the graphics. I don’t know if this is the color palette i used or the drawing, but something was wrong when i put it into the game. So i decided to review my copy with my pixel editor (PyxelEdit) and The Adventurer became The Aviator. Et voila. Looks promising.




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

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.

So finally i have finished (well, for the moment because i know myself: i will have another idea in two months and i will change again UI….) my main user interface for the Cthulhu game.


  • On the left the main character portrait with 2 gauges: one for life and one for mental health.
  • Then the number of Gold
  • On the center of the screen, the two objects held by the character.If you click on them, inventory is open and you can change them.
  • On the right, followers’ portraits. If you click on one of this portrait, the character clicked become the new main character.
  • On the bottom of the screen classical control button: on the left a pad and on the right two action buttons to use the two objects held by the character.
  • On the bottom / center, a slide button to show the map.

I just finished to implement a better version of path finding for my cthulhu game.

The basis is still based on A* but i add some additional steps to make the path used by hostile smoother and clever: I describe my enhancements in drawings below:

  1. The first drawing explain the real situation: you have one hostile located at point A. This hostile is modelized as a rectange (the collision area); The hostile need to reach point B behind a wall.
  2. The second drawing explains a path finding result using A*. A* is based on tiled so you will have a tiled vision of the path to used to reach point B. But remember, our hostile is a rectangle on a map with x,y coordinates and not integer tile indices.
  3. My first enhancement take A* tile path result and remove unecessary tiles (see third drawing) to keep only turn points.
  4. Then i do some additional process to compute real points (x,y coordinates) which takes care of hostile collision area and mnimizes the path regarding turn points.

The result in action:

Few weeks ago, “followers” feature was implemented in my next game project “Cthulhu”. The code is still under development to be perfect but this video give an idea of the result.