Tile City Generator  1.0
 All Classes Functions Variables Properties Pages
Getting Started

Introduction

generalview.png

Tile City Generator is a tool to resolve the connections between prefabicated tiles to generate a connected world. The world grid will generate new connected tiles and destroy tiles out of range with the player movement

Installation

This tool use prefabicated tiles, your first step is create a bunch of nice tiles, to do that you can use some modeler software like Blender. Only need 3 requirements:

  • Tile with ground square, same height and width
  • All tiles must have the same ground dimensions
  • All tiles must have the same available connections

The next step is define the connections border. Add the Border.cs script to each tile prefab and fill the needed data into the inspector.

  • Number of connections by side: Connections available by each side
  • Active connections array: indicates that the tile have a connected path in this position
border.png

You can make different tiles with the same border pattern, its useful when you want the same connections but different content inside. You can make the same road intersection with different fountains in the center

The last step is add que script World.cs to some object of the scene, like the main camera, and configure the parameters:

  • Size: number of prefab tiles
  • Tiles list, drag each game tile into the list
  • Initialrange: Define the number of tiles generated around the player
  • Tile Size: tile side size in Unity Scale
  • Tile Connections: number of connections by side of the tiles, (the same value used in the Border script of all tiles)
  • Pool object position: the position of the pool object parent. We use a pool of tiles to produce a smooth gameplay. It's the position of this pool, must be out of visible range.
    world.png

That's all. Run and move the player with double-click, you can see how when the player change the tile a row of tiles are generated in front and a row of tiles are destroyed at back