Dicey Table

Build with an agent

Build a room or table pack with an agent

An AI agent builds a DiceyTable room or table pack with room_set, table_pack_set and fields_set, then checks it with editor screenshots and a physics test.

On this page9 sections

An agent builds a room or table pack in the same editor as a game. It sets the room with room_set and environment_set, or the table with table_pack_set and a few fields_set calls. Then it checks the result with screenshots in the editor and a quick physics test.

A room pack is the space around the table: walls, floor, windows, posters, scenery and lights. A table pack is the table itself: its model, its surface, its size, the shape pieces land on, and the ring of seats. Got a table model already? The page on importing 3D models shows what DiceyTable can take in.

What you'll need#

  • An editor tab paired with your agent.
  • A key with Edit projects, plus Play at the table for the physics test.
  • Any models or textures, ready to import.

Everything in Build a game with an AI agent about looking first, the project lease and saving applies here too.

Step 1: Create or open the pack#

The agent calls project_create with subject: "room" or subject: "table" and a name. For an existing pack it uses project_open. The editor opens in the matching mode, and page_info reports it as the subject.

Step 2: Room packs: decor, lights and sky#

  • room_set sets the decor and lighting: surfaces, openings, posters, the view outside and scenery lights.
  • environment_set sets the sky, the exposure and the light that comes from the surroundings.
  • fields_set reaches everything else by field id. The room.* panels, such as room.surfaces and room.light, are in the field catalogue.

Room lights are ordinary entities with a light component, so component_set works on them too. Models and textures come in through asset_import, and material_create and material_set handle surfaces. Room and lighting explains what each value does.

Step 3: Table packs: model, surface, collider and seats#

  • table_pack_set sets the table model, its surface material and its size.
  • fields_set on table-pack.play-surface sets where pieces rest: the play surface's height and size.
  • fields_set on table-pack.collider sets the collider, the invisible shape pieces land on.
  • fields_set on table-pack.seat-ring sets where the seats sit around the table.

A collider that doesn't match the visible top is the usual reason dice float above the felt or sink into it. For a custom model, asset_import brings in the file and converts formats such as FBX and OBJ to GLB. The Model editor's collision and interior fields are under item.model.collision and item.model.interior.

Step 4: Assign the pack to a game#

pack_assign sets which room or table a game uses. The agent passes role: "room" or role: "table" and the pack's id. A packId of null clears it, which means the platform default (Modern Room for a room, Square Table for a table). See Assign a room or table.

Why screenshot a room pack in the editor?#

Known gap. Room decor does not render in a preview tab today. The capture code says so in its own warning (apps/web/src/playcanvas/photo/agentCapture.ts, ROOM_PACK_PREVIEW_CAPTURE_WARNING: "room-pack decor does not render in the preview tab"). A preview screenshot of a room pack shows the table in an empty space and comes back with that warning. Table packs render normally in a preview, and the room looks right in the editor. So take room pack screenshots in the editor viewport until this is fixed. See Known limitations.

In the editor, the agent asks for something like this:

JSON
{ "camera": "iso", "hide": "chrome", "settle": true }

The editor viewport also lets the agent camera look from anywhere, even from under the table to check the bottom of a model. Take screenshots with an agent lists the cameras.

Step 5: Test that pieces behave#

A table pack is only right if things land on it properly. Open a game that uses it, and start a preview with playtest_start. Then the agent:

  1. Drops a few dice and cards with table_spawn, rolls the dice with table_roll, and waits with table_wait_settled.
  2. Checks with table_assert that everything is still on the table and at rest.
  3. Reads the resting heights with table_snapshot.

For a repeatable look at a fall, table_step_physics freezes the physics and steps it forward a set number of times. It only works in a private preview, never in a live room. Play-test your game with an agent covers these tools.

Step 6: Save and publish#

The agent runs project_save and project_validate, then publish_preview and publish_request, the same as for a game. Credits for imported models and textures follow the same review rule: you check each one before you publish.

Next steps#

Did this page answer your question?