2DXngine tutorial - Engine overview

Posted on Sat 28 October 2017 in 2DXngine

Hi everyone. This will be my first post in English, so I believe that it will be worst. I've made decision lately about that to make some simple 2DXngine tutorial. Writeing this in English language can reach bigger audience I believe. Let's start from the beginning. 2DXngine is my project which I started this year for Get Noticed 2017 competition. For now this project is actively developed from 8 months. During this time I implemented base 2D engine functionality and some additional features (and possibly some bugs). More or less complete feature list you find on github. For now engine should works on Windows with CPP 2017 redistribute package. I also have plan to port it to MacOS(OSX) and Linux, but for now this is distant future. Ok, so let's move to overall architecture:

2dxngine

As you can see window and input backend is build on top SDL2 with OpenGL and GLEW for 2D rendering. I also use other 3'rd party libraries:

  • Pugi Xml,
  • GLM,
  • Soil,
  • SLD2_mixer,
  • Freetype font,
  • Simpleini,
  • Google Test.

Like you see I have testing library in my stack, so I try to cover as much as I can with Unit/Integration Tests. Not all code is covered but I try cover some all more complex features.

I also try to make architecture flexible that you can use only thing that you need . For example you don’t want to use scene system and component model no problem. You can take Spritebatch from graphics library and game handler as build your own scene/game state system with our own entity system. If you need some specific service you also can add one and register it in service locator. There are some couplings with some elements, but generally there are possibility to extend any functionality in desire way.

2DXngine also provide scene system with component model. Scene API provide game object manager which can be populated by game object with components. For now you can create three type of components:

  • Plain component which can contain data and so on,
  • Updateable Component contain behavior for game objects,
  • Drawable Component this can contain draw logic using scene renderer with spritebatch.

Any component you create should be register for type cache in order to have possibility to find them via type. I also want to automate this process but I don’t figure out any good solution for that.

If you want to check out what features I currently focus on please go to this Trello board. I try to update this frequently, so this is the most fresh information about development. In next post I show some simple game implementation to show you some of engine possibilities. Like always I invite you to comment section to share your opinions with me.