Personal Blog
written by reiti
a blog by
Project Home
Blog Posts
<< New Phone arrives tomorrow!
SimCity 5 (p)review - Do not get it now >>
2013-03-10 14:13
Going really Cross Platform in 2D
I am currently in the progress of porting some of my games over to different plattforms. The goal is to release on as much platforms as possible.

This is somewhat of a pain in the ass - I can tell you. The problem is, that there is no way to just code in a language and push some buttons to build release pakets.
This is really a missing feature. Well there are different approaches, each of it has it's very own downsides.

For the first there is java. For java there are numerous wrappers and libs which makes it able to do hardware accelerated graphic output on various devices. Indeed, java should be the obvious language to use. Beside android devices, java would run on nearly every desktop platform out there. But it needs a VM .. bad, but ok.
Problem is, google is fighting with oracle about java rights to us it on android devices - which is ridicolous, but well, in worst case, android will switch away from java, either making their own VM based on java bytecode or switching all over to binaries - who knows. But that's not the main problem.
The main problem is, that java always was (and will be) a provisional system, in my opinion it has some true flaws which makes live hard for a game developer (missing of struct for example) and is slow (in comparison to native) and a bit buggy somehow (sorry, but it is) and in the backend will rely on native libraries after all to perform in game environments.

Unity and such frameworks are not in my flavour. I found that Unity games all look a bit the same and it is for me not flexibel enough. I am a coder, I want to code high performance code parts to make smooth games. If I would do some sort of side scroller or shooter, yes, unity would be the way to go (no matter the price)

Same is true for most of the other script-based game angines. True, they ARE the only way to be completely platform independent, because they provide several backends for all those platforms. In the end you will still be not that free, like you could be with going native. For mobile apps (not games) that is indeed the best option to make a app and share the business logic behind the ntive UI look.

Mac is no option. Objective C is somewhat low level, and is not supported anywhere else - so apple is out.

HTML5 is a good approach - it uses the browser to do the rendering - in the end it is not fast. Not suitable for sophisticated game programming.

On of the best coding languages at the moment is C# (.Net) - it just is, no discussion about it. As a dev you will not find any better language for coding fast. With the appearance of mono C# is even more cross platform. .Net is what java should be, even when it is not that much accepted all over different platforms. Honor to numerous open source solutions to bring .net over to other platforms.
Another very good feature of C# is, that the code is very similar to java, so it is easy to port over, you will need some wrapper classes for sure (to minimize coding effort) but it will work.

C++ is surely the lang to use if you want the max of performance. You will also be able to use this lang on different other languages as well but you will have to put a much effort in it to do so and development time is raising as well.

So going with C# would be the obvious way to go for a dev. There are also numerous projects which helps you to bring your C# game over to all the other platforms. Talking about monogame (XNA replacement) and/or Xamarin. Xamarin is a nice approach .. but it is heavily priced, so not very suited for hobby developers and I am still not sure how goog it is in terms of bugs and such things.
In my case even their installer didn't work, so that's no good sign in my opinion. hopefully they get that up because it would be the way to go for platform independency (hopefully).

I would rather build some wrapper classes and port my game manually to android than paying a big price tag for .. it is really not that hard to port it manually - that may depend on your game for sure but for me it is currently not worth the extra headache if there are any bugs.

for iOs .. you are alone .. you even need a mac to code for iOS .. (xamarin offers such a compiler for windows as far as i know) .. so if iOS is a must for you .. you will ont have that much alternatives to xamarin (at the moment).

But it is still a pain in the ass, i can tell you. I started t not port but to completely recode one of my games in respect to easy portability just to see how it will work. For doing that you have to write many helper classes yourself - but in the end, that would be, what I would wish as a dev. Give me a small game framework, which can be coded in C# and let me do the rest, the framework should care about the platform dependencies.

For 2D that would be not THAT hard, sadly noone offers such a framework, most of them are so much bigger (raising possibility of bugs and complexity).

But maybe I am looking at this with too less scepsis, aybe it is much harder. I will see. For me currently, I will proceed with the manual porting, at the moment. On that piece of code I can try different approaches. Stay tuned.
most popular at
Robo Miner
for Android
Personal Blog

Age of Asteroids on Greenlight!
Leave a Reply
Name: (Required)
Mail: (will not be published) (Required)
Website: (optional)
Anti Spam: 5 + 5 = ?
Privacy Policy
© 2022 Peter Reitinger. All Rights Reserved