Thoughts Serializer

Computer graphics, Games, Personal

Flappy Herbie Saga: Trolls of the Forest

2 Comments »

Flappy Herbie: Trolls of the Forest iconFlappy Bird did it. The most simple game ever build at the top of every AppStore. How frustrating can that be to big game development companies that put hundreds of thousands of dollars into developing and marketing their games? It is so funny to follow this industry. You can never predict the future.

I was feeling so psyched about it! I needed to mock it, understand it, troll it, test it, everything at the same time. So my creative juices started boiling again, and I decided that I had to make a game that will express all that. Everything in it should be trolling some part of the situation. The game itself, the gamers, the appstores, the clone haters. So starting from the game name you can begin to understand what is going on. “Flappy Herbie Saga: Trolls of the Forest”. I used to name my games with short names. Not anymore. The game is also SO hard that it provides Zen relaxation services to the gamer for free. Even though I was tempted to make it a paid service at some point just to meta-troll it. When you feel frustrated by the game you can read beatiful Zen calming quotes, while listening to nice relaxing music. I am not going to dive into all satire points in the game as I will ruin it, but you will get the point for sure.

I had to make it in 1-2 days. Read the rest of this entry »

How the world looks with different app stores

No Comments »

Below are the revenue maps for my apps, from Apple App Store and BlackBerry World.

 

Revenue Map for Apple App Store

Revenue Map for Apple App Store

 

Revenue Map for BlackBerry World

Revenue Map for BlackBerry World

As you can see with Apple the US is king, while with BlackBerry the king is Canada.

Hint: Combine the two and you got the whole north america ;)

 

Porting your iOS game to Blackberry Playbook (and future BB10 phones)

20 Comments »

Continuing after my latest post about porting existing iOS games written in C/C++ to the Android platform, here I am again writing about my latest porting endeavor that brings Pop Corny to the third platform! Ever thought of porting your iOS game to the Blackberry Playbook? Well, here I will share some insight of what to expect.

The basics

If you are like me you will probably think that the Playbook has something to do with the tech that used to run Blackberry’s phones. This misconception was so strong in me that I didn’t even consider a port to it. The truth is however, that the Playbook is based on the new platform that Blackberry is creating based on the QNX operating system, and will also be used on the BB10 phones. Things started to look better on the porting front with these info, but there is always a fear that Blackberry could be Google and force everything to Java and only support native after a long time has passed. It turns out that things are much better than I expected. Not only Blackberry allows you to write native apps, but its Native Development Kit (NDK) is a complete solution for developing on the platform. Not like Android for example, where the NDK is just a crude exposure of the native Android’s build system, supports minimal functionality and requires Java calls for most stuff. On Playbook you can write a full native app and never look at Java again. The NDK will provide C level APIs for all that you are going to need. From screen handling and input, to in-app purchases.

The Blackberry provided development environment is QNX Momentics, which is based on Eclipse, but also you can easily do everything with command line tools if you prefer. I chose to go with Momentics even though I find Eclipse slow and sluggish, because it is very nicely setup for native C/C++ development (with debuggers, profilers, etc) and I wanted to see how far it will get me until I started missing the command line. Surprisingly, it did all the way. Had no problem with it, which is a first for me and Eclipse.

You also get an emulator for trying out your, code which is based on VMWare. This didn’t strike me a good thing because you have to buy VMWare to run it. Sure there is the VMWare Player version that is free, but you can use that only on Windows and Linux. The Mac users, like me, will have to use the 30-day trial of VMWare Fusion, or buy it.

Next I will go through the major porting areas to keep this consistent with my corresponding article for Android. Read the rest of this entry »

Porting my game engine to the Playbook

14 Comments »

The last few days I am a happy owner of a BlackBerry Playbook. The device was offered to me by RIM (thanks to Luca Filigheddu) in order to port Pop Corny to it. To tell you the truth I never owned a Blackberry device before, not to mention develop for it. It was a totally new experience, where I had no idea what to expect.

It turns out RIM has done an awesome job with Playbook and probably with its upcoming phones (just speculating I don’t know for sure). The system is based on the QNX operating system and it has strong support for standards and open libraries. I found myself right at home with it! I am going to come back with more details about the process (probably with an altdevblogaday article), but by cutting the long story short, I was able to port the engine with only native code (no java glue code like on Android) with OpenGL, OpenAL (even ALUT), freetype, etc all coming bundled with the system. Read the rest of this entry »

Porting your game from iOS to Android

4 Comments »

So you created a C/C++ game for iOS that gives joy to iPhone and iPad gamers from around the world. How can you deny this joy from all loyal Android users? I can’t, so I had to port Pop Corny to the Android platform. It was a very interesting experience, full of gain as I say, and I think it would be nice to share some information and knowledge on the subject. Read the rest of this entry »

Writing portable code: A process full of gain

No Comments »

Lately I am spending some of my time into porting my game engine to the Android platform. It is a rather refreshing, interesting, rewarding and also frustrating experience. All at the same time. The process helped me learn new lessons and remember some old ones I had forgot.

Getting confortable

First of all I realized once again that we people get comfortable. And oh boy we get comfortable! I remember myself a few weeks back being frustrated with XCode 4 and how it was slow and sluggish compared to XCode 3, how I don’t like the new environment, etc. Well, no more! All it took was a few days in Eclipse. Dialog windows popping up behind the main window, >500ms on most clicks on files, kitchen & sink user interface, can go on forever, and all you really basically get at the end of the day is just a smart editor and debugger that only works for the Java part. Compare that to XCode with its memory profilers, time profiles, filesystem profilers, network profilers, battery optimizers, the very helpful OpenGL state inspector and logger, there is really no relation. I had forgot how it was to develop on other platforms, and how amazed I was initially with the special treatment that Apple gives to developers with its tools. What amazed me more is that I don’t come from such a “comfy“ background. The initial version of Sylphis3D was developed in parallel on Linux and Windows, mostly using no IDE at all, and I never found the tools a problem. As it turns out hardship builds character, while comfortness breaks it.

Portable software is good for you

Building portable software is highly valued in my mind, because it helps you be a better software engineer while making better quality software at the same time. You get to learn many different development environments, understand their design decisions, workaround platform differences, think further ahead, etc. All these require you to get a deeper understanding of your code and your dependencies. Always pushes towards a more organized code structure and reveals bugs that would otherwise go unnoticed until Murphy’s laws decides it is the worst time to trigger.

So if you are a software engineer, don’t get too comfortable with your development and target environment. No matter how attractive that environment makes it! Make your code portable, to keep yourself and the code in better shape. After all wouldn’t it be cool to run your code on a future toaster?!

Beta testers on Android wanted – Ask inside

No Comments »

Pop Corny on Android Sony Xperia X10 Mini

If you follow me online you probably know that the last weeks I have been porting Pop Corny to Android. I can say that it is a great experience and I myself can’t wait to put it out there. I am also going to blog about my experience and will try to provide any valuable information about the process. However the plague of Android that hears to the name “fragmentation” is creeping in, and I need your help to fight it!

Yes that is right, if you have and Android device you can be my soldier. Do you have what it takes? Are you prepared to suffer finger damage from extreme screen swiping? Do you know the history of pop corn? Are you prepared to play a game that will probably crash every 5 minutes and not throw the device out of the window? You do?! Just register on the form and I will contact you with more details:

CLICK HERE TO BECOME A BETA TESTER

To tell you the truth this is going to be more of an ALPHA-BETA testing phase as I don’t have an Android device myself. I did try out 2-3 real devices but it is quite likely to take some time until I can have a stable beta running on most devices. This will require patience on your side. If you are not interested yourself, tell a friend. I will need all the help I can get! If you also happen to have an old device (new ones will do too! :D ) that you don’t mind sacrificing in the name of game development, I would gladly accept it as a testing device, and you would gain a special place in the game’s credits and more importantly in my heard. For this contact my directly at my email: harkal at gmail dot com.

Lets get it started!!

C++ Concurrency and Parallelism

No Comments »

One of the blessings and curses of C++ is its Standardization Committee. The bureaucrats that steer the language can surely be both. I admit that I have found myself frustrated with the slowness and lag that C++ can have with catching up with progress, but when I think about it I wouldn’t be able to find a way to move forward such a huge language, with so many different forces pushing for its evolution. Today I read this article about the implementation of threading, parallelism and concurrency in C++, and it can be very explanatory on why questions “y u no standar threading, C++?” don’t have an easy answer.

Link: The Future of C++ Concurrency and Parallelism

My game design hat

2 Comments »

One of the main traits that an indie developer must cultivate is that of wearing many hats. All indie game develepers will tell you about it, and it is the first thing you will realise when going indie. Wearing many hats is usually the result of small budgets. Small budgets mean less heads, but equal amount of hats. What I learned through the course of developing my indie game is that your success depends on how well your head fits those hats. Your game will simply be as good as the worst fit.

One of the hats I had to wear for the development of “Pop Corny” was that of the game designer. The closer I had ever come to game design before this, was playing games with a little more inquiring spirit than most players do. This can definitely be interpreted as a bad hat fit. It was clear that in order to have a successful game, I had to find clever ways to improve the fit. This of course could be done by adjusting the head (becoming a better game designer) or by adjusting the hat (adjusting the problem itself to something that I would handle). It was obvious that I had to do the first as much as possible, but without the later I was not going to go far. Read the rest of this entry »

Predictable garbage collection with Lua

4 Comments »

In one of my previous posts I talked about how you can make the Lua garbage collector (GC) more predictable in running time. This is a virtue that is highly valued in a GC used in games where you don’t have the luxury of going over you frame time. In that post I described a solution to the problem which works fine most of the time, leaving little space for garbage collection times that will hurt the framerate. However I ended that post with a promise to provide a better solution and in this post, I deliver.

The ideal situation would be to have the GC run for a specific amount of time. This way the game engine will be able to assign exact CPU time to the GC based on the situation. For example one strategy would be to give a constant amount of time to the GC per frame. Lets say 2ms every frame. Or it can be more clever and take into consideration other parameters, like the amount of time it took to do the actual frame. Is there enough time left for this frame? If there is, spend some for GC, if not, hold it for the next frame when things might not be too tight. Other parameters can be memory thresholds, memory warnings, etc.

All of the above depend on a GC that can be instructed to run for an exact amount of time. This kind of GC is what we call a realtime GC. And Lua does not have one. However it turns out that we can get very close to realtime with minor changes to the Lua GC.

The patch below modifies the behavior of the GC in the way we need it:

--- a/src/lgc.c
+++ b/src/lgc.c
@@ -609,15 +617,14 @@ static l_mem singlestep (lua_State *L) {
 
 void luaC_step (lua_State *L) {
   global_State *g = G(L);
-  l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul;
-  if (lim == 0)
-    lim = (MAX_LUMEM-1)/2;  /* no limit */
   g->gcdept += g->totalbytes - g->GCthreshold;
+  double start = getTime();
+  double end = start + (double)g->gcstepmul / 1000.0;  
   do {
-    lim -= singlestep(L);
+    singlestep(L);
     if (g->gcstate == GCSpause)
       break;
-  } while (lim > 0);
+  } while (getTime() < end);
   if (g->gcstate != GCSpause) {
     if (g->gcdept < GCSTEPSIZE)
       g->GCthreshold = g->totalbytes + GCSTEPSIZE;  /* - lim/g->gcstepmul;*/

The only missing part from the patch above is the getTime() that can be something like this:

double getTime() {
    struct timeval tp;
    gettimeofday(&tp, NULL);
    return (tp.tv_sec) + tp.tv_usec/1000000.0;
}

I guess however that everyone will want to use their own time function.

The patch modifies the code so that is stops based on a time limit and not based on a calculated target memory amount to be freed. The simplicity of the patch also comes from the fact that we “reuse” the STEPMUL parameter that is no longer used to carry the aggressiveness of the GC. We now use it to hold the exact duration we want the GC to run in milliseconds. So the usage will be this:

lua_gc(L, LUA_GCSETSTEPMUL, gcMilliSeconds);
lua_gc(L, LUA_GCSTEP, 0);

The above code will run the GC for gcMilliSeconds ms. This way you will never be out of your frame time budget, because the garbage collection took a little longer to execute. Problem solved!