Tilemap: Trigger-Tiles (melden statt blockieren, z. B. Wasser, Lava) #160

Closed
opened 2026-09-19 11:41:51 +02:00 by meleki · 2 comments
Owner

Aus #132 (Kommentar mit den Folge-Issues: „Trigger-Tiles bleiben offen, dafür gibt es noch kein Issue“). Dort war der Vorschlag: erst nur solid, Trigger-Tiles bei Bedarf nachziehen.

Befund

  • Eine Tile kann heute Solid, One-way und Collision scale (src/core/properties/PropertySchema.ts, Abschnitt tile). Melden ohne zu blockieren (Wasser, Lava, Stacheln, Zielzone) geht nur mit einem eigenen Trigger-Objekt über der Karte.
  • Die Tilemap-Kollision (src/core/model/tilemapCollision.ts) baut nur blockierende Formen; Events gegen eine Tilemap kennen keine Tile.

Zu bauen (Vorschlag)

  • An der Tile ein Schalter Trigger: Die Zellen blockieren nicht, lösen aber On collision enter/exit/stay aus.
  • Die Events bekommen einen Weg zur getroffenen Tile (Tile-Asset und Zelle), sonst kann der Graph Wasser nicht von Lava unterscheiden.
  • Trigger-Zellen verschmelzen wie feste Zellen zu Rechtecken, aber nie mit festen.
  • Tests gegen beide Systeme (Editor-Run und Play).

Offen (mit Vorschlag)

  1. Wie erfährt der Graph die Tile? Vorschlag: zusätzliche Ausgänge tile und cell x/y an den Collision-Events, leer bei Objekten.
  2. Enter pro Zelle oder pro zusammenhängender Fläche? Vorschlag: pro Fläche, sonst feuert ein Gang durch einen Teich bei jeder Zelle.
Aus #132 (Kommentar mit den Folge-Issues: „Trigger-Tiles bleiben offen, dafür gibt es noch kein Issue“). Dort war der Vorschlag: erst nur `solid`, Trigger-Tiles bei Bedarf nachziehen. ## Befund - Eine Tile kann heute **Solid**, **One-way** und **Collision scale** (`src/core/properties/PropertySchema.ts`, Abschnitt `tile`). Melden ohne zu blockieren (Wasser, Lava, Stacheln, Zielzone) geht nur mit einem eigenen Trigger-Objekt über der Karte. - Die Tilemap-Kollision (`src/core/model/tilemapCollision.ts`) baut nur blockierende Formen; Events gegen eine Tilemap kennen keine Tile. ## Zu bauen (Vorschlag) - An der Tile ein Schalter **Trigger**: Die Zellen blockieren nicht, lösen aber `On collision enter/exit/stay` aus. - Die Events bekommen einen Weg zur getroffenen Tile (Tile-Asset und Zelle), sonst kann der Graph Wasser nicht von Lava unterscheiden. - Trigger-Zellen verschmelzen wie feste Zellen zu Rechtecken, aber nie mit festen. - Tests gegen beide Systeme (Editor-Run und Play). ## Offen (mit Vorschlag) 1. **Wie erfährt der Graph die Tile?** Vorschlag: zusätzliche Ausgänge `tile` und `cell x/y` an den Collision-Events, leer bei Objekten. 2. **Enter pro Zelle oder pro zusammenhängender Fläche?** Vorschlag: pro Fläche, sonst feuert ein Gang durch einen Teich bei jeder Zelle.
meleki added the new label 2026-09-19 11:41:51 +02:00
admin added low-priority and removed new labels 2026-09-19 12:41:10 +02:00
admin added this to the Development project 2026-09-19 12:41:13 +02:00
  1. vorschlag passt
  2. beides, steuerbar per input port (boolean)
1. vorschlag passt 2. beides, steuerbar per input port (boolean)
admin moved this to Next in Development on 2026-09-22 09:25:57 +02:00
Author
Owner

Done in 275e50a, wiki 875594a (Tilemaps, Colliders, Behaviors, Development).

What changes
A tile can report a touch without blocking it, and the collision events name the tile and the cell, as answered in the comment above.

  • Switch: a tile has Trigger (reports, never blocks) right under Solid. Cells of that tile hold nothing up (no Move, no falling body, no ray) and raise On collision enter/stay/exit, with the tilemap as other.
  • Three new outputs on all three events (answer 1): tile, cell x, cell y.
  • New input per cell on all three events (answer 2), as a checkbox on the node or through a link:
    • Off (default): one event per area. An area is cells of the same tile that touch side by side. A walk through a pond is one enter and one exit.
    • On: one event per cell.
  • Scene view: trigger cells are outlined in yellow like a trigger collider, merged to rectangles but never with solid cells.
  • Is touching with the map counts trigger tiles. Set tile works while the game runs.

Decided here

  • Trigger wins over Solid. A tile with both ticks does not block, as with a collider.
  • Water beside lava is two areas, and so are two ponds that touch only at a corner.
  • Which cell an area names: the one nearest to the centre of the collider, on exit the one it named last.
  • Without a tile tile is empty and the cell is -1, -1. That also holds for the solid cells of a map, they still do not name their tile.
  • Normal, impulse and point are 0, as with a trigger collider, because the touches are not found by the physics engine.
  • Collision scale and outlines shape a trigger cell like a solid one. One-way, friction and bounciness have no effect.

Under the hood

  • src/core/model/tilemapCollision.ts builds the trigger variant beside the solid one: rectangles, outlines and the cells for the run.
  • src/runtime/systems/tileTriggers.ts is the one overlap check both systems use (editor run and play).
  • behaviorPulses.ts filters the pairs by per cell and fills the new outputs.

Tests

gate (stein2)     205 files, 3104 tests, CHECK EXIT 0 (3067 + 37)
e2e 39,40         ALL PASSED - 106 checks
e2e 1-8,39-43     ALL PASSED - 490 checks
  • The gate ran on stein2 this time, the e2e runs on melektaus-atx. No full run and no smokes. The sum of 1648 (1645 + 3) in README and wiki is reckoned. There is no CI run for 275e50a: the workflow ci.yml was switched off (disabled_manually) when the commit was pushed, so nothing measures the sum until it is on again.
  • 37 unit tests in tests/core/tile-triggers.test.ts, nearly all against both systems.
  • Three e2e checks with a real mouse in block 40l-iv: set the switch and check the outline, tick per cell on the node, a box walks over the block in play (1 enter for the area, 9 for the cells).
  • Two screenshots looked at: the yellow outline around block and single cell, and the node with per cell true and the three outputs.
  • Only unit tested, not in the browser: Stay and Exit on a trigger tile, the editor run, a tile with an outline as trigger. Not tested at all: the fill of trigger cells while painting.
Counter-check Result
24 in the unit tests all work
2 in the browser both work
  • Two unit counter-checks did not work at first, tests were added for them. One more was dropped because the change it makes changes nothing (cells outside the grid fall away before).
  • The 1645 before this change were never measured by CI: run 282 for 2ff3a78 broke off in module 52 without a single FAIL, because the Windows PC was switched off during the run.
Done in `275e50a`, wiki `875594a` (*Tilemaps*, *Colliders*, *Behaviors*, *Development*). **What changes** A tile can report a touch without blocking it, and the collision events name the tile and the cell, as answered in the comment above. - **Switch:** a tile has *Trigger (reports, never blocks)* right under *Solid*. Cells of that tile hold nothing up (no `Move`, no falling body, no ray) and raise `On collision enter/stay/exit`, with the tilemap as `other`. - **Three new outputs** on all three events (answer 1): `tile`, `cell x`, `cell y`. - **New input `per cell`** on all three events (answer 2), as a checkbox on the node or through a link: - **Off (default):** one event per area. An area is cells of the same tile that touch side by side. A walk through a pond is one enter and one exit. - **On:** one event per cell. - **Scene view:** trigger cells are outlined in yellow like a trigger collider, merged to rectangles but never with solid cells. - `Is touching` with the map counts trigger tiles. `Set tile` works while the game runs. **Decided here** - **Trigger wins over Solid.** A tile with both ticks does not block, as with a collider. - **Water beside lava is two areas**, and so are two ponds that touch only at a corner. - **Which cell an area names:** the one nearest to the centre of the collider, on exit the one it named last. - **Without a tile** `tile` is empty and the cell is -1, -1. That also holds for the solid cells of a map, they still do not name their tile. - **Normal, impulse and point are 0**, as with a trigger collider, because the touches are not found by the physics engine. - **Collision scale and outlines** shape a trigger cell like a solid one. One-way, friction and bounciness have no effect. **Under the hood** - `src/core/model/tilemapCollision.ts` builds the trigger variant beside the solid one: rectangles, outlines and the cells for the run. - `src/runtime/systems/tileTriggers.ts` is the one overlap check both systems use (editor run and play). - `behaviorPulses.ts` filters the pairs by `per cell` and fills the new outputs. **Tests** ``` gate (stein2) 205 files, 3104 tests, CHECK EXIT 0 (3067 + 37) e2e 39,40 ALL PASSED - 106 checks e2e 1-8,39-43 ALL PASSED - 490 checks ``` - The gate ran on stein2 this time, the e2e runs on `melektaus-atx`. No full run and no smokes. The sum of 1648 (1645 + 3) in README and wiki is reckoned. There is no CI run for `275e50a`: the workflow `ci.yml` was switched off (`disabled_manually`) when the commit was pushed, so nothing measures the sum until it is on again. - 37 unit tests in `tests/core/tile-triggers.test.ts`, nearly all against both systems. - Three e2e checks with a real mouse in block 40l-iv: set the switch and check the outline, tick `per cell` on the node, a box walks over the block in play (1 enter for the area, 9 for the cells). - Two screenshots looked at: the yellow outline around block and single cell, and the node with `per cell true` and the three outputs. - **Only unit tested, not in the browser:** `Stay` and `Exit` on a trigger tile, the editor run, a tile with an outline as trigger. **Not tested at all:** the fill of trigger cells while painting. | Counter-check | Result | |---|---| | 24 in the unit tests | all work | | 2 in the browser | both work | - Two unit counter-checks did not work at first, tests were added for them. One more was dropped because the change it makes changes nothing (cells outside the grid fall away before). - The 1645 before this change were never measured by CI: run 282 for `2ff3a78` broke off in module 52 without a single FAIL, because the Windows PC was switched off during the run.
admin moved this to Done in Development on 2026-10-02 07:29:16 +02:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#160