views:

2232

answers:

13

For a long time now C++ has been the dominate game development language. Many AAA quality 3D engines are available to fit any budget.

My question is, with the rise of XNA, has C# and the .NET framework been positioned well enough to take over as the new standard game development platform? Obviously the inherent cross-platform nature of the XNA framework (Windows, Xbox, Zune) has its benefits, but are those benefits good enough to entice large game dev studios to switch gears?

Personally, i am torn between using C#/XNA for a new project, and using Java via jMonkeyEngine. I have a great desire to have my game be portable to multiple platforms, and the only languages i know well enough to accomplish this are C# and Java. i would love to see an implementation of the XNA codebase that is powered by OpenGL and would run on Mono, but i think that is merely wishful thinking at this point.

I am curious to hear what others have experienced while building 3D games in something other than C++.

+1  A: 

Well, between those too I think C#/XNA is a clear winner based on library support and really the maturity given Microsoft's experience in DirectX. That being said, I don't see C#/XNA replacing C++ as the lingua franca of serious 3D game programming (i.e. by large development houses) for a very long time, if ever.

BobbyShaftoe
+15  A: 

The large gaming studios will probably not adopt XNA any time soon. Some indies are using it, but definitely has the potential to eventually be very successful and leave C++ behind.

XNA provides many classes that you can use in game development, but many others often choose to use a fully fledged games engine. Although XNA is rather good for beginner's to cut their teeth on if you are new to programming games.

C# is a good language to use for games development. Games development produces applications that require sound, advanced graphics, AI, Physics, etc. All that requires a powerful and fairly quick language environment. While most of the top tier PC and console games are written in C++, C# has a road map that will likely leave C++ behind. The coming changes in C++0x will no doubt reinvigorate C++ for a little while but C# looks poised to overtake it.

If you really want to be a games developer I would urge you to at least learn C++ and write your own game engine. Using a pre-made game engine is easy and you can code something that is 'okay' but you will run into many limitations that you won't be able to code around. You will effectively be confined to the capabilities of the game engine (unless you have access to the source, which you could then modify to your liking).

Learn C++ and preferably OpenGL :) Once you know OpenGL you can learn DirectX pretty easily.

C# is a piece of cake once you know C++.

Brock Woolf
What about managed DirectX, are there any retail games that have been written in completely managed code using managed DirectX? Something I've always wondered about....
BFree
@Brock Woolf: XNA is not much more than a managed DirectX wrapper, though a large one. If you say "every XNA game is the same terrible FPS", don't you confuse that with things like Game Studio 3D, or whatever the latest version's name is? XNA is not a game engine.
OregonGhost
All modern games are written in C++? For small values of "all", and restrictive values of "modern." A large and growing number of games are written in Flash, to pick one obvious exception. There's a lot more to game development than console games.
Robert Rossney
On the other hand, OP *was* asking about a "new standard game development platform" and 3D games. Never mind.
Robert Rossney
@BFree: I do know of Arena Wars, a pretty impressive commercial RTS that was written in managed dx. http://uk.pc.ign.com/objects/692/692397.html
Adam Naylor
"The exception of course are internet games written in Flash, which aren't real games anyway." - not real games?! huh?
Codebrain
@Codebrain: Desktop tower defense is not Crysis now is it?
Brock Woolf
I wouldnt say XNA is inflexible, the language itself is extremely flexible. It's just the content pipeline that is limited, and that can be extended by the developer. Also, saying that flash games aren't real games is a pretty fascist thing to say. If someone out there enjoys playing it, its a good game.
LoveMeSomeCode
Learning OpenGL is a Good Thing, since every console (PS3, Wii, iPhone, PSP, DS) are using OpenGL based rendering architectures.
Jasper Bekkers
Flash games are not real games, eh? What a load.
Ross
+1  A: 

It is not just the studios to consider, it is the audience. Chances are that as long as Sony and Nintendo are around, they are unlikely to move the a C#/XNA platform. At least for Nintendo, when you have the mass-market appeal that they currently do, they will continue to dictate their development platform.

I love XNA, since I can now write applications for my Zune, but C++ for a broad-based development platform for gaming is going to be around for a long time. There might be an influx of new indie developers for Microsoft devices, but we are a far way from seeing XNA be used across the board, if ever.

joseph.ferris
+12  A: 

While some time ago XNA Professional was announced, Microsoft now seems to focus on the Express edition (though it lost the "Express" in the name), and that seems to be aimed at the hobbyist market rather than the commercial market. Among other things, this largely benefits the XBox 360 community, because they now allow hobbyist developers to develop their games for Windows and XBox 360 and then to sell their games on the XBox network, and that is a good thing.

I'd really love to see XNA gaining momentum in the professional world, but this won't happen unless it's available for the other major gaming platforms (PS3 and Wii). The problem is not only the XNA framework / API, it's the language / framework requirement, so you can't even write the game in C# and then use XNA on Microsoft platforms and OpenGL on other platforms.

The performance profile of XNA is also aimed at the hobbyist market rather than commercial, though the performance seems to be quite good and there are impressive demos out in the wild.

Edit:

If your question is actually "should I use XNA now for my project with a budget much less than a million", my answer is definitely yes. Go try it out, it's free. And it's powerful.

OregonGhost
Yeah, one nice example of this is the game (Sharky's Air legends) http://sharky.bluecog.co.nz/ This one developer made a game using XNA in his spare time, and now it is being published.
Daemin
+10  A: 

I worked at a place called Newfire in the late 90's. Before funding ran dry, we had an engine that could render an immersive world that was 10,000 square km with a resolution of 10 cm. You could get a huge number of players in at once and persistently deform the landscape. This engine ran at frame rate on a P200 with a Voodoo 2 card.

Most of the engine was written in carefully tuned C++. All the game code was written in C or C++ or Java. I also had prototype code that could define object behaviors using a push down automata that could do very decent AI. It took nearly no CPU time. The execution of game logic was dwarfed by rendering.

At one point, I had a demo of Conway's Game of Life running in Java using our software renderer. The cells were cubes laid in a plane which appeared or disappeared and changed color as they aged more generations. While the game was running with a fixed generation rate of 4 generations per second, the 3D display was running at 20+ FPS, again on a P200 with the software renderer.

So the answer is not definitely C++. The answer, like any problem domain, is the language that works the best within that domain. C++ works well in that domain for the rendering engine, but for the actual game logic and rules, lots of languages work well. Python is great. C# is great. Java is great.

plinth
Yes, however you argument is based upon facts from about 10 years (or more) ago. Today, C++ is what is use in games, with possibly some inline assembler and GLSL/HLSL.
Brock Woolf
Games now use Lua as the language to write rules/etc in, but the game core is still written in C++.
gbjbaanb
+5  A: 

I think that there is a kind of BS elitism that happens when people talk about XNA or java game frameworks or pygame or whatever. Yes, professional game houses will use C++ for a long, long time. But Atmospherian is asking about something for his own project, so I'm going to assume that he's an amateur (if he were the CEO of Epic or something I doubt he'd be posting on SO)

Anyway, just because you couldn't code FarCry in it doesn't mean that it's a worthless framework. Major-studio level games require millions of dollars and dozens of people, but XNA/Java/pygame/etc have allowed amateurs to do some pretty awesome stuff. Amateur games and major-studio games are two different beasts and call for two different sets of tools.

To answer your questions, Atmospherian:

-Yes, XNA can do some pretty cool stuff and people have used it to make some cool games.

-If you want XNA to be cross platform and work with mono, I think it's technically possible, but I wouldn't hold my breath.

-If you want to end up with a job in the games industry, you are going to need to learn C++.

-I think the path of least resistance to getting a working cross-platform game engine is currently in pyglet. The ease of use might trade off with speed when compared with java or C++.

Ryan
+3  A: 

Surprised nobody has mentioned the possibilities for a mobile gaming. I can't see any managed code competing with C++ anytime soon for the likes of Half-Life and Halo, but for less-intensive mobile device games it seems like it's got legs.

annakata
+4  A: 

Just add to the conversation ... C#/.NET is certainly available on other non-microsoft platforms.

Between those two right there, you can target linux, mac, wii ... I'm sure if there was enough funding/interest in it, they can get Mono to run on a ps3 as well. At that point, you'd be able to write for all major game platforms using C# (albeit, probably not with XNA per-se).

Also, to anyone wondering about performance ... lots of great things are in the works, such as Mono's new support for fast floating point math using their SIMD extensions (x86 only for now, of course): http://tirania.org/blog/archive/2008/Nov-03.html

Joel Martinez
+3  A: 

As a follow-up to this question, i started looking at some OpenGL based 3D engines written in C++ (CrystalSpace, Irrlicht, Panda3D), and they all look rather solid. An interesting note about Panda3D is that it is written in C++, but the main way you use it is through Python. It seems to me that method would give the best of both worlds as far as a fast engine written in C++ combined with the ease of programming in Python. I'll pose another question comparing these engines. Thanks for the replies.

Jason Miesionczek
+58  A: 

I think C++ will go out of fashion in the next 10 years just the same way as assembly did. I'm a professional game programmer for more the 15 years. In early 90's lot of people said that C is not efficient enough for games. In the late 90's same people said that C is OK but C++ is just way too slow for performance critical applications such as games. Now C++ is the standard high performance language and people argue that other languages would be too slow. In the meantime today's games use script languages like Lua, Python or Unrealscript for game logic which are ten times slower than C# or Java.

C++ is much faster when you do math in your game. Doing linear algebra is painfully slow in C# or Java. However, this is only a part (10 - 25%) of the game. When it comes to the game logic bottleneck is memory access so using an other language does not reduce the performance significantly. The tool side of the game, which use to be the 50-80% of the code, really does not require any C++. It happily runs in C# which is fast enough for almost any tool.

One also should not forget that C++ is derived from C, which is made in the early 70's. So C++ is obsolete in many ways. The most annoying thing is probably the pre-processor which kills transparency and causes insanely long compile times. An average state of art C++ game engine compiles in 30-60 minutes. In such time you could compile every C# and Java project ever made by humans. Lack of self reflection and dynamic code creation is also a drawback. It often costs a lot of development time to overcome on these shortcomings.

Nevertheless C++ development costs a lot it would cost even more for a game studio to risk a failure by switching to a new technology which is not yet proven in game development. It is also an important factor that majority of experienced game programmers use only C/C++ and they do not have experience with other languages which would definitely increase the risk of switching. Because of these, you probably will not see game studios in the next couple of years switching to C#. However, it is likely that a Microsoft owned studio will make a big hit with a C# game in the next 5 years which will convince other studios that it is feasible to make AAA titles in C# and then you will see more and more studios switching to C#.

For now, my advice is: If you want to make an AAA multi-platform title you have no other choice than C++ for the runtime part of the game. Consider using C# for the tool side. It's a little bit tricky to efficiently connect managed and unmanaged code but on long run it worth the effort you spend on it. If you do a hobby project or a B title where performance is less important than development cost/time then forget C++ and just use C# for everything and spend some extra time to optimize the math.

Luppy
Really good, sober and insightful analysis.
Patrik
Good insight/essay. Games now use a combination of languages, with C++ for the core maths stuff, and other scripting languages for the game logic. Though I have to disagree with the C++ being an old language, it's constantly updated and improved, just the perception that its old, nothing more.
Daemin
A lot of C++ compile times are templating, afaik. However, you're right the preprocessor certainly doesn't help.
sixlettervariables
I think the future of C++ in games will largely depend on how C++0x will get adopted by the industry.
Jasper Bekkers
+10  A: 

As a poster mentioned, XNA is currently limited to Microsoft platforms but you can still use C#, .NET and any .NET programming languages to develop games in a cross-platform way.

The Mono runtime does provide a cross-platform engine that can be used to run your C# (or .NET code) under a variety of desktop platforms (Windows, MacOS, Linux) as well as gaming consoles (Wii supported by Novell, PS3 coming soon and Xbox360 "on your own").

There is also a commercial gaming platform called Unity3D that has done wonders using Mono. They are a game IDE that surpasses XNA as a game development environment: physics, graphics, lights, models, collisions are handled all in native C++ code while all of the gaming logic (AI, camera control, views and so on) are handled by managed code written typically in C# or UnityScript (a strongly typed Javascript implementation that gives you the best of both world: the Javascript syntax, but strong types that improve performance).

miguel.de.icaza
Also, there's a free version of Unity3D for indie developers: http://unity3d.com/unity/download/.
Kevin Thiart
A: 

Lua should be of interest to you, as you can embed it in C# and access your objects from LuaScript.

David Robbins
+9  A: 

I am not a game developer (unless you count the Reversi game I wrote in Atari 6502 assembly language in ~1982), but I do have a lot of experience writing commercial application software in Assembly -> C -> Objective-C (anybody remember the Next Cube?) -> C++ -> Java and now C#.

I cannot compare the game libraries but I do have some thoughts on C++ versus C#.

IMO, the argument for C++ over C# due to performance is not as simple as some would have you believe. The software I work on is performance critical. We compete with products compiled to native code (presumably written in C / C++ / Assembly) and we win on performance to the point that our competitors even use our software over their own for certain applications.

How can that be if C++ is faster than C#? In my experience, the answer is the fact that for any complex system, the architecture and algorithms are more important than the language (assuming that the potential performance is in the same ballpark - which it certainly is with C++ and C#). Even though I was a full time C++ developer for more years than I have used C#, I am much more productive in C# than C++. This means that I can spend more time refactoring and perfecting my architecture and algorithms than I could previously.

Now, sometimes I have to admit that I am tempted to rewrite the core engine of my application in C++ because I know that I could get it to run faster and use less memory. So far I have resisted the urge because I believe that the drop in productivity would mean that it is only a matter of time before my C++ codebase is slower than where I would be if I had stayed with C#.

I believe it is only a matter of time before game development transitions to C# and / or Java and / or some other language which is more productive than C++. Having used Java for several years and now C# for several years I would bet on C# - but that's just a guess.

If I were getting started in game development today I would definitely bet on Silverlight and / or WPF. WPF is built on Direct3D. Microsoft has already announced that Silverlight 3 will support hardware assisted 3D rendering. Silverlight runs on various browsers and the Mac. With Moonlight it runs on Linux. It has been announced for some phone platforms. Thanks to the fact that Silverlight is essentially a lightweight version of WPF (it was initially introduced as "WPF/E" where the "E" means Everywhere) you can target both without a great deal of extra effort. You can have a lightweight version (free or supported by advertising) of your game using Silverlight in the browser and the real deal for serious gamers which uses WPF and runs on Windows.

Better yet, be the person to create an excellent gaming library which allows for easy targeting of both WPF and Silverlight 3 (or Silverlight 2 if you don't need hardware assisted 3D rendering).

While I have seen no official announcement, it is hard to believe that the next generation of XBox will not support Silverlight. Of course, I would not look for it on Sony or Nintendo gaming systems.

Joe Erickson