C++ or .NET enviroment

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
ledstrom
Posts: 1
Joined: Mon Apr 16, 2007 4:33 pm
Location: Sweden
Contact:

C++ or .NET enviroment

Post by ledstrom »

Hello! Me and my friends are trying to do some cool stuff with the irrlicht as a school project..
My question is what is best for developing? In .NET enviroment or C++?
What is fastet, what is most stable and got most help?!

Thanks! :D
thephoenix
Posts: 19
Joined: Wed Jan 25, 2006 7:44 pm

Post by thephoenix »

I think C++ is used more widely, it is faster for it does not use interpreted bytecode as .NET, but if it is more stable really should depend on you, maybe it is a bit more tricky to use somtimes (I don't have any experience with .NET, but that's what is said...).

I prefer C++.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

i give my vote for c++, however c# isnt so bad. c# is easyier, but its not cross-platform completely (see MONO project). c++ has much more capabilities but for school project i gues you dont need them. while ago irrlicht .net binding could not support all standart irrlicht functions, i dont know its current condition. for simple school project i would suggest you to use c# if you want just to make it and get rid of it. if you want to learn something useful and have more fun - c++ is your friend :)
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Do not trust c#. It is the spawn of the devil and will consume all programmers who have not yet allied themselves with c++. Thee who shallt not bow down to the master c++, who is good, shall have to suffer ethernal damnation in the flames of Belsebub the destroyer and perverter!

Ehr, i mean.. err... Just stick with c++, and you'll have lots of advantages.
If you don't have anything nice to say, don't say anything at all.
bigfish
Posts: 19
Joined: Fri Mar 23, 2007 6:18 pm

Post by bigfish »

If by "advantages" you mean memory leaks, painful string manipulation, and pointer headaches, then yes, C++ has lots of advantages. ;) C++ is indeed a great language but for a school project I highly recommend going with C#. Chances are you're not looking for tip-top runtime speed but development speed is at a premium. I'm in the same exact situation and am using Irrlicht .Net CP. It's got most of the features of the C++ version of Irrlicht but you get all the creamy goodness of C#.

By the way, calling C# pure devil spawn is a bit harsh. It's more like the love child of Microsoft (aka Satan) and Sun. It's just Java with some of its shitty qualities removed and a few other handy bits thrown in.

(All of the above comes from the mouth of a long-time C++ fanboy and Microsoft hater to the core. Actually I guess it's from my fingers and not my mouth but you get the point.)
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

I would say your best bet (seeing from the posts above) is to consider which would be faster for you (school deadlines), and how many features you will really need (are you going to be making something triple a, or is it casual?).

FlyingIsFun1217
pedrosal
Posts: 5
Joined: Tue Sep 20, 2005 12:01 pm

Post by pedrosal »

I have done that same question a lot of times. Just some facts to help you decide by yourself:

.NET (C# included) is not interpreted. In an assembly it is stored in intermediate language. When required the IL is compiled into native code. You can optimize an assembly to a given CPU... the compilation is then made on compile time. So the first time you use a class you get a performance penalty. In games I don't see a point here because games always take quite a while to load :). One more second won't hurt.

C++ is faster. I read an article about a quake port to managed c++ and the decrease of performance was about 10%. But to be able to compare it it is necessary to check why. .NET arrays are always checked for boundaries. .NET manages its own memory by using Garbish Collection. .NET always checks the stack for overflows... and so one... Now if you use Smart Pointers, Garbish Collection, Safe Arrays and other C++ implementations of the very same features how faster is C++? I have never seen an article on this but I would say the 10% will get shorter and shorter.

.NET has a very complete development framework. I have never seen a class library as complete and easy to use as the .net framework and also as consistent. Do you know the design team gets together just to discuss the method and class names :)?

.NET has better debugging, better auto completion and compiles faster.

When using a C++ library (you can think of irrlicht engine) in .NET you get a performance penalty because types have to be marshaled back and forward in order to connect both worlds.

To finalize some ideas:

- If you can load your scene graphs in native code and maintain your game logic in managed code you will probably get a balanced solution.

- For smaller projects you will like the C# compile times.

- Try to understand how .net calls C++ native APIs so that you can have a clear idea of the performance impact of calling an API with Interop. With this in mind you can better decide what to do in a managed world and in a native world.

And good luck...
bigfish
Posts: 19
Joined: Fri Mar 23, 2007 6:18 pm

Post by bigfish »

Pedrosal, just one little typo that could be confusing...
.NET (C# included) is not interpreted. In an assembly it is stored in intermediate language. When required the IL is compiled into native code. You can optimize an assembly to a given CPU... the compilation is then made on compile time
I think you meant to say runtime, not compile time. The translation from the intermediate language to native code is done right when you run the program which is why there's a little bit of a delay at first. I agree that it's definitely not an issue with things like games!

Oh and it's "garbage collection", not "garbish collection" but that's just nit picking..... ;)
Post Reply