Post news RSS Deep Flare Devlog #2: Terrain Editor

We implemented a handy terrain editing tool to ease the level making process.

Posted by on

This week we've all been busy with personal stuff, so we're going to make a 'delayed' devlog about something we've worked on some time ago.
As we briefly introduced last week, in Deep Flare the graphics style is no longer going to be retro-oriented as was planned for Deep Flare: Explorer. Instead, we're going for an hi-res 2D approach. We're still figuring out how to make most of it, so we don't have much to show - you might have noticed that from our WIP gifs. But there is one aspect of it that we settled for good: the terrain.

Old vs New terrain comparison.

For our planets' ground, we went back and considered again one of our prototypes from back when Deep Flare: Explorer was still just an idea we were considering. At the time, we sketched most of the gameplay using a black-and-white, vector-style graphics. It was just a prototype, but there is something about that style that sticked with us. Aesthetics aside, this approach gives us a considerable technical advantage: the ability to represent the whole planet - or chunks of it - as a list of vertices, one connected to the next, forming a circle. In DFE, the terrain was tile-based, as the pixel-art tradition dictates. But that approach forced us to either work with a very limited set of graphics, or to put more work on our artist's shoulder, asking him to make more and more different tilesets - most of which would be used only a couple of times in the whole game.
With a vectorial approach, we trade the neat grid of the tile-based system for a more flexible one, which perfectly fits our new graphics style.

terrenonuovo grande

Representing the terrain as a list of vertices leads naturally to think about it as a flat 3D model. And if the terrain is a flat 3D model, we could use Unity to create our levels directly in-editor! Long story short - after some hard work, we coded a bespoke solution for creating and editing our planets by using custom editor windows and inspectors. This way, Matteo will be able to iterate his level design directly, without having to ask for changes to be made, and that of course is going to ease a lot the development process.

If you're wondering about how does this system work, it's dead simple. We coded a script which uses Unity's Mesh class, in order to create one and assign it to an object's MeshFilter. Inside the script, we have a set of terrain vertices, which are used to compute the actual mesh vertices, indices and UVs by some code that prevents the end result from having weird distortions - and adds the terrain collider using a PolygonCollider2D with the same list of vertices. On top of all of that, we have a custom inspector which overrides the OnSceneGUI method to provide a handy editing tool, and a custom editor window for creating planet terrain objects.

A new level is born!

Editing timelapse

Testing the end result!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.