Monday, September 19, 2016

Creating the Level Creator - The Sharpest Tools in the Shed

As the newest version of the Soko Banish Level Creator continues to evolve, I continue having more stuff to show and talk about. A lot is new and different even since the last post I made, as you can see the in the first good look at the work-in-progress Level Creator below.

Level Creator 1.2 in action!

Although the most visible features are the graphical changes, toolbar extension (two more objects! Just enough for all the wall styles currently in the game) and the optional grid (the rulers slide back when the cursor is near them!), the most notable one I'd like to talk about are the tools. You can see them in the bottom-left - the four little grey buttons taking up conveniently little space to the left of the game elements instead of needing a separate bar. So what's hiding behind these little icons?

The first, as you have have guessed already, is the draw function - it's the standard mode for object placement that the editor has always had. The icon is a little paintbrush painting a line, in case it's hard to make out. And speaking of little paintbrushes, the cursor also becomes one now while the tool is selected! The moving square on the grid remains, but the shape of the mouse cursor changes for each tool to make it easier to know which one is selected.

And speaking of selecting, that's the little cursor icon to the right of the brush. I'm fairly excited about this one and may expand its abilities some more in a future version, but right now it can do three things, each of which first required drawing a selection rectangle on the grid:
  1. Delete the contents of the rectangle, making for a quick way to erase a chunk from the level,
  2. Drag & drop the section somewhere else, overwriting anything it's plopped on top of (empty fields are part of the rectangle), and
  3. Transform all objects of a certain type within the selection into another object.
The last one was actually the reason for implementing the tool - I needed a more practical way for the user to quickly change walls and decorations to their alternative appearances, replacing the cycling-by-clicking method (I talked about this in my previous blog post). The way it works is simple: You select an area, double-click on an object within the area and get a pop-up identical to the one used for replacing objects on the toolbar (which looks much nicer by now). Pick anything and you're all set! Since it's not limited to alternative appearances, you can change any object into anything else - if you need to replace a bunch of wooden gates with golden ones or somesuch, you can also do that now!

But that's not all that can be done with rectangles in the updated Level Creator - a rectangle draw tool (which doubles as a line tool for horizontal and vertical lines) was long overdue and is now in as well, functioning in pretty much the same manner as drawing the selection rectangle except that it's filled with the object you have selected. Large areas can now be filled with a single mouse click, which certainly beats the click-fest that was version 1.0 and also freehand drawing.

And in case there's more filling to be done, the last new addition is the fill bucket tool, which can work in two ways: if you click on an already placed object that's on a different layer than the one you're filling the level with, that layer is ignored (e.g. soulstones will be filled on top of rune circles if you start the filling action on a rune circle). If you start filling on an empty field, only empty fields will be filled. The first option was going to be the only one until I realised that it would cause void tiles to slip under the boundary walls, which made the fill tool nearly useless as filling in the outer boundaries with void is probably the single most useful thing it can do. Instead of working around by implementing special behaviours for certain objects only, I instead did it like this. I'm not sure if it's self-evident enough, but it certainly beats having inconsistencies in handling the objects.

There's more, but I'm saving that for another time. Stay tuned for more news and surprises! We may even begin to advance into the actual game - after all, Soko Banish 1.3 is to be the main attraction.