Hello Guest

Author Topic: Auto Tiling for my game  (Read 201 times)

Dexer

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Auto Tiling for my game
« on: July 08, 2018, 01:58:31 PM »
Hello!

I would like to write an auto tiling sistem on top of tk2d for using in our game. I have used TilEd before to create tile maps and import it to tk2d but in our game we also rotate and flip tiles and TilEd does not support that.  Also while some tiles can be rotated and used as floor or wall or ceiling, some can be used only as floor or ceiling and some just as floor.

I am not very experienced in coding. Could anyone please give me an advice, how to update tilemap while painting? Is it possible?

I used search before and found some unikronsoftware replies related to Auto Tiling but could anyone be more specific and  Excuse my not native English.

Quote
we had a working autotile system at some point, but there are no plans on completing it at the moment. Its not polished enough for general release, and probably no longer works with the latest builds... You could build one on top of the system that exists currently. I can offer some advice if you want to code a solution.

The easiest way to do this is to manage this in the tilemap stage. You paint in the core tile. So... you if you have grass and mud, with all the possible corner pieces (13 if I remember correctly) - you only ever use the center piece. Your map should now look like its made of solid grass and solid mud.

Once this is done, you write a script to run through your tilemap, and based on the tile you are on, and the 8 adjacent tiles, you pick the appropriate transition tile and replace that tile. Because this is a one off process, you basically have a big lookup table that tells you the best tile to pick based on the surrounding tiles.

To reiterate - You use the existing tools to paint solid values in, and then write a custom script to convert the solid tiles to the edges, etc.

You can modify the tilemap quite easily - tilemap.SetTile(x, y, tileId);

ComputerNerd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Auto Tiling for my game
« Reply #1 on: July 22, 2018, 12:32:09 AM »
Tiled supports flipping tiles. And 2d toolkit reads it perfectly.