iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Closed TopicStart new topic
> C# vs C++, When it comes down to Game Development.
Scorneo
post Dec 4 2010, 09:40 PM
Post #1


If n = infinity, (1+(1/n))^n=1
Group Icon


Type: Undisclosed
Alignment: Lawful Good




Hi, i know that this is a very common thread in many forums but not when it comes to game development and so i was wondering if any of you guys know anything when it comes to this sort of stuff.

From my point of view, C# seems to be much more superior than C++. It's easier to use, more flexible, better compatibility and it's just better in almost every single aspect. I am surprised why game developers don't take their time to learn C# and use it.

Even though C# is great in almost every way, DX9 lacks the support for C# but i heard that DX11 and newer versions won't (but i'm not sure).
Do any of you guys prefer C# when it comes to game developing and will it ever be used widely as C++ is today or does C# belong to software programmers?


--------------------
QUOTE (Albert Einstein)
Imagination is more important than knowledge.




Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 4 2010, 09:50 PM
Post #2


No method: 'stupid_title' found for 'nil:NilClass`
Group Icon


Type: Coder
Alignment: Chaotic Good




Well, there are many good reasons that professional development companies use C or C++ over a language like C#. C# is a great language that I use often, but you should be using the right tool for the job.

1. Cross platform support - C# runs under .NET, which has no official ports on anything but Windows based operating systems. There are projects like mono which emulates the .NET runtime, but generally cross platform development is easier to accomplish by using C or C++.

2. Low level programming - C# is a high level language, full of abstractions. These abstractions are great most of the time, but games are very resource heavy. You cannot get deterministic resource use when you are not the one managing these resources. You cannot easily get hardware-level access in C#. You cannot typically write your code to be tailored to use GPU specific functions (your graphics engine of course can, but that is not written in C# either for the same reason) because the manufacturers of these hardware devices tailor their API's to C or C++.

Low level optimization gets tough in C# when the abstractions become more of a burden then a benefit. It's tough to optimize things like CPU cache lines and memory access in C# because you simply do not have access to that level of abstraction. C# was simply not designed for applications which need to work intimately with hardware devices.

3. Legacy code - There is *a lot* of pre-existing code used by game companies that is already written in C or C++ that would be tough to call from C#. Why rewrite code that works already just to be able to use it from C#? There is no real business benefit in doing that.

4. History - The people making games now know C and C++ and are comfortable using the tools they have been using for years. Again, no real benefit in learning a new language/framework here. These people know what they are doing and would be reluctant to switch over.

Those are the four biggies. You have to also realize that people who really know C and/or C++ don't want to switch to C# just for the heck of it. There is not a big upside to moving to a new language just for the heck of it.


--------------------
My blog - It's awesome, I assure you
QUOTE
While sloppy writing does not invariably mean sloppy thinking, we've generally found the correlation to be strong -- and we have no use for sloppy thinkers. If you can't yet write competently, learn to. - Eric Raymond

---
My awards for being so awesome
Spoiler:
Go to the top of the page
 
+Quote Post
   
Reedo
post Dec 4 2010, 10:29 PM
Post #3



Group Icon


Type: Coder




All of BigEd's points are completely valid and accurate.

However, the challenges have been *mostly* overcome, and the tides are changing...
http://create.msdn.com/en-US/

XNA Game Studio really does provide nearly anything you could want to do, resource-wise, with DirectX. And it makes it *super* easy if you are already familiar with .Net coding and C#.

Even without XNA, you certianly can download .Net wrappers for the DirectX API components and write code in .Net (C# or VB) that uses DirectX 9 (and 10 if you want) and does pretty much anything that you as the developer can understand how to make DirectX do! tongue.gif So I'm not sure what lead you to belive that C# does not have support for DirectX 9, but I assure it does. I have too many development projects that use it! Here's a for instance tongue.gif This is based on a project started back in .Net Framework 1.1 with DirectX 7, which was simply called Xarcade. The Vengance version (linked here) was redesigned in Framework 2.0 using Visual Basic .Net 2005 and Direct X 9. And I just updated it for the latest DirectX runtimes (though it is still a very rudementary DX implementation for 2D). I also have a couple of projects based on just the DirectSound portion of DirectX in managed code (which I would link as well, but it probably needs the same reference updates that Xarcade needed). But all of these projects require a fair amount of leg-work just to get the required DirectX resources up and running, and then getting efficient use of those resources can be another chore.

So why go through so much leg-work, especially when for the most part, every game you make needs these same core objects? Hence the creation of the XNA Framework. A complete libaray of game objects, with very fast, very powerful, suprisingly simple access to most all (* Edit Actually there may still a few advanced feaures or ways of using shaders and such that aren't implemented, but that you should rarely if ever need) of DirectX and most of the associated hardware features. XNA does so much of the leg-work for you that it is route down which MS is focusing it's game developement. And we are talking about Games for Windows Live, XBox 360 and Windows Phone 7... so modern game platforms.

Of course, this does really make point 1 from BigEd hit home: you are glued to Microsoft if you use C#. Its not entirely true; if you plan for it, you can write something somewhat portable to C++, though you'll still have a number of helper objects to create to complete a conversion. But, you as the developer need to decide whether or not this is actually a problem... If using the XNA Game Stuido means you can develop your game in 1/100th the amount of time (or better), and your single source code compiles and distrubtes on Windows Desktop, XBox 360, and Windows Phone 7, and MS will sell it for you on its Game Marketplaces (doing all the work and taking ~30%), then how bad is it that your game has Microsoft as a requirement?

For established game studios with existing engines and in-house development tools worth thousands of man-hours and immessurable dollars, a switch to something like XNA and C# may not be feasible. Although there are signs that these technologies are being adapted into exisitng C++ toolsets...

But for new developers and development studios, XNA presents a world of possibility and should be explored in-depth before deciding on what development path you should take.

That's my "FWIW" anyway! tongue.gif

This post has been edited by Reedo: Dec 4 2010, 10:44 PM


--------------------
"Yes, I saw that. You were doing well, until everyone died."
"When you do things right, people won't be sure you've done anything at all."
The Satellite That Collided With God – Futurama

Spoiler:


Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 4 2010, 10:48 PM
Post #4


No method: 'stupid_title' found for 'nil:NilClass`
Group Icon


Type: Coder
Alignment: Chaotic Good




I should have clarified a little bit.

Technical challenges are not the largest factor here. You can write perfectly performant games using C# and XNA as Reedo mentioned. The determining factors are really numbers 3 and 4 from my original post.

QUOTE
3. Legacy code - There is *a lot* of pre-existing code used by game companies that is already written in C or C++ that would be tough to call from C#. Why rewrite code that works already just to be able to use it from C#? There is no real business benefit in doing that.

4. History - The people making games now know C and C++ and are comfortable using the tools they have been using for years. Again, no real benefit in learning a new language/framework here. These people know what they are doing and would be reluctant to switch over.


And reedo is 100% correct with his statement here:

QUOTE
For established game studios with existing engines and in-house development tools worth thousands of man-hours and immessurable dollars, a switch to something like XNA and C# may not be feasible. Although there are signs that these technologies are being adapted into exisitng C++ toolsets...


--------------------
My blog - It's awesome, I assure you
QUOTE
While sloppy writing does not invariably mean sloppy thinking, we've generally found the correlation to be strong -- and we have no use for sloppy thinkers. If you can't yet write competently, learn to. - Eric Raymond

---
My awards for being so awesome
Spoiler:
Go to the top of the page
 
+Quote Post
   
Scorneo
post Dec 5 2010, 07:25 AM
Post #5


If n = infinity, (1+(1/n))^n=1
Group Icon


Type: Undisclosed
Alignment: Lawful Good




Thanks, guys smile.gif
Well, maybe some time in the future, C# might actually be used more widely in the gaming industry. DICE are already using C# when developing their gaming engine FrostBite 2.0.
But does any of you guys know if C++0x will be better and perhaps easier to use than C++? I honestly can't find any info whatsoever about it.


--------------------
QUOTE (Albert Einstein)
Imagination is more important than knowledge.




Go to the top of the page
 
+Quote Post
   
BigEd781
post Feb 27 2012, 05:30 PM
Post #6


No method: 'stupid_title' found for 'nil:NilClass`
Group Icon


Type: Coder
Alignment: Chaotic Good




Well, that's not true (Windows is by far the most popular gaming platform and the main reason for using C++ is performance and existing libraries), but regardless; this thread is over a year old. Closed.


--------------------
My blog - It's awesome, I assure you
QUOTE
While sloppy writing does not invariably mean sloppy thinking, we've generally found the correlation to be strong -- and we have no use for sloppy thinkers. If you can't yet write competently, learn to. - Eric Raymond

---
My awards for being so awesome
Spoiler:
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 30th August 2014 - 05:22 PM

RPGMakerVX.net is an Privacy Policy, Legal.