Working on Tile-based Map Making tool for my Unity3d game. Blender knowledge is low.

Before we start, I have plenty of experience in programming, but just don’t know how to go about this in Blender, and especially not the best way.

In the following post I will cover all of the problems I have.

TL;DR at the bottom

The Map Making Tool
The idea for my tool is that you enter in a width, height, and length, and a string of numbers, and then a script will run which will put tile models together according to the numbers entered.

The models are then to be merged with ctrl+j and can then have the decimate modifier applied to lower the poly count. It will probably be necessary to leave the outer corners out of this process (due to the complicated UV map)

The attached picture shows 4 models (cliff corners, cliff side, and floor) that are all 1x1x1 in size, as well as showing a demo map made from them

Tile Tags
The numbers relevant to the linked picture are as follows:

  • 0 = air/blank tile
  • 1 = floor tile
  • 2 = cliff tile

(more tile tags are to be used, but these are all that’s relevant to the image)

The demo map would consist of 2 layers.

Layer 0 (bottom)

0 0 0 0 2
0 2 2 2 2
2 2 1 1 1
1 1 1 1 1

Layer 1 (top)

1 1 1 1 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0

The script will take those as input and make the demo map.

UV Maps
When I put all the models in manually, and then merge them (so that I can decimate the poly count), the UV map generated is in need of fixing, because of the floor and cliff tiles being stretched larger than the map texture, and especially because of the outer cliff corner models having a complicated UV map that doesn’t automatically unwrap well.

One solution is to leave the cliff corners out of the merging process so that they won’t be affect by Decimate, or have their UV maps changed.

One other thing I would like is if I could use script to build the UV maps how I wanted them to be so that there was no manual fixing required, but generally fixing the maps (provided cliff corners are excluded) is not hard.

My Questions / TL;DR:

  • How can I place specific models at specific positions via script?
  • Can I (and if so how) arrange the UV Map properly using script?