3D Tile Navigation and Storage

3D Tile Navigation and Storage

This asset provides a collection of scripts that handle unit traversal across complex tile-based terrain, and level data serialization and storage to disk. Unlike most other similar assets, this asset uses a traversal graph instead of a 2D array. As a result, it supports complex 3D structures like spirals or tunnels. It provides support for units, buildings and square as well as hex tiles.

Just construct the level visually in the Unity editor, and this asset automatically generates the traversal graph. Click on a unit and then click on any tile, and the unit will smoothly travel to that tile, choosing the shortest path there.

This asset ships with a default tile set, but is designed to be extensible. To create your own tiles, inherit the tile class, set the appropriate values, create a prefab and you’re done. Buildings and units can be similarly extended.

This system works well with turn-based strategy games, real-time strategy games, dungeon crawlers or any games that use tile-based mechanics.

Available on the asset store
Web demo and full feature list

Features:

  • Support for square and hex tiles
  • Support for tiles, units and buildings
  • Dynamically generated traversal graph
  • Smooth navigation implemented without the physics engine
  • Traversal graph visualization for graphical debugging
  • Reading from and writing to files
  • In-editor level construction
  • Full source code included
  • Clean and commented code
  • Easily extensible
  • Decoupled game classes and path finding classes
  • Quick start guide and prefabs included. Set up a working project with a single prefab

If you have any feedback or questions, please write to me at apoorva.ramesh.joshi@gmail.com, or post below.

This looks interesting, especially because it works on elevation. I have a few questions though…

  • Does it work with terrains?
  • Are there any workflow videos/screenshots for this?
  • Is there a move limit system on the unit class?
  • How configurable is it - could I replace the path indicators with other graphics easily (show red tiles where you can’t move, green tiles where you can, blue tiles where it’s moving for example)?
  • Is it usable with randomly generated levels?
  1. It doesn’t work with terrain out of the box. You might be able to get it working, but you would need to modify the core system first. The main purpose of the system is to make working with tiles easier. If you need complex maps, you can use hex tiles with any kind of elevation you desire.

  2. Here are two screenshots that sum up the level editing process:
    2.1. Creating levels. Place buildings, tiles and units under a hierarchy as shown in the image. Each building, tile or unit is a prefab. You can create your own prefabs, and sample scripts are provided with the asset. Then attach the Level Writer script to the parent object, and the level will be written to the specified file.

2.2. Loading levels. Create an empty GameObject, and attach the Level script. This is a sample script with a small amount of code which loads the level. It internally uses the Level Reader script, which is also included in the asset.

  1. The unit class does not come with a move limiter, but this can be easily done in a few lines of code. The system already supports move costs for tiles. e.g. A swamp or forest tile would cost more than a plain tile. The system already returns the shortest path to the destination as a list of tiles. All you would need to do is to add the costs of the returned tiles, and act accordingly.

  2. The system is extremely configurable. All the source code is provided and is separated into different classes by functionality. You could modify the tiles to change colour at will.

  3. It is most definitely usable with randomly generated levels. In fact, I designed it expressly with procedural generation in mind. The traversal graph is generated at runtime with a single function call and the generation process is extremely fast.

If you need any one-on-one help, please feel free to drop me a mail at apoorva.ramesh.joshi@gmail.com

Cheers, that’s enough for me to seriously consider it for a side-project, then :slight_smile:

Lack of terrain support isn’t a stopper for me, just nice to have (Word/TerrainComposer sitting here, waiting to be used!). The plan is mainly for tile-based use, and if it supports procedural use then in-game editors aren’t impossible either. If the unit class is just an example to get started, I think that works better for me anyway.

I’ve been looking at using the built-in navmeshes and agents for this purpose, but it’s lacking configurability of “steps”. Almost everything is there for tile-based navigation, including support for multi-story buildings etc. Just not an actual configurable grid, so your solution could be the winner :wink: