QuantumMischief

Since XNA is using C#, and is is a more intuitive language than C++, is it possible that in the future that C# will dominate, espessially in AAA titles. Could XNA be ushering a new way of programming in the main stream


Re: XNA Game Studio Express Could C# be the future of gaming?

jsedlak

For now, at least, no; C# as well as Managed DirectX still have a hurdles to get over (IMO). The language is still relatively new, developers are still learning the ins and outs and how to push applications developed in C# to the limit. In my opinion, although I love C# and swear by it, the professional community is and will be very reluctant to drop C++ for a newcomer such as C#, especially considering its lack of cross platform abilities.




Re: XNA Game Studio Express Could C# be the future of gaming?

Jim Perry

With the ability to use unsafe code in C#, I expect performance to not be an issue in any game other than cutting edge stuff. There will probably always be those that will prefer C++ over anything else, but I can see a move by smaller companies to C#, for the increased speed of development if nothing else.




Re: XNA Game Studio Express Could C# be the future of gaming?

Michael Klucher - MSFT

This is more of a comment thread then a question so much, As really there is no definitive answer. I think if you take a look at our partner, Garage Games, I think they are demonstrating that it can be used for serious gaming :-) It's up to the individual to decide though...




Re: XNA Game Studio Express Could C# be the future of gaming?

cowgillbones

I develop serious games/simulations at my job and we use C++ exclusively, and any loss of performance would put us below our minimum requirements for framerate, etc. However, I plan on downloading the new XNA software and learning C#. Since hardware can make up for some performance loss in the future, and for some smaller applications it would be great to reduce dev time and the number of lines of code when performance is not as important. At some point the total cost of developing an application is offset by the performance gain you would get with using C++, if C# is really as easy as I have read about.

Jeff

Wright State University






Re: XNA Game Studio Express Could C# be the future of gaming?

jarradwinter

Hi Jeff,

As some one who is a partner in a company (and lead developer) that produces enterprise high performance security applications, many of them in C#, I think you will be very surprised what you can do with C#. I develop in C++, C++/CLI (.net C++) and C#. C# is my favorite by far. While it certainly takes a lot of care and research to get the "barn burning" speed you can truly get out of C#. Once you know what to avoid and how to write performance critical apps in C#, you will only go back when you have to... Enjoy learning C#, and be sure to grab the "CLR in C#" books by MS press. It will "show you the light" as far as the inner workings of the CLR and how to make your managed code nearly as fast (and in some cases faster) then it's unmanaged counter parts. It certainly helped my apps go from pretty fast to very fast... You already mentioned the "time to market" benefits of the .Net platform so I will simply agree with you and leave it at that.

God Bless,






Re: XNA Game Studio Express Could C# be the future of gaming?

twospoons

I think people underestimate the performance of managed code. There are not many scenarios where unmanaged code will significantly out perform managed code.

 

When people start to better understand how the garbage collector works and ensure that objects stay small and prevent them from getting promoted to generation 1 and 2 it will make a big performance increase. From what I understand the GC on 360 is the same as in the compact framework, so Ill have to read up on the differences.

 

If you look at malloc vs the new keyword in managed code, the new keywords is very fast. The new keyword in managed code is only half the speed of a stack alloc. To beat this performance in C++ you have to override the new keyword and implement your own heap management. To add to the complexity you must also keep your heap defragmented in C++ or else your application will hurt seriously in performance over time.

 

Many people implement in C++ what the GC already does for you, Im not saying the GC in managed code is perfect, but its pretty darn impressive.

 

Also, binaries in C++ must be compiled for a target CPU architecture to ensure that the binary is optimized for your current CPU. MSIL is not tied to a specific CPU architecture, and it will be optimized during JITing for your current CPU. Overtime I expect managed code to outperform unmanaged code do to these issues.

 

You also got to look at where the time is spent in your code, most of it is GFX / IO related and this will not benefit much from being written in C++ since it will still use a HAL.

 

Inline asm in C++ can potentially beat anything out there, but again, it still does not talk directly to hardware (unless you are writing a driver). And having to keep up with all the new instruction sets being release from the different CPU vendors is going to be harder and harder. A team just working on optimizing the JITer for different CPUs will have the edge in this race I think.

 

Also, whenever a new version of the JITer is released your code will automatically benefit from it. In C++ you will have to go and recompile your code, and change all your inline asm.

 

I think the final blow to unmanaged code is time to market. Most people are more productive in managed code vs. unmanaged code. You can also have entry level developers write high performing code, which means less cost for the project.

The tools for managed code are also getting better and better, which again leads to less error prone code and shorter development cycles.

 

 

I think most game studios can live with a 20% performance decrease if they can get their product out faster at less cost.

 

Sorry for the long post J

Roger Larsen





Re: XNA Game Studio Express Could C# be the future of gaming?

Jim Perry

I think the 20% performance decrease is an extreme. I think you'll be looking at under 10% in the vast majority of cases, probably just a couple of % points. I think most developers wouldn't even worry about it unless they're working on next-gen stuff.





Re: XNA Game Studio Express Could C# be the future of gaming?

twospoons

Jim,

You are correct, 20% is probably the worst I have seen. Unless you do some real thight loop memory operations.

Most people never talk about poorly written code either, which is slow regardless of programming language. There is some horribly inefficent examples for every language out there. Having said that, I find it a lot harder to optimize c++ for performance, than c#. The guts is in the algorithms, if you get them right it should not really matter if you write your code managed c#.

Roger Larsen





Re: XNA Game Studio Express Could C# be the future of gaming?

gabereiser

From my experience (and that is having developed several shareware games) C# is no different than Managed C++. The same performance. Native C++ only has a small (within 1%) performace increase over C#. I have been successful in porting one of my games from CLI C# to MONO C# for linux/Mac OS X and it was flawless.

C# IS the future, it's easier to read, easier to program, opens up the doors to RAD C++ because that's what C# is.

What Roger said about the algorithms is true, after all the language comparisons, if its just poor code, it's poor code.





Re: XNA Game Studio Express Could C# be the future of gaming?

AOEA

QuantumMischief wrote:
Since XNA is using C#, and is is a more intuitive language than C++, is it possible that in the future that C# will dominate, espessially in AAA titles. Could XNA be ushering a new way of programming in the main stream


C# is the future only if all you are concerned about is writing games for Windows PCs and Xbox 360. I'm sure Wii, PS3, DS and PSP will continue to have their fair share of AAA titles in the years to come and they will be written in a mish-mash of C, C++, GLSL, Cg and ASM, not C#. No disrespect intended towards MS.

I am just getting started with C# (coming from C++) and so far I'm enjoying it. As far as performance is concerned I think it will be a non-issue for myself and probably the majority of people participating in this club. The cold reality is that most people who are all fired up about participating in this program are never going to finish writing a single game much less get to the point where they are trying to sap every last ounce of performance they can out of their hardware. I'm excited about this program, but having owned both a Yaroze and PS2 Linux kit, plus having dabbled in AGB homebrew, experience tells me no matter how painless Microsoft makes the development process, it will still require much more effort and discipline to create the simplest of games than most people are prepared to commit. Personally if I manage to get something as simple as Pong or a Kirby's Avalanche clone working with some nice shader effects I will be very pleased.




Re: XNA Game Studio Express Could C# be the future of gaming?

Duck-o-cide

I agree with a lot of what is said here. A collegue and I dabbled in producing "cottage industry" type games using C# and DirectX 9. The Z-Buffer web site (www.thezbuffer.com) shows the groundswell of movement towards managed languages and game writing.
Excuse this ... (Under the "games" link, the game "d-Rez" was our first attempt at a C# DirectX game)
.

Personally, I think managed environments are the way forward in creating some much needed layers to game industry.

I love C#. I don't write games as a day job. However, if there is one thing about the safe "managed enviornment" I really liked (unlike my very early days of assembler and C game writing), you can develop things on an ad-hoc part time basis without fear of forgetting those core rules to that wonderful cascade of memory pointers you are using. In other words. For me. The managed language environments allow me to pursue ad-hoc development when (for whatever reasons) you have to sometimes leave an appreciable amount of time between game writing sessions

Bring it on I say - Arguments over a loss in performance are somewhat moot . Let alone the obvious march of technology (http://en.wikipedia.org/wiki/Moores_law). I think there will be more than enough capability for average "community" game. From my experiences using DX9 and C#. As AOEA says:

"experience tells me no matter how painless Microsoft makes the development process, it will still require much more effort and discipline to create the simplest of games"

It is a statement that absolutely hits the mark. To be honest though, ever since I started writing C# games. I'm amazed at what you can achieve for such a few lines of code!






Re: XNA Game Studio Express Could C# be the future of gaming?

Khaireddin

Although Im a huge C++ fan but..

XNA will be using C#, DirectX is now shipped with many samples tutorials for managed frame work, and the bench mark between C++VS C# graphic applications isnt noticeable even sometimes its better on C# with all that I guess its time to migrate from C++ to C#...





Re: XNA Game Studio Express Could C# be the future of gaming?

YCDC.CN

QuantumMischief wrote:
Since XNA is using C#, and is is a more intuitive language than C++, is it possible that in the future that C# will dominate, espessially in AAA titles. Could XNA be ushering a new way of programming in the main stream

I think, before XNA released,C# isn't the primary gaming language

but,since XNA will be released, it's said that in the FAQ,C# will be the important gaming language.

hehe






Re: XNA Game Studio Express Could C# be the future of gaming?

DEBRO

Hi there,

I don't know if this is the right forum for this but I was reading this thread and had a question.

I haven't done hobby PC game programming or C/C++ coding since the early 90s. I started to get back into C/C++ game programming by looking at the GBA (I went back to my roots and have been coding in 6502ASM). Just when I was about to get started I read the news on XNA. I've read a few things on C# and CLR. I've read that managed code can run as fast if not faster than unmanaged code.

Anyway, back when I did game programming, it was better to write code like 320 * x as (x << 8) + (x << 6). Do you still need to do optimizations like this if the number can be represented as a power of2 Have the compilers (more importantly C#) gotten better to where this type of optimization is not needed