Wildagotchi: Virtual Pet

Hi, I’ve made with my girlfriend a retro-looking ‘Tamagotchi like’ game.
Game is free (with rarely shown ads), here is link: https://play.google.com/store/apps/details?id=com.mawges.wildagotchi

Description of game is on Google Play so to avoid redundancy, here I’ll describe technical side only :wink:

App is written using Java, C/C++ and Lua.
In Java I have:

  • modified LibGDX part that handles Audio / Input / Files,
  • networking with JmDNS (to allow playing with Bonjour on iOS side), because of that I set minimal Android version to 2.3.3 -> too many devices below 2.3.7 don’t handle multicast dns properly,
  • lifecycle handling, opengl initialization, sharing, ads and rest of pure Android stuff.

In C++ :

  • modified gdx-cpp project that handles Graphics,
  • JNI glue,
  • binds to LuaJIT,
  • binds from Lua to Java via JNI (where is no sense to have wrapper classes).

In Lua:

  • game logic.

There is a lot of action on Lua side but LuaJIT have 0 problems with it. If you make game with Lua on LuaJIT, more probably GPU will be your problem, not CPU. What is sad that is on iOS you can fell that no-JIT is problem and I have 20fps only on ip4 when on Galaxy S with debug build & old arm instruction set (no armv7) & power saving I have easily 60 fps.

Questions and Feedback are welcome :wink:

Why so many different languages for one small game?
Would everything be so much simpler if you just used Java?

Yes it would be easier.
I wanted to make something crossplatform, that may be extended by native code (c++/java/obj-c) and expressive enough without sacrificing too much performance (Lua).
Now I can make next game faster and I can easily add another platform (for example winphone, when I get angle workin).
But to be honest, writing crossplatform thing is more enjoyable than writing only games all the time :wink:
It gives also a lot of experience from many technical domains.

Java is cross platform…
Without to many effort you can made a game for Android, Linux, Windows, Mac and much more just using Java.
Correct me if I am wrong.

Java wants to be crossplatform and at least for PCs it is, but in mobile space it is not so nice.
On iOS you would have to play with Avian, but at all it would be so problematic cos Java on Android is not the same Java that Avian will handle (Android SDK etc).
On iOS you may also use RoboVM, it’s going to be great but lacks a lot of things now.
For Winphone you have few things like IKVM (if it works, I don’t know), anyway these options are not good.
I wish Java to be crossplatform on mobile as it is on desktop, but it is not.

Well of course it isn’t going to be. But why would you program one game in so many different languages when the majority of them aren’t supported on phones? Unless I’m missing something here.

Lua is supported where C is supported (even most of microcontrollers support it), but Lua is only scripting language that I placed on top for speed up development of simple games. C++ is for things that cannot be done in Lua (OpenGL, threads etc), so we may say that support for C++ on given platform is critical for being cross-platform. Windows Phone 8, Android and iOS support C++. Then for some things that may be accessed only by given platform language I have to write minimal ‘backend’ in that language. For example I need Java for sound, opengl canvas initialization and JmDNS stuff. Obj-c on iOS for sound, EGL and network.

I know that it may look like overhead for just one game, but overall it was great experience :wink: