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

## Recommended Posts

##### Share on other sites
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 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 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 on other sites
Quote:
 Original post by carllloydAm 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 on other sites
I do like .net, but some computers I program for don't have the .net framework.

##### 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 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 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 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 on other sites
Quote:
 Original post by NypyrenC++ has some things that .Net languages don't... multiple inheritance...
For the record, that is not entirely true. Multiple inheritance is supported with interfaces, just not with classes.

##### Share on other sites
Quote:
Original post by benryves
Quote:
 Original post by NypyrenC++ has some things that .Net languages don't... multiple inheritance...
For the record, that is not entirely true. Multiple inheritance is supported with interfaces, just not with classes.

Believe it or not, I program in C# for over 80% of my tasks and time and multiple inheiritance (of implementation) is one of 3 things I constantly hate not having in .NET.

I use interfaces (extensively), and build systems of reusable, plugable binary components.

But dammit, whenever you want a things which needs to act as an A and a B, having to frigin forward all the calls of 1 or the other behavior manually just because the compiler is too stupid to support a syntax for specifying that in one line, pisses me off.

I'm not even asking for C++ style, identify modifying, legacy pointer based multiple inheiritance. And yes, I understand the evil problems for both compiler writers and programmers in such a system (when dynamic_cast<B>(obj) != dynamic_cast<A>(obj) it is easy to screw up logic big-time). But dammit, C# has explicit interface implementation, whatever happened to HELPING developers GET WORK DONE. how about something like:
public class C : IA, IB{  private A a;  private B b;  forward IA a; // auto forward all methods in interface IA to member object a;  forward IB b;}

that's just thought one, obviously the compiler writters can change the details to be truely appropriate to their vision, but come on, THIS:
public class C : A, IB{  private B b;  void IB.Method1(a1, ...)  {    b.Method1(a1, ...)  }  ...}

just sucks!

##### Share on other sites
Personally, I hate doing AI stuff in C++. This is primarily because I do AI stuff in a generic style with lots of functional programming, and in C++ this generally means either disgusting amounts of runtime overhead from Boost's nooks and crannies, or ten times as much code.

With that said, Dave's a smart guy. He's fully capable of doing stuff in C++. And getting C++ and .NET to talk with each other turns out to be really, really easy, so there's not that much development friction that'll be added by going with a mixed approach. Let Dave do his thing, and you can do yours.

##### Share on other sites
Quote:
 Original post by SneftelPersonally, I hate doing AI stuff in C++. This is primarily because I do AI stuff in a generic style with lots of functional programming, and in C++ this generally means either disgusting amounts of runtime overhead from Boost's nooks and crannies, or ten times as much code. With that said, Dave's a smart guy. He's fully capable of doing stuff in C++. And getting C++ and .NET to talk with each other turns out to be really, really easy, so there's not that much development friction that'll be added by going with a mixed approach. Let Dave do his thing, and you can do yours.

I do want to say that I agree with you here... Dave IS a smart guy, and I never intended to make it out like he wasn't.

He linked me to a bunch of threads on here where the topic has already been discussed... most of them are "C++ vs C#" threads, but it's all the same. :)

The thing that kinda bugs me about this particular case is that we're specifically talking about AI here, and the assumption that it's better to use pre-written code in C++ (and then modify it to the needs of the app), than to use the language the rest of the game is being written in. Especially if, as you say, C++ AI code is cumbersome and has tons more code, etc... It seems to me the benefit of using the pre-written code snippets would be offset by the necessary customization of that code, and the integration in to the main project.

Honestly, if C++ were to be used on a game server's AI for the entities, it might as well be used for the rest of the server as well, just so all of the data is preserved and not having to be passed between languages all the time.

It's that transition between the two languages that really concerns me...

##### Share on other sites
Quote:
 Original post by EagleEyeIt's that transition between the two languages that really concerns me...

It certainly seems so. If I were you, I'd spend a few hours learning about this. Figure out what's involved in using C++ with .NET, so that you can determine exactly what it'll add to your particular project.

##### Share on other sites
For AI, which is mostly algorithms and maths, any compiled language is fine. The code will probably look pretty similar in C++ or C# ...

But yeah, asking this in .Net isn't going to get a lot of anti-.Net sentiment.

##### Share on other sites
Please note that HIS code is written in VB.net - so we aren't just talking C++ connecting to C#. That's where the problem lies. If he creates all the character info and the world code in VB.net, it isn't so easy to write the actual "monster" AI in C++. For example, there would be a lot of shared base classes between the character and the world entities. Which language do you write them in? See the problem?

I would like for "BaseEntity" to be in C++ so I can inherit stuff all the way down the tree from that. However, that means that his character stuff (in VB) would then have to either have its own base class or we have to band-aid things together. Alternately, if "BaseEntity" is in VB, and maybe even "MovingEntity" (inherited from BaseEntity), then where does the C++ begin? *shrug*

It's his project, so he makes the call. But at some point, I may not want to bother.

##### Share on other sites
What he says is right... do we really want to have duplicated class structures across languages, and pass the data between the two? That's a nightmare for sure...

The way I see it, that's not really an option, so the only options I really see are:

- Rewrite the server to be completely C++ (which I wouldn't really object to for speed reasons... just that it would be a major PITA to do so, considering I already have the network and database code done).

- Do the AI in .NET... and have me actually do the programming, with Fox doing the design of the actual objects, and conceptual AI documents that I can work off of.

That second one is the more attractive option for me... I'm sure I can write the AI myself. I think I just need help with conceptual stuff anyway.

To a certain extent, I have to admit that I'm sort of a ".net fanboy" myself... I'm writing an entire game in VB.NET... both client and server... (granted, using a C++ engine core in the DirectX SDK, with an API to access it via .NET in TrueVision3D). I certainly have my technical reasons for doing so that go beyond mere "fanboy"-ism. I have to admit, though, that I want to prove to the world that .NET is a capable game development platform. The whole "Everyone else does it this way so this is how it must be done" thought process is one that I instinctively reject... but that's a topic for another day. :)

Anywho... thanks for the feedback guys...

##### Share on other sites
Quote:
 Original post by EagleEyeThe way I see it, that's not really an option, so the only options I really see are:- Rewrite the server to be completely C++ (which I wouldn't really object to for speed reasons... just that it would be a major PITA to do so, considering I already have the network and database code done).- Do the AI in .NET... and have me actually do the programming, with Fox doing the design of the actual objects, and conceptual AI documents that I can work off of.
#3, the network code and actual serialized database (which you don't use live-time anyway) can stay as is. Only the game object hierarchy needs to be homogenous. It doesn't matter how you transmit or save the data really. But now we wander off topic... I only post it here to see if anyone has ideas on how this sort of thing could be accomplished.

##### Share on other sites
You want to use C++ so that you can use existing libraries?

Well then, use managed C++ (yuck), C# or VB.NET for the code that you write, and then interop with the existing (native C++) libraries. This will presumably be easier than writing all your code in C++ and having interop between that and the rest of the game code, because the interfaces to the external libraries/code-bases that you're using will have nothing specific to your game in them, and will be much more easily to isolate.

If you want to work with existing code bases but modify them to fit into your project, then that might just be one of the occasions where managed C++ could actually be useful - if you're going to be modifying the code to fit in anyway, then it hopefully wouldn't be too hard to apply whatever modifications are needed to make it run in a managed environment (but I have no experience with this - it's just a hunch).

John B

##### Share on other sites
It's not just a matter of using libraries with hooks in them. This is code that I want to use in and around my own things... an A* algorithm or a state machine system that I will actually import and modify for my own use. This is stuff that will be actually used INSIDE my own classes as well as being connected to them.

##### Share on other sites
Just thought I'd chime in..

I've been using C++ for a very long time and continue to do so for my gaming projects.

I absolutely love .NET and I think it will "be there" for games down the road.

Right now, it just doesn't seem to have enough market penetration for indie games.

Heck, even in the AAA crowd, the only (major) .NET project released commercially so far is ArenaWars.

Ultimately, it's your project so you're free to use whatever technology you want and must make your own decisions with respects to the audience you're making your game for.

hth,

##### Share on other sites
Quote:
 Original post by TheOtherRight now, it just doesn't seem to have enough market penetration for indie games.
And that has been my entire point. [rolleyes]

##### Share on other sites
Quote:
Original post by InnocuousFox
Quote:
 Original post by TheOtherRight now, it just doesn't seem to have enough market penetration for indie games.
And that has been my entire point. [rolleyes]

Then high-five my friend! :)

Depending on your finances (and putting a *LOT* of faith in future trends), you could go the .NET route and hope the marketplace eventually follows suit. You'll then be in the perfect business position at hte perfect time.

In one way, all these constant virus and hacker threats to a Microsoft OS only helps .NET developers, because even the "mainstream media" regularly advises you to update your OS (which in turn usually pulls down the latest .NET runtimes)

And as customers ditch their Win95 boxes for brand-spanking new dual-cores, they'll have the .NET framework already deployed to the box.

But again, considering the casual developer is still working with DirectX8.1, it may take a while before C#/VB.NET become more of a serious option.

just my .02

hth,

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978617
• ### Similar Content

• By trjh2k2
I've never really been a "Unity guy", since all of my game-dev learning happened in C++, and in other engines, but I recently discovered the "complete projects" section in the asset store.  It's full up on projects you can buy that are billed as "ready to customize and release", with full ad integration.  Some of them claim to be for educational purposes, but why would you include a complete, polished, full featured game with ads as an educational example?
This leads me to the question of why this goes by unchallenged?  Does Unity and the environment of the Unity Store actively encourage this style of game development?  Is the problem of asset flipping our own fault?  I don't mean this as a "we should make Unity shut this down" kind of thread, but rather just to examine whether or not the environment of being able to just buy whole games or pieces of games is something that damages the industry.  I get why Unity would allow it, and I'm sure it's a working business model for some people- and maybe some people DO actually just use these to learn from, but I'm not that naive as to think that there aren't people who recognize this as one of the shortest paths to putting a game on the market so they can cash in.
Thoughts?
• By StefanJo
Hi everyone!
I have just released a project called Line Driving to the Unity Asset Store.
Line Driving is complete project ready for release for both Mobile and PC.
It is a game where you have to draw your own road for a car using mouse controls or touch input.
Features:
1.Simple to understand,detailed commented scripts
2.Well-written documentation
5.Easy to customize
and much more…
Support email: sjovanovic0831@gmail.com

• Got the UI Inventory screen working now.
Fully keyboard and mouse driven, this is where you manage all your items split up into separate 'tabs'.
This is the 'Fossil' management area.

• Hey, I'm looking for some people that can help me with a game that I'm making that is a 3d platformer.
I mostly need someone for character design and animation,  I can do some coding but if you can do coding as well you're still welcome because I'm still not the greatest at coding just yet.
if you need to contact me add me on discord @ Kurupted#1206

• Hi,guys.I m working on a Fantasy RPG.Currently i m work alone on the project.I really need someone can make UI stuff.If someone can handle it please feel free to contact me on email: 270514974@libero.it.
Thank you guys and sorry for my english.

• 9
• 13
• 12
• 10
• 12