• Stephen Brown

Fenced Off!

Whilst creating these 3 new countries, I decided I wanted to add more variation to them from the original tracks in the game. After doing a bit of research, I found that Australia was a track which needed some cattle grids and lots of fences to make it look a bit more authentic.


As you already know, the entire game is procedurally generated at runtime to keep the data size super small. The current algorithm used for placing fences didn't really have any logic to it, it simply placed a line of fences along the side of the road. However this is not very realistic as fences are meant to "fence off" areas and contain things. So fences need to go in different directions in order to fence off certain areas and make it look better. Add to this the fact that we wanted cattle grids on the road, meant that I needed to come up with an entire new solution for placing fences on the tracks.


The first thing to do was to place the cattle grids on the track, this was done using the exact code that the bridges use, after all it is a type of "mini" bridge! Next was to place little markers on the cattle grid asset to let the algorithm know where a fence may join up (this can be done for any asset in the game to create fences that link to them!).


Once we have this data, we parse the track and work out areas that can be fenced off, in fact this is great because it divides the track up so we can place certain things within a fenced area to create a more diverse track! After doing this we arrive at the situation below where you can see potential areas to be fenced. There is no need to do too much away from the track because you never see it, this game is after all smoke and mirrors!

Once you have a fence list, you may want to only place a few of them, so the algorithm then decides a priority for the fences, the ones that are linked to in game assets are always placed, others are randomly sorted and placed based on a random percentage. The game then uses the normal placement code for all assets to place fences at these locations, and you end up with the following result. Notice how the cattle grid now has fences laterally across the track dividing it up, and then other fences join that and run along the side.

In game it looks like this, and to make it all a bit more fun, I've made them all completely "smashupable"!

I hope you enjoy it when it is released! (Stay tuned for announcement!)


Ste


431 views3 comments

© 2020 Brownmonster Limited.

  • Buy for Nintendo Switch
  • Buy on Google Play Store
  • Buy on the Apple App Store
  • Discord
  • Follow us on Instagram
  • Follow us on Twitter
  • Follow us on Facebook