informa
3 min read
article

To build or not to build (a level editor)

Sometimes creating a level editor can be a waste of time. Here I describe an experience using Inkscape to develop the levels of Gravity Maze

For the last few weeks I’ve been working on Gravity Maze a game/prototype that uses the idea of gravitational forces moving an avatar to solve mazes.

The goal for this game was getting it done quickly and reusing as much code as possible to reach a deadline for a contest.

One of the problems that arose was the interaction between the avatar and the maze. I had two ideas in my mind:

  1. Using a mask for the walls of the maze and detecting collision with a pixel-by-pixel technique.
  2. Using a physics engine.

I chose the physics engine for many reasons.

What did it mean? That each wall in the maze was part of a body, this way I could apply a rotation to the body and the whole maze would rotate. Also we got the avatar’s collisions and bouncing for free.

Then another problem arose: how to design levels.

There were a few options here too: creating the levels by hand, or developing a level editor.

I suddenly realized that both options would kill the project. Both were too complicated. Constructing a level editor is a long development task, and doing the levels by hand was a lot of work. Both were so time consuming that conflicted with the main goal of getting things done quickly.

Then I recalled an old project I built in 2005. It was a regular polygon generator that used the n-th root of unity.

The interesting thing about that project was that it generated an SVG using the vertices from the equations.

The idea came to my mind: we could use Inkscape to design the levels! We only had to parse the XML (SVG files are XML files) and bingo!

I started to work at once and, after three hours, we had successfully finished an XML parser that loaded all the walls into the physics engine.

I must say that this simple idea made the difference between finishing the project on time and losing it. I think it’s a great option when there is little time.

If you plan to use this on your next game, be careful! Read the generated XML all the time since Inkscape uses matrix transforms when you move or rotate objects and groups. Either have your parser handle this or design the levels carefully taking care that no transformations are applied.

Another cool detail to have in mind is that Inkscape allows you to add custom attributes to objects.

I used them to define the maze’s start and finish. I'll be waiting for your comments and hope you still use FLOSS and let your head innovate on new ways to use existing stuff!

Latest Jobs

Treyarch

Playa Vista, California
6.20.22
Audio Engineer

Digital Extremes

London, Ontario, Canada
6.20.22
Communications Director

High Moon Studios

Carlsbad, California
6.20.22
Senior Producer

Build a Rocket Boy Games

Edinburgh, Scotland
6.20.22
Lead UI Programmer
More Jobs   

CONNECT WITH US

Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter

@gamedevdotcom

Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Register
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more