C++ or Objective C

View previous topic View next topic Go down

C++ or Objective C

Post  riruilo on Tue Sep 30, 2008 3:19 am

Hi everybody!

I'm new to iphone development but usually I program game in OpenGL and C++.

My question is: If I use this engine, should I use C++ or Objective C?

Thanks a lot.

riruilo

Posts : 9
Join date : 2008-09-30

View user profile

Back to top Go down

Re: C++ or Objective C

Post  sio2interactive on Tue Sep 30, 2008 4:24 am

Well that's the great thing about objective-C, you can have in the same file (.mm) Obj-C, Obj-C++, C & C++ code and compile just fine, me too at the beginning as was skeptical but... I had also the same questions as you when I first start coding on the iPhone and now well... Check the source tree of (ie:) the template project in SIO2:

SIO2 = Pure C ANSI ISO 99

Bullet = Pure C++

The OpenGL ES window on an iPhone + (IO) = Obj-C

You can code code your game entirely in C++ if you want to...

Actually me I would suggest you C, but that's my own preference Wink, cuz at the end of the day a game its all about control & speed, and I feel that pure C give me all that...

I remember that when I first start creating engines I was also all C++, but I remember that one day one guy challenge me and say "that's impossible to create a 3D engine in C++", and I say "ho really?" and start doing some tests just for fun, and finally I never get back to C++ for the engine code only pure C and SIO2 is my 3rd engine. Wink

Checkout the SIO2 code that might give you some ideas Wink
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: C++ or Objective C

Post  riruilo on Tue Sep 30, 2008 4:39 am

Thanks for your reply.

But I have some questions after reading your reply.
Why create an engine using C and not C++? I don't understand you. Ogre3D, Unreal Engine, OpenSceneGraph... all of them are been created using C++.

Anyway, I don't care too much about this if I don't "see" your source code. My last question, Can I develop a game using C++ and OO paradigm with sio2 engine? I don't have time to learn Objective C (I don't like it and I don't want it) and when I create a game I always use OO paradigm, I think is easier than procedural programming (or C).

Thanks a lot for your time.
Any suggestions?

riruilo

Posts : 9
Join date : 2008-09-30

View user profile

Back to top Go down

Re: C++ or Objective C

Post  sio2interactive on Tue Sep 30, 2008 4:59 am

My last question, Can I develop a game using C++ and OO paradigm with sio2 engine?

>> Yes absolutely
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: C++ or Objective C

Post  riruilo on Tue Sep 30, 2008 5:09 am

You are right, but quake 3 is a little bit special, even has some ASSEMBLER parts inside. Did you download this engine? It is impossible to read the source code. Too difficult.

When I say easier, I mean easier to build and develop a game. Of course, probably a C engine is more efficient than a C++ engine (linux kernel has been created using C rather than C++ because of this reason)

Thanks for reply.

riruilo

Posts : 9
Join date : 2008-09-30

View user profile

Back to top Go down

Re: C++ or Objective C

Post  sio2interactive on Tue Sep 30, 2008 5:21 am

hmmm? what happen to the rest of my message about Quake 3 and being a carmack fan? anyway...

You are right, but quake 3 is a little bit special, even has some ASSEMBLER parts inside. Did you download this engine? It is impossible to read the source code. Too difficult.

>> Yes I did and I actually inspire myself from their structure to create SIO2 (and steal some bits and pieces from it as well, but don't tell iD Software) Wink

When I say easier, I mean easier to build and develop a game.

>> Easier hmmm yes and no, its just take a little "get used too", but once your fine with it well the rest is easy Wink

Of course, probably a C engine is more efficient than a C++ engine (linux kernel has been created using C rather than C++ because of this reason)

>> Definitely, especially when you are developing cross platform and target low end to high end device. The engine that Im coding at work have to work on: Windows, Mac, Linux, iPhone, iPod Touch & Windows CE (I even compile the engine and run it on the NDS of my wife Wink, and can probably run it on others that we didn't even try...) so by having an engine written in pure C its also easier to port and you know that in any case the performance for the specific device will be great.
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: C++ or Objective C

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum