[.net] 3d engine on .Net , worth?

Started by
70 comments, last by GameDev.net 19 years, 4 months ago
I am transitioning my 3D programming activities from C++ to C# .NET and have some practical experience with the issues. There are basically two aspects to this discussion - C# language and the .NET platform.

With respect to the C# Language vs C++ or others. As you all know by now, language debates never result in a clear winner. Your knowledge and skill in using the tools of your language is most important. Let the compilers handle the rest. I am definitely seeing the productivity improvements promised by C# and the framework library but I do have some issues with the .NET platform.

I am running into 3 issues with .NET as a 3D programming/gaming platform:

1. Garbage collection interupting program execution - basically causing hickups in the frame-rate.

2. JIT compiling in the middle of the program causing hickups. When .NET reaches a new section of code that it hasn't executed previously - it has to stop and compile it.

3. Distribution of software. Depending on when they installed them, it is possible for an end user to have .NET and DirectX but not DirectX.NET and getting this sorted our requires a complicated installer - far more complicated than it should be.

There are workaround for all of these - but working through these issues seems to negate all the productivity gains of using the new tools in the first place.



Advertisement
Quote:Original post by _DarkWIng_
Quote:Original post by Anonymous Poster
Now getting a licence to develop for it would be another story.

Why? Who would have to pay to whom?

Sony?
Quote:Original post by wacampbell
There are workaround for all of these - but working through these issues seems to negate all the productivity gains of using the new tools in the first place.

While I agree to your first argument, the second can be done during install with no significant extra work from your side (e.g. adding a small script) and the third point is just ridiculus.

One point in PC application distribution is 'never assume'! That's why you'll find the required 3rd party software and libraries in every commercial game package. Adding two more items (DX.NET and .NET) is nothing special all. Ever installed a large app on Linux? There are tons of depedencies taht need to be matched correctly and no one bothers about that because it's common practise.

While I see the reasoning behind your last point, I clearly not take it as a .NET specific issue. It is there since day one (on the PC, that is).
Quote:Original post by Integra
Quote:Original post by Anonymous Poster
Quote:Original post by Promit
A couple things.

You guys underestimate how portable MS apps are, in reality. They don't normally release stuff for anything other than x86 boxes...but the NT kernel wasn't even designed on x86. It was originally on a MIPS, IIRC. That thing is every bit as portable as the Linux or BSD kernels...should MS choose to do so.

I suspect the .NET Frameworks are the same. Remember, there's a Compact framework, which is run on all sorts of small devices, most of which run MIPS. And a MIPS is big endian...a PPC release would be trivial.


As the Mono project rapidly approaches a stable release, it's not difficult to write programs that compile to completely portable binaries, Of course you have to be aware of endian issues...unless you use .NET serialization. You have to avoid certain libraries, of course, but Gtk# and such give you more or less the same capabilities.


Hmm...I think it was actually PowerPC, because a lot of early devving and testing was done on macs, before PC's became viable, but that's trivial.


If you are referring to the NT kernel you are wrong, as Promit stated the NT kernel was built for MIPS but was later moved to the x86 platform. Although as stated as well, a PowerPC release would be very trivial if a working MIPS core was established.


Sorry, that was me.

I had some talk with a couple of the NT guys over the summer about this. They told me that PowerPC (or whatever mac used back in the day), still exists in the NT kernel, not in an up to date state, but it still exists. They said back in the day, a lot of dev and testing was done on the PowerPC, though obviously there was never a release for the PowerPC.
VSEDebug Visual Studio.NET Add-In. Enhances debugging in ways never thought possible.
Actually there was. NT4 was released for PPC, and I believe 3.51 was too. And incidentally, NT was originally designed for the i860.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Quote:Original post by wacampbell
1. Garbage collection interupting program execution - basically causing hickups in the frame-rate.


Grab a copy of the free CLR Profiler from MS and look at why exactly the GC is going off so much. Especially watch for things getting unecessarily getting promoted that are causing unecessary gen 1 and 2 collections. A timeline view that doesn't look "normal" can also indicate where the problems are.

Quote:Original post by Martee
Actually there was. NT4 was released for PPC, and I believe 3.51 was too. And incidentally, NT was originally designed for the i860.


I stand corrected, I had no idea. Of course, if MS release XP for the Mac these days they'd get sued.
VSEDebug Visual Studio.NET Add-In. Enhances debugging in ways never thought possible.
Quote:
1. Garbage collection interupting program execution - basically causing hickups in the frame-rate.

Your not using Application.DoEvents() in your main loop are you? This will definitely cause the GC to fire more frequently.

Also use of the IDisposable interface is a good idea - it will give you a lot more control over when the app does this.

From the docs - regarding IDisposable:
Quote:
The garbage collector automatically releases the memory allocated to a managed object when that object is no longer used, however, it is unpredictable when garbage collection will occur. Furthermore, the garbage collector has no knowledge of unmanaged resources such as window handles, and open files and streams.

Use the Dispose method of this interface to explicitly release unmanaged resources in conjunction with the garbage collector. The consumer of an object can call this method when the object is no longer needed.


This will give you better control over when its disposed of. There are other methods you can use to ensure your objects are not disposed of until you are ready. I know a lot of people don't like the idea of Garbage Collectors - it does take the control away from the programmer to a degree, but it also eliminates a lot of bugs.

And as I mentioned earlier, c# .net has already been used to develop and release a commercial game, so it must be at least satisfactory for a range of titles. Remember, not all games are doom 3 - so not every game needs this kind of performance. There is a huge portion of the market place that could be produced using tools such as C#. I love C++, but i'm only one programmer, and sometimes I need the leg up that developing in C# gives - thats the trade off. No Doom 3 style graphics engine, but I wasn't going to do that in C++ by myself anyway.
The original NT kernel was built by MS under contract by IBM for a chip that finally shipped 9 months late, iirc. Before that, they did their development on an emulator. Then they gave up on IBM (which always had and still has a terrible record for getting stuff done) and moved to the x86 platform, developing NT primarily for PCs and eventually deciding to construct a new Windows on top of NT.


Based on the fact that .NET comes in a portable version which runs on PDAs and WinCE, I'm willing to bet that the entire framework is platform agnostic and could be ported to any architecture, if there was a reason to. Considering the XBox2 is almost certainly going to use some evolution of the G5, a PPC port of .NET seems inevitable.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
I am not quite following the "You're Just Plain Wrong" logic here. Let's look at the original quote"

"The obvious advantage is that, like it or not, .Net is the future because Microsoft wants it, so the sooner we migrate, the better."

Are you saying that you believe and agree with this statement? If so, why? I do not understand why one would think that it is better to do something just because Microsoft wants you to do. Please clarify.

Also, I still think that statement is more accurate:
"The obvious disadvantage is that, like it or not, .Net will never work as well on all other consoles and operating systems. .Net will never perform better than C++. .Net will never be governed by a neuetral standards body..."

Even if .Net was a better language for game development, then Microsoft would NOT want the PS3 or Linux to be able to use it. They would prefer to have .Net be their competitive advantage. It will always work better on Microsoft products than on other platforms.

.Net will not perform better than c++ - perhaps it will perform on par. Let's not waste time on this one...

Ultimately, Microsoft is in control of .Net. ECMA - Please. Microsoft controls where .Net is and isn't going.

Once again I will close with the friendly
Happy Coding (even on .Net)

(This is much better than the typical "You Are Wrong, Stupid, Evil, and You Can't Read" that is so often posted)
;-)

-----------DO NOT READ BELOW THIS LINE-----------------------
In the long run, Open Standards will prevail for common infrastrucure. Like TCP/IP.

Did you know Doom3 uses OpenGL instead of Direct3D? I bet that makes their port to Linux and the Mac easier. Imagine that, state-of-the-art graphics AND portability. That sounds like a recipe for success.

Not only do I think you should use c++ for your language - you should use openGL for your graphics.

Keep the playing field level and open.

This topic is closed to new replies.

Advertisement