Jump to content
  • Advertisement
Sign in to follow this  
EagleEye

Unity [.net] The value of .NET in game programming.

This topic is 4286 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

Over the past few years, I did a lot of research in an attempt to find out what the best technology would be to produce my game. I was looking for a 3D engine to use, and as a result I was also attempting to decide on the language I would use for my game's core code as well. I originally was using Auran Jet (which is now a dead project evidently)... because of the lack of support and updates for that engine, I moved to Ogre. Both of these engines are written in C++... and I was content, at first, to use C++ to develop my game. I was under this really strong impression (beaten in to my head by language fanboys) that "No self-respecting developer would EVER make a game in anything but C++." I think that at the time (circa 2003 I think?), this was fairly true... But here's the problem... I absolutely HATE C++. I hate its antiquated syntax, the long compile times, the hodge-podge method of linking god knows how many dependencies together, and having to update them from god knows how many websites, etc... (ie: stlport, among others), just to get things to compile. It was, to me, like having to learn how to build a car just to get to the point of being able to learn how to drive it. The language barrier, in short, was a real downer for me... but one I was resigned to deal with simply because that was the only real option... ... or so I thought. Sometime in 2005, I found .NET. I was doing a windows maintenance utility for a company I was working for... and after starting on it in VB6 (*shudder*), I found out about VB.NET! (This was about 8 months before VS2005 was released). In a MONTH I rewrote an entire VB6 app in VB.NET, learning the syntax as I went... with no compiler problems, or having to debug linker issues, or having to track down problems with invalid paths in my dependencies, etc... It was amazing! And what I found even more amazing... I learned that VB.NET was fully capable of doing damn near EVERYTHING that C++ is capable of doing... at least in the meaningful things. It truly was like driving a Cadillac! So, I started looking for other engines for my game... I did my research, asked a lot of questions about performance, etc... what I found was this: C++ programmers, in general, are fanboys that don't want to even LOOK at .NET because they simply can't allow their egos to risk having their "leet skillz" become obsolete. They will trash .NET (especially VB.NET) at every opportunity. (On that note... I found it hilarious when I would ask if they liked C#, and they would be like "Oh yeah, that language is fine... but VB.NET sucks!" Then I would point out to them that they're stupid, because C# and VB.NET compile down to the same intermediate language that is compiled by the JIT compiler... made them eat a little crow there...) I found that there ARE C++ programmers out there that are knowledgeable about .NET... amazing how they don't mind it at all, but the C++ programmers that haven't even LOOKED at it, and know nothing about it, make it out to be like it's worthless. I found that .NET is about 95% to 98% of the performance you'd get from a C++ application... and I determined that the minor performance hit was worth it for the reduced headaches and shorter production time. I found that .NET has a lot of premade stuff in it that, while available in C++, you'd have to find the right addon library for it, and add yet another dependency... it's all just THERE for .NET. IT was then that I realized that the .NET library is pretty much an UPGRADE of the old C++ "MFC". So anyway... I am now working with a .NET-based 3D engine (Truevision3D), which is basically a front end API for DirectX... it exposes all of the capabilities of DirectX to VB.NET (and C#, and Delphi, and ASP.NET, etc... even VB6!) SO here I am, with a client app written entirely in VB.NET... with an input system, a GUI system that I wrote FOR Truevision3D, a fully functional networking system (using TCP and UDP), that communicates with a server... again, which is written in VB.NET, using an ODBC connector to do the database work, a multi-socket network listener... even a Windows Form on top of it all to control the game server's settings while it's running! And the damn thing is SCREAMING fast! There is one thing missing from it all... AI. That is the ONLY thing I haven't even bothered to do anything with, because my brother (Dave, aka InnocuousFox) is going to be handling that. Here's the problem, though. Dave seems convinced of the same things those above-mentioned "fanboys" all chirped at me... maybe not specifically with game programming as a whole, but specifically with AI. He seems convinced that AI is best done in C++, and that we'd rather deal with the hassles of interop/CLI/COM, than for him to learn a new language and library. Now, he may very well be right here... maybe AI *SHOULD* be done in C++... But I'd like the opinion of some fellow .NET people here, as well as other AI programmers, or just other game developers in general. Am I being anti-C++ here? Is Dave being anti-.NET? Would Dave benefit in other ways from learning .NET? Should Dave ditch his "C++ only" mindset? Am I not realizing the limitations of .NET, or is Dave not realizing its potential and power? Is it really necessary for game developers to know C++ when they're not doing any low level hardware-layer stuff (like you would do in the actual 3D engine)? Hell... is C++ even NECESSARY for non-engine game programming? If given the choice, would YOU pick .NET over C++ for your game development, specifically for things like game LOGIC (not just AI, but game flow and message processing between systems like input to GUI, network to... anywhere?) Discuss please! [Edited by - EagleEye on March 9, 2007 3:33:00 AM]

Share this post


Link to post
Share on other sites
Advertisement
Am I being anti-C++ here?

No, you are doing the exact same that a C++ fan boy would do by saying, why should you write in another language when you are happy with VB.NET :) Its all personal preference and some people still maintain that C is still the best development language because its fast.

Is Dave being anti-.NET?

No, he may be onto something but it depends on what AI system your using. I think as a rule, if you need it to be really, really fast then you have to consider C/C++.

Would Dave benefit in other ways from learning .NET?

Probably, I love C++, but I would like to learn C# for Tool development and rapid application development

Should Dave ditch his "C++ only" mindset?

Thats up to Dave :)

Am I not realizing the limitations of .NET, or is Dave not realizing its potential and power?

No Dave has a good point about speed in an application and you have a good point about speed of development.

Is it really necessary for game developers to know C++ when they're not doing any low level hardware-layer stuff (like you would do in the actual 3D engine)?

Yes, because the majority of the time I dont do low level hardware work and it still needs to be blisteringly fast or i would be fired :)

Share this post


Link to post
Share on other sites
I've used a LOT of C++ and C# (and a bit of C++/CLI), and I've also coded some sections of high-level AI in C++ for two games so far. As far as AI goes, other than the low-level pathfinding and line probing stuff it's really not that math/processor/memory intensive, and is more about making sure you're just handling the bajillion state/animation transitions between different entities in the correct order.

For everything other than pathfinding, having the ease-of-development from .Net would win versus anything I can think of that C++ might do better (which isn't much).


C++ has some things that .Net languages don't... Macros, insane template tricks, multiple inheritance... But many of those things just completely confuse the hell out of you when something goes wrong. Can you debug some ridiculously gory expanded template mess? Sure. But do you WANT to?

.Net languages (C# in particular) have things that C++ needs ugly templates or hacks for. Delegates? Anonymous delegates? Reflection??! Fully automatic GRAPH deserialization (without more than one line of code tagging serializable classes)?! On the fly compilation (not interpreted!) of code? (the built in .Net Regular Expression system uses this, and trust me, that system is 'blisteringly fast') There are tons of totally different ways to do very very complex tasks using very simple methods in .Net that are still easy to understand and debug.


Perhaps the best part about .Net is that you can mix-and-match your languages. If Dave wants to use C++, he can use C++/CLI (although why bother learning the extra freaky keyword rules when he could (probably) learn C# faster?)

Share this post


Link to post
Share on other sites
Interesting analysis there Nypyren...

To be sure, Dave is VERY smart, and can learn new languages very easily... hell, he has a background in VB (for MS Access)...

I think one of his issues is that a lot of AI stuff out there (like code samples in books and such) are already done in C++, and he would want to just drop pre-done code in to start things out, and work up from there.

I think one of the major disconnects C++ programmers have when it comes to .NET is they think they'll have to rewrite all this old code they have built up over the years that allows them to do the stuff they want to do... when in fact, .NET removes the necessity of that cludged coded entirely... the library truly is cutting-edge.

Share this post


Link to post
Share on other sites
Quote:
Original post by carllloyd
Am I being anti-C++ here?

No, you are doing the exact same that a C++ fan boy would do by saying, why should you write in another language when you are happy with VB.NET :) Its all personal preference and some people still maintain that C is still the best development language because its fast.

A true fanboy would say "C++ only because .NET sucks" without even knowing anything about .NET. [wink]

I've done C++ in the past for many years and I'll never use it again unless I'm forced to. There's just no good reason for me to use it.

Unless you're doing near-cutting edge stuff, .NET is perfectly capable of doing great games, especially with the advent of XNA. Take a look at the results of the Dream-Build-Play competition when it's over and see if that's not the case.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I do like .net, but some computers I program for don't have the .net framework.

Share this post


Link to post
Share on other sites
The reason I don't like .NET isn't from a programming standpoint, but rather a user standpoint. On every computer I've seen, .NET applications take much more time to load and are less responsive than native applications. Now, I know there must be some .NET applications that don't fit this stereotype, but I have yet to find one.

I'm sure .NET is much easier and probably more fun than coding in C++, but I think the users are paying the price.

My recommendation would be to use .NET (or java) for in-house tools, and use native code for anything that will be sold or released to a user.

Share this post


Link to post
Share on other sites
I'm just really sad that there isn't a half-decent C# IDE for OS X, and the end-user problems (on Mac) are even more annoying.

Share this post


Link to post
Share on other sites
The reason you see that some .net apps are slower is becuase the people writing them didn't take the time to understand the costs of varies .net calls. It is no different then doing Win32 api calls and not understanding what is being called. There are many Api calls that will drag an app to a stop if you use them too much. If the call is going to take a lot of time then you need to either let the user know this by some method or call it in a non-blocking fasion so the application keeps running.

In my opinion it is not .NET that is at fault but the people using it without understanding what is going on under the surface.

theTroll

Share this post


Link to post
Share on other sites
I must mention that I have been a little misrepresnted here. ("You can indict a ham sandwich.") I AM a VB guy... years worth of VBA while doing Access/SQL databases. I am only recently come to C++ in fact which I learned specifically for game development. The reason I did that, in fact, was that I found that 90% of the game development world was written in C++. Because of that, I found that if I wanted to use anyone else's code to plug into my own game projects (e.g. downloads or AI code from the "Gems" books or "AI Wisdom"), then my project needed to be in C++. I am not inherently biased against .NET or VB - the existing base of game code is. I am not convinced that AI is best done in C++... I'm convinced that all the stuff I want/need to use already IS in C++.

To specifically answer the questions he posed:

But I'd like the opinion of some fellow .NET people here, as well as other AI programmers, or just other game developers in general.

First note... you actually think you will get an unbiased answer in the .net forum? People who don't use .net for whatever reason don't even enter this forum. Try asking the question in the "Game Programming" forum if you want unbiased answers. (Note: if you misrepresent me again the way you did here, I'll simply drive over and kick your ass.)

Am I being anti-C++ here?
No more than Mac or Linux people believe in their products over the popular alternative.

Is Dave being anti-.NET?
The way you present it? Sure. But, as mentioned, I'm being pragmatic. I simply don't want to rewrite a ton of already written code that I like to use simply because of the preference of one developer that I may or may not work for - for free.

Would Dave benefit in other ways from learning .NET?
Sure. It would make me more employable outside the game world. Same thing for Java and a lot of other languages. Hell, in 1999, it would have been nice to know COBOL to help with the Y2K bullshit. I actually plan on getting into .NET at some point... but probably not for AI or game programming simply because it is not yet convenient.

Should Dave ditch his "C++ only" mindset?
...which I don't really have. However, I have a bookshelf full of articles and code that are... oddly enough... "C++ only".

Am I not realizing the limitations of .NET, or is Dave not realizing its potential and power?
I think you are not realizing the scarcity of .NET... and simply the fact that I don't want to burn calories on another language at the moment.

Is it really necessary for game developers to know C++ when they're not doing any low level hardware-layer stuff (like you would do in the actual 3D engine)?
If you want to get a job working for or with someone other than yourself, you damn well better know C++.

Hell... is C++ even NECESSARY for non-engine game programming?
Define "necessary"... you can actually write entire games in Python if you want. And with the pre-written engines and SDKs out there, you don't need to do a lot on your own to write an actual working game.

I can't believe that I actually had to deal with this...

edit: added other references from other forums on GameDev

One large one and others referenced in that one.

1) Professional Games Made In C#?
2) Java for game development?
3) Java----C/C++
4) c++ or c#
5) Question about Java Vs. C# Vs. C++
6) Java Games?
7) Java is fast?
8) Secondary Language:VB or Java?
9) What makes C++ so powerful?
10) C# games and cheating...
11) Is C# good enough for system utility programming
12) MC++ vs. C#
13) Which language is best for a 3d Games Engine?
14) C# vs C++ as a choice for development
15) Is Java the Future?
16) why C# and not Java?
17) What do you think of the D language?
18) my c++ d c# benchmark!
19) The Definitive Guide to Language Selection
20) Sharp Java
21) C++ or C#?

[Edited by - InnocuousFox on March 9, 2007 10:24:15 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!