Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hisham.i

macrumors newbie
Original poster
Jan 20, 2012
6
0
Hello,

I was wondering how computer games are made for phone, do they have to rewrite the complete code that is already written for computer game to make on the phone?

Many of the application that are in appStore are also found in application market for android phones, so i am wondering if developers have to rewrite the code for both operating system, or there is a method to make this ?
 

hisham.i

macrumors newbie
Original poster
Jan 20, 2012
6
0
mmmm, but how can they maintain all its features? i mean how developers manage there programs in order to rewrite them on different environments without loosing any feature?(I have a program about 5000 lines, and i forgot some of the functions that i wrote within my code, so how they manage there code in order to get the same result?)
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Take a couple liter of coffee/redbull, think about your flow, and rewrite the whole thing, also writing maintainable/correct architecture code is a big must for porting to other platforms.
I think that's a biiiig misstep alot of coders make, because they think it will be just them using it (i've been there..), and in the end, I ended up rewriting it anyways for the same platform, so it can be ported easily to android too.
 

dantastic

macrumors 6502a
Jan 21, 2011
572
678
This very much depend on the type of app you have as well.

If you think about angry birds I imagine that they have written their own engine in C or are using a C engine. That way most of the "Business Logic" is the exact same code across all platforms with a C compiler, which is most, Android included. Then they only need to adapt a small portion of the code so they can present and run the game on all platforms.

Then take the other example of the Facebook app which is pretty much the polar opposite. The Facebook app I imagine contain virtually no Business Logic but everything is just downloaded and displayed the most optimized way possible for the platform. I imagine the iPhone app and the Android app will have very little code in common.

The important thing to remember when wanting to create a portable app is design, design & design. A clearly separated Model with clearly defined methods that do one thing only - that have a pre and post requisite. If you can't just use the code you will be in a much better position to port the model across.

Worth mentioning as well, don't use any cool features available to one platform only, such as Core Data. You should have a pretty good understanding of all platforms involved in this as well so you know already beforehand what's going to cause problems so that can be avoided already from the beginning. It will cause more code but it will be more portable.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
This very much depend on the type of app you have as well.

If you think about angry birds I imagine that they have written their own engine in C or are using a C engine. That way most of the "Business Logic" is the exact same code across all platforms with a C compiler, which is most, Android included. Then they only need to adapt a small portion of the code so they can present and run the game on all platforms..

Afaik, their first version is made in Cocos2D, you have stuff like Cocos2D-X, which ports to all platforms, opensource ofcourse.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.