I spent the last few evenings working on a fun side project which is now complete: a level editor for Loren Schmidt’s Star Guard.
the first level of Star Guard
the same scene in the editor
A few things came together that caused me to make this level editor:
- I was looking for an excuse to do something interesting with QML.
- Star Guard is a great game and stores its levels in friendly, easily accessible XML files.
- When I emailed Loren about the project, he allowed me to use some of the game’s artwork.
The whole thing was surprisingly easy to do, took a couple of days and amounted to less than 1200 lines of code – one half of it QML and the other C++.
The editor uses QML to describe every aspect of the user interface. It’s turned out to be very useful in the beginning of the project when the editor was still QML-only and the interface layout and behavior changed a lot. It also means that it’d be very easy to redo the user interface now – even for someone without any C++ knowledge. Also, not having to recompile after every step simply makes fiddling with the UI a lot more pleasant.
Of course there’s the disadvantage of not following the native look and feel. But no one ever complains that most games don’t use it – and I don’t think it’s necessary for a level editor to look just like your spreadsheet application either.
The C++ part deals with the backend work, like providing a model that holds the map, a QML item that paints it, and loading from and saving to files. I used the QML plugin mechanism to expose these to the UI code.
The editor is fully functional; I consider it done and will not continue working on it. If someone wants to improve it or base his own tile based level editor on it, feel free! I release the code under the Boost Software License 1.0.