Tilesets
A tileset is an asset of kind tileset. Its canvas is one tile, and each tile is an animation (usually one frame), so normalising, QA, contact sheets, effects and the web app all work on tiles as they are. On export, it becomes a tile-map layer, plus an autotile lookup when the tiles have terrain corners.
This page covers:
- terrain that autotiles;
- cliffs;
- platforms;
- importing a tile sheet you already have;
- single tiles;
- game fields such as
solid; - using a tileset in the game.
Recipe: top-down terrain that autotiles (PixelLab)#
Using Atelier, make a <16> px tileset
<beach>: lower terrain "<shallow ocean water>", upper terrain "<sandy beach>", short names <water> and <sand>. Normalise it, check the seams and export it.
What you get from generate_tileset is a Wang corner set: 16 tiles, one for every combination of the two terrains at the tile's four corners.
- Tiles that are all one terrain are named after it:
water,sand. - Mixed tiles are named
<lower>-<upper>-<NW NE SW SE>, with 0 for lower and 1 for upper. For example,water-sand-0011has sand along the bottom. - Each tile's corners are stored, which is what makes autotiling possible.
Then:
normalise_framesscales the tiles without re-centring them, since a tile's edges must stay where they were drawn.qa_reportchecks seams. Each plain tile must tile with itself, and each pair of tiles that share corners must meet without a visible jump. Regenerate with a newseedif many seams fail.export_assetwrites the sheet, an atlas,<id>-tilemap(the tiles as a layer, with a demo island to look at) and<id>-autotile. The preview page draws the demo with the realtile-mappackage.
Variations:
| Want | Ask for |
|---|---|
| Raised banks | transitionSize: 0.25–0.5 |
| Cliffs | transitionSize: 1 (25 tiles, three terrains; the cliff face is the third) |
| A drawn border between terrains | transition: "<wet sand>" |
| Rounder or square edges | shapeStyle: "round" / "square" |
| Richer 64 px tiles | mode: "pro". Uses the style guide's view and palette, and costs more. |
| Terrain that looks like an image you have | lowerReference: "art/style/refs/water.png", upperReference, transitionReference: a texture, a tile you like, or a crop of a mockup |
Recipe: more than two terrains (chained sets)#
Using Atelier, make a <16> px tileset
<meadow>of <sand> to "<short green grass>", chained onto<beach>.
Make one tileset per pair of terrains that touch (water/sand, then sand/grass) and chain each onto the one before: generate_tileset { chainFrom: "beach" }.
- The shared terrain is the earlier set's upper terrain by default (
chainTerrainto choose another). It becomes this set's lower one (chainAs: "upper"for the other way round). - It keeps its name (
sand), so the autotile lookup sees one terrain across both sets. - PixelLab is given the earlier set's pure tile as the reference for it, and the base tile id it gave that terrain, so the two sets meet along it.
- Chained into the same asset (
assetId: "beach"again), the sets share one sheet, and the shared terrain's tile you already have is kept, not replaced. - Chaining is experimental: check the seam between the two sets.
Recipe: hexes, roads and building kits (tiles pro)#
Using Atelier, make <32> px <hex> tiles
<coast>: <sand to sea>, as a terrain set.
generate_tiles_pro (PixelLab's /create-tiles-pro, a job of a minute or two, experimental) makes tiles generate_tileset can't:
shape / feature |
You get |
|---|---|
| no feature | numbered variations: describe each, "1) grass 2) dirt 3) stones" |
feature: "roads" (square) |
18 path tiles, named by the edges they join: road-ns, road-ew, road-nesw… |
feature: "tileset" |
a terrain set: 16 Wang tiles on squares (named and autotiled like generate_tileset's), a 32-tile coastline on hexes |
feature: "building" (square or oblique) |
a construction kit: floor, walls, doorways, a pillar, stairs (building sets wall and floor materials) |
shape |
square (default), hex (flat top), hex_pointy, octagon, oblique |
Each connectable tile keeps its mask (which edges or corners join), shown on the Tiles tab. tile-map draws square grids only: hex and octagon tiles export as a tileset to place in your own grid. Isometric tiles are out of scope.
Recipe: tiles from a 3D model#
Using Atelier, render
<wall>'s model into <32> px tiles<walls>, facing <s and e>.
tile_from_model (free) renders a module (a wall, a cliff, a fence, a bridge) made with generate_model or boxes on the Model page into a tileset's tiles at the tileset's camera, one tile per turn (tiles: [{ name: "wall-s", yaw: 0 }, { name: "wall-e", yaw: 90 }]). Every turn shares one scale and one ground point: the module's outline fits the tile, its lowest point on the bottom edge (anchor: "center" for flat ground). Normalise and QA them as any tiles.
Recipe: side-scroller platforms (PixelLab)#
In a game with projection: side, generate_tileset makes platform tiles by default (or pass sidescroller: true):
Make a <16> px platform tileset
<cave-platforms>of "<dark cave stone>" with a top layer of "<green moss>".
lower is the platform material and transition is the top layer. Tiles are named from the corners PixelLab reports, the same way as Wang tiles. This is experimental: look at the contact sheet and tag the tiles you need (see Game fields).
Recipe: import a tile sheet you already have#
Import
<art/style/refs/dungeon-tiles.png>as a <16> px tileset<dungeon>(<1> px spacing, <0> px margin).
import_tileset slices the sheet into one tile per non-empty cell, named t-<row>-<col>, or by names in reading order. It handles gaps between tiles (spacing), a border around the sheet (margin) and tiles taller than wide (tileHeight). Empty cells are skipped unless you pass keepEmpty.
Imported tiles have no terrain corners, so there's no autotile lookup. Lay them out with your own level data.
Recipe: single tiles (any provider)#
For painted games (Ludo has no tileset endpoint), or to add a tile to any tileset:
Generate a
<moss>tile for<floor>: "<cracked stone floor with moss in the cracks>".
This is generate_image with the tile's name as animation. The prompt automatically asks for a seamless, edge-to-edge tile with an opaque background. For a new tileset, Claude first creates the asset with asset_create { kind: "tileset", canvas: <tile size>, directions: "1" }. QA then checks that the tile repeats seamlessly.
Game fields (solid, hazard…)#
Tiles can carry custom fields that are copied onto the tile definitions the game loads. tile-map's getLayerRectangles reads them, for example to build collision from solid tiles.
On
<dungeon>, setsolid: trueon <t-1-1, t-1-2, t-1-3> andhazard: "spikes"on <t-4-2>.
Claude does this with asset_update: { tileset: { tiles: { "t-1-1": { fields: { solid: true } } } } }. Re-export afterwards.
Or paint them yourself on the tileset's Tiles tab: every tile in a grid with its fields. Type a field and a value (solid / true, cost / 2), then click or drag across tiles; Erase takes the field off. Save writes them.
Using a tileset in the game#
Register the tileMap processor and load the exported content:
import ContentManager from '@basementuniverse/content-manager';
import { textureAtlasContentProcessor } from '@basementuniverse/texture-atlas';
import { TileMap, tileMapOptionsContentProcessor } from '@basementuniverse/tile-map';
ContentManager.initialise({
processors: {
textureAtlas: textureAtlasContentProcessor,
tileMap: tileMapOptionsContentProcessor,
},
});
await ContentManager.load([...content, ...beachContent]); // beach.content.json
const options = ContentManager.get('beach-tilemap');
options.layers[0].data = myLevel; // rows of indexes into layers[0].tiles; -1 = empty
const map = new TileMap(options);
map.draw(ctx, { x: canvas.width, y: canvas.height }, camera.position, 1);
To autotile with beach-autotile, store your level as the terrain at each grid corner: (rows + 1) × (cols + 1) terrain names. Then pick each cell's tile from its four corners, and build myLevel before setting it on the layer as above:
const auto = ContentManager.get('beach-autotile'); // { order: ['NW','NE','SW','SE'], tiles: { 'water|water|sand|sand': [5], … } }
const tileAt = (x: number, y: number) => {
const key = [corners[y][x], corners[y][x + 1], corners[y + 1][x], corners[y + 1][x + 1]].join('|');
const choices = auto.tiles[key];
return choices ? choices[Math.floor(Math.random() * choices.length)] : -1; // cliff sets have several per pattern
};
const myLevel = Array.from({ length: rows }, (_, y) => Array.from({ length: cols }, (_, x) => tileAt(x, y)));
If your game registers the processor under another name, change export.processors.tileMap in art/atelier.json and re-export.
Next: Finishing touches.
Found a mistake? Edit this page on GitHub.