Who's first?

I have been struggling for quite some time on a seemingly simple feature in Race: how to compute the position of the vehicles within the lap, ie: is a vehicle at the beginning of a lap, in the middle, or is it 80% done? And related to this, how close is it from the track borders? This is useful in many cases: to determine the player rank, to know if a lap has been completed (without cheating…) or to let the AI take decisions.

I did quite a lot of research on the topic until I found this great article from one of the MotoGP developers. I implemented something similar by splitting the track into convex quadrilateral sections. The goal of these sections is to map the vehicle (x, y) coordinates into a “track” coordinate system where the first coordinate is the distance within the lap (distanceInLap) and the second coordinate is the distance from the track center (distanceFromTrackCenter).

The following diagram illustrates this:


  • Sections are in red
  • x’ is the distance within the section
  • y’ is distanceFromTrackCenter
  • distanceInLap can be computed as the section number + x’ (assuming x’ goes from 0 to 1)

Determining the current section number is easy: my code iterates on all the quadrilaterals until it finds one which contains (x, y) (If this turns out to be too slow, I will store the quadrilaterals in a spatial-aware container). Next I needed to map (x, y) to (x’, y’). More research and head scratching brought a solution based on an homographic transform.

For debugging purposes, I created a tool which draws the sections in an image, using red for y’, green for sectionNumber and blue for x’.

Given this track:


You get this fancy output:

Debugging track

Looking at each channel individually is actually more useful.

Here is x’:




and the sectionNumber:


The quadrilaterals are currently defined as polygons in Tiled, but it’s a bit error prone as one must take care of defining the vertices in the right order and ensure the vertices of adjacent quadrilaterals are at the same place. I plan to change this to use segments going from (0, -1) to (0, 1) and (1, -1) to (1, 1). This would make it possible to share vertices (the y’=1 segment of section N would be the y’=0 segment of section N+1). I also plan to define track borders from those segments instead of using yet another Tiled object layer as I do for now.

All those changes will be for later though, right now the next feature I plan to work on is the bonus system, hopefully bringing some Mario-kart-like fun into the game.

More Racing Experiments

I have been doing more experiments these days with my car game project. I decided to try out how it would feel to turn it into a “real” racing game with laps and positions rather than an endless runner.

I put together a simple race track and got the AI cars to follow a predefined set of waypoints. I originally thought it would be very easy to notice how all AI cars follow the same path, but it turned out to be not so apparent. They are still quite dumb though: they happily ignore the other cars and don’t know they should reverse when they get stuck (which happen rather often due to them ignoring the other cars), I need to teach them a few tricks. It’s quite fun nevertheless though: sometimes I find myself chasing the AI cars for a bit longer than would be necessary for testing: not good for making the best of my limited time, but still a good sign :)

The car can still shoot endlessly right now, but I am leaning toward a Mario-Kart gameplay, so endless shooting ability is going to be replaced with one-shot bonuses.

Here are a few screenshots. First one, just after the beginning of the race:

3 - 2 - 1 - Go!

Race has started:


A bunch of AI cars got stuck. Told you they are stupid :)

Stupid AI

Death Rally style!

Death Rally Style!

Guess who's coming to dinner

In the current version of Burger Party, the “boss” customer of the Japanese world is a girl wearing a dragon costume. I was not happy with it though: after I was done drawing it, it ended up not looking big enough to be a suitable boss, especially the boss of the last world.

During this holiday I started sketching a more imposing replacement. Since this is Japan, I picked a Sumo wrestler:

Sumo Sketch

And here it is in action, looking a bit annoyed because I am taking too long to prepare his burger:

Sumo Screenshot

As you can see on the screenshot, the dragon girl has not disappeared: she has just been “downgraded” to a regular customer, so you will see her more often when playing the Japan world. This is a good thing if you ask me, because it took me a long time to draw her!

The sumo will be in the next update, which is planned for this month.

Christmas Preview, the Video

As a follow-up to my previous post, here is a short video of the game in action, because videos speak louder than words, even if there is no audio for now :)

Want to give it a try?

Get the APK

Christmas Preview

It’s Christmas time at Green Yeti Labs! I have a (one day late) little present for all of you: a very early version of what I have been working on for a few weeks. As I mentioned in an earlier post, it’s a top-down car game. It has changed quite a bit since this post though.

Here is the pitch: some yet-unnamed villain decided to steal all the Christmas gifts from Santa Claus head quarters. That evil person got his minions to load all the gifts in their trucks, they are currently escaping on the road! Santa is furious. Unfortunately, his sled is out for its yearly check up before the great day, so he jumps in his car and goes after the bad trucks.

You play as Santa: chase the bad trucks, take them down with your ice cannon and get the gifts back. Be careful not to shoot the innocent cars on the road! Oh and mind the mines, they were probably left there by the aforementioned unnamed villain…

Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

As I said, it’s a very early preview: there is neither music nor sound effects, graphics need to be refined (I still use some nice free car sprites from opengameart.org) and I am still experimenting with the game play and with the car control, it does not even have a proper name or an icon for now! It’s nevertheless already quite fun, and I would love to get feedback from you. You can get it as an .apk for your Android phone or tablet:

Get the APK

I am especially interested to hear from you regarding the different input methods: which method do you find the easiest to use?

Subtle difference between Duplicate and Copy'n'Paste

I use Inkscape a lot, and for a long time I got puzzled by a strange behavior of duplicated clones. But first a short introduction of the features (feel free to skip if you are familiar with them):


Clones are a super handy way to repeat a shape or a group of shapes multiple times. A clone is an exact replica of a shape or a group of shapes: you can create several clones of a polygon and move them at different places, resize and rotate them. Whenever you want to change the polygon, you select the original (or select a clone and press Shift+D to go to the original) and modify it, all clones will be modified the same way.

Here is a quick example. Let’s start with a simple leaf:

A leaf

Now clone it:

Cloned leaves

Edit the original, the changes are propagated:

Edited clones


Sometimes you want real copies though, not clones. To create real copies you can either use the good old Copy (Ctrl+C) and Paste (Ctrl+V) combination, but you can also use Duplicate instead: a simple press of Ctrl+D will create a copy of the selection. It is often suggested to use Ctrl+D as it is one less keystroke than Ctrl+C then Ctrl+V.

The Subtle Difference

I thought for a long time that Duplicate was just a faster way to do Copy then Paste, but it turns out they behave differently. If you duplicate cloned shapes within a group using Duplicate, the new clones point to the original shape in the original group. If you use Copy and Paste instead, the new clones point to the copy of the original in the copied group. Confused? Hopefully this example will make it clearer:

Difference between Copy+Paste and Duplicate

Is It Really That Annoying?

I don’t know about you, but I like to keep various versions of a drawing or parts of a drawing as I experiment with changes. In the past I used Duplicate to keep older versions around but the clones were messed up. Nowadays I create those “backup” versions with Copy and Paste. I am not sure if this is a bug or a feature: I can see how it could be handy to make sure all clones still point to a single original, but this behavior was surprising to me.

Game and Toolkit Experiments

Taking a break from doing some marketing for Burger Party, I decided to do some experiments to decide what my next game will be.

Starting a new game is the right time to experiment with other technologies. Burger Party is built with LibGDX but my preferred language is actually Python, so I started looking around for a Python-based game library which would let me create games for mobile devices.

I found Kivy and started playing with it. I was disappointed however when I tried to get my prototype on my phone as I could not get the tools to create a .apk to work and the prototype was way too slow to be usable when running in Kivy launcher. Too bad, no Kivy for now, but I’ll definitely give it another try for my next-next-game. Based on how long it took me to get Burger Party done, this leaves ample time for Kivy tooling to mature :)

Next on my list was Phaser, a Javascript game framework. Having rewritten my prototype using it, I was again disappointed by the performances: Neither my tablet (Nexus 7 2012, yes, a bit old) nor my phone (Nexus S, really old!) could keep up with it.

I decided to end my framework explorations there and went back to LibGDX. At least this time I get to use the latest version with shiny new toys^Wclasses. I also switched from trusty Eclipse to Android Studio, which I like so far. I am particularly fond of the VIM plugin, it is quite close to the original.

You may be wondering about the game itself. It’s still very much in flux, but it looks like it is going to be a top-down car game, using tile-based maps. It currently looks like this (car comes from this parking game pack):


I told you it’s a prototype!

Right now, the goal of the game is to complete the track as fast as you can, but only time will tell whether there will be other cars, a timer to beat or something else I haven’t thought about yet.

Last week-end we had guests at home and the kids got to play with an early version. They liked it so far, which I take as a good sign. That version used primitive home-made vector math for the car physics, but I could not get my math to produce convincing skids (and I really want the car to skid!), so I am currently rewriting it with Box2D, which I wanted to learn anyway.

Writing a top-down game may not be the best way to get started on Box2D though: you have to create a world with zero gravity so that the car does not fall down to the bottom of the screen, and as such many features such as drag must be implemented by hand, because as far as Box2D is concerned, your cars are floating in the void. Luckily, I found this great tutorial on simulating a top-down car with Box2D which helped a lot.

Burger Party 1.1.3 released

Burger Party 1.1.2 did not make it to production as another bug got caught in the tester nets: the score count in Kids mode would sometimes increase for ever… I fixed that in 1.1.3, which made it to production this week-end, if you haven’t received it already, it should reach your Android devices soon!

First Update of Burger Party

A little more than one month after the public release of Burger Party, here comes the first update. The main change of this version is the introduction of three difficulty modes:

  • kids: no global timer, customers are more patient
  • normal: just like before
  • expert: shorter times, less patient customers, no arrow indicating the next item to add

The new start screen

This change should make the game more interesting to young children: they get the challenge to pick the ingredients in the right order, without the stress of the global timer. Note that even if the global timer is no longer there, they still get 1, 2 or 3 stars depending on how satisfied customers are, so it is a good way for them to get ready for the normal mode.

This change should also address the requests for a harder game: testers have found the expert mode doable but more challenging than the normal one.

There is also another minor change: pirates can now add pineapple slices in their burgers (never tried it in real life, but I am sure it must be quite tasty if you are into sweet and sour flavors!)

The new start screen

I hope you like this update. If you haven’t installed Burger Party already, head over there!

Burger Party on Amazon Appstore

Do you own an Amazon tablet or phone? Then I am happy to let you know Burger Party is now available on Amazon Appstore!

Available at Amazon