.NET vs clear C++ with WinAPI in game programming

Started by
10 comments, last by gharen2 17 years ago
Hi everyone, could you tell me what is better - programming in .NET or in clear C++ using WinAPI and DirectX/OpenGL? I heard that many people are migrating to .NET but why? C++ is faster than .NET library. Are there some new libraries for game programming?
Advertisement
.NET has something like 98, or 99% of the speed of C++, so for most programming tasks, including most game development, the speed is not much of an issue at all. Also, I hear that the DirectX interface for Managed (.NET) programs is much cleaner.

C++ can be run as a .NET, managed, program, by the way.
Edit: never mind that last statement, you already know that, judging by your use of the word 'clear'.
Because C# is a joy to work with. The IDE is leaps and bounds better. You spend far less time fighting the language and more time writing the game.
The .Net languages are much, much more productive in general, for a few reasons: no manual memory management, a very rich library, and certain languages (notably C#) have support for first-class functions, which makes certain kinds of programming problems much easier to solve.

I prefer C# for almost all of my utilities and tools these days, unless it's some bit-twiddling or something that I can more comfortably do in C++.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

I second the C#-praising, but for completeness, .NET comes with a few considerations.

If your target audience is today's Windows user, then there's no contest. However, if you need to accommodate older versions of Windows (pre .NET framework) or other operating systems, then these managed languages will be of no use to you. In particular, for true cross-platformity, the most popular choice is C++ with OpenGL.

Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.
IMHO from a marketing perspective until most of your target audience have the .NET framework already installed by default (i.e. All running Windows Vista) then it's a question of whether you'd like to slap a .NET Framework 2.0 requirement on your product (Though you could mitigate this by installing the framework alongside your game's installation).

As for performance (not to be confused with productivity), if it's a big issue for your game genre then go for C++, otherwise, perhaps you can raise the bar on your game's hardware requirements? :)




What has .NET specially that C++ doesn’t have - I have some kind of libraries in mind. What library has .NET which can help in game programming?
XNA

Generally both C# and C++ have lots of existing libraries you can pick from for just about anything. You can write games in both languages. You'll just save lots of time if you use C#. I've made the switch in last december and I won't ever go back to C++ unless I get paid lots of money for it ;)
Quote:Original post by Eternal
XNA

Generally both C# and C++ have lots of existing libraries you can pick from for just about anything. You can write games in both languages. You'll just save lots of time if you use C#. I've made the switch in last december and I won't ever go back to C++ unless I get paid lots of money for it ;)


I switched to C# too since January. I really don't understand why I didn't do that earlier on. The advantage you gain against keeping up with C++ is just to big to ignore. The speed advantage you lose using C# + .NET is just trivial now, especially with the incoming Multi-core technologies.

There are some cases which I still need to use C++ to gain access to certain libraries only available to C++, but then I just write a wrapper and make it another CLR assembly :D (Reusability FTW).

Let even alone the advantage which let you work together with people who only program in Visual Basic for example.

Regards,

Xeile
Quote:Original post by TheAdmiral
I second the C#-praising, but for completeness, .NET comes with a few considerations.

If your target audience is today's Windows user, then there's no contest. However, if you need to accommodate older versions of Windows (pre .NET framework) or other operating systems, then these managed languages will be of no use to you. In particular, for true cross-platformity, the most popular choice is C++ with OpenGL.

Admiral


Someone's never heard of mono :)

I've had great success using SDL and OpenGL in c# on linux and mac os x.

At the moment, if you really plan things carefully, you can write games that work in windows xp (and whatever versions support .net 2.0), linux, mac os x, and the xbox 360.

This topic is closed to new replies.

Advertisement