Game Engine Programming in XNA

Started by
7 comments, last by LanceJZ 11 years, 6 months ago
So I have this Question all over my head. Is it possible to create a perfect Game Engine in XNA?
Like there are Big Game Engines developed in C++ using Direct3D.
Unity3D.
UDK.
And Many Other.

If its not possible than is it possible in just C#?
Like i tried to find the Direct X tutorials for C# but failed to find any good one.

So that's my question Is it possible to make a Perfect Game Engine in XNA or at least in C# using Direct3D?
Advertisement
Define perfect!

You CAN make a good engine with both XNA and DirectX. Which to choose depends on many things.

I would not go for the combination C# and DirectX though, since the API is written for C++, and Microsoft's wrapper is outdated.
Only issue I can forsee is that alot of higher end engines are crossplatform whereas XNA and directX aren't. OpenGL can be used from C# on mono with either Tao, OpenTK or the mono XNA equivelant: Monogame.

Of course cross platform might not be one of your aims. If you want to use C# with directX your only options now are XNA (much higher level though), slimDX or sharpDX. SlimDX is apparently the more mature project.

Either way its possible to make a game engine using C#. Perfect is a separate matter, what I see as perfect you may not see as perfect.
So Which one i should choose to Start with?
XNA, OpenTK , SlimDX or SharpDX?
I think telling us your goals would help people give you a more useful opinion.

Why are you making this engine? What void are you intending to fill with it? What platforms do you want this to be usable on?
I think you also have to remember what C# is lacking compared to C++. If you wan't to do a real game engine a big part of it is that system layer with memory management and the likes. There you need direct memory manipulation.
I think it might work for a game engine for small and fun games but you lose a lot of performance next to C++ engines I guess
Student of Computer Science - Digital Media and Games

Check out my blog, where I document my learning process in game development:
http://nighttimedeve...nt.blogspot.de/

Always thankful for help.

I think you also have to remember what C# is lacking compared to C++. If you wan't to do a real game engine a big part of it is that system layer with memory management and the likes. There you need direct memory manipulation.
I think it might work for a game engine for small and fun games but you lose a lot of performance next to C++ engines I guess


Yeah. For number crunching, C# is still a bit slower than C++ for various reasons (I really hope to get SIMD-support in the MS CLR) and there's always going to be some overhead when calling the native DirectX API from managed code. However, almost all current "real" games I play are GPU-bound (on my system), so the CPU-overhead isn't really noticeable in a lot of cases.

If you primarily want to create an engine, I would suggest going with SlimDX or, if you're really concerned about performance, SharpDX, because they are closer to native DirectX and offer more freedom. If you want to create a game though, I have to say that XNA is probably "good enough" for the majority of projects while offering some nice abstractions and tools.

current project: Roa

It really depends on what your going for, if your only making 1 game then going full hog and making an engine is probably not worth the time and effort so the higher level tools offered from XNA or monogame will be more worth your time (make games not engines seems to get chanted alot). Which of the 2 you choose really depends on the platform, XNA has more tutorials available but if you need mac and linux support then you will have to use monogame, much of the XNA tutorial content should apply to monogame as the aim of the project is to create an open source XNA for mono.

If you are looking to make a full on engine then slimDX or sharpDX should be your windows choice, if cross platform support is needed then OpenTK would be your other choice. These are much lower level API's. slimDX and sharpDX are straight wrappers of directX, almost impossible to get any lower, OpenTK I think has a few simplifications over bog standard openGL, there is also the Tao framework which seems to be a dead project. These will offer alot more control and flexibility in your engine that you won't get with XNA or monogame. XNA is stuck on directx 9 aswell whereas both slimDX and sharpDX can do 9, 10 and 11.
Making a game engine even for one game is a good thing, if you ask me. It may take a week to create a game engine, but then it would only take you a few days to create the game.
If you want to see a simple 3D game engine using XNA 4, you can have a look at mine on my web site. It is used in a tutor on making a game engine.
I hope that helps anyone who comes across this.
Thank you for your time.
if (Try()) Do();
else DoNot();

This topic is closed to new replies.

Advertisement