2D Structures

Status: built, 2026-11-22 (runtime 20261122.3). Tests: structure-2d, image-layers-place, map-passage-overrides. A 2D structure is the 2D side of Database › Structures: a building (or any piece of a map) made once on a phantom map and placed on 2D maps as often as wanted, beside the 3D structures in the same list.

What the Owner Asked For

  • Built on a phantom map, as a 3D structure is: Database › Structures › Build opens it, the map's own tools paint it.
  • Any mix of tilesets, and pictures, as layers on it.
  • Passability set right there, cell by cell: X (blocked), O (open) or \* (the character passes underneath: the cell's art draws over them, as a ☆ tile does). A structure of A3 pieces whose back a character walks behind is the case in point.
  • Passability set on the structure (on its phantom map, and on its page in the Database), and honoured wherever it is placed.
  • Placed on a real map as an object that keeps following its structure: change the structure's passability (or its art) in the Database and every map it stands on follows.

The Structure

A record in Database › Structures with dimension: "2d", in its file under 3d/Structures beside the 3D ones:

FieldWhat it holds
dimension"2d"
name, sizeIts name; [width, height] in tiles
layersIts layers, bottom first. A tile layer: { kind: "tiles", name, tilesetId, tiles }, tiles the six map layers of the plot (width × height × 6, as a map's data). A picture layer: { kind: "picture", name, picture, at: [x, y], opacity }, picture in img/pictures, at in pixels from the plot's corner.
passage{ "x,y": "X" | "O" | "*" }; a cell left out follows its tiles
surfacesMedia surfaces on the plot, as a 2D map holds them
bakedWhat a placement copies, written at each save: { below, over, cells }: the names of the two pictures in img/parallaxes/structures/ (one drawn below the characters, one above them), and every cell's passability worked out

Saving bakes the layers into the two pictures. A cell marked \* goes, with everything on it, into the picture above the characters, and so does a tile its own tileset marks ☆. Every other cell goes below. The pictures' names carry a hash of what they show (Inn-3f9a2c-below.png): a changed structure writes new files, and the maps it stands on take them the next time the editor applies it.

Each cell's passability is worked out at the save: X blocked, O and \* open; a cell with no mark follows its tiles by their own tileset's flags (the top tile that decides, as Game_Map.checkPassage reads them). A cell with nothing on it leaves the map's own passability alone.

The Phantom Map

The plot is a 2D map of the structure's size, never saved as a map. While it is open, the sidebar's map list becomes the structure's parts (its layers, top first, then its videos and images), the map's events go, and the map's own tools that the structure would not keep (Build, Image Layers, events, terrain, playtest) are dimmed and refused with a note (main.workshopRefusal).

  • The layer being painted is the plot's own tiles, with its tileset in the palette. The other layers show as pictures under or over it.
  • + Tiles opens the tileset picker (TilesetPicker.js: every sheet of the tileset selected) and adds a tile layer with the one chosen; + Picture opens the picture picker (img/pictures); + Video opens the video picker and lays the one chosen on the plot. A click on a video takes it up with its handles (move, resize, warp), its settings in the panel; every change is kept as it is made, and a click away puts it down.
  • The panel beside the plot edits the chosen layer: its name, its tileset (chosen again from the tileset picker, the plot shown with the new one at once), or its picture (chosen again from the picker), X and Y (pixels from the plot's corner) and opacity. The list orders the layers: a row is dragged to a new place, or moved with its ▲ ▼; its ✕ removes it and its eye hides it while painting.
  • Move Everything shifts the whole structure a tile in any direction: every tile layer, every picture, the marks and the videos (asking first when part of it would leave the plot).
  • Passability turns the plot's clicks into marks: X, O, \*, Sides (a click near a cell's edge blocks that side, again opens it; stored as dN, RPG Maker's side bits), or none. Placed, a cell is 1 open, 2 blocked or 16 + its blocked sides, and a step across a blocked side is refused either way. The marks show over the plot as the Passage view does.

On a Map

A 2D structure is placed from the tile palette's S tab (or Database › Structures › Use on the map): a click on its card, then a click on the map for each copy; a right-click on a placed one removes it. With no card in hand, the S tab selects placed structures on the map: a drag moves one, Delete removes it, a right-click opens its menu (Duplicate, Edit Structure, Remove), a double-click opens it in the workshop.

Use on the map (Database › Structures) places it: a preview follows the pointer, and a click puts it with its top-left corner on that tile. A placed structure is an object of the map's own, $dataMap.rrStructures2D = [{ id, file, at: [x, y] }]: a right-click on it while placing removes it as one, and one undo takes a placement or a removal back.

What the game reads is made from that list and the structures as they are now (RRStructure2D.apply), when a structure is placed, moved or removed, when the map opens, and when a structure is saved:

  • each placement's two pictures as image layers, fit: "place", at: [x, y], below the characters on ground and above them on over, tagged structure2d: <id>;
  • its worked-out passability in $dataMap.rrPassage, offset to where it stands (a later placement over an earlier one wins);
  • its media surfaces, moved the same way and tagged the same.

The map's own image layers and surfaces are left as they are. A game build needs nothing more: the map file holds what it draws and how it is walked.

In the Game

  • Image layers: a layer with fit: "place" draws its picture at its own size with its top-left corner on tile at, moving with the map.
  • Passability: $dataMap.rrPassage ({ "x,y": 1 | 2 }: 1 open, 2 blocked) is read before the tiles. An open cell can be entered and left in every direction; a blocked one in none. The editor's Passage view shows the same.

Limits

  • A plot is at most 64 × 64 tiles: it is drawn at 48 pixels a tile into two pictures (3,072 pixels a side).
  • A cell without a mark is open or blocked as a whole: a tile that blocks only some directions (a fence) counts as open. Mark it X where that matters.
  • Placed structures show on maps seen in 2D. A map shown in 3D does not draw image layers that lie on the map.