Building a new map

Hi everyone, it’s been a while, so time for a dev update I think.

Over the past couple of months I’ve been working on making a new map for the full game.  Currently in the demo there’s a procedurally generated “desert” map that’s a bit boring as it doesn’t have much variation.  So I decided to hand craft another map that would be more fun for testing wheeled vehicles, with various road and race track layouts.

At some point I’d like to have other maps tailored towards different kinds of creations, but those will have to wait until some time in the future.

The race track layout

The map sizes in the game are 12x12km, with an 8x8km playable area, which is a huge area to create a map for, especially by hand.  So for now I’ve been focusing on one 2x2km region to try and get that up to a decent quality level.

The first step was to design a race track layout, which I did by piecing together corners inspired by some of my favourite real world tracks.  I wanted to have a good mix of corner types, elevation change, and a nice flow.  The track also has multiple routes, for more variety.

The next stage was to build the race track in Unity, for this I used EasyRoads3D (http://www.easyroads3d.com/).  This is a node based tool for creating road layouts that generates the road meshes, matches the terrain height to the road, and can generate other associated objects such as tunnels, bridges, kerbs, and walls.  This tool isn’t without its problems, it has quite a few bugs that I struggled with initially, especially when using the flex connectors to create road intersections.  However once I got used to working around these issues, I found this tool to be quite powerful and flexible, and it can produce some great results.

Here’s the initial race track layout, you can see where I’ve used intersections to create alternate routes and a pit lane, and where the flat terrain has been automatically raised up to match the elevation changes in the track:-

Following on from this I sculpted the terrain around the track to match it, and added a tunnel for the bit where it crosses over:-

Terrain texturing

Before painting textures onto the race track terrain, I first wanted to make some improvements over the terrain texturing that has been in the game so far.  The textures themselves didn’t really fit the visual style of the game, they weren’t varied enough, and I’m not a huge fan of “cross fade” blending between the textures either.

So I created a set of new terrain textures with a more stylised look (a mix of adapting some pre-made textures and making my own).

I implemented height-based blending into my terrain shaders (also with gloss, occlusion, and metallic maps), this was based on the mask map support in Unity’s URP (I’m using the built-in RP).  I’ll skip the details here for brevity, but here’s a comparison between conventional and height-based blending:-

And now here’s the terrain with the textures painted onto it (and also with some tweaks to the pit lane area):-

Terrain details and trees

The next job was to add some terrain details (grass & rocks) and trees.  I implemented custom shaders for all these, in order to have deferred lighting support, and translucency on the tree leaves.  I created tree models using Unity’s old tree editor, which is somewhat flawed (I think it might be abandoned nowadays?), but it did the job, and besides I couldn’t justify spending money on a third party tree creator tool!

I implemented a simple tool in Unity to procedurally place the grass and rocks based on the underlying terrain textures (e.g. so I could quickly place the grass details on top of wherever the grass terrain texture is painted).  The trees I just placed by hand.

Here are some images of the final result:-

Desert map

I also worked on the old desert map to bring it in line with the new one, by switching over to the new stylised textures, adding grass & rock details, and adding trees.  The desert map was created procedurally using TerrainComposer (http://www.terraincomposer.com/terraincomposer-2-2/), so it was fairly simple to set up and automatically place the details and trees.  They definitely add a bit more life to the old map:-

Next steps

Overall I’m reasonably happy with how the race track map turned out so far, the track itself is a lot of fun to drive on, although visually I feel the map is still lacking something in some places.  I’d like to tweak the terrain and tree textures some more, improve the pit / paddock area, and maybe place more objects (such as large rocks) around the map.  Hopefully that’ll help.

More importantly, I need to finish laying out the rest of the map, by adding an oval track (I’ve made a start on this already), a go kart track, and an off-road track.  Beyond that, I’ll probably fill out the remaining outer regions of the map with more generic elements (hills, mountains, etc.) which should be less time consuming to make.