Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


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.

  • You cannot reply to this topic
29 replies to this topic

#1 SoldierX   Members   -  Reputation: 103

Like
0Likes
Like

Posted 21 April 2010 - 07:13 PM

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?

Sponsor:

#2 strtok   Members   -  Reputation: 191

Like
1Likes
Like

Posted 21 April 2010 - 07:44 PM

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.

#3 Captain P   Members   -  Reputation: 1088

Like
0Likes
Like

Posted 21 April 2010 - 07:46 PM

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.
Create-ivity - a game development blog Mouseover for more information.

#4 Fiddler   Members   -  Reputation: 826

Like
-1Likes
Like

Posted 21 April 2010 - 07:56 PM

- 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.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]


#5 Kylotan   Moderators   -  Reputation: 3338

Like
0Likes
Like

Posted 21 April 2010 - 11:07 PM

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++.

#6 Telastyn   Crossbones+   -  Reputation: 3726

Like
-1Likes
Like

Posted 22 April 2010 - 02:00 AM

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?

#7 stonemetal   Members   -  Reputation: 288

Like
0Likes
Like

Posted 22 April 2010 - 02:15 AM

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.

#8 rhanarion   Banned   -  Reputation: 100

Like
0Likes
Like

Posted 22 April 2010 - 02:18 AM

I get the whole performance argument, but would Java not be an option (C++ like syntax, cross plattform, some game libraries...)?

#9 Antheus   Members   -  Reputation: 2397

Like
-1Likes
Like

Posted 22 April 2010 - 02:22 AM

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.

#10 Atridas   Members   -  Reputation: 151

Like
0Likes
Like

Posted 22 April 2010 - 02:22 AM

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.

#11 Machaira   Moderators   -  Reputation: 1028

Like
0Likes
Like

Posted 22 April 2010 - 03:06 AM

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.

#12 Josh Petrie   Moderators   -  Reputation: 3110

Like
0Likes
Like

Posted 22 April 2010 - 03:46 AM

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.

Josh Petrie | Core Tools Engineer, 343i | Microsoft C++ MVP


#13 BrianLarsen   Members   -  Reputation: 100

Like
0Likes
Like

Posted 22 April 2010 - 05:03 AM

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.




#14 Spynacker   Members   -  Reputation: 106

Like
2Likes
Like

Posted 22 April 2010 - 05:33 AM

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.

#15 SoldierX   Members   -  Reputation: 103

Like
0Likes
Like

Posted 22 April 2010 - 05:46 AM

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.




#16 Sneftel   Senior Moderators   -  Reputation: 1776

Like
0Likes
Like

Posted 22 April 2010 - 05:55 AM

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.

#17 Manoel Balbino   Members   -  Reputation: 132

Like
0Likes
Like

Posted 22 April 2010 - 06:28 AM

Use D.

#18 Xood   Members   -  Reputation: 122

Like
0Likes
Like

Posted 22 April 2010 - 06:38 AM

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.


#19 Antheus   Members   -  Reputation: 2397

Like
0Likes
Like

Posted 22 April 2010 - 06:58 AM

Food for thought.

#20 phantom   Moderators   -  Reputation: 7052

Like
0Likes
Like

Posted 22 April 2010 - 07:19 AM

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]




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