Archived

This topic is now archived and is closed to further replies.

C#

This topic is 5589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. One of my online friends is making a game, and his programmer insists on making it in C#. I heard that C# isn''t a good language to program a game in. Is this true? I don''t want to mislead him at all. -Boco

Share this post


Link to post
Share on other sites
The facts are that......

- Its not supported by many libraries so, you are limited in your choice of components.

- Right now, forget porting that.

- Again, as of now, there is only one compiler for it, and thats not a good thing, as you dont have any other options.

- The language didn''t prove to be good over the years... It''s new.

- And finally, its a microsoft creation, and you can be sure microsoft is gonna do everything it can to prevent C# from ever becoming portable...

Why should you want to limit yourself and program in C# when you can program in C++...

Share this post


Link to post
Share on other sites
quote:
Original post by Max_Payne
The facts are that......
- Again, as of now, there is only one compiler for it, and thats not a good thing, as you dont have any other options.


There are four compilers for it, actually - in various stages of completeness. Two of them are from MS, two from third parties.
quote:

- The language didn''t prove to be good over the years... It''s new.


The principles behind it have proven themselves well.
quote:

- And finally, its a microsoft creation, and you can be sure microsoft is gonna do everything it can to prevent C# from ever becoming portable...


''Everything''? Like submitting it for standardization and releasing sourcecode for a version that runs on FreeBSD?
quote:

Why should you want to limit yourself and program in C# when you can program in C++...


Because C++ is a pretty nasty language.


"PL/I and Ada started out with all the bloat, were very daunting languages, and got bad reputations (deservedly). C++ has shown that if you slowly bloat up a language over a period of years, people don''t seem to mind as much."

James Hague

Share this post


Link to post
Share on other sites
I played around with C# a little in the beta version. There are probably other people here who can answer better than I can, but I’ll tell you what I think anyway.

I think C# is a nice language. For games, one concern I’d have about it would be speed. I remember reading in some MS hype that C# could perhaps be even faster than C++ in some cases because the just-in-time compiler knows specifically what processor it’s compiling for and can optimize for that. But in reality, I still don’t know how the performance of C# compares with that of C++. For most business-type network apps I’m sure it’s plenty fast enough. But games need all the speed they can get. If anyone knows how the speed of the two languages compares, I’d be interested to know.

Another issue might be garbage collection. Unlike C++, you do not delete memory that you’ve allocated. The language does that at some later time and it’s typically out of you control, although you can force the garbage collector to work by calling a function. But in a game, you don’t want the garbage collector going to work at some random time and stalling the whole thing. If I remember right, there are also no destructors like there are in C++. So releasing resources when you want them to be released is harder to do. You have to jump through a couple hoops to get the same control you’d get with C++ as far as releasing resources goes.

You can call C/C++ DLL libraries if you want. You can call regular Windows API functions. But you need to add a function declaration for each function to tell .NET how to marshall the parameters. (I’m forgetting the details of how this works now) I tried making a MIDI application that would send some MIDI system exclusive messages to one of my keyboards. Since .NET doesn’t have any MIDI support yet, I had to make calls to the Windows multimedia API. I never got it to work right—there was some kind of pointer problem happening in the .NET part of the marshalling code and I never figured it out. Since I was using a beta version I figure that it might not be my problem at all and so I didn’t spend any more time on it. Anyway, I’m starting to ramble so I guess that’s it.

Share this post


Link to post
Share on other sites
Ok, just in short: C# is usable for games - ones Direct 9 comes out. Full native implementation.

Speed is nice, but - floating point performance is not too good. They did not fully optimise the JIT for this - and when doind 3d in your engine, thhiw will come back UNLESS you use methods provided by DirectX, which are accelerated. Trying to find out how critical this is right now. Now, just for all listeneing: I am in the Dx9 Beta group and under NDA, but this FP performance issue is not related to DirectX - it is a not yet fully optimised part of the full framework.

Besides this, there are people making 3d games in java, so you can definitly use C#. The rest and bashing is bullshit :-)


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites