Tutorial

Getting started

  1. Create a new project with a new empty scene.
  2. Import TileWorldCreator from the Unity Asset-Store.
  3. Drag and drop the prefab TileWorldCreator from the TileWorldCreator folder to your empty scene.
  4. Now click on Generate New. TileWorldCreator has just generated a new map for you.

Paint map

Now let's modify the map a little.

It is recommended to switch the scene camera in Unity to orthographic and the view to top. Right click on the menu in the scene editor. Also make sure to be in the move tool in Unity before painting(W) -> see screenshot

  1. Now you can paint directly onto the grid. Press Z or Y for undo/redo. Press H to show or hide map.
  2. Select automatic build in the edit map tab to see your chances directly.
  3. If you wish, you can add additional layers and paint on them by selecting a layer in the edit map tab.

Build map

You'll need to assign new tiles to a preset to build a map.

  1. Open the tab Presets and select Add new preset.
  2. Now go to the project folder TileWorldCreator -> _Art -> _Presets -> _preset_03.
  3. You will find 5 numbered prefabs. Drag each one of them into the according tile slot. Number one to the first slot, number two to the second and so forth.
  4. Make sure you set the block offset Y position to 0.0.
  5. Click on Build and you will see your newly created map in the scene.

Merge map

Now that you have your first map ready we should merge it to reduce drawcalls.

  1. In the Settings tab at the bottom you can find a cluster size value.

    Default is set to 5. Set it to 10.

  2. You can now click on Merge.
  3. In the hierarchy view you will find a gameobject called TWC_World. All generated tiles will be parented inside of this gameobject. If you open it up, you can see 4 clusters with the merged meshes inside.

Working with masks (new since 1.2.0)

A mask layer can help you with masking specific cells from your layer. A mask layer uses masks behaviours which describes how the layer should be masked. You can of course modify / paint a mask layer like any other layer by selecting the mask layer. TileWorldCreator comes with 4 default mask behaviours (border, inner, circle, random) You can also add your own mask behaviours by creating a new class file in unity and inherit from TileWorldCreator. Check out a mask class inside the MaskBehaviours folder to see how a simple mask behaviour is created.

Now let's see how we can add an additional preset and mix it with our map by using a mask. In this example we will use a second layer to apply a different tileset only for the border of our map. This is great if you want to add an additional tileset with ramps for example.

  1. If you have merged your map before, regenerate a new map by clicking on generate new.
  2. click on the duplicate layer button on the right side of the first layer. This will duplicate our first layer to a second layer.
  3. Make sure that in the settings you have unchecked the option "Build overlapping tiles"
  4. Now that we have an exact duplicate of our first layer we will need to assign it with a new preset which will have a different border tile. In this example we will use the ramp tile from the preset_00. So just duplicate the first preset and assign the ramp tile to the first slot of our newly created preset.
  5. TileWorldCreator adds automatically a Y offset to every layer so we have to compensate that in the newly created preset by setting the block offset Y to: -0.5
  6. Assign the newly created preset to the second layer.
  7. Now make sure you have selected the second layer then click on the Add mask button, select in the dropdown field the border mask behaviour and click apply
  8. That's basically it. By selecting the mask layer you can remove or add cells to the mask.
  9. Try different mask behaviours by selecting them in the dropdown menu of the mask layer. By clicking apply, the mask layer will be re-builded

Objects placement

Random Objects

TileWorldCreator can help you bring more life to your maps by instantiating additional objects. This is great for trees, stones, decals... Let's start adding a nice palmtree to our map.

  1. Make sure you have the TileWorldSpawner script on you prefab. If not, you can find it in: TileWorldCreator -> _Core -> Scripts
  2. Open up the tab Set Random Objects, and select Add new GameObject.
  3. Let's drag the palmtree prefab from TileWorldCreator -> _Art -> _Presets -> _presets_03 onto the empty GameObject slot.
  4. Choose spawn childs and set the settings like in the screenshot to add some variations.
  5. Select place on block and click on Instantiate random objects.

World start/end placement

TileWorldSpawner can help placing your player and/or your end position gameobject to your world.
  1. Open up the tab Set Start/End Position.
  2. Add you player gameobject to the empty gameobject slot.
  3. You can choose between nine positions on your map. (topLeft, topCenter, topRight, middleLeft, middleCenter, middleRight, bottomLeft, bottomCenter and bottomRight)
  4. Set the correct offset.
  5. Click Instantiate Start/End objects.

Runtime editor

TileWorldCreator comes with an easy to use runtime editor. It will use all settings from the assigned TileWorlCreator prefab to generate the maps.

Setup the runtime editor:

  1. make sure a TileWorlCreator prefab with a correct setup is already in your scene, then you simply have to drag and drop the TileWorldCreatorRTE prefab located in the TileWorlCreator folder to your scene.
  2. Make sure you assign the according references to the prefab such as the TileWorlCreator prefab and the scene camera.
  3. Hit play and you are ready.

Map cruncher

TileWorldCreator comes with a map cruncher script which can subtract or add tiles based on the position of an object. The map gets updated automatically. You can find the script inside of the TileWorldCreator/Script folder. Just drag the script to any object in your scene assign the TileWorldCreator reference and hit play. There's also a simple demo scene with the map cruncher script.

TileWorldCreator

Save/Load map

You can save or load an existing map by clicking on the image banner in the inspector of the TileWorldCreator script. Select Load or Save map. It will save an .xml file.

If you use Random Seed values to generate maps in a specific pattern. You theoretically only need to save the seed value. See Random.seed for more informations about random seed.


Settings

  • Invert: Inverts the map. True = Great for dungeons. False = Great for islands.
  • Flood unjoined: Basically removes all smaller unjoined islands
  • Flood holes: Flood holes inside of an island
  • Water: Build water tiles or not.
  • Number of layers: Number of layers to add when generating a new map
  • Layer inset: Defines the amount of inset for each additional layer. See Layers
  • Build overlapping tiles: Set to false, overlapping tiles from the layer underneath will not be build (only active when theres more than one layer)
  • Grid width: Width of the map
  • Grid height: Height of the map
  • Scale: The global scale of the map
  • Scale tiles: If true, the tiles will be scaled according to the global scale slider
  • Chance to start alive: Sets how dense the initial grid is with cells.
  • Number of steps: This value defines the smoothness of the map.
  • Random seed: Set a random seed for the map generation. See: Random.seed
  • Minimum size: TileWorldCreator tries to generate a map until the size is at least the size of the minimum size value. (can be not more than 50% of the size of width*height)
  • Cluster size: Set the size of a cluster when building the map. This is useful for preparing the map for occlusion culling.
  • Add mesh collider: Add a mesh collider when merging the map.

  • Presets

    TileWorldCreator only needs 5 tiles to generate a complete map. See Anatomy of a map for more informations.

    For each preset you can assign an edge tile, corner, inverted corner, block and floor tile.

    Tilesets

    If you wish to add more variety you can add additional tilesets. TileWorldCreator instantiates randomly from those tilesets. For example: We create a preset with one tileset. The generated map looks at some point very repetitive. So we can add an additional tileset and add different prefab tiles to it, which varies from the other tileset, for breaking the repetitive pattern. You can add as many presets and tilesets as you like.

    Edit map

    In the edit map tab you will find the layer system. You can assign for each layer a different preset by selecting it in the dropdown list.

    Layers

    When generating a map randomly you can specify how many layers should be added in the settings tab. TileWorldCreator generates the base map randomly and adds for each layer the same map to it, but with an inset. The inset value can be edited in the settings tab

    Mask layers

    To add a new mask layer, select the layer you wish to apply a new mask and click on add mask. To know more about mask layers see: Mask layer

    Building your own tiles

    When building your own tiles for TileWorldCreator, you must make sure they meet the following requirements:
  • You will need 5 tiles for a complete map (edge, corner, negative corner, terrain, water)
  • They must be square in size x and z. The height doesn't matter. Best way would be to create your tile with a size of 1 in x and z.
  • The pivot must be centered
  • If you want to create a "2D" map, you can also use the unity default quad object (GameObject-> 3D Object -> Quad). Then you only have to assign your textures to it.

  • Anatomy of a map

    TileWorldCreator only needs 5 tiles for creating maps. This helps to reduce production time and keeps the whole system very simple to use.

    Although there are some important informations to know when creating maps with TileWorldCreator.

    See screenshot for a better understanding.


    Copyright © doorfortyfour 2015