Tiled P4 — object layers (shapes + text), custom properties/types, templates → opt-in spawning #72

Closed
opened 2026-09-01 12:30:09 +02:00 by orkun · 1 comment
Owner

Follow-up P4 of the Tiled design (#66). Design record: Design: Tiled maps §3.8–3.9.

Scope — objects, properties, templates

  • Object layers: all shapes — rectangle, <ellipse>, <point>, <polygon>, <polyline>, <text> (font/size/style/align).
  • Custom properties/types: string/int/float/bool/color/file/object scalars; class/enum resolved via the project custom-type table (.tiled-project / objecttypes.xml). Exposed via Tiled.prop(...).
  • Templates (.tx/.tj): external reusable object defs with optional embedded tileset.
  • Opt-in entity spawning: an object's class + properties map to a Ludic archetype/components (dovetails with the controllers roadmap #57–#61). Off by default; no gameplay coupling in the core load.

Golden fixtures

orthogonal-outside.tmx (shapes, probability, colour prop); perspective_walls.tsx (per-tile bool props, <tileoffset>); examples.tiled-project + objecttypes.xml (custom types); sticker-knight/templates/*.tx; hand-authored <text> fixture (design §4).

Acceptance

  • All object shapes + text parse and are queryable.
  • class/enum properties resolve against the custom-type table.
  • A template instance inherits its template's fields.
  • Opt-in spawn maps object class/properties → components.

Depends on #69. Priority low.

Follow-up P4 of the Tiled design (#66). Design record: [Design: Tiled maps](https://git.workshopsoft.io/workshopsoft/ludic/wiki/Design%2FTiled) §3.8–3.9. ## Scope — objects, properties, templates - **Object layers**: all shapes — rectangle, `<ellipse>`, `<point>`, `<polygon>`, `<polyline>`, `<text>` (font/size/style/align). - **Custom properties/types**: `string/int/float/bool/color/file/object` scalars; `class`/enum resolved via the project custom-type table (`.tiled-project` / `objecttypes.xml`). Exposed via `Tiled.prop(...)`. - **Templates** (`.tx`/`.tj`): external reusable object defs with optional embedded tileset. - **Opt-in entity spawning**: an object's `class` + properties map to a Ludic archetype/components (dovetails with the controllers roadmap #57–#61). Off by default; no gameplay coupling in the core load. ## Golden fixtures `orthogonal-outside.tmx` (shapes, `probability`, colour prop); `perspective_walls.tsx` (per-tile bool props, `<tileoffset>`); `examples.tiled-project` + `objecttypes.xml` (custom types); `sticker-knight/templates/*.tx`; hand-authored `<text>` fixture (design §4). ## Acceptance - [ ] All object shapes + text parse and are queryable. - [ ] `class`/enum properties resolve against the custom-type table. - [ ] A template instance inherits its template's fields. - [ ] Opt-in spawn maps object class/properties → components. Depends on #69. Priority low.
orkun added the
priority:low
area:stdlib
labels 2026-09-01 12:30:09 +02:00
Author
Owner

P4 landed in main (b8c71d2).

  • Object layers — all shapes (rectangle / ellipse / point / polygon / polyline / text) and custom properties parse and are queryable: Tiled.object_count, Tiled.object, Tiled.object_shape, and Tiled.prop / Tiled.prop_int / Tiled.prop_type over any object / tile / layer / map.
  • Custom types — Tiled.load_types reads an objecttypes.xml project custom-type table so a class property resolves its default; enum values resolve as strings.
  • Templates — Tiled.template reads a .tx/.tj, and Tiled.load merges each object's template reference under the instance's overrides (field inheritance).
  • Opt-in spawning — Tiled.spawn / Tiled.spawn_layer map an object's class + properties onto Ludic components through the reflection ABI (Position from x/y, each property → a like-named field). Off by default — no gameplay coupling in the core load; split into tiled_spawn.ludic, spliced only for a Tiled game so a plain map-reading tool never links against the world table.

Acceptance

  • All object shapes + text parse and are queryable — object_shape classifies rectangle/ellipse/point/polygon/polyline/text; polygon points + text content read from the tree.
  • class/enum properties resolve against the custom-type table — an object with no hp gets the Enemy default (10); with an override, 99.
  • A template instance inherits its template's fields — the instance picks up type=Enemy and hp=25 from p4_enemy.tx.
  • Opt-in spawn maps object class/properties → components — spawning Enemy from an object sets Position.x and Health.hp from the object.

Also validated against the design's named orthogonal-outside.tmx (ellipse/point/polygon/2×polyline). Proven by examples/library/tiled_p4.ludic (18 assertions) in x test (95 passed).

**P4 landed** in `main` (b8c71d2). - **Object layers** — all shapes (rectangle / ellipse / point / polygon / polyline / text) and custom properties parse and are queryable: `Tiled.object_count`, `Tiled.object`, `Tiled.object_shape`, and `Tiled.prop` / `Tiled.prop_int` / `Tiled.prop_type` over any object / tile / layer / map. - **Custom types** — `Tiled.load_types` reads an `objecttypes.xml` project custom-type table so a class property resolves its default; enum values resolve as strings. - **Templates** — `Tiled.template` reads a `.tx`/`.tj`, and `Tiled.load` merges each object's `template` reference under the instance's overrides (field inheritance). - **Opt-in spawning** — `Tiled.spawn` / `Tiled.spawn_layer` map an object's class + properties onto Ludic components through the reflection ABI (Position from x/y, each property → a like-named field). **Off by default** — no gameplay coupling in the core load; split into `tiled_spawn.ludic`, spliced only for a Tiled *game* so a plain map-reading tool never links against the world table. ### Acceptance - [x] All object shapes + text parse and are queryable — `object_shape` classifies rectangle/ellipse/point/polygon/polyline/text; polygon points + text content read from the tree. - [x] `class`/enum properties resolve against the custom-type table — an object with no `hp` gets the `Enemy` default (10); with an override, 99. - [x] A template instance inherits its template's fields — the instance picks up `type=Enemy` and `hp=25` from `p4_enemy.tx`. - [x] Opt-in spawn maps object class/properties → components — spawning `Enemy` from an object sets `Position.x` and `Health.hp` from the object. Also validated against the design's named `orthogonal-outside.tmx` (ellipse/point/polygon/2×polyline). Proven by `examples/library/tiled_p4.ludic` (18 assertions) in `x test` (95 passed).
orkun closed this issue 2026-09-01 14:08:22 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: workshopsoft/ludic#72
No description provided.