Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Creating a cross-platform C++ engine, incl. android and IOS


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • This topic is locked This topic is locked
6 replies to this topic

#1 nixius   Members   -  Reputation: 128

Like
0Likes
Like

Posted 30 December 2012 - 10:32 AM

Hello all,

 

forgive me for posting about a topic that has probably been discussed several times; I do feel that my question has a few extra points though and I have done a couple of days of reading on the matter.

 

I started writing a game engine in C++ with Ogre3D, SDL and Bullet physics. I have got 70% of a game done with it but it was just not written very well with some fundamental issues so I am starting again with those lessons learned. One of the reasons I am so keen on using C++ is that I am trying to better myself in C++ (since that is what my career is based around).

 

This time I also want to consider how I can code the engine in the best way possible to be able to 'port' it to android and IOS (as well as supporting Windows/linux/mac) since I realised the current engine I have it would be near impossible to do. I have done a lot of reading about the android NDK and Objective-C but I'm still not really sure.

 

I do understand that on any platform there will always be specifics that will need to be written for that platform regardless (I think I read that I'd have to code the UI myself for android at least) but I'd like to avoid rewriting code as much as possible.

 

Ideally I would like to avoid tools like Unity as that is C# and costs a fair bit of money for licensing extra platforms which I just don't have at the moment. I also want the experience of writing more of the engine than a tool like Unity will allow (even if it is just piecing a few pieces of middleware together).

 

Will it just be easier to write 3 separate engines? One for PC/Mac/Linux and one for each mobile platform? Should I try and brush up on plain old OpenGL and OpenGL ES 2.0 for phones.

 

Am I trying to do too much for a one man job?

 

I'd be glad of any thoughts any of you have on this matter.

 

Thanks for reading,

Nixius



Sponsor:

#2 frob   Moderators   -  Reputation: 22231

Like
0Likes
Like

Posted 30 December 2012 - 09:53 PM

Being a systems programmer for one platform is hard. Doing it for multiple platforms would be a good learning experience but it would be improbable to become expert at all of them at once without many years of experience.

You will likely come up with a set of multi-platform common code using per-device abstractions.

If that is your passion then go for it. I don't know too many people who have that passion once they understand what it really means.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 nixius   Members   -  Reputation: 128

Like
0Likes
Like

Posted 31 December 2012 - 10:56 AM

Thanks for your reply.

 

Hmmm... you are probably right there, maybe I am biting off far more than I can chew at my current level and for a project on my own.

 

Perhaps then, I will initially concentrate on a PC/Mac/Linux engine and get proficient at that, populating the engine's functionality with a few games and then try my hand at a mobile platform completely separately.

 

Once I feel I have mastered those, perhaps then I may be in a better position to tackle something like I initially proposed.

 

Do you think that sounds like a more plausible approach?

 

It just irks me that I will be starting something I know I will probably have to rewrite, perhaps that is just something I will have to swallow; at least for now.

 

Nixius



#4 0r0d   Members   -  Reputation: 819

Like
2Likes
Like

Posted 01 January 2013 - 07:33 PM

You dont want to write 3 separate engines.  Write a single engine and put as much functionality as you can into platform-independent code.  Current mobile platforms are similar enough to the others (PC/Mac/Linux) that this should be a doable objective if you're writing in C++.

 

With each platform the parts that will mostly have to be platform-dependent will be the setup code, UI, and graphics.  If you're using OpenGL then you can get most of the graphics code to work on all those platforms.  Just make sure you still make the wrapper layer platform-independent so you can easily add new platforms later (like DirectX for Xbox, etc).  

 

As far as the setup code, just make sure you only do as little as needed to get the app up and running, then hand off the updating, rendering, input handling to the platform-independent code.

 

For UI, if you have your own UI system, then it's not a problem.  If you use each platforms native solution (Interface Builder in iOS, etc), then you do need to rewrite that for each one.



#5 Sporniket   Members   -  Reputation: 345

Like
0Likes
Like

Posted 05 February 2013 - 11:38 AM

Hello, you will need a platform abstraction that will allow you to code your game without worrying about the environment (PC/Mac/Android/etc...) ; then you will need to implement your platform abstraction for any supported environment.

 

If I'm not wrong, iOS does not support C++, so you will not be able to get a "write once, run every where" system (at least, it will not run on iOS).


Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com


#6 Ameise   Members   -  Reputation: 751

Like
0Likes
Like

Posted 07 February 2013 - 01:23 PM

Hello, you will need a platform abstraction that will allow you to code your game without worrying about the environment (PC/Mac/Android/etc...) ; then you will need to implement your platform abstraction for any supported environment.

 

If I'm not wrong, iOS does not support C++, so you will not be able to get a "write once, run every where" system (at least, it will not run on iOS).

You're wrong. You do need an Objective C layer, though.



#7 frob   Moderators   -  Reputation: 22231

Like
0Likes
Like

Posted 07 February 2013 - 02:05 PM

Please don't revive old threads.  The OP had his questions answered months ago.


Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS