GUI editor

As a little diversion from working on Superforce, I added an interactive GUI editor to NLEngine.

Pressing a hotkey anywhere in the game switches to GUI editing mode. In this mode, I can drag any GUI element around. I no longer need to re-launch the game several times and check if I’ve set the correct coordinates. I just move it around with the mouse until it looks right, then press Save and I’m done.

All in about 200 lines of code, with full undo/redo support and SQLite persistence. Glad I took the time to do this. It’s not actually super useful in Superforce because there the layouts are finalized but I’m pretty sure I’ll use it for something later. Like, for real.


Here, buttons are made aware of the GUI editing mode and will ignore input when it is enabled.


The GUI editor just handles the dragging. The layout (x, y, w, h) is then saved to disk and that’s pretty much it.

Debug buttons

Debug buttons

Some shortcuts for testing and debugging Superforce:

  1. Die
  2. Win
  3. Slow down time
  4. Collision detection overlay

Wouldn’t it be great to have #2 and #3 in real life? Or #4, when coming back from the pub?

Level editor

Devastro had a built-in level editor and it was the best thing ever.

Devastro level editor

For Superforce I did the same thing. Putting extra time into making an editor is paying off. Making levels is really fun.

Superforce levels use tile-based maps with freely moving objects on top. The editor has three modes to allow me to edit everything in a single view.

  1. Object editing mode – for placing enemies and pickups on the map. Objects can be selected and dragged around.
  2. Tile editing mode – editing the map itself. The map is tile based. I first tried to use Tiled for editing the map but the TMX file format is too complicated for my needs and the workflow was really awkward.
  3. Collision mask editing mode – editing materials for tiles. I can draw with a “grass” brush over one tile and all the tiles of the same type get updated instantly. The mask is used for collision detection (water vs. terrain) and also for creating visual effects. Bullets hitting water create a little splash; when they hit grass, a little bit of dirt flies up; hitting a metal object creates sparks etc.

Pressing “P” switches into playing mode, so I can playtest immediately. ESC resets the game and goes back to editing mode.

The user interface is based on the IMGUI concept: all UI elements are rendered and evaluated at the same time and it’s all done on each frame. There are buttons, lists, draggable items, multi-selection for objects, undo/redo, native Mac OS X dialogs for saving, keyboard shortcuts etc.

Object editing mode
Tile editing mode
Collision mask editing mode

1 day workweek

I had a promising game prototype for about two years. It was just lying there… I wanted to turn it into a full game but I just didn’t have enough time and energy to do it. I spent long hours each night trying to move it forward but I was just too tired. It wasn’t going anywhere.

In Spring 2014 I decided to reserve one day of the week to work on my game. So each Friday, instead of commuting to my regular job, I go upstairs into my home office and work on Superforce all day long.

Home office

So far I count 16 Fridays. It’s a cool setup and the game is now progressing really well. There’s no stress. I get up in the morning, fresh and with a full day of game development ahead of me. Good times. Big love & thanks to my wife for supporting this endeavour.

I don’t want to call myself an indie. To me, being independent now means something else than it used to. It’s not about making enough money from games to be able to do it fulltime. I tried to achieve that and it didn’t work out for me. But even if it did, I’d have to work really hard just to keep it that way and that would spoil the fun. When it comes to game development, I am now as independent as I can ever be. Will the game sell? It would be nice but I don’t depend on it. I’m an amateur. A hobbyist. And I’m happy.

Superforce for Mac? Not really…

I have a working build of Superforce running on Mac OS X. Am I going to release it? Nope. So what is it for?

The iOS Simulator is fast enough for running apps. It is way better than the Android emulator, but it’s not fast enough to run a game at 60FPS. And it is completely useless for running a game that is controlled by the accelerometer. There’s a way around that, but it’s too complicated for my taste. I want to iterate quickly, so I’ve invested some time to optimize my workflow.

Setting up a Mac build has paid off almost immediately.

The Mac version starts super quickly and runs smoothly at 60FPS. I can comfortably control it with keyboard and mouse. Another big advantage is that it can read and write files in the filesystem. This is required for the built-in level editor. It also helped me identify a few areas in my code which had problems on a 64-bit architecture. I was able to fix those without ever running the game on a 64-bit iOS device.

Superforce running on Mac OS X

Superforce details

Superforce is a one man project. It has a limited scope. Instead of generating tons of content, I’m focusing on making the core mechanics as good as possible, adding some nice details and generally having fun making it.

Design goals

  • Easy to play
  • Simple controls
  • Quick 5 minute sessions
  • Destruction = fun
  • iPhone only

Non-goals

  • Storyline
  • Enemy & weapon variety
  • Boss fights
  • Huge number of levels
  • Launch on multiple platforms

Would be nice

  • Achievements
  • Global highscores

For a sequel

  • In-game shop with upgrades
  • iPad version
  • Mac version with level editor

Pricing

  • Single purchase game
  • No ads
  • No free-to-play bullshit

Superforce main menu

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. with 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 uses OpenGL which is good enough for now. I’m just blasting sprites on the screen. I’m looking forward to using more modern graphics APIs 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.

From Java to C++

My previous games used Java and LWJGL but I decided to make a big change and leave Java behind.

Superforce is written in C++.

When I started making games, I thought Java was a good choice. It is a nice language. I know it really well. The IDEs are super powerful and garbage collection usually doesn’t hurt too much.

But when the iPhone and the App Store appeared and started gaining momentum, Java left me out in the cold. First, I was just disappointed. Perhaps they would add Java support in a few months. But it didn’t happen. Disaster.

It wasn’t an easy decision to change my main technology. I took it very seriously. After completing two games, I had a lot of reusable code which seemed valuable. But I knew needed something solid that really does run everywhere.

So for Superforce, I quite literally started from scratch. Clicked Xcode > File > New Project and started rewriting my engine in C++.

Superforce

Hello, it’s time to announce my next game.

Superforce

It’s an action game called SUPERFORCE. It will run on the iPhone.

Superforce is going to be my first iPhone game. It is inspired by River Raid, Renegade Ops and Devastro.

There is no release date. Keep an eye on this blog for updates.

Superforce screenshot