DevBlog #3 – All about Maps

Today I’m going to talk about the map making process today, as well as the way the actual race circuit itself is implemented in order to track player progress as well as guide AI.

Later on aswell I’m going to talk about the actual changes I made this week, because I haven’t done that properly in a blog as of yet.

Map Design

Map design, as with anything, starts with me scrawling something out on paper which resembles a track. For example I pick a theme, say winter. Then build up around that. They are built in MagicaVoxel, like all of the assets in the game. After around 30 minutes worth of work, you end up with something like this:

This is then imported into Unity, which is where the real work begins. The placing of all the trees, assets, track nodes, spawn locations. All the fun stuff.

We’ll start with the simple stuff, placing assets. 

Pictured above is the tree I’m going to use on the winter-themed map. It’s based off the model I used on Forest, but this time covered in white blocks to resemble snow-fall.

This is an example of the tree placer script at work. I simply have to click where I would like the tree to be placed, then the script creates a new one with a random rotation. This helped make the forest look natural and real, as well as being super quick to create.

“Snow” as it is current dubbed in-development is still being created, so I haven’t had much opportunity to fluff it out with fences, grass and extra details. But here is some game play with some of the AI:

Position Tracking

In order to track the players position around the track, as well as providing a guideline for the AI, I decided to use a system of track nodes. In the simplest way, each node links onto the one following, so we can track the progress between the two. This is done by a simple Vector algorithm which gets the closest point on the line between the nodes that the car is.

Each yellow cube represents the track node, with the red line between them representing the line I mentioned earlier. You can just see the white line off of the Tiny, that is the line between the car and the closest point.

Using some basic Vector maths, you can calculate the distance between each node. Given the amount of nodes, you can then calculate an extremely precise positioning in a race.

The track node system also doubles up as a way to power AI. In the simplest terms, they drive towards each node, then once approaching a corner (within 20 units), they begin to aim towards the next node. The AI will be talked about more as it is developed further.

Progress this week

This week saw a huge step forward for the AI in the game. I actually implemented them properly to start off with, as well as implementing collision prevention and also what to do when they get stuck. It still needs a lot of refining, but I’m extremely happy with how it’s progressed.

As well as this, we saw the creation of “Snow”, the winter themed map which you saw a bit of above. Also, the featured image of this post is a rendering of the next map to implement. Which I haven’t given a name to yet. Probably will be something boring, I’m not good at naming things.

Thanks for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *