• 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
SoldierX

So you say C++ sucks? What else can I use?

29 posts in this topic

Nowadays, it's pretty common to see people bashing C++ of various reasons (too complex, etc.). Most of these arguments are totally correct - there are a lot of other programming languages that are more simple, less error prone, and so on. But now I planning to start a rather advanced game project, and I want it both to be cross-platform (Win+Linux+Mac, that is) and have high performance (stunning 3d graphics, yadda yadda). So, C++ fulfills these requirements. But what alternatives do I have? -C#/.XNA. Classic choice these days. But as far as I know, it only runs on Windows (and XBox, of course). Pretty pointless here. -Python. Cross-platform, and a lot of game related libraries seem to exist. But performance-wise? Okay, some of you might say the classic "But just rewrite the heavy parts in C/C++", and I guess you're right. But isn't that a little bit against the whole idea of keeping the code simple when writing in Python? Am I wrong? To me, it would seem more effective to use it to script a C++ game, instead of extending a Python game with C++ code all over. And, if the game is supposed to be a competitive multiplayer game, wouldn't it be a little too easy for the hackers if they just had to change in a bunch of plain-text .py-files? Are there other language choices? Are there any good non-XNA cross-platform C# game/graphic engines that runs on Mono, maybe? Or should I stick good old C++ and just shut up?
0

Share this post


Link to post
Share on other sites
C++ doesn't suck. Unfortunately these days it's very popular to bash it, especially by people who don't know the language.

You won't reap the benefits of using C++ unless you pay the price to truly learn it. You can argue that you don't have the time or desire to do so, but don't expect to find something else that has the same advantages (specifically, the excellent balance between high level abstraction and performance) while somehow being "easy" or less complex.

If C++ isn't the right tool for the job, then don't use it. However, if you're looking for a C++ replacement, then you should just use C++ (and invest whatever is necessary to become more fluent). It's not perfect (what is?) but it is extremely good at what it does, which is to provide high abstraction capabilities while maintaining high performance.
1

Share this post


Link to post
Share on other sites
Quote:
Original post by SoldierX
But now I planning to start a rather advanced game project, and I want it both to be cross-platform (Win+Linux+Mac, that is) and have high performance (stunning 3d graphics, yadda yadda).

At this point, language certainly is not your only problem. Did you think about how to create the content for your game? What about tool support? What about gameplay testing/iterating? What about testing the game on the various platforms and system configurations?

Quote:
-Python. Cross-platform, and a lot of game related libraries seem to exist. But performance-wise? Okay, some of you might say the classic "But just rewrite the heavy parts in C/C++", and I guess you're right. But isn't that a little bit against the whole idea of keeping the code simple when writing in Python? Am I wrong? To me, it would seem more effective to use it to script a C++ game, instead of extending a Python game with C++ code all over.

You can go either way - both approaches have advantages and disadvantages. There's recently been some discussion about them on the forums here, but I forgot on which board. Either way, you can take Panda 3D as an example: the engine is written in C++, but Python code can simply use it as a module.

Quote:
And, if the game is supposed to be a competitive multiplayer game, wouldn't it be a little too easy for the hackers if they just had to change in a bunch of plain-text .py-files?

You can compile Python code (.pyc files), so at least it's no longer plain text. Or pack them up into some encrypted archive file. Still, everything can be reverse-engineered. Clients should never be trusted. You'll want the server to verify their actions.


EDIT: @strtok: from what I've seen, it's mostly the experienced programmers here that 'bash' C++ - those that have been using it for a decent amount of time. It may be performant (if, indeed, you know how to use it), but it doesn't lend itself well for rapid development. This makes it a poor choice for gameplay code, which often needs to be refined.
0

Share this post


Link to post
Share on other sites
- There's also C#/OpenTK, which runs on Windows/Linux/Mac and opens the possibility for an iPhone port. This is low-level OpenGL/OpenAL/OpenCL but it's about 2x more productive than using the APIs from raw C/C++.

- Alternatively, Unity3d is a great 3d engine that is scripted in C#. Sadly, it's only available on Windows/Mac/iPhone (no Linux).

- Panda3d is a good, solid choice.

- Blender game engine is another solid choice. Bonus points for being integrated into Blender, giving you an interesting development path (create assets in Blender, click on "play" and test).

- Axiom is a C# port of Ogre3d. No idea if it's any good, though.

- KRI engine has some very very interesting features (Boo+OpenTK, usable by .Net languages) but it's not really ready for wide use. I'm keeping an eye out for it, but it's not for the faint of heart, yet.
-1

Share this post


Link to post
Share on other sites
Quote:
Original post by SoldierX
-Python. Cross-platform, and a lot of game related libraries seem to exist. But performance-wise? Okay, some of you might say the classic "But just rewrite the heavy parts in C/C++", and I guess you're right. But isn't that a little bit against the whole idea of keeping the code simple when writing in Python? Am I wrong? To me, it would seem more effective to use it to script a C++ game, instead of extending a Python game with C++ code all over.


This isn't logical. Adding a small bit of C++ to Python code doesn't ruin the Python code, nor does it make it as complex as having done the whole thing in C++. It just means you have a middle ground.

It would only be more effective to stick to scripting with Python if you feel that writing most of your game in C++ is easier and/or quicker than writing most of it in Python and rewriting some modules in C++. Personally I don't think it would be. Writing most code in Python is so much faster and easier that I wouldn't choose to use C++ unless I had to, and there are many tools to make the Python/C++ crossover easy these days, eg. Cython.

Quote:
And, if the game is supposed to be a competitive multiplayer game, wouldn't it be a little too easy for the hackers if they just had to change in a bunch of plain-text .py-files?

Security needs to be done primarily on the server, not the client.

Besides, if you really want extra security through obscurity, we've already established that you can code parts in C++.
0

Share this post


Link to post
Share on other sites
C++ sucks. That said, it's probably your best option if cross-platformness is a hard and fast requirement. I would question that requirement though. It forces some of your design decisions and limits your ability to get the game done. For what? Maybe 5% more users in the ideal scenario?
-1

Share this post


Link to post
Share on other sites
What language doesn't meet those requirements? Just about every language I can think of offers decent performance and a C interface to use libraries like opengl. The slower languages I can think of all offer a way to get a C module loaded to handle performance critical stuff. If I were looking for an easier to use language that wouldn't need to piggy back on another language I would look at C#, Ocaml, C, Haskell, Java, factor in about that order.
0

Share this post


Link to post
Share on other sites
I get the whole performance argument, but would Java not be an option (C++ like syntax, cross plattform, some game libraries...)?
0

Share this post


Link to post
Share on other sites
Quote:
Original post by SoldierX
But now I planning to start a rather advanced game project, and I want it both to be cross-platform (Win+Linux+Mac, that is) and have high performance (stunning 3d graphics, yadda yadda). So, C++ fulfills these requirements. But what alternatives do I have?

UDK.
-1

Share this post


Link to post
Share on other sites
I agree on the "Java" choice.

I used LWJGL for rendering and it's good enought. Recently I changed to JOGL, wich has a "cleaner" way of doing some tinks, but I recommend both.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Telastyn
C++ sucks. That said, it's probably your best option if cross-platformness is a hard and fast requirement. I would question that requirement though. It forces some of your design decisions and limits your ability to get the game done. For what? Maybe 5% more users in the ideal scenario?

QFT!

Of course, everyone here (myself included of course) is biased so you're only really true answer will come from evaluating the possibilities and making you're own decision. Personally, I'll never touch C++ again. It's just not worth the frustration. I'm not doing cutting edge games and I only care about Windows PC, 360, and soon Windows Phone 7 so C# and XNA Game Studio are perfect.
0

Share this post


Link to post
Share on other sites
Quote:

Nowadays, it's pretty common to see people bashing C++ of various reasons (too complex, etc.). Most of these arguments are totally correct - there are a lot of other programming languages that are more simple, less error prone, and so on.

I think you're taking most of these arguments -- at least, most of the valid arguments -- out of context.

I think you are overestimating the impact of the "performance advantage" of C++. It is a language allows for fast code to be obtained decently easily because of its lack of basically any high-level features and it's bend towards paying only for what you use. To write truly stellar code with it, however -- just like with any other language -- you have to know it very well.

C# plus some kind of OpenGL wrapper may be an option (XNA is eliminated by your desire to deploy to Macs and Linux, of course). As are all the other languages mentioned in this thread -- Java, Python, et cetera.

The correct answer is thus to use the one you are most familiar with it -- whether that be C++ or something else -- because that's the one you will be most productive with and the one you will be able to write the most efficient code with.
0

Share this post


Link to post
Share on other sites
Im just going to say that before you choose your language... DESIGN the program first and do an honest assesment of your abilities. Then you will know what you actually will need.

Having a learning experiance can in fact be a legitimate goal of the program. If you want to be a generalist then you need to aquire experiance in many languages including the dreaded C++. If you prefer to become a specialist then select your language and make all your projects fit it.

ANSI C is an almost universal language but is also an easily abused one. It requires a lot of care and discipline by the programmer to write quality code. Much of what other languages offer is in fact availible to ANSI C as a matter of program design.


0

Share this post


Link to post
Share on other sites
I would confirm BrianLarsen's statement.
Quote:
ANSI C is an almost universal language but is also an easily abused one. It requires a lot of care and discipline ...

C++ is neither good nor bad. It gives the programmer full control
and some shortcuts.
Thats the dangerous thing about it. You get seduced to use these
shortcuts rather than doing it the right way which will make your
code unreadable.
Python forces you into the "right" direction and ofcourse takes a
lot of work away from the programmer to the VM but my opinion is
that this does suppress the own style of a programmer.
Java is a choice too and a good one for platform-independece but it
has its cons like every VM driven language.
Finally it is mainly a choice of what language is your favourite and
how well you structure your code.
2

Share this post


Link to post
Share on other sites
My own interpretation of the answers, so far:
-C++ doesn't suck, use it.
-Python is a good way.
-C# has several interesting engines/frameworks.
-Write most code in Python, with some parts in in C++.
-Cross-platform is stupid.
-Any language, blah blah.
-Java is a good way.
-UDK. (?!)
-Java is a good way - again.
-C++ sucks. Microsoft platforms is the only good way. Yadda yadda.
-C++ doesn't that much of a "performance advantage". Any language, depending on what you are most familiar with.
-Design first. Choose language depending on what you want to learn.
-All languages have their advantages & disadvantages. Pick your favourite.

First of all, thanks everyone for the replies. Secondly - you sure don't agree with each other.

One thing that I find interesting is that some people avoid C++ because it is unproductive. "Write less code and make fewer errors, by choosing this better language", they say, and point at some other new cool language like Python. Sure, I like Python. I really do. And I like C# too. But tell me - is it really that more productive to write something with OpenGL in C#, than it is to use a good mature 3d engine with C++ (Irrlicht, Ogre) ?

The thing is, I havn't come across that many _mature_ game-related libraries for those languages. I will, however, keep looking.

As it seems right now, I will probably stick to C++, using Python for some scripting. I might give C# a chance, if I find a 3d (or game) engine that suits me.

And by the way, I'm not a "n00b" trying to make a new cool mmorpg. Sorry to disappoint you. Just trying to get back to my game development hobby.


0

Share this post


Link to post
Share on other sites
Quote:
Original post by SoldierX
One thing that I find interesting is that some people avoid C++ because it is unproductive. "Write less code and make fewer errors, by choosing this better language", they say, and point at some other new cool language like Python. Sure, I like Python. I really do. And I like C# too. But tell me - is it really that more productive to write something with OpenGL in C#, than it is to use a good mature 3d engine with C++ (Irrlicht, Ogre) ?
No. It is most productive to use C# or Python or Java or whatever with an engine. For instance, if you're set on Ogre, you could use MOGRE with C# or Python-Ogre with Python or Ogre4j with Java. Or you could use an engine that's designed to work with your language of choice, rather than being bound to it, such as XNA with C# or Panda3D with Python or jMonkeyEngine with Java.
Quote:
The thing is, I havn't come across that many _mature_ game-related libraries for those languages.
Maturity is always an issue when looking for open source libraries. Certainly some of the libraries I mentioned up there are crud. 90% of libraries for these languages are crud, but that's because 90% of libraries are crud. Standard crud-avoidance strategies apply.
0

Share this post


Link to post
Share on other sites
SoldierX, I think you came to a good conclision.

I kind of miss some level of experience attached to what people write in forums. If someone played around with c++ and decides its not good how strong can such an argument be?

I have been developing games in in C for over 20 years and C++ over 15 years. I am almost programming daily. And frankly can find no argument against the language.

When I first checked out XNA I stumbled upon C#. Later with iPhone Development I saw this funny looking syntax called Objectiv-C. Now I am glad I wrote a nice C++ wrapper for iPhone. My code base compiles on every platform I have been so far. I am sure if you were to stick to anything besides C/C++ this would not be the case.

As for "scripting" languages this is something else. As I don't see them suitable for engine development, but more gamelogic and so forth.


Looking back I am happy with the way I went. (especially since back then people said Pascal would rule the world. lol)
However I can actually not really judge if C/C++ is the right way to go if you start all from scratch. Time is moving.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Food for thought.


What I would take away from that is that reusing and updating existing code as needed is good. Reusing engines is good.

What I wouldn't take away from that, nor the comments section, are the comments on the 'games industry' as a whole. He, and his commenters, appear to have missed that MANY games do reuse the same engine, just an updated version of it.

My favorite comment cited Valve as a good example of 'engine reuse' which is true... it's just that TF2, L4D and Portal all used an engine which had been updated from the original Half-Life.

So; once again, code and engine reuse good.

And while this guy might be doing well his view that he is the only one doing it places his head firmly up his bottom region I feel [smile]
0

Share this post


Link to post
Share on other sites
Vogel's comments re: Blizzard/Activision losing money are also entirely off base. Nonetheless, I like the article's primary point about code reuse.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by phantom
What I would take away from that is that reusing and updating existing code as needed is good. Reusing engines is good.


I read it more as making something that users care about. The rest are just tools used to accomplish that.

Regardless of how people feel about Zynga, they've pushed it to the extreme. Everything is tailored around user behavior. They manage it through profiling and split testing, but those are yet different tools of achieving the same goal.

No product in history ever succeeded or failed because of Language X or API Y.

How many people would believe that a PHP MySQL app can affect the lives of half a billion people and transform the web landscape? Also, iFart.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by phantom
Quote:
Original post by Antheus
Food for thought.


What I would take away from that is that reusing and updating existing code as needed is good. Reusing engines is good.


So true. This is why I kind of hate the game industry: it seems that the code only should exist and work until the game is released, then it doesn't matter anymore. More code (and other assets as well) reuse! :)

0

Share this post


Link to post
Share on other sites
Quote:
Original post by SoldierX
My own interpretation of the answers, so far:
-C++ doesn't suck, use it.

I really hope no one ever told you that it sucked... C++ doesn't suck. C++ IS hard though. It's not an easy language to learn right, and it's not an easy language to use right. Part of that is due to its design. As demonstrated in a recent thread here, people can think they know what they're talking about in C++ and really have no clue at all. The language is just that complex.

It's mainly due to the design of the language. C++ was build with performance in mind: You don't pay for what you don't use. As such many parts of the language result in undefined or implementation defined behavior to allow compiler vendors the ability to perform optimizations that were either known at the time, or unknown future optimizations. A prime example is that of the evaluation of function parameters, it's unspecified for a reason. However, that very element of being unspecified means that you can cause undefined behavior unintentionally with a single call:
f(a++, a, a++);

It looks innocent enough, but that's actually entirely undefined.
Quote:
-Python is a good way.
-C# has several interesting engines/frameworks.

Indeed, and many other languages have similar frameworks exposed for them. Some are more mature than others, some are easier to use than others. It's really a pick and choose world. Go for what feels the most comfortable to use.
Quote:
-Write most code in Python, with some parts in in C++.

Not necessarily, but... game code needs to be quick and easy to change, so that you can quickly test new concepts and ideas with minimal setup time. This is why scripting languages are so popular. That doesn't mean everything has to be python, or that even the majority does... Just delegating the gameplay code to python, for instance, will save a significant amount of development time.
Quote:
-Cross-platform is stupid.

No, cross platform isn't stupid. But it is HARD to do. People like to talk about C++ when they're talking cross platform, but C++ code is rarely cross platform unless restricted to a minimal subset of the language. Compiler differences, library differences, and other issues crop up otherwise. Cross platform isn't something you should strive for in your first project, but if this is a few steps down the road, then it's a good idea to get used to the frustrations related to distribution and building of a cross platform project. That means more than just writing code that builds everywhere. Games are distributed in binary form, which means that if you want it to work on linux, you'll need to package up all of your dependencies.

It's also important to note that many language are perfectly cross platform... Mono project has MonoXNA, Java and JOGL, and so on.
... skipping ahead a bit ...
Quote:
-C++ sucks. Microsoft platforms is the only good way. Yadda yadda.
-C++ doesn't that much of a "performance advantage". Any language, depending on what you are most familiar with.

Microsoft has the best tools for development I've ever used... and having been developing software for a bit over 20+ years now... that's quite an accomplishment. That doesn't mean their compilers are the most compliant, or produce the best code... but the tools you use to develop with are simply the best.

C++ doesn't have a performance advantage, not much of one anyways. Let me explain: You get approximately a 5% performance bonus over C# managed code "some" of the time. Usually in relation to floating point calculations. This is actually not due to any superiority of the C++ compiler over the .Net JIT, but actually has to do with the requirements the .Net standard requires for the JIT. There are limitations placed on the JIT to enforce a certain level of floating point consistency between calculations, it doesn't completely eliminate floating point error, but it does reduce it significantly for most cases.

The reality is, anytime you need truly fast performance, you'll write your code in a highly optimized SSE enhanced manner, and not in plain old C++ or C#. At which point both choices gain the same performance benefits, even if the manner in which you interact with them differ slightly. Combined with tools like my SlimGen project, which allows you to replace method bodies with hand written assembly (for now), you can gain the benefits of native code and the speed of RAD. Also, in C++ your default associative container (that most people think of), is std::map, which is a tree based map with and amortized O(log N) looku , while the default associative container in .Net is the dictionary, which is a hashmap that has an amortized O(1) lookup...
Quote:
-Design first. Choose language depending on what you want to learn.
Don't have a BDUF. It doesn't work 90% of the time, but do have a design, yes.
Quote:
-All languages have their advantages & disadvantages. Pick your favourite.
Exactly.
Quote:
First of all, thanks everyone for the replies. Secondly - you sure don't agree with each other.
Why should we? Many different levels of experience, many different perspectives, and many different backgrounds.
Quote:
One thing that I find interesting is that some people avoid C++ because it is unproductive. "Write less code and make fewer errors, by choosing this better language", they say, and point at some other new cool language like Python. Sure, I like Python. I really do. And I like C# too. But tell me - is it really that more productive to write something with OpenGL in C#, than it is to use a good mature 3d engine with C++ (Irrlicht, Ogre) ?
Python's not that new, nor is C#... it's newer than C++ though. But C++ has only been standardized since 1998 and hasn't evolved much since then. Heck, C++0x isn't even completed yet, and after it is completed you can expect to way probably 5 more years before compilers sufficiently support the new feature sets.

Regarding the speed of development: It depends. There are .Net ports of many of those common C++ engines (Irrlicht, Ogre, etc), and they also suffer from many of the problems that their C++ cousins have (Singletonitis comes to mind). Combine that with the fact that it really is hard to write code that is buggy at a non-logic level in managed languages and you quickly find yourself writing a game, not debugging that random crash that happens only in debug mode, and not release mode.
2

Share this post


Link to post
Share on other sites
Quote:
Original post by Washu

No, cross platform isn't stupid. But it is HARD to do. People like to talk about C++ when they're talking cross platform, but C++ code is rarely cross platform unless restricted to a minimal subset of the language. Compiler differences, library differences, and other issues crop up otherwise. Cross platform isn't something you should strive for in your first project, but if this is a few steps down the road, then it's a good idea to get used to the frustrations related to distribution and building of a cross platform project. That means more than just writing code that builds everywhere. Games are distributed in binary form, which means that if you want it to work on linux, you'll need to package up all of your dependencies.

It's also important to note that many language are perfectly cross platform... Mono project has MonoXNA, Java and JOGL, and so on.

I believe most developers that start out with this requirement (not counting the clueless ones who list Linux as a target and go on to choose something clearly incompatible) do so because of a desire to develop on Linux, and/or to specifically address the small but underserved Linux game market, i.e. themselves. Considering cross-platform issues is a natural goal in that case.

Other than that, I'd just say I think actually getting started is more important than worrying about your language choice. Nobody says you can't take a break from the main project and write a small demo using different tools, and incorporate those tools if you like them. In fact I think having little toy projects on the side is usually recommended so you don't burn yourself out.
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