Animations Are Evil, Performance Rules

While working at our upcoming game Momo, I am keeping a close eye on performance. It needs to run smoothly (60fps) on an iPhone 3GS, and that is a constant challenge.

While its great to develop for mobile platforms, it can get tricky when you don’t obey the Golden Performance Rules of Lukas. ;)

There are a some simple rules like:

  • Forget about pixellights, too expensive (although the new hardware is looking promising!)
  • Keep your drawcall count low as graphic state changes are cpu expensive
  • Mark objects that don’t move as static
  • If they move, try to keep ‘em below 300 vertices, it will then be dynamicly batched
  • Don’t instantiate or destroy objects in runtime as memory is slow and it will create hiccups
  • Don’t alpha reject pixels on iOS devices because its slow on tile based rendering, use alpha blend instead
  • Don’t talk about polygon count but vertex count
  • Don’t rely on the 3D modelings package for your total vertex count, use the 3D engine instead as a number of things can influence this number
  • Don’t non-uniform scale your objects in an animation as they won’t be batched

On this last one I have a good example, with some pictures. (yay pictures!)

So here we have a nice cracked rock

In the game it will crack and fall apart

But wait, 2 drawcalls?

The complete asset is only 176 vertices and it should batch! Well it is batched, partially. Lets investigate it. The rock consists of 6 pieces. All using the same material? Check. All under 300 vertices? Check. All scales are uniform? Check. Or is it? Well on start it is but in the animation one of the rocks is slightly scaled in the x and y axis.

Okay, so walk to the artist, I tell him, he frowns, I explain, he frowns, he fixes, all happy.

At the bottomline: performance isn’t only a programmers thing anymore. For mobile, a lot depends on how game assets are created, you can’t get away with sloppyness anymore.

Oh and by the way, if you are an artist and you want to go up a few levels, please please please read the book Creating 3D Game Art for the iPhone with Unity. It will make your and my life a lot easier. It has been written by and for the game artist but even I enjoyed reading it!

A New Day, A New Website

After months of hard work by the talented gentlemen from Red Factory, our new website has finally gone live!

With the new design, we have made a major focus shift – while the old website was focused on B2B customers, the new website is much more geared towards our players. We wanted to give people a place to play games and have some fun.

The biggest feature is the new “Game Bar”, which shows all games we have available. As you can see we only list our own titles here, not our work-for-hire projects. Right now you can see EnerCities, Jimmy Pataya, and our upcoming game Momo. As we create new games, you will find them here. On the right side of the game bar you can see two wooden swords. This is a little something we have been working on, called Paladin Arena. More on that soon ;)

Have a look around, I hope you like it. And please let us know what you think of it in the comments!

Jimmy, Meet Admob

Yesterday, one of my colleagues was ill, and the project we work on was paused for a day. So here I was being stuck for a day and having nothing to do.

Then an idea popped up in the studio: Why not finally make the Android version of Jimmy Pataya for the Android Market? We decided to do so and we went for a free-version-with-ads business model.

We already converted the iOS version to Android for the Korean Marketplace, which was a little different from the Google Android Marktplace in terms of DRM.

So my to-do list for that day was:
- Change the language textures to english
- Integrate an advertisement program
- Figure out the Google Android Marktplace DRM
- Make it all work

After several hours the result was this beauty:

We used AdMob as the advertisement provider and to simplify the integration into Unity we went with the AdMob plugin from Prime31, which I highly recommend.

I know it may sound lame to say this, but I am very happy with ads inside Jimmy! ;)

You can download Jimmy Pataya for free from the Android Market soon, very soon. Stay tuned!

The Quest for Great Pinball Physics

I am making the Game Physics for Project Momonga. The game will have pinball mechanics, which means we are dealing with very high speeds and collisions. So when I started, I knew this wasn’t going to be an easy task. The fact that it needs to perform well on a mobile device only makes it harder. Here’s how I did it:

The basics are simple. You take a ball and flippers, set up a table at an angle and let gravity do the rest.
So it wasn’t long before I got a basic setup working and I was able to shoot some balls.
But the tricky part in physics is always in the details… and this is where you go one step forward and then 2 steps back.

When I had the basics working I started to create the first level. We had made some design on paper and I was trying to implement them in the game. In an ideal world, you have full control over where you want the ball to go, and the ball can go just about anywhere. However, we quickly found out that some places were impossible to reach. The angle of the ball was limited: It was very hard to flip the ball to the sides of the level.

How to solve such a problem?

There are a lot of variables you can tweak:
- Flipper rest angle
- Flipper maximum angle
- Flipper strength
- Flipper material (friction, bounciness)
- Ball material
- Ball weight
- Ball drag
- Table material
- Gravity strength
- …and many more.

Of course changing any of them affects the whole game… and this is where Game Physics starts to hover between science and art :-)

I created an isolated test setup to determine exactly how all these things influence the ball trajectory. In this test a ball gets spawned every couple of miliseconds, and the flipper is activated automatically. We then trace the ball to see where it goes.

Now I could change one setting at a time, and see clearly how it affects the ball trajectory.
Using this way of testing I came up with settings that gives the player a lot of control.

Now we have this one off the list, we can make more crazy and exciting levels!

Trailer: Oorkania

Project Momonga is not the only thing keeping us busy. Check out this trailer for the game Oorkania which we’ve been working on the past months. It’s a cultural exploration game about music. Go on a quest to free the seven planets of Oorkania! Then collect all sound orbs and mix the music styles and sounds to create your own crazy composition :)

Oorkania is created by a collective of some amazing people:
Willem Lagerwaard, an illustrator,
Vuurrood Junior, a design company,
Oorkaan, a theatre group and
Joey Roukens, a classical composer.
Not to mention the amazing artists who perform the music – it’s really an experience to jump from planet to planet and discover custom-created soundtracks.

Release is scheduled in September, so stay tuned!