I am currently developing a game framework for the Android system using Java. I have a small runtime scripting language that users can utilize to create models, move them around, and do various things.

However, I would now like to start targeting iOS applications.

So as a case study, how is an engine like Unity3D implemented? They have various scripting languages(Javascript, C#, etc.), and they can target multiple platforms.

Do they implement the same codebase on multiple platforms? For example: They have a Java codebase that implements all of the functionality needed to create android apps, and then they duplicate that codebase to implement all of the functionality they need for iOS apps, etc.

How do they deploy to multiple platforms? Are they simply translating source from a target language(C#, Javascript, etc.) and then generating Java code for Android from there Java codebase, Objective-C code for iOS from their separate Obj-C codebase, etc?

The overall theme of my question is how do I structure my codebase so that I am not duplicating a lot of work to support multiple platforms. Should I build my own VM that is deployed to each of these systems(I'm aware this will be a cost in performance)?

They don't use Java or Objective C. They use C++. Let me clarify that. They use the bare minimum that is needed to interact with the device. The engine is written in C++ and the C#, Javascript are just scripting languages.

You may want to check out a few open source games engines to see how this works. Try Cocos2d-x or gameplay3d. You will notice that in these engines there tends to be only a single file that provides a layer to the bare platform and everything else is cross platform code.

You can write your code in lua which gets translated to C++, or you can write it in C++ directly. Then when you pick which platform you want to deploy on, it will generate the appropriate binary that you can load onto Android, iPhone, Windows or BlackBerry phones.

Ive been investigating console/smartphones for secondary game operations for a MMORPG and one definite concern is what display and input methods/capabilities are available (and what might be common across an adaquate spectrum of all the available hardware models)

You will hope to not have to re-code/re-test/re-debug the same code on lots of platforms - so looking for commonality between then (and unfortunately a 'least common denominator' requirement). Common library compatibility will be a key thing to consider.

--------------------------------------------Ratings are Opinion, not Fact