Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

Ok so lets say we have this example map. Grassland, Dirtland, and Iceland. everything works fine until you hit a border (in purple)

Let's just look at the top purple tile. I need the left half of the tile grassland, and the right half dirtland. Basically I need two tiles stacked on top of each other to make that effect. My first attempt is to just give every biome its own tileset layer and stop at the purple border, that gets this.


You see the purple leaking between the borders? Now this is really easy to fix by hand, just pick an edge and make the lower layer a full tile and not a half. But programatically that means making a non binary bitmap. Basically make a ruleset for edges on what biomes overlaps what, make a ruleset for where three biomes meet, then make a ruleset where 4 biomes meet. Even after all that work that still might not cover every scenario and get weirdness. If you look at this super basic 16x16 tileset instead though...


You'll notice you don't have that purple peeking through problem. Because the borders are flush against each other. Everything extends 8 pixels into the middle so there is never a gap. You can stack 6 binary tilemaps (basically a ruleset of "either there is a tile, or there is not) on top of each other and everything just works. They don't even need to be flush, You could expand the white areas and have tilesets overlap, and it will still work fine. Just some examples of what I threw together (the top left tile is just an icon)


That gets you this

No gaps, just map

(1 edit)

Would it work to fill the entire land with "dirt" first and then just cover it with other terrain types without using any special rules? You might end up with some dirt between other types of terrain but this is what HOMM I and II we doing too. And I'd guess they did if for similar reasons.

Also - how far did you go with auto-tiling? Can the effects of your work be seen somewhere?

(1 edit) (+1)(-1)

So I think you're talking about giving each biome a layer and stacking them on top of each other. That works for 98% of scenarios. But any time you have a section of width/height 1 tile, you run the risk of covering it up by another layer. (at least in a 2x2 bitmask, may not be an issue in a 3x3. ) I did that for the longest time, until I started noticing small peninsula's and bays in my ocean were appearing/disappearing where my code said there wasn't one. Place a single random tile of iceland in the dirtland and depending on how you layer things, it can vanish entirely.

I have my auto tiling working pretty damn well at the moment.  lacks a buttload of polish, but it even wraps around. The ultimate goal I'm trying to do is be able to "lock" tiles into place and then reroll the world around them. I haven't actually tried exporting something in godot yet but I bet I could throw something up in github once I figure it out.

If people are interested