Game Development, Mortuus Est

A Basic Level Editor

In an effort to speed up the development time of our little game, I fleshed-out the bare bones level editor into something a little more powerful and user friendly.

Before, objects were spawned in front of the player using the 0-9 number keys, numpad keys controlled object manipulation, and ‘/’ was used to select existing objects in front of the player so that they could be manipulated. It was awful.

Now there is a categorized left-hand sidebar that lists objects available to create. Because I chose to implement different objects with the same properties as a single class with enum values (instead of deriving multiple classes from a superclass), new types can be created and the menu is automatically populated by iterating through the enum of that type – this saves hard-coding new objects into the menu.

Furthermore, mouse input is now accounted for – click on the menu to select an object, click in the world to place it at that location. When an object is selected from the menu, ‘CREATE’ mode is activated so that every click places a new object. When no item is selected, ‘SELECT’ mode allows any object in the game world to be clicked on and set as the active instance for manipulation (or duplication).

Level Editor Example

Although it works well enough, the code itself is massive, messy, and inefficient. I can see the level editor turning into it’s own offshoot project in the future – a flexible, powerful, and user friendly editor that I can use with all my libgdx-based projects and perhaps something that even supports scripting events through the interface.

Below is a quick video of a stage I slapped together as a demonstration. Don’t mind the broken zombie AI and epileptic gates – there’ still a bug that causes newly created objects to misbehave, but when the level is reloaded everything works as it should.

3 thoughts on “A Basic Level Editor”

    1. Yes it was 🙂 It’s actually part of the main game code, so that I can drop in / out of level editor on the fly to make tweaks, and then save it at the end of a playthrough. At the moment it just spits out Java code into a file though, which has to be pasted back into the game’s level classes as I don’t have external level files. So many changes are in the pipeline!

      Liked by 1 person

      1. I see. It sounds a bit complicated, but I’m sure it’ll be useful and worth the effort when it’s done. 🙂

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s