Why C++?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
hayk0510
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 21
Joined: Tue Mar 10, 2009 11:03 pm

Why C++?

Post by hayk0510 »

Hey everyone,

I was wondering why everyone uses C++ for game development?

I realize that it is the industry standard, but what difference does it have when compared to other languages such as Python, or C#?

According to some research, I don't think the speed issue should be a problem for a "hobbyist game developer". The reason companies still use C++ is because they do not wish to waste the time/resources redoing massive amounts of code in "X" Language. (Correct me if I'm wrong.) Other than the usual Microsoft bashing and such, how does a language like C# or Python really compare to C++ for game development(and applications as well)? Is the rapid development time worth the speed hit for the hobbyist programmer?

My real question is, are there any severe limitations from using a scripting or high level language(C#, Python...) vs using C++, just because it's the "industry standard"?

PS. I am going to pursue a degree in Computer Engineering next year(If that makes a difference in what to learn at all)
"Manually managing blocks of memory in C is like juggling bars of soap in a prison shower: It's all fun and games until you forget about one of them."
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Why C++?

Post by Falco Girgis »

Nice, I'm in my second and a half year of my computer engineering degree.

...and you're wrong. Speed and efficiency make all the difference in the world when it comes to modern games, and especially console games. What do you think let Resident Evil 4 look so damn good for the Gamecube? Why do you think that the Unreal engine cost so much money?

C++ is low level when compared to things like python and other scripting languages. There is no conceivable way that Elysian Shadows could be written (with the performance we want) in something like Python, Perl, or pure Lua. And there is definitely no way in hell that it would run on a 200mhz Dreamcast.

C# is decent, but it's certainly not standard, and it certainly can't outperform C++ as far as low level speed goes. Python and things like that have no chance in hell, as they are completely interpreted. C++ is not just used because it's the industry standard--it's also by far the best suited language for making games.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Why C++?

Post by avansc »

well i dont know how you judge what the industry standard is.. i say this because i allways thought C/C++, but its al dependent on field.

here is a site for popularity http://langpop.com/

but i noticed that even these are not representitive of the industry, for example, IBM uses REXX, which used to be IBM proprietary, and they use it alot. almost all the server labs use it as opposed to C++. and that basicaly most of IBM which i believe is still the biggest corporation (this was once true and i didnt research it now so dont get on my case if its not so any more)

as for your speed question.. yeah i agree that speed is less of an issue now, baring that you dont go be all 1999 and deve for dreamcast like ES team. (i originally just put falco, but im sure the rest of the team would have been like, that fucker doesent even do the bulk of the work or something snotty like that)
.
if you were just gonna do a small game and wanted something that baby sitted you more that C/C++ i would go java or C#. java has a huge community but i would say that C# is the better bet because of native support for al the little goodies like graphics and sound. dont get me wrong java has those to but not to the extent that C# has.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Chaos Clown
ES Beta Backer
ES Beta Backer
Posts: 61
Joined: Sun Sep 21, 2008 4:46 am
Location: U.K.

Re: Why C++?

Post by Chaos Clown »

There's also the issue with platform dependence. If you go for C#, you're bound to Windows/Xbox, so if you want to dev for other consoles, macs, or linux systems, then you're screwed. C++ should compile on pretty much anything, depending on which libraries you're using.
¡Sí! ¡He dejado en libertad los prisioneros y ahora vengo por ti!
~El Pollo Diablo
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Why C++?

Post by avansc »

Chaos Clown wrote:There's also the issue with platform dependence. If you go for C#, you're bound to Windows/Xbox, so if you want to dev for other consoles, macs, or linux systems, then you're screwed. C++ should compile on pretty much anything, depending on which libraries you're using.
ummm.. i believe that C# works on lin and others alike.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
aamesxdavid
ES Beta Backer
ES Beta Backer
Posts: 347
Joined: Wed Jan 07, 2009 8:49 pm
Location: Bellevue, WA
Contact:

Re: Why C++?

Post by aamesxdavid »

hayk0510 wrote:According to some research, I don't think the speed issue should be a problem for a "hobbyist game developer".

Is the rapid development time worth the speed hit for the hobbyist programmer?
If you're talking simply about the hobbyist/indie development, in most cases Python or C# would be fine for PC games (or XBox of course, using XNA). But the industry standard is the industry standard for a reason. Professional developers need to squeeze every little bit out of the processing power, and languages like C# and Python just aren't quite efficient enough to do that. A lot of development can be done in a lot of different languages, but because games are so processor-intensive, you need the fastest language. As far as being worth the time to develop in, most companies would rather spend more time making the game more efficient than producing worse games more frequently.. unless you're Activision. </burn>
User avatar
wtetzner
Chaos Rift Regular
Chaos Rift Regular
Posts: 159
Joined: Wed Feb 18, 2009 6:43 pm
Current Project: waterbear, GBA game + editor
Favorite Gaming Platforms: Game Boy Advance
Programming Language of Choice: OCaml
Location: TX
Contact:

Re: Why C++?

Post by wtetzner »

avansc wrote:ummm.. i believe that C# works on lin and others alike.
Yeah, C# works on Mac, Linux, and Windows on the Mono platform (an open source implementation of the .NET framework). And (at least in theory) your compiled executable should run unmodified on those platforms without having to "port" them.

EDIT: Also, since we're talking about game development languages, I thought I would mention this: http://www.franz.com/success/customer_a ... ydog.lhtml.
They used Lisp to write the Jak and Daxter games. I thought that was pretty cool. What's really cool about using Lisp (other than it's macro system) is that you can change a function, and recompile it while the program is running, updating in real time.
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
Chaos Clown
ES Beta Backer
ES Beta Backer
Posts: 61
Joined: Sun Sep 21, 2008 4:46 am
Location: U.K.

Re: Why C++?

Post by Chaos Clown »

Whoops, shows how much I know, heh. Good thing I don't use C#, because if I did, it would be really embarassing :oops:. I could have sworn it was microsoft exclusive...
¡Sí! ¡He dejado en libertad los prisioneros y ahora vengo por ti!
~El Pollo Diablo
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Why C++?

Post by avansc »

Chaos Clown wrote:Whoops, shows how much I know, heh. Good thing I don't use C#, because if I did, it would be really embarassing :oops:. I could have sworn it was microsoft exclusive...
nah dont worry about it.
i dont think its microsoft exclusive, and even if it was it be hard for them to make it windows only, that would make it a very unattractive programming language.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
hayk0510
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 21
Joined: Tue Mar 10, 2009 11:03 pm

Re: Why C++?

Post by hayk0510 »

I see.

I was talking to a friend of mine who is in the software industry and he keeps urging me to learn C#. He says it's the latest and greatest and the future. (btw I live 5 minutes away from microsoft)

For me, creating games is a learning experience, I'm not looking at profit. So as far as the learning process goes(with a software/game job in mind) would it be smarter to invest my time in learning C++?

(might sound like a dumb question, but I want to have a solid programming foundation, and not develop any bad habbits along the way)
"Manually managing blocks of memory in C is like juggling bars of soap in a prison shower: It's all fun and games until you forget about one of them."
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Why C++?

Post by MarauderIIC »

C++ is what you'd maintain everything in. There's a lot more old stuff out there than there is developing new stuff. Also, if C# is the wave of the future (every two years there's a new wave of the future), you'd probably need to port C++ stuff to C#.

And C++ -> C# is pretty easy. I know, I did it. Am doing it. Whatever.

I vote C++.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Why C++?

Post by avansc »

most legacy code is in C, VB and fortran and cobal.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
hayk0510
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 21
Joined: Tue Mar 10, 2009 11:03 pm

Re: Why C++?

Post by hayk0510 »

Thanks for all the replies, you guys are a big help...

I'll give C++ a go, I've been programming in Python for a couple of months now I can seriously feel the limitations. It's easy but I do not feel like I am in full control. And a lot of game engines are made to work with C++ ( I think?)

Also, sort of off topic for this thread, but my bro would like to take a shot at game art. How do you get started there? Do artists just draw? Or is there programming or design required? (Sorry for randomness)
"Manually managing blocks of memory in C is like juggling bars of soap in a prison shower: It's all fun and games until you forget about one of them."
User avatar
LuciDreamTheater
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Tue Jan 20, 2009 2:18 am
Location: Southern CA
Contact:

Re: Why C++?

Post by LuciDreamTheater »

I congratulate your eagerness to get into C++, but just because it's standard in the industry, doesn't mean it's always used to learn how to program. Sure, many people take that route, but there are much easier languages to pick up than C++. Personally, I have no preference. I learned C++ first, but there are other options.
User avatar
hayk0510
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 21
Joined: Tue Mar 10, 2009 11:03 pm

Re: Why C++?

Post by hayk0510 »

anothrguitarist wrote:I congratulate your eagerness to get into C++, but just because it's standard in the industry, doesn't mean it's always used to learn how to program. Sure, many people take that route, but there are much easier languages to pick up than C++. Personally, I have no preference. I learned C++ first, but there are other options.

True, but I have already learned the basics of Python. Now I want to get my hands dirty with a compiled type language. The thing is, I would much rather have a steeper learning curve now, than to have a bumpy learning process the whole way through. I feel that if I pick up C++ now, I will be able to pick up other languages fairly easy in the future(assuming that I become good with C++). Then again, a good programmer know many languages and how to use them well.

Although I have been warned many times to stay away from C++, it's either that or C (The only other books I have) Again this is for the educational experience, and I'm still doing quite a bit of research myself. But once I pick a language, I will stick to it.
"Manually managing blocks of memory in C is like juggling bars of soap in a prison shower: It's all fun and games until you forget about one of them."
Post Reply