算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
tiled【设计与创意】Tiled is a free, open-source 2D level editor for building tilemaps, placing game objects, and designing levels, exporting to JSON (.tmj) or TMX (.tmx) for engines like Phaser, Godot, and Unity. Use when a user wants to design a tile-based game level, set up tile and object layers, build auto-tiling terrain brushes, animate tiles, attach custom proper…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Tiled is a standalone desktop editor for building 2D tile-based maps: tile layers for rendering (ground, walls, decoration), object layers for free-form game logic (spawn points, triggers, paths), image layers for full backgrounds, and group layers for organizing all of these. It exports to its own JSON (.tmj) and XML (.tmx) formats, plus tileset companions (.tsj/.tsx), which any game engine's Tiled loader (Phaser, Godot's TileMap importer, Unity via a plugin, PixiJS) can read directly — Tiled itself has no runtime, it only authors the data.
Download the editor for Windows, macOS, or Linux from https://www.mapeditor.org/download.html, or install it from Steam or itch.io. There is no package-manager install for the desktop app on most platforms (Flathub ships a Linux build: flatpak install flathub org.mapeditor.Tiled).
A Tiled map is a stack of layers, bottom to top:
collides custom property)// dungeon.tsj — Tiled tileset, JSON format
{
"name": "dungeon",
"tilewidth": 16,
"tileheight": 16,
"image": "dungeon-tileset.png",
"imagewidth": 256,
"imageheight": 256,
"tilecount": 256,
"columns": 16,
"tiles": [
{
"id": 0,
"type": "floor",
"properties": [{ "name": "walkable", "type": "bool", "value": true }]
},
{
"id": 16,
"type": "wall",
"properties": [
{ "name": "collides", "type": "bool", "value": true },
{ "name": "destructible", "type": "bool", "value": false }
]
},
{
"id": 48,
"type": "animated-torch",
"animation": [
{ "tileid": 48, "duration": 200 },
{ "tileid": 49, "duration": 200 },
{ "tileid": 50, "duration": 200 },
{ "tileid": 51, "duration": 200 }
]
}
]
}
Tiled's terrain system auto-selects the right tile variant based on its neighbors:
export class GameScene extends Phaser.Scene {
create() {
const map = this.make.tilemap({ key: "level-1" });
const tileset = map.addTilesetImage("dungeon", "dungeon-tiles")!;
const ground = map.createLayer("Ground", tileset)!;
const walls = map.createLayer("Walls", tileset)!;
const decorAbove = map.createLayer("DecorationAbove", tileset);
// Collision from the tileset's custom property, not a hardcoded tile ID list
walls.setCollisionByProperty({ collides: true });
const objects = map.getObjectLayer("GameObjects")!;
objects.objects.forEach((obj) => {
switch (obj.type) {
case "spawn":
this.spawnPlayer(obj.x!, obj.y!);
break;
case "loot":
this.createChest(obj.x!, obj.y!, obj.properties);
break;
case "trigger":
this.createTriggerZone(obj);
break;
}
});
decorAbove?.setDepth(10);
}
}
The agent creates tile layers (Ground, Walls, DecorationAbove), marks wall tiles with a collides boolean property in the tileset, and adds an object layer GameObjects with a Chest object carrying lootTable: "common" and locked: true custom properties:
{
"name": "GameObjects",
"type": "objectgroup",
"objects": [
{
"name": "Chest",
"type": "loot",
"x": 320,
"y": 112,
"properties": [
{ "name": "lootTable", "type": "string", "value": "common" },
{ "name": "locked", "type": "bool", "value": true }
]
}
]
}
The game engine reads obj.properties.lootTable and obj.properties.locked at runtime to decide what the chest drops and whether it needs a key.
The agent adds a polyline-type object for the patrol path and a rectangular trigger zone object with custom properties identifying which boss to spawn:
{
"objects": [
{
"name": "PatrolPath",
"type": "path",
"polyline": [
{ "x": 0, "y": 0 },
{ "x": 96, "y": 0 },
{ "x": 96, "y": 64 },
{ "x": 0, "y": 64 }
]
},
{
"name": "BossZone",
"type": "trigger",
"x": 400,
"y": 64,
"width": 128,
"height": 128,
"properties": [
{ "name": "bossId", "type": "string", "value": "skeleton-king" },
{ "name": "oneShot", "type": "bool", "value": true }
]
}
]
}
The engine walks the enemy along PatrolPath's points and spawns skeleton-king once when the player enters BossZone, gating the trigger with oneShot so it doesn't refire.
.tmj) rather than TMX (.tmx) unless the target engine specifically wants XML — JSON is easier to parse in a custom loader and is what most engine importers expect by default.Tilemaps, Godot's TileMap import, a Unity plugin, etc.) is in place.