terrain-autotiler
terrain-autotiler copied to clipboard
An advanced terrain tile matching algorithm for Godot 4.
Terrain Autotiler
Note: As of 4/2024, this repo is no longer being actively maintained.
Terrain Autotiler is a replacement terrain tile matching algorithm for Godot 4. It was designed for accurate, deterministic results in player-facing situations such as procedural generation and tile-based games. It is fully compatible with Godot 4 TileSets without any additional setup, but also brings back optional features from Godot 3, such as ignore bits and merging autotiles.




Features
Core
- A more accurate and deterministic terrain tile matching algorithm. It fixes multiple open issues. (While it is not fast, it is usually a bit faster than the engine.)
- Fully compatible with the Godot 4 terrains system. No additional setup is required.
- Brings back compatible Godot 3 features:
- Corners and Sides "Full" 256-tile mode to match individual diagonal connections.
- Alternative terrains can function as ignore bits similar to Godot 3.x by matching any other terrain, or can match a specific list of terrains.
- Custom primary peering terrains to allow merging tiles of different terrains.
- Ability to recalculate and update all terrain tiles in a TileMap layer.
Scripting
- Create a new Autotiler object using
Autotiler.new(tile_map), then use it to access terrain tile placement functions. Contains complete in-editor documentation.set_cells_terrain_connectandset_cells_terrain_pathwork the same as their base TileMap functions, but provide more accurate, reproducible results.set_cells_terrainsplaces multiple terrains by providing dictionary of{coords (Vector2i) : terrain (int)}. This makes bulk updates in procedural generation faster and simpler.update_terrain_tilesrecalculates and updates all the terrain tiles in a layer.
Editor Plugin
- TileMap editor: Toggle seamlessly between Godot 4 and Terrain Autotiler painting tools in the Terrains tab.
- Paint in real time with a more accurate Draw mode.
- Lock individual cells to prevent tiles from being updated (useful for preserving Path mode painting).
- Error notifications appear in real-time while painting to assist in identifying issues such as missing tiles.
- Open the debug panel to view detailed data for troubleshooting and bug reports.
- Note: The editor plugin is a work in progress. Notably, it is missing the option to paint specific individual tiles as well as non-contiguous mode for bucket fill. Toggle off the Terrain Autotiler tools to access these base Godot 4 editor features instead.
- TileSet inspector: Set up advanced features such as "Full" Corners and Sides matching mode, @ignore terrains and custom primary peering terrains.
- Includes minor editor bug fixes and UX improvements
- Selecting a TileMap in the scene tree always opens the bottom TileMap editor (rather than sometimes opening the TileSet editor instead)
- Coordinates and current tool information appear when hovering over cells
- More obvious visual feedback when painting with terrain tools
- Bucket tool fills all adjacent tiles of the same terrain, even if the tiles are not identical.
Installation
Github
- Download the latest version from Releases.
- Unzip and move the
addons/terrain_autotilerfolder to the project. - Go to Project Settings -> Plugins and enable Terrain Autotiler.
Uninstallation
- Go to Project Settings -> Plugins and disable Terrain Autotiler.
- Delete the
addons/terrain_autotilerfolder from the project. - (optional) Open the TileMap and TileSet inspectors for your scenes and delete the "terrain_autotiler" metadata.
Acknowledgements
License
- Terrain Autotiler is Copyright (c) 2023 dandeliondino (MIT license)
- Godot Engine is Copyright (c) 2014-present Godot Engine contributors (MIT license)