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.
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:
- Ease of use
- Simplicity in design
- 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
- Geometry utilities, cameras
- Scene management with transitions
- Texture atlas
- Tile maps with material masks
- Animations such as fade, rotate, scale, move etc. with easing curves
- Timers – realtime, fixed step and a scoped timer for quick performance profiling
- Undo/redo history (for editing tools)
- SQLite wrapper (for keeping game stats, highscores etc)
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.