Why is C++ used for Game Development?

I can't find any good articles or information!

  • (2 Pages)
  • +
  • 1
  • 2

21 Replies - 11686 Views - Last Post: 22 June 2009 - 08:07 AM Rate Topic: -----

#1 stev3  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 44
  • Joined: 04-June 09

Why is C++ used for Game Development?

Posted 21 June 2009 - 03:59 PM

Hello!

I've been searching google for ages... I cant find a single good article on why C++ is so great for coding games.

Could anyone point me in the right direction?

- Steve
Is This A Good Question/Topic? 0
  • +

Replies To: Why is C++ used for Game Development?

#2 moopet  Icon User is offline

  • binary decision maker
  • member icon

Reputation: 339
  • View blog
  • Posts: 1,185
  • Joined: 02-April 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 04:08 PM

View Poststev3, on 21 Jun, 2009 - 09:59 PM, said:

Hello!

I've been searching google for ages... I cant find a single good article on why C++ is so great for coding games.

Could anyone point me in the right direction?

- Steve


Because it's wicked fast compared to pretty much anything else in the OO field?
Was This Post Helpful? 0
  • +
  • -

#3 stev3  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 44
  • Joined: 04-June 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 04:12 PM

View Postmoopet, on 21 Jun, 2009 - 03:08 PM, said:

View Poststev3, on 21 Jun, 2009 - 09:59 PM, said:

Hello!

I've been searching google for ages... I cant find a single good article on why C++ is so great for coding games.

Could anyone point me in the right direction?

- Steve


Because it's wicked fast compared to pretty much anything else in the OO field?


yeah but why :P

im failin here :(
Was This Post Helpful? 0
  • +
  • -

#4 sparkart  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 113
  • View blog
  • Posts: 688
  • Joined: 16-February 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 04:21 PM

Because of the performance that allows for better computing, better graphics.
Was This Post Helpful? 0
  • +
  • -

#5 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 04:22 PM

Hi stev3

Like Moopet said it is extremely fast, not only that it supports a variety of different coding styles, such as OOP which is excellent for game programming, it also supports procedural programming for more CPU intensive functions.

C++ gives you low level access to your computer and the scope to create high level code through abstraction. When dealing with a huge project OOP is a real help and C++ has excellent support for this.

Taking all this into account its hard to think of a language better suited to the creation of games.

Hope that helps :^:
Was This Post Helpful? 0
  • +
  • -

#6 stev3  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 44
  • Joined: 04-June 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 04:24 PM

View Poststayscrisp, on 21 Jun, 2009 - 03:22 PM, said:

Hi stev3

Like Moopet said it is extremely fast, not only that it supports a variety of different coding styles, such as OOP which is excellent for game programming, it also supports procedural programming for more CPU intensive functions.

C++ gives you low level access to your computer and the scope to create high level code through abstraction. When dealing with a huge project OOP is a real help and C++ has excellent support for this.

Taking all this into account its hard to think of a language better suited to the creation of games.

Hope that helps :^:


Thanks buddy, it did!
Was This Post Helpful? 0
  • +
  • -

#7 stev3  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 44
  • Joined: 04-June 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 04:46 PM

I still could benefit from some articles to have a read through... finding it really difficult to write about the subject if im honest
Was This Post Helpful? 0
  • +
  • -

#8 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 05:07 PM

Heres a short essay I wrote about this exact thing :)

Attached File(s)


This post has been edited by stayscrisp: 27 June 2009 - 09:57 AM

Was This Post Helpful? 2
  • +
  • -

#9 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 05:49 PM

Quote

I cant find a single good article on why C++ is so great for coding games
It's not like it's the ideal language or something. Much of it has to with age. C has been around for a long long time and has been a choice language for much systems level work. C++'s design allows for (within constraints) compatibility with C, and from that, a huge codebase has been built around C or C++. That cannot change suddenly.

I disagree with the empty "C++ is fastest" claim. Implementations are fast. Languages are not. C++ is not that low level either. It's a portable implementation. Read the standard and you'll understand that the machine defined in the standard is some abstract idea. It could be a real machine or a virtual machine, but it doesn't matter.

If you're going to talk about how fast C++ is, why does anyone not mention Fortran? Eh? Been around for a long long while, used heavily in high performance computing. Compiler implementations have been extensively optimized. Interesting...
Was This Post Helpful? 0
  • +
  • -

#10 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 06:01 PM

You would be hard pushed to find any help on making games in Fortran, while you are right to say that C++ may not be the fastest I would say that looking at the current most used languages for games programming it is the fastest, by that I mean C#, Java and python among others.

C++ is popular and has been for some time which contributes to why it is still so widely used.
Was This Post Helpful? 0
  • +
  • -

#11 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 06:07 PM

I'm swaying towards saying C# with XNA would be the best route to go for Game Development nowadays, or even C# without XNA if you want.

I say this cos from a little research I did with a few friends, C# comes out fastest when it's down to looping, which is pretty much everything to do with a game. Our little 100%-Non-Scientific-Nor-Conclusive test was a loop in different languages (x86ASM, pure C, C++ (procedural), C#, Java, VB6 and VB.NET) that would click the mouse. C# came out with fastest clicks every time, not sure why but hey.

Anyway I'd also suggest a managed language for another key reason -> Garbage Collection. Games have generally come with extremely high memory requirements for a long time, and they keep going up, yet textures are staying the same if not smaller due to new compression, so what gives?? Could be the slacker-style of programming adopted by some (read: most) programmers that allow tiny little memory leaks... That keep happening and build up and up and up. GC stops this.
Was This Post Helpful? 0
  • +
  • -

#12 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 06:13 PM

I would have to strongly disagree with you there MageUK mostly because using C# ties you to Microsoft. I like to write cross platform code.

I don't know how you conducted your tests but its pretty much a given that C++ gives better performance than C#.
Was This Post Helpful? 0
  • +
  • -

#13 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 06:15 PM

C# is just a language, I'm sure eventually there'll be (more) native compilers for C#. There's also Mono for cross-platform, but in the game development world you'd be taking yourself out of XNA there.

I don't know where you've seen that C++ is faster than C# in every case, though. The .NET Framework and the optimisations that the runtime/compiler apply to the IL code are quite unique and fast.
Was This Post Helpful? 0
  • +
  • -

#14 Dantheman  Icon User is offline

  • D.I.C Regular

Reputation: 34
  • View blog
  • Posts: 445
  • Joined: 27-May 09

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 06:24 PM

No matter how good the optimizations will be, the fact is C++ has less run-time baggage and it is compiled straight into the native code. It will always be faster. But let's not create another "Java is slow" thread.

I don't think anybody has mentioned this yet, but C++ is running in circles around C#/Java in terms of number crunching. This is extremely important when you're writing things like a custom physics engine.
Was This Post Helpful? 0
  • +
  • -

#15 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Why is C++ used for Game Development?

Posted 21 June 2009 - 06:24 PM

While I would never say it performs better in every case (that would be silly!) it does out-perform C# when it comes to most things, that said there are benefits to .NET such as JIT which could theoretically give better performance.

I just don't think I would say C# is the best route for game development, possibly in the future. But each to their own, whatever gets the job done.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2