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

Started by
28 comments, last by guywithknife 14 years ago
Vogel's comments re: Blizzard/Activision losing money are also entirely off base. Nonetheless, I like the article's primary point about code reuse.
Advertisement
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.
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! :)

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.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

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.
Some people here mentioned Java. Java is OO-only language; C++ is multi-paradigm. The boxing-up of one's mind into everything-is-an-object is bad enough, but the performance issues should be the real geek anti-Viagra here.

I regularly find use at least of two features Java doesn't do: templates and multiple inheritance.

C++ is more complex than many other languages, yes, but no pain no gain

If you want to have the shortest development time for complex algorithms instead of fastest performance, go with Lisp--I remember mentions of multi-language programming competitions mentioned on /. and the lispers solve the problems the fastest (then again, might be because they're usually the uber-math types).
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
I've found the lisp people to solve small, moderate to medium size problems faster (due to lisp expressive power) but once the program grows into 1000k+ line project you need a different set of tools to manage the complexity and code base and at that point it isn't about the programming language anymore.

C++ is still the industry standard you can't go wrong there. C# is used alot in tools programming and having it as a secondary language is useful. If your more interested in the design and scripting side you'll need to learn one of the more dynamic languages like Lua,Python,&#106avascript or even Scheme (rare scripting language) and get a solid grasp of how to write programs for those in the large and small domain.

These days graphics is mostly done on the graphics card and GPU shaders, learning C++ isn't going to help u make kick ass graphics im afraid. Learning a shader language will get you a job as a graphics programmer if your focus is making kick ass graphics. You'll also need a solid background in computer graphics theory.

Parallel programming is big now you'll do well to get some experience on multi-core, multi-threaded programming. This skill translates well to a variety of domains, AI, physics programming, graphics programming, etc..

Good Luck!

-ddn
Another way you could go, if you change your keyboard layout...



[Edited by - Zahlman on April 23, 2010 6:16:59 AM]
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Quote:Original post by Prune
Another way you could go, if you change your keyboard layout...


Wow! An APL keyboard!
Quote:Original post by SoldierX
pt 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?

Regardless of the technology used, you can never ever make your client unhackable (and I say this as someone who has reverse engineer friends and have tinkered with reversing a little myself). This means that you HAVE TO put the securoy in the server and not the client. Also, you do not have to actually distirbute the source .py files. You can, for example, distribute compiled .pyc files, use something like py2exe or cx_Freeze to precompile or otherwise preprocess the source files. This still won't stop the game from being hacked, but it will stop the casual person from obtaining the code.

This topic is closed to new replies.

Advertisement