Feb 19

Tile Based Map Generation with SabreCSG

Now that i’m finished with my metaballs implementation I’ve started working on creating map assets and building out test levels for my game. Since I’m creating this myself I tried to find a tool or asset pack that could help me speed up the creation of the tile assets for the map.

To keep things easy and reusable I decided the level design would be a 3D tile based.

So I needed to find something that could:

  • Create tile based models
  • Do per face texturing
  • Create reusable components
  • Easy to learn
  • Free – if possible


A brush based tool like Valves Hammer from the Source Engine seems like an easy way to build out a map. I had seen ProBuilder and ProBuilder free, but I didn’t really want to be tied to a free package that might be missing features I need down the line and force me to purchase the full version.

I found SabreCSG, a brush based asset that is completely free, I didn’t get around to even testing ProBuilder free because Sabre seems to do the job for me.


Tile Models

The creation of models was pretty easy with SabreCSG, my only issue I had was with some of the weird rotations the system puts on brushes when you extrude or split them, which caused issues with my procedural generation.

Once I figured out a scale that would fit the player on one tile I started building out some prototype blocks that I will be using in my maps.

tile models


Map Generation

As great as tools like probuilder and SabreCSG are for building models quickly, I wanted to have some rapid prototyping of levels. The easiest way I could implement this was to create a prefab out of each of the models I created above, then use Excel to layout my map by specifying which ID should be used in each cell, along with its Y axis Euler rotation, then iterate through the CSV file and spawn the prefabs in the correct locations.

Using the Unity resources folder, I put all my prefab models in a folder called Tiles and ensured I labeled my tiles with IDs so when the resource folder was loaded into an array, all of my tiles would be in the correct position in the array.



The excel file just contains the ID and the Y axis Rotation in a cell, separated by a space.

csv grid


The magic happens in an Editor script I wrote which reads the CSV file and spawns the prefabs. It is attached to the CSGModel gameobject so the prefabs are spawned under it and become brushes. The only thing the script doesn’t do yet is clear out any existing prefabs, so if you want to make big changes, its easy enough to delete everything under the CSGModel object and generate the map again.

To call the above functions, I made an Editor script to run them from the Editor. If you haven’t created any Editor scripts yet, you should! They’re so helpful and speed things up.


MapGen Editor


Now I can generate some test levels quickly!

Test Level


1 ping

  1. […] Tile Based Map Generation with SabreCSG […]

Leave a Reply

Your email address will not be published.