C# Game Engines

Started by
3 comments, last by ShadowKGames 10 years, 3 months ago

I was wondering if anyone has built a GameEngine in C# and can outline any issues they had.. Currently I have an engine framework built in Java with LWJGL and a port in C++.. Java is ridiculously easy to rip wide open and I like windows forms.. So C++ with visual studio isn't that bad, but I was amazed at how quickly I built the framework in Java (literally two weeks to create an OpenGL 4 renderer, shader compiler and input / matrices / rotations etc.) When working with the port development it is much slower and I'm on a bit of a time crunch. So I'm thinking of going the C# route.

Before porting the engine over to C# some experiences would be very welcome.

Advertisement

I've built quite a few games in C# (both at work and as a hobby). It's extremely easy for any experienced programmer. You will probably find it much like your Java work, but possibly slightly nicer to work with. C# and .Net have some really nice features that will make your life MUCH easier when you learn how to use them.

Downsides are fairly minor, related to low-level optimizations, and only really affect resource-constrained devices like iPhones or Android. If you're running on a desktop PC you probably won't see any issues at all.

My only real game-related gripe with .Net is that it doesn't seem to use SIMD instructions (the last time I checked was in 2008 so it might be different now), which could come in real handy when doing high performance 3D math. You can get around this by writing a small math library in C, then use it from C#. I believe Mono might support SIMD but I have not actually tried it out.

My only *major* gripe is that on iOS devices, the mono AOT compiler cannot reliably generate working code 100% of the time if you use certain patterns of code (specific types of function dispatch do not work properly). You can work around this issue, but you'll usually be forced to make your code more ugly to do it.

Hmm, I see.. I was looking into Mac and Desktop only. So I'll have to cross compile between the two..

Appreciate the tips, I've had a quick play around and done basic things like convert the hash maps to dictionary strings. I tried OpenTk and found some of the syntax missing, so I'll just import the GL libraries directly.

I am new to C# outside of Unity, but it doesn't really seem that different to any other languages out there.. But I love not having header files :)

C# apps on OSX+Mono usually just magically work (without even recompiling). Beware that using the WinForms stuff in Mono on a Mac has tons of bugs due to an imperfect implementation (especially on multiple monitor setups). I would recommend using something other than WinForms if you intend to make any GUI apps that you want to run on both platforms. I've used GTK# which worked OK, but I found its design really unwieldy compared to WinForms. sad.png

I'd wager that most of the GL-based stuff works just fine on both platforms, but I haven't done any testing since I don't have any OSX machines at home.

There's also Monogame which I keep hearing about, but haven't actually used yet.

I'll try and get a windows release out there first and make a Mac Build later, It's not at the top of the priority list.

I really appreciate you taking the time to answer.

This topic is closed to new replies.

Advertisement