Sponsored By

MAKING TOOLS WITH UNITY: WORLDSHAPE PART 1

It’s been said before how important tools are for game development. Good tools allow you to build solutions to problems in a more natural way. We at AtomJack see the value in creating tools, because it simply makes game development more efficient.

Max Anderson, Blogger

June 25, 2015

7 Min Read
Game Developer logo in a gray background | Game Developer

It’s been said before how important tools are for game development. Good tools allow you to build solutions to problems in a more natural way. Imagine making images on a computer without image editing tools like Photoshop -- it’s possible, but not at all how you want to get things done.

Of course, building tools (especially good ones) takes time and resources just like any other part of a game. Additionally, tools are usually only ever appreciated by the team creating the game, so it is difficult to justify finding time to build and support tools when that time could be spent on “actually making the game.” Anything we can do to make tools development “cheaper” helps justify more and better tools.

One of the primary reasons AtomJack chose Unity to build Wayward was its reputation for extension and tool creation. Today I’ll be sharing some of the ways we’ve extended Unity to create our world-building tools. If you’re the technical type, I’ll also walk you through some neat pictures and explain what parts of Unity made these tools possible in Part 2.

First, what are we even building? Wayward is a 2D exploration platformer, so it needs some 2D platforms… and walls, and ramps, and ceilings, and etc. So, it needs shapes! Shapes will define the solid parts of the world. Unity comes with some 3D primitive shapes like cubes and spheres. You can move and resize them, but that’s about it. We can do better.


The first tool created for Wayward was the WorldShape “tool.” It looks like this:

 

 

Amazing! Okay, so this looks INCREDIBLY boring, but there’s actually a lot going on here. What we’re looking at is the editor for a simple 4x4 box that gets created when you add a WorldShapeComponent to an empty GameObject. Components are at the heart of Unity’s flexible game engine design, and they come with a lot of extension points at runtime and in the editor. WorldShape takes advantage of many of these features.


Here’s a better view of what’s actually happening in Unity:

 

We have three views here: HierarchyScene, and Inspector. The Hierarchy shows a tree of all of the objects in our Scene. The Scene view shows the visual representations of our objects, as they might be seen in game. The Inspector shows modifiable properties of the Components on our selected object. This is all standard Unity stuff.

What’s interesting about these views, though, is how we got here and what we can do next. Take a look at this video, which shows me starting from scratch and then using the features of the WorldShape tool:

 

 

Here you can see how I create a new WorldShape, and how it is reflected in the three views. I create a new GameObject and attach a WorldShape Component. I also expand the Shape object in the Hierarchy to show the newly-created vertex objects. I can then perform a number of operations on the shape: adding, moving, and removing vertices and edges, moving the entire shape, and changing the pivot position of the shape. I can also undo all of these operations.

If I’ve done my job right, none of that looks impressive. With a simple set of keyboard keys and mouse gestures, a level designer should be able to make the shapes they want instead of being restricted to spheres and cubes.

This tool forms the backbone for all of our level editing. Here are some ways it is used:

  • Creating solid shapes in the world for characters to collide with.

  • Creating pass-through “trigger volumes” that detect character presence, which can be used to create puzzles and script conditions.

  • Creating shapes that can be moved along “motion paths,” which are edited with a similar tool.

  • Creating “effect volumes,” like spikes traps or lava, that affect characters within the shape.

 logo in a gray background |

Was it easy to do? Yes and no. The first pass of this tool took a week or so as I was getting used to Unity, but now that I’ve learned my way around the engine, it would be pretty easy to reproduce. Regardless, it was well worth the effort, and has served as a baseline of knowledge for many subsequent tools.


If you’d like to know more about how this was actually made, check back next week for a detailed walk-through in Part 2.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like