Project Clockwork Dev Diary # 2

Hello! I’ve been making some decent progress on the level editor. In my last update, I’d just finished fighting with the code to pull information from the level data and display it in the editor panel. Having done that, making changes to that information was relatively trivial (although I did have to make a few more changes to the way the editor categories are stored). I implemented controls for increasing and decreasing values, and once that was working the changes you made were automatically reflected in the level, which felt really rewarding! Here’s a video:

After getting value editing working, I made a few more changes. First, I implemented functionality for moving the camera to a specific location. This will eventually be useful in the game (for highlighting a door that you’ve opened, for example), but in the editor it is used for centring the object you’re making changes to. To do this, I needed to make a system that takes an item from the editor, and returns a set of coordinates for the object that it’s associated with. For gears this would be the centre point of the gear, but for geometry vertices it would be the coordinates of the vertex itself, and so on.

Next I got buttons working. I forgot to demonstrate this in the video, but these are generally used for adding new elements; sections, gears, walls, that kind of thing. Then I needed a way of highlighting objects that you’re editing. I was mostly able to adapt the previous code for getting the location of an object, and use that to tell the code that draws all of the level objects to flash the currently selected object. It also draws a crosshair over whatever is most relevant to the item you currently have selected.

So, I think I’m finished with these systems for the time being. There are a few things that I need to work on next: A context menu that can be used for copy/pasting, deleting items, and undo; a secondary editor mode where you can move a pointer around the level directly, and select and move objects directly (this is going to be a big job); a system for determining a better location for newly-created objects (currently these get spawned at (0, 0), but this can often be quite far away from where you want them to be).

See you next time!

Project Clockwork Dev Diary #1

Hello! First things first, this is my first entry for quite some time. I’m going to be writing about my development process here going forward, as I have recently started working on a project full-time. I’m a bit late in announcing this here, as I wanted to at least have something concrete to post, and what I ended up working on was something that’s not particularly exciting to look at. I will post a few GIFs of things I’ve done previously that are a bit more interesting, however!

Here is some prototyping I’ve done on what will eventually be a playable game:

Gears13.gif

Without wanting to give too much away this early on, I’m making a platformer where the levels are filled with gears and clockwork mechanisms. I’m creating it in a 2D engine, but as you can see above I’ve faked a 3D effect; there’s a reason for doing this that I hope will eventually be apparent!

One side-effect of this, however, is that there is a lot of data that goes into building the levels: they’re constructed from ‘sections’ which can be fully articulated, and each section has geometry data for all of the background layers (which are used to create the illusion of 3D), and each of the gears has a lot of data describing it. So far I’ve been entering all of this by hand, but it’s time consuming and fiddly.

As such, since working on the game full-time I’ve started making a level editor. Because of the nature of the platform I’m making the game for, it made most sense for me to build this within the game itself (otherwise I’d have to maintain two separate codebases in two separate SDKs whenever I add new level features, and I don’t really want to do that). There was a certain amount of UI design required to to fit a level editor within some fairly strict constraints, and once I did that I could start implementing it. Here’s a video showing where I’m at so far:

The panels on the right were fairly easy to implement; first thing I did was create data structures for containing each of the items that would appear in each panel, based on what needs to be editable for each feature of the level. I made them scroll up and down, and slide in and out when you move between menus. This is a little glitchy in places, and I may eventually fix it, but I wanted to focus on the functional stuff first. In general though, this was the easy part.

What was less easy was linking the items that were displayed in the editor with the level data. I spent quite a lot of time trying to figure out how to build a system that is able to take a list of menu items, and then look at the level data and determine how many of those it needs to display on screen, and also pull the existing value and display that. I think it might be just that I don’t have a lot of experience with building tools like this, so cross-referencing data structures is an unfamiliar area for me. The basics of it are working now, though, and hopefully the next steps will be a little more straightforward.

Speaking of which, my next plans are to implement the ability to change values (which, now that I’ve solved the problem of reading the data in the first place, should be fairly trivial), allow the saving out of edited level data, and eventually build controls for moving around the level. More on that: Soon!