Developing in native for mobiles question

Started by
4 comments, last by Strategy 8 years, 9 months ago

HI all,

i know that it is listed in the FAQ about the libraries and tools in developing cross platform mobile games stuff like Marmalade or Unity or any 3rd party tools always comes up.

but my question is, how did tools like them did it?

our situation is, we have a native game developed in Android native, by native i meant stuff like 2D canvas, opengl, etc.

our original agreement and contract is only for android, and a couple of years later, they want to release it in iOS as well.

so how did these 3rd party tools do it? how did they make a library or a tool that compiles to both android and iOS.

I just want to get idea on how to develop and release a game that runs across platform using the platform native.

perhaps sometime in 2D they 'compile' or release in HTML5/javascript? how about if the game is in 3D?

im just asking these question as we are still considering to develop in native or for short not use any 3rd party tools or libraries.

Advertisement

What these libaries do is to try use the system api:s as little as possible, most is done within the library itself.

For both iOS and android, you can compile code for the CPU running in the phone with whatever compiler supports generating code for those CPUs.

So in Unity they use C#, and in marmalade they use C++.

The library then implements api:s and services needed for making a game, and you use them instead of any platform apis as much as possible.

The library will have separate implementations of everything for each platform it supports, in iOS it will be some Objective-C code doing it, and on android there will be C or C++-code, and possible a bit of Java through JNI calls.. (This is usually a pretty thin layer, most of the functionality in the library is implemented within the library in whatever language and framework they choose to use)


our situation is, we have a native game developed in Android native, by native i meant stuff like 2D canvas, opengl, etc.

our original agreement and contract is only for android, and a couple of years later, they want to release it in iOS as well.

If it was developed using the standard Android Java SDK, then you are pretty much out of luck.

It needs to be rewritten from scratch using something else.

Since OpenGL is supported on iOS too, those parts could possibly be re-used with a little effort (some copy-pasting and fixing the syntax) in a rewrite, but it would still be a rewrite...


so how did these 3rd party tools do it? how did they make a library or a tool that compiles to both android and iOS.

I just want to get idea on how to develop and release a game that runs across platform using the platform native.
perhaps sometime in 2D they 'compile' or release in HTML5/javascript? how about if the game is in 3D?

Olof covered most of it above, but i want to reiterate one key detail.

These cross-platform tools typically do not expose ANY of the native functionality.

For example in Unity you are programming in C# but it targets Unity objects and classes. You use Unity's Behaviour classes, Unity's Canvas class, Unity's Color classes, Unity's GL class that serves as a wrapper to the low-level commands and dumps them in the correct OpenGL implementation details for the platform.

Then the Unity team writes their own implementation on each one of the platforms. If it needs to do anything different to support a mesh on a platform, their Mesh class implementation details do that work for you. A side effect of this is that performance is different between platforms when they need to do something different. A function that has hardware-accelerated support in one place may need a lot of love on another platform to reach reasonable performance levels.

You (the end user) write your code for a single platform and then do very little work to get it working on new platforms. They (the engine developers) need to do quite a lot to make sure every part of their engine works well on each new platform.


our original agreement and contract is only for android, and a couple of years later, they want to release it in iOS as well.

This can range from a quick and easy port all the way through a near-complete rewrite of code. It all depends on the implementation details within your code.

If all your code is storing and manipulating objects provided by the OS and using OS functionality directly then you're looking at a potentially nasty rewrite. If all your code is working with modular components, you've wrapped system calls into subsystems, you've abstracted features and implementation, it can be easier. And if you happened to use any middleware that is already ported between platforms the system will be that much easier.

The UE4 source is free for download, it's supports many platforms, so maybe have a look?

You should check out libgdx, you only write in native java code once and then port it to HTML5, Linux, Android, iOS and Desktop.

Olof and frob have already answered your question, I think.

Just want to mention that for an existing Android Java project, I would look towards RoboVM + libGDX. You won't get away with still having to reimplement the UI and stuff like that using RoboVM/libGDX bindings, but - depending on your code, of course - you should be able to reuse most of the actual game engine.

Michael A. - Software Engineer, moonlighting as a game developer
A Brief History of Rome
Pirates and Traders

This topic is closed to new replies.

Advertisement