Behind the Brain

Write games, not engines - a post mortem

Like Josh Petrie said: Write games, not engines. And yes that's a better aproach. I stopped working on a C# implementation and isntead took a wrapper. This has one main reason: Not taking a wrapper but porting something to another language has only one advantage: Speed. However I was so stupid that I didn't realize that I just moved this "problem" one stage deeper. I was porting Irrlicht to C# (suprise, suprise) however I used SlimDX and OpenTK for the DirectX and OpenGL part. These two libraries are wrappers as well. So I figured out that it wouldn't make a difference if I use a wrapper for the whole library or use wrappers to implement parts of the library.

However if you are interested how far I came: Checkout the SVN repository at Google Code. The OpenGL and DirectX drivers are more or less done but not heavily tested. The io namespace is alsmost complete as well. Just some archive loaders are missing (well all except the zip reader). The core namespace is completely done and most of the interfaces for the scene namespace are also more or less done (however not their implementations). The GUI is one big construction site. The irr namespace is ok but could use some fine-tuning at many edges. Most of all the Win32Device...

Known issues:

  • OpenGL extensions are not tested. So if your driver/hardware/os/whatever don't support an extension that is used the app will crash
  • The Built-In font (and most propably bitmap fonts in general) have a glitch in rendering. Didn't take a closer look on it though. See example 01.HelloWorld and you'll know what I mean.
Be warned: The code is not very .NET like. It's mostly a copy-and-paste from the original c++ code with adapted syntax. Most noteable in IReferenceCounted... just don't take a look at it ;)

If you take a look through the code you'll see that I integrated some other things that are not (yet) included in Irrlicht. First of all of course IrrIni, well ok there is the interface but I wanted to get done with Irrlicht itself before adding features. Then my GUI-Animator patch and some interfaces for Sound (ah looks like IrrSound ;)) and Network (nope I don't have any networking lib out there, trust me). You're asking why? Well when I was frustated because I couldn't find bugs I added them. And when I added and added things a voice in my head started screaming "write a game engine". That's were the Networking part is coming from but I silenced the voice ;)

However if you feel like using the code, working on it further (, or laugh at me), just drop me a line or two. If you want to, I'll grant you access to the repository.

So have I learned something from this trip? Yes I did. There's real truth in the saying "even a failed project will help you building better software". Well ok I wouldn't call it a failure. I just stopped working on it (for now - who knows what the future will bring). First of all I really learned a lot about the inner workings of Irrlicht. I'm playing around with it since version 0.5 or something around that time, so I'd say I knew much about it. Well now I know even more about it and found some bugs in the engine as well :)

Furthermore since I needed to rewrite all of the DirectX and OpenGL code I learned a thing or two about them as well (yes I never did anything much bigger in DirectX than drawing some triangles, hey that's what graphics engines are made for!). I came to the conclusion that OpenGL just sucks no matter what language you use it with... I mean it's great that we have a graphics API that is also available under non Microsoft systems but I totaly hate this C-API.

And since I only wrote C# code for two month I don't want to - and propably won't - switch back to C++. Even Visual Assist feels, well I don't know how to describe it... C#'s IntelliSense is just better than Visual Assist and of course worlds better than C++'s IntelliSense.

So that was the part about the "engines" but what about the game? Well I won't anounce anything but I startet IrrSharp because I wanted to write a game. And as stated some times by me I feel more comfortable coding in C#. So I looked through many C# engines, ranging from plain XNA to Axiom (a C# port of Ogre). Hell I even took a look at Unity, but I didn't really like any of them so I took Irrlicht and started porting it.

So what has changed? Well I'm now using IrrlichtLime and wrap the things it currently doesn't support using C++/CLI. Well I've never done anything in C++/CLI but since I know C++ and C# I didn't have any problems until now. However now I know why even Microsoft says, that it shouldn't be used to write real applications but only to write interfaces between legacy C++ code and .NET applications. One of the ugliest languages I've ever seen. However I'm used to ugly languages from my work so I can live with it. I'll send my ports to the author of IrrlichtLime so I hope in the final game I won't have any C++/CLI code since it all went into Lime. But that are just dreams.

The design document only exists in my head currently and I'll have to write all this stuff down sooner or later. I'll need to write some editors and other tools, finally learn things about shaders that are beyong the basics like a 2d blur shader, find artists and sound designers and maybe some other programmers. Wuh this is going to be some work. Well another good point about not having a girlfriend - you have all the time you want ;)

So far

Happy coding ;)

Sep 14th 2010, 20:08 by Sylence.

Back to top