AutoTileGDX - LibGDX Procedural Terrain Auto-Tiler

Posted by Gideon Pertzov
autotile.jpg

A procedural auto-tiler for generating tiled terrain maps using corner matching “Wang Tiles”
Source code available on Github

Run live in browser

Implemented using libGDX which is one of the best Java game development frameworks for 2D game development.

libGDX is not a full game engine, but still implements many game related components,
So you don’t have to reinvent the wheel (if you don’t want to).
This gives you the perfect balance between using a full game engine and writing everything from scratch.
And on top of that it’s also open-source, so you can see how stuff is implemented.

The AutoTiler loads a JSON configuration file which specifies tile-set and terrain types definitions.
It can then prodcedurally generate a tile map by iterating on the map cells from bottom-left to top-right,
And picking a tile for a certain map cell, based on its neighboring tiles.

For example, from this tile-set:

RPGTiles

And this JSON configuration:

{
  "texturePath": "img/RPGTiles.png",
  "tileWidth": 32,
  "tileHeight": 32,
  "terrainDefs": [
    [
      "sand",
      "water"
    ],
    [
      "sand",
      "grass"
    ]
  ]
}


You get this:
AutoTile Animation

Original tiles by Simon Bachmann © Robotality UG (haftungsbeschraenkt) 2013
Licensed under CC BY-SA