Reputation: 381
I am working on functionality for destructible, procedural terrain (think Terraria / Starbound) for a game, and in order to make the blocks not look terrible, I have configured a nice auto-tile. See sample tileset below:
So far, these work great and tile well enough - they randomly select from the available tiling options etc., however as part of the game mechanics, players will need to be able to remove tiles, so this:
Would become this:
As you can see, it's quite ugly. Ideally the dirt border on top would also get deleted, and the correct autotile would fill in that area, like so:
I've tried looking for various settings such as tile dependencies (to solve the culling of border tiles) or automatic autotile refreshing, but I haven't found anything of either sort. Any kind of programmatic solution I can think of would likely involve calculating all nearby tiles and manually culling / placing border tiles as appropriate, which would likely be catastrophic for performance given how many times this action will be happening.
Any solutions or pointers would be appreciated.
Upvotes: 1
Views: 244
Reputation: 653
Maybe this might help,
best I can tell from the video is that you first have to remove the tile using set_cell
Then have to get all 8 tiles (4 horizontal & vertical + 4 diagonals) surrounding the tile you removed and update those tiles using set_cells_terrain_connect
Upvotes: 1