NLEngine

As I wrote in my previous post, I’m using C++ to write Superforce. I had to unlearn a lot of Java habits and get up to speed with C++ again. C++ is much more powerful and expressive than Java. Not having garbage collection actually helps me write better code. The C++11 update is great.

Great to be back
Hello C++, it’s great to be back

I didn’t want to use a 3rd party engine for the same reasons I stopped using Java. I want to be in control of the core technology and I want to build it myself exactly the way I need. So even before writing any game code, I built an engine.

NLEngine is what I call it. Nice Little Engine. Don’t laugh, it’s a separate project in Xcode, so I had to give it a name, OK? And “Source” was already taken. Shut up! Anyway, it is aimed at 2D action games. I’d love to build a few with it and Superforce will be the first one. The overall goals are:

  1. Ease of use
  2. Simplicity in design
  3. Reasonable performance

So far it does the following things:

  • Sprite renderer with batching
  • Sound playback with ogg streaming, OpenAL output
  • Reading touch, accelerometer, mouse, keyboard input
  • File I/O, can use mmap, supports PAK files
  • Image loading
  • Fonts
  • Geometry utilities, cameras
  • Scene management with transitions
  • Texture atlas
  • Tile maps with material masks
  • Particles
  • Animations such as fade, rotate, scale, move etc. all with built-in support for easing curves
  • Timers – realtime, fixed step and a scoped timer for quick performance profiling
  • IMGUI
  • Undo/redo history (for editing tools)
  • SQLite wrapper (for keeping game stats, highscores etc)

External dependencies are kept to a minimum: stb image, stb vorbis, rapidxml, sqlite. I do use the STL but stay away from Boost.

It still uses OpenGL 1.2 but that’s good enough for now. I’m just blasting sprites on the screen. I’m looking forward to using shaders but right now I feel it would be too much new stuff at once.

It runs on iOS and Mac OS X. There’s a good chance I’ll get it to run on Linux. Later I might look at the Android NDK, but I’m not sure what to think of the absence of OpenAL there. Windows port is not planned.

All game code is written in C++. I don’t want to use a scripting language and rather focus on designing good APIs and abstractions in C++. Sooner or later taking care of the bindings for a scripting language would become too complex for me. If I absolutely had to pick a scripting language, it would be Lua.

Leave a Reply