Managed C++ for Game Programming?

This is a discussion on Managed C++ for Game Programming? within the Game Programming forums, part of the General Programming Boards category; I've begun to rewrite my engine, using Windows Forms for the UI, which uses Managed C++/CLR/.NET (i'm not really sure ...

  1. #1
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070

    Managed C++ for Game Programming?

    I've begun to rewrite my engine, using Windows Forms for the UI, which uses Managed C++/CLR/.NET (i'm not really sure which is the appropriate name; I don't really know the difference).

    I'm wondering though, if MC++ is suitable to code the engine framework in. Would it cause the engine to be slower? Are there any advantages to MC++? Or would I be better off just sticking with standard C++ for the engine framework, and leaving the Managed stuff to the UI?

    Sorry for the many questions at once, but I really don't get what this Managed C++/CLR stuff is all about, and certainly not how it would affect game programming.

    Thanks.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,467
    Stroustrup is not very happy about it.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    but I really don't get what this Managed C++/CLR stuff is all about, and certainly not how it would affect game programming.
    It's about Microsoft. No, it's not good.

  4. #4
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Quote Originally Posted by psychopath
    I'm wondering though, if MC++ is suitable to code the engine framework in. Would it cause the engine to be slower? Are there any advantages to MC++? Or would I be better off just sticking with standard C++ for the engine framework, and leaving the Managed stuff to the UI?
    Managed C++ could be suitable to code a game engine framework with if all of your engine code is unmanaged C++ and you're only using the .NET extensions for the UI like you say. The unmanaged code will be compiled into actual machine instructions just like C++ would so it may not be very much slower if you know what you're doing.

    IMHO I'd stay away from developing a game engine with Managed C++ though, because the relationship between managed and unmanaged code is pretty awkward and I can imagine it turning into a debugger's nightmare real fast.

    And just a personal note here, but I've never come across a good example of Managed C++ being useful enough to justify its existence.
    Last edited by BMJ; 07-10-2006 at 10:13 AM.

  5. #5
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    I actually decided to go with C++/CLI for everything (UI and engine) since I first posted this. So far, i've noticed no slowdown (as long as I run the exe in release mode). I can always run NGen on the exe if I need to.

    I did make an attempt at just keeping the windows forms related stuff managed, and the rest native, but that turned out to be very difficult to keep up, due to the incompatible types, and conversion and marshaling usually doesn't work properly for this. The main problem I had though, was OpenGL. In order to run OpenGL in a control in the UI, I needed to use OpenGL bindings for .NET (I used the Tao Framework for this, if you're interested), meaning that my engines OpenGL driver would need to be managed, and this of course, would not mix very well at all with native code. For example, the managed version of glVertex3fv() takes a managed array; if I coded the rest of the engine in native C++, the engine would probably try to pass this function a native array. Converting this would be very slow, perhaps moreso than just using C++/CLI for everything, and avoiding ugly conversions.

    The only code I have kept native, is in some file loaders which depend on knowing the size of a struct at compile time.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing params between managed c++ and unmanaged c++
    By cechen in forum C++ Programming
    Replies: 11
    Last Post: 02-03-2009, 07:46 AM
  2. Does managed code make people stupid?
    By zacs7 in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 07-28-2008, 04:10 PM
  3. Managed Vector
    By Coding in forum C# Programming
    Replies: 2
    Last Post: 05-19-2008, 07:15 PM
  4. instantiate unmanaged object in managed code
    By Redhead in forum C++ Programming
    Replies: 1
    Last Post: 01-11-2006, 06:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21