XNA Creators Club Online
Page 1 of 1 (9 items)
Sort Posts: Previous Next

Native Libraries Mixed With XNA In Published Game?

Last post 09-27-2007 9:30 PM by ShawMishrak. 8 replies.
  • 09-27-2007 3:25 PM

    Native Libraries Mixed With XNA In Published Game?

    As a hypothetical question, if I were to build a game using XNA and Game Studio that made use of a native library with a managed wrapper, is it possible to have that library/managed-wrapper combo put with the game on the Xbox 360? Just curious as I'm starting to think about using a wrapper for a physics library.
  • 09-27-2007 4:10 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    Nope... native x86 code won't run on the Xbox 360 since its a Power PC.

    Well at least as a GSE/CC user that won't work. Now if you write a good enough game and got a publishing deal and access to a dev kit etc... well then I guess you would have access to the right compilers and documentation to at least try it.



    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 09-27-2007 4:23 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    Well hm. I was only considering the possibility of during publishing so as a GSE/CC user I know I can't do it. More just curiousity than anything. I'm nowhere near a publishing deal (in fact I haven't even started on the project that will be using the native library yet :)).
  • 09-27-2007 7:53 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    There is no way to interop into native code from the XNA Framework on Xbox, regardless of whether or not you have a publishing deal.
    XNA Framework Developer - blog - homepage
  • 09-27-2007 8:01 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    Thats no fun ;-)

    So how does the Xna Framework on the Xbox call the native DirectX, Xact, Xinput and Xbox libraries?

     



    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 09-27-2007 8:34 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    Shawn Hargreaves:
    There is no way to interop into native code from the XNA Framework on Xbox, regardless of whether or not you have a publishing deal.


    So even a publishing deal, a native library, and a managed wrapper can't get libraries into XNA? I guess I'll just have to start writing a 3D physics library then.
  • 09-27-2007 9:03 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    The ZMan:

    So how does the Xna Framework on the Xbox call the native DirectX, Xact, Xinput and Xbox libraries?



    With great difficulty :-)

    Obviously there is a mechanism for calling from managed -> native, but it isn't anything nice like pinvoke on Windows. More like the DOS BIOS call mechanism if anything, if you remember how that worked, except with separate address spaces to make things even more awkward. We have to statically register all the interop functions during kernel startup (the whole kernel is just one static executable, there is no plugin mechanism), and then when managed code jumps into these available entrypoints, it can only marshall across a small number of primitive type parameters. Any more complicated or larger data needs to be manually transferred in both directions, using copy helper functions to transfer ranges of bits from one address space to the other.

    Quite apart from the lack of a plugin mechanism, this is not the kind of developer experience I would wish on my worst enemy :-) It is one thing for us to take on the pain of making a small and carefully scoped set of APIs work across this boundary, but would be quite another to attempt to document all this, and then support other people who aren't experienced kernel level developers getting their code running in such an environment. Little details like the complete lack of any way to debug native code across the user mode boundary can cause a lot of developer pain: this is much much lower level than even regular native coding on Xbox.
    XNA Framework Developer - blog - homepage
  • 09-27-2007 9:04 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    Nick Gravelyn:

    So even a publishing deal, a native library, and a managed wrapper can't get libraries into XNA?


    That's the current situation, yes. There is no interop mechanism available for you to call into native code from your managed game.

    Nick Gravelyn:
    I guess I'll just have to start writing a 3D physics library then.


    That's what I would recommend.
    XNA Framework Developer - blog - homepage
  • 09-27-2007 9:30 PM In reply to

    Re: Native Libraries Mixed With XNA In Published Game?

    The first team to release a decent-performing 3D physics simulator that works on the Xbox will have quite a market share in the XNA GSE community.  It's a highly untapped market.  :)

    I've actually been playing around with some ideas and implementations the last few months regarding this, but I haven't had the time to get much done.  Someone really needs to get a team together.  It could be a very interesting, rewarding venture.

    Microsoft DirectX/XNA MVP
Page 1 of 1 (9 items) Previous Next