Skip to content

Map editor: Go to Tile, random mode, cut, major grid lines, undo steps; Tiled marked experimental - #109

Open
Xehanort88 wants to merge 5 commits into
Psychronic-Games:mainfrom
Xehanort88:pr/map-editor-extras
Open

Xehanort88 wants to merge 5 commits into
Psychronic-Games:mainfrom
Xehanort88:pr/map-editor-extras

Conversation

@Xehanort88

Copy link
Copy Markdown
Contributor

Stacked on #108 (Tiled exchange), #107 (turned tiles) and #106 (shortcuts). This pull request adds one commit of its own. It uses the shortcut table and the turned-tile bookkeeping, and it relabels the Tiled commands.

The problem

A handful of conveniences that Tiled and most tile editors have, and the Reactor map editor doesn't:

  • jumping to a given tile;
  • painting a scatter of variants instead of a repeating pattern;
  • cutting an area rather than only copying it;
  • a grid line that shows where a game screen ends;
  • a choice of how much undo history to keep.

What changed

All of this is on the flat map; the 3D view is not touched.

  • Go to Tile. Press Ctrl+G, or click the cursor's tile position in the info bar. It asks for X, Y (checked against the map size), centres the map on that tile and outlines it briefly.
  • Random mode. Use the new dice button in the toolbar, or press D. With several tiles picked, each cell painted by the pencil, rectangle, circle or fill gets one of them at random instead of the repeating pattern.
    • The choice comes from a hash of the cell and a seed that is renewed after each stroke, so the hover preview shows exactly what the stroke will place.
  • Cut with Shift + right-drag. The area is picked up as usual and also removed from the map (tiles, shadows, regions and turned-tile entries) as one undoable edit.
    • The autotiles and wall shadows around the hole are redrawn to fit.
    • Shift + right-drag no longer pans while a paint tool is active.
  • Options › Major Grid Lines. With the grid on, a stronger line appears every game screen (the default, taken from the project's screen size), or every 5, 8, 10 or 16 tiles, or not at all.
  • Options › Undo Steps. Choose from 10 to 500 map edits (default 50). Very large maps still keep fewer, within the existing 64 MB limit.
  • Tiled marked experimental. The map list now says "Export to Tiled (experimental)…" and "Import from Tiled (experimental)…". Every Tiled message ends by saying feedback is welcome and that Help › About RPG Reactor lists where to send it.

New strings are in all 17 locales. These are a machine-assisted first pass and should be reviewed; the feedback line uses each language's own names for the Help menu and the About window. The new settings are not added to the stored default preferences, so editor-preferences.test.cjs is unchanged.

Verification

  • Tests:
    • editor/tests/map-editor-extras.test.cjs: random-mode determinism and preview agreement, the cut and its undo, major grid steps, the undo-steps clamp, and Go to Tile validation.
    • map-shortcuts and tiled-map were updated for the D key and the new labels.
    • On this branch, all 990 tests in the map, tile, Tiled, i18n, dialog and preferences test files pass.
  • Running editor, driven over CDP:
    • random mode compared pixel for pixel against its preview;
    • the cut and its undo;
    • Go to Tile with valid and invalid input, and the outline pixels;
    • the Options rows (typing 5000 clamps to 500);
    • the labels;
    • layout checked both windowed and maximised.
  • Full npm test on the fork's main, which carries all four pull requests: only the known Windows environment and POSIX-path failures.

Limits

  • Flat view only.
  • Random mode picks uniformly; there are no per-tile weights.

🤖 Generated with Claude Code

Xehanort88 and others added 5 commits November 30, 2026 18:58
On the flat map, with no dialog up and no text field in use:

- B, R, C, F pick the pencil, rectangle, circle and fill; E and S toggle
  the eraser and the shadow pen. Each button's tooltip ends with its key.
- Ctrl with +, - and 0 zooms in, out and to 100%; Ctrl+/ fits the map in
  the panel. Zoom is about the middle of the panel and uses the wheel's
  own steps and limits.
- The arrow keys scroll by one tile (Event mode keeps them for its cursor).
- Space held over the map turns a left drag into a pan, beside the middle
  button and Shift+drag. The painter stands down for that drag.

The key table is utils/MapShortcuts.js. The 3D view keeps its fly keys,
and the sidebar lists and open dropdowns keep their letters.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…20261130.4)

A map cell can show its tile mirrored or turned a quarter, so one drawing
in a sheet serves for its eight orientations.

The orientation is three bits per tile, the three Tiled uses (1 mirrored
left to right, 2 top to bottom, 4 transposed), kept beside the tile ids in
a new map field: rrTileFlips maps "x,y,z" to the bits of layer z of that
cell, and only turned cells have an entry. Tile ids are untouched, so
plugins and older editors read the map as before. Only ordinary tiles turn
(B to G and A5); an autotile's piece is chosen by its neighbours.

Editor (flat view):
- X and Y mirror what is in hand, Z turns it a quarter clockwise, Shift+Z
  back. A palette tile turns in place; a block of palette tiles is also
  laid out turned by the pencil; a copied area turns as one picture, its
  shadows and regions with it.
- The table is settled after every paint step from the stroke's own
  before and after (MapEditor.reconcileFlips): the brush's tile takes the
  brush's orientation, a tile pushed to another layer keeps its own, a
  replaced or erased one loses it. Undo, redo, resize and save carry it.
- Both tile renderers, the hover preview, the stamp preview, Save Map As
  Image and the passage overlay draw turned tiles.

Runtime (2D): Tilemap.setTileFlips; the chunked mesh, the layer mesh and
the sprite fallback draw turned tiles; Game_Map.checkPassage turns a
tile's directional passage with its picture.

Not in this change: the 3D view and 3D maps draw these tiles unturned, and
the rectangle, circle and fill tools turn each tile of a multi-tile
pattern in place without rearranging the pattern.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…time 20261130.5)

VisuMZ_0_CoreEngine, enabled in most VisuStella games, broke both halves of
turned tiles in a real game:

- its Tilemap._addSpotTile wrapper passes on three arguments, so the
  orientation, passed as a fourth, never reached _addNormalTile: turned
  tiles on layers 1 and 2 (and 3 and 4 off overpasses) drew unturned;
- it replaces Game_Map.checkPassage without calling the original, so a
  turned wall blocked on its unturned side.

The orientation now rides on the tilemap instead: _addSpot sets
_rrSpotFlip before each tile and clears it after the cell, _addNormalTile
reads it, and _addSpotTile and _addTile are the stock methods again.
Passage is a shim installed in Scene_Boot.start (and the two boot paths
that skip it), over whichever checkPassage is live by then: on a cell with
a turned tile it hands that check tileset flags in which the tile's four
passage bits are turned; elsewhere the check runs as it was. The stock
checkPassage is back to what it was before turned tiles.

Checked in the user's game (133 plugins, CoreEngine among them): every
_addSpotTile call went through CoreEngine's three-argument wrapper and the
three turned tiles reached the layers with their orientations; passage
answered by CoreEngine's check turned with the tile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A map can be laid out in Tiled (mapeditor.org) and brought back.

Export writes <name>.tmj and four pictures beside it, drawn by the
editor's own tile drawer: tiles (B to G and A5), autotiles (a row a kind,
a column a piece), the sixteen quarter shadows and the numbered regions.
The tile at position N of those pictures is Reactor tile N, so a Tiled
tile number is the Reactor id plus one and nothing is guessed either way.
Layers: Layer 1-4, Shadows, Regions, and the events as a locked object
layer for reference. Turned tiles (rrTileFlips) go out as Tiled's own
flip flags and come back as them.

Import reads such a .tmj into the open map as one edit Undo takes back;
nothing is written until the map is saved. Array, base64, zlib and gzip
layers and group layers are read; renumbered tilesets are followed. What
cannot come back is counted and named in the result: tiles from other
tilesets, layers it did not write, flips on autotiles. A map of another
size, an isometric or infinite one, or one Reactor did not export is
refused with the reason.

The pure converter is utils/TiledMap.js; the pictures, utils/TiledAtlas.js.
The new phrases are in all 17 locales (a machine-assisted first pass).

Not done: autotile pieces painted in Tiled are not reshaped on import;
.tmx and external .tsx tilesets are not read; never opened in Tiled
itself here (not installed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… lines, undo steps; Tiled exchange marked experimental

All 2D (flat map); the 3D view is not touched.

- Go to Tile: Ctrl+G, or a click on the cursor's tile in the info bar,
  asks for X, Y (checked against the map), centres the map on that tile
  and outlines it for a moment.
- Random mode (toolbar dice, or D): with several tiles picked, each cell
  the pencil, rectangle, circle or fill paints takes one of them at random
  instead of the pick's pattern. The draw comes from a hash of the cell and
  a seed renewed after each stroke, so the hover preview shows what the
  stroke will lay.
- Shift + right-drag: the area is picked up as usual and lifted out of the
  map (tiles, shadows, regions, turned-tile entries) as one undoable edit;
  the autotiles and wall shadows around the hole are redone. Shift +
  right-drag no longer pans while the map is being painted.
- Options > Major Grid Lines: with the grid on, a stronger line every game
  screen (the default, from the project's screen size), every 5, 8, 10 or
  16 tiles, or none.
- Options > Undo Steps: 10 to 500 map edits (50 by default); very large
  maps still keep fewer, within the existing 64 MB bound.
- Map list: "Export to Tiled (experimental)" and "Import from Tiled
  (experimental)", and every Tiled message says feedback is welcome and
  that Help > About RPG Reactor lists where to send it.

New strings in all 17 locales (a machine-assisted first pass); the
feedback line uses each language's own names for Help and About.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant