• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
meeshoo

Portable game engine - C or C++?

15 posts in this topic

Hello guys,

I've begun research for coding a cross-platform, portable game engine (rendering engine at first). Before you ask, this engine is not because I want to build a specific game with it, it is more of an exercise, a general purpose rendering engine and then game engine that can be used on a multitude of platforms.

When I'm thinking about portable, I don't just want it to be for Windows/Linux/Mac, but also for portable devices like IPhone, Android and other known and well established platforms.

The problem is that I recently read a book (an OpenGL ES programming guide) released in 2008 in which it states that C++ is not supported very well on a multitude of mobile platforms, and it is better to choose C as a programming language for them.

I worked using both of them for more than 10 years now and I'm experienced with both, that is not an issue, however, writing a full blown game engine in C can be a difficult task, and C++ looks much more fit for developing such a software package.

My question is: should I go on with C++, hoping that more and more platforms will support it fully or go with C, and which are the arguments behind your advice?

Thanks.
0

Share this post


Link to post
Share on other sites
I don't know of a relevant platform where C++ is not well supported. Even Arduino (a tiny microcontroller) can be programmed in C++.
0

Share this post


Link to post
Share on other sites
Well, in the opengl es 2.0 programming guide I've read about, on page 342, there are the following issues stated:

- lack of RTTI support on some
- lack of exceptions support on some
- some platforms don't have STL
- lack of multiple inheritance on some platforms

link to book: http://www.amazon.com/OpenGL-ES-2-0-Programming-Guide/dp/0321502795/ref=sr_1_1?ie=UTF8&s=books&qid=1283362309&sr=8-1

[Edited by - meeshoo on September 1, 2010 12:21:27 PM]
0

Share this post


Link to post
Share on other sites
iPhone, Symbian and Android all have full c++ support (including exceptions and stl). In case of Android it's supported by an add-on, but still it works.
0

Share this post


Link to post
Share on other sites
Most of that is stuff you probably wouldn't use on a mobile platform game engine anyway. Anyway, that's not the point. C++ is a superset of C. So you can choose to either use C, giving up all the benefits of C++, or you can use a limited implementation of C++, giving up only some of the benefits. Put in that light, which would you choose? In any case, mobile platform C++ implementations are improving all the time. Most have full support, and those that don't are rapidly getting it.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by meeshoo- lack of RTTI support on some
- lack of exceptions support on some
- some platforms don't have STL
- lack of multiple inheritance on some platforms

Mostly these features now-days works on most of embedded platforms, but very often people doesn't use them for some reasons - either performance or size of generated code, or something else (poor performance for standard library implementation, old cross-platform compiler versions with bugs, etc).

Really - how often do you need RTTI on small game engine (for iPhone, for example)? I've never used C++ RTTI myself even on desktop platform, except indirectly by third party library (LLVM, boost).

Vanilla C++ (think C + objects/inheritance) imho would be fine for such game engine. Just don't rely on RTTI/exceptions and you will be fine.
0

Share this post


Link to post
Share on other sites
Thanks for all your replies, it was very helpful. I will continue then with C/C++ combo that always works best, leaving fancy C++ stuff aside, but benefiting from objects, polymorphism, encapsulation and so on.

Thanks again.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Echkard
C++ is a superset of C.

This isn't strictly true. Rather, C++ was designed with the aim to be compatible with C code, but it's not a perfect compatibility--there are subtle differences. Approaching C++ as if it were C with classes will ultimately lead you astray.

Edit: Here's some material on the subject.
0

Share this post


Link to post
Share on other sites
Don't worry about it, I have a lot of experience with both (ranging from Windows drivers to desktop applications). Giving up some features of C++ in order to maintain compatibility won't hurt that much.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by yckx
Quote:
Original post by Echkard
C++ is a superset of C.

This isn't strictly true. Rather, C++ was designed with the aim to be compatible with C code, but it's not a perfect compatibility--there are subtle differences. Approaching C++ as if it were C with classes will ultimately lead you astray.

Edit: Here's some material on the subject.


Here's a more dedicated link, some of you will be shocked: Are You Ready For C99?

Excerpt:

Variadic Macros
void realdprintf (char const *file, int line, char const *fmt, ...); 
#define dprintf(...) realdprintf(__FILE__, __LINE__, __VA_ARGS__)

(taken from here)

Variable Length Arrays
void foo (int x) {
int frob[x];
}


Named Initialization (two years before C#, heh)
typedef struct {
int alpha;
int bravo;
} Foo;

Foo foo = { .bravo = 1, .alpha = 5 };


"Struct Hack" Support
See this.

And some more.


And to lead "C++ is a superset of C" ad absurdum in a freaking glimpse: You can't use "class" as an identifier for a variable in C++ :D
0

Share this post


Link to post
Share on other sites
Quote:
C++ is a superset of C.
Quote:

Approaching C++ as if it were C with classes will ultimately lead you astray.
That's interesting, as Bjarne Stroustrup -- whom I once met -- said that was exactly his goal when designing C++, to make it "C with Classes". Yes, there are some mostly trivial differences, but I've succesfully compiled many a C project under a C++ compiler with little to no changes.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Echkard
Quote:
C++ is a superset of C.
Quote:

Approaching C++ as if it were C with classes will ultimately lead you astray.
That's interesting, as Bjarne Stroustrup -- whom I once met -- said that was exactly his goal when designing C++, to make it "C with Classes". Yes, there are some mostly trivial differences, but I've succesfully compiled many a C project under a C++ compiler with little to no changes.


I would no longer call them trivial as for above mentioned C99 features. And not all C99 features will also be supported in C++0x.

That is not to say, of course, that most C is also C++. But a significant amount is not.
0

Share this post


Link to post
Share on other sites
I think C++ 0x has a quite a long road before it will be approved, because i think they had 2010 as a deadline and they didn't make it.

Btw, how about SIMD support on mobile processors?
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Echkard
Quote:
C++ is a superset of C.
Quote:

Approaching C++ as if it were C with classes will ultimately lead you astray.
That's interesting, as Bjarne Stroustrup -- whom I once met -- said that was exactly his goal when designing C++, to make it "C with Classes". Yes, there are some mostly trivial differences, but I've succesfully compiled many a C project under a C++ compiler with little to no changes.


Funny how years and years of language development and learning can change an outdated original goal, isn't it? I don't think he would consider C++ "C with Classes" today, and indeed, he spends a lot of time trying to explain to educators that C++ is its own language and needs to be taught differently than learning C features and then C++ features.

Learning Standard C++ As A New Language
0

Share this post


Link to post
Share on other sites
Quote:
Original post by meeshoo
I think C++ 0x has a quite a long road before it will be approved, because i think they had 2010 as a deadline and they didn't make it.


As I understand it, the deadline is March 2011. Mind you some compilers already support it.

Quote:
Original post by meeshoo
Btw, how about SIMD support on mobile processors?


This has got nothing to do with C++, and everything to do with the CPU manufacturers.
0

Share this post


Link to post
Share on other sites
I know it hasn't have anything to do with C++, but still it is about portability, and I know too little about what kind of CPUs are on the majority of the phones. I know ARM architecture is very popular, but are there any others that I should care about?

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0