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

Started by
22 comments, last by TheOther 17 years, 1 month ago
Quote:Original post by Nypyren
C++ 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.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Advertisement
Quote:Original post by benryves
Quote:Original post by Nypyren
C++ 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!
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.
Quote:Original post by Sneftel
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.


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...
Jared "EagleEye" Mark
Quote:Original post by EagleEye
It'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.
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.
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.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

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...
Jared "EagleEye" Mark
Quote:Original post by EagleEye
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.
#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.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

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
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.

This topic is closed to new replies.

Advertisement