---
title: Designing a table module
description: Choose native dice, pawns, flat tokens, tablets and table tools. Design readable controls for players and game masters.
order: 19
section: Tables
toc: true
---

# Designing a table module

Start with what people need to do at the table. Check the Shelf and Workshop for
existing pieces and use the table's built-in systems for common actions. Reserve
custom assets and Lua for the parts that make your game distinctive.

## Choose the piece by its job

| Job | TTCraft component | When to reach for it |
| --- | --- | --- |
| Roll for a result | **Native die** | Start with a die from the Shelf. Use its roll and result behavior, and customize the appearance if needed. Use a custom die when the game needs a new shape or a special face map. See [the custom die example](/docs/scripting-recipes#a-custom-d3-from-any-object). |
| Move a standing character or creature | **Pawn** | Put portrait or silhouette art on an upright plate with a base. A single image can also serve as mirrored back art. Match the base to the grid and give repeated creatures short, distinguishable names such as Bat 1 and Bat 2. |
| Place a small marker, resource or flat miniature | **Flat token** | Use a round or rectangular image token for conditions, objectives and terrain markers that move. Two sides can carry different artwork. Use a native chip or coin when its stock appearance and behavior already fit. See [flat image tokens](/docs/workbench-tokens). |
| Draw, shuffle, deal or keep cards in hand | **Card or deck** | Build the deck with the card workbench. Pick the footprint, faces and backs there. The native deck supplies card and hand operations. See [card formats](/docs/workbench-cards). |
| Read or edit a sheet on the table | **Tablet** | Use it for character sheets, scoreboards on the felt, image handouts and PDFs that people need to read or open at a useful size. Pick a page size and use document elements only when the sheet needs fields or interaction. See [tablets](/docs/scripting-ui#tablets). |
| Place a print on the felt | **Decal** | Use it for a map within the decal size limits, a printed target, a labelled area or decoration fixed to the surface. Use a movable board object when moving the whole board is part of play. |
| Store and retrieve pieces | **Bag or container** | Use the built-in container behavior for supplies and random draws. A container can look like its contents belong there. See [object methods](/docs/scripting-objects). |
| Count or time something | **Counter or clock** | Use the native component when players need a number or timer on the table. Use a panel control when the value belongs inside a player or GM screen. |
| Give scenery or a piece a meaningful 3D silhouette | **Model** | Import or reuse a model when its height, shape, effect attachments or collision matter to play or presentation. Check the collider, scale and resting pose. A portrait or a flat symbol usually needs only an image and a native pawn or token. |

A pawn and a flat token can both appear as `prop` in runtime object records.
Inspect `props.pawn` and `props.token` to identify them. The built-in template
identifier and its current name are available from the library. Template
protection and the lock on a spawned piece are separate properties. Pin fixed
scenery when appropriate. Check that pieces players move stay movable and
that their bases rest on the intended surface.

In **Workbench → Add**, choose **Pawn with artwork** for an upright portrait,
**Flat token** for a small marker, or **Tablet for text or controls** for a
readable or interactive document.

The Shelf ships with dice, standard 32- and 52-card decks, chips, coins and
clocks, alongside reusable models and sets. For example, the portrait pawn
base is `tpawn_base`, the stock flat bat is `tflat_bat`, and the domino set is
`tdominoset`. A stock sculpted pawn or bat remains a model in the library.
Search by its name when you want that exact piece.

## Reuse the table systems

| System | Use it for | Practical distinction |
| --- | --- | --- |
| [Table plan](/docs/table-plan), grid and snap points | Table outline, seats, repeatable layouts and exact placements | A grid guides movement. A snap point locates a piece. A layout zone can name a region and trigger rules. |
| [Zones and hidden zones](/docs/scripting-world#zones) | Respond to pieces entering regions or control visibility | Use the zone's actual visibility rules for secrets. Printed shapes and UI labels only describe the region. |
| [Hands](/docs/scripting-objects) and seat hand zones | Private possession and drawing cards into a player's hand | A zone owned by a player may serve other purposes. Choose the seat's hand zone for hand capture. |
| [Turns](/docs/scripting-players#turns) | Passing play between seated players and optional interaction gating | Turn entries are player IDs. For initiative involving several creatures controlled by one player, keep a separate per-creature order in Lua. |
| [Music](/docs/scripting-world#music--shared-and-synchronised) and [effects](/docs/scripting-world#effects-and-sound) | Shared soundtrack, layers, soundboard and short cues | Let music carry the scene. Use an effect when it communicates a game event or supports the atmosphere. |
| [Table archives](/docs/table-archives) | Preserve a playable setup or distribute a module | Check that referenced art ships with the module and that opening the module twice has the intended result. |

## Put the controls where players look

1. **Ribbon for entry points.** Give a persistent window a
   [ribbon launcher](/docs/scripting-ui#open-a-window-from-the-ribbon). Group
   related actions on one module tab. Let the player choose when to open a
   full window. The system's **Table windows** menu can restore it later.
2. **Context for a single piece.** Put inspect, damage and status actions on
   the relevant pawn or token. When the action needs one choice or a number,
   use a player dialog or a counter instead of a permanent row of commands.
3. **Choose the layout by its job.** Use the native **List** for initiative,
   scores or inventories, and **Control panel** for a GM screen or setup form.
   The table handles spacing, long labels and scrolling. Use a freeform row
   or column for a short custom toolbar. See the [layout reference](/docs/scripting-ui#lists-and-control-panels).
4. **One primary action per phase.** Use a clear verb and a short label. For a
   combat tool, show preparation controls before combat and turn controls
   during combat. Keep infrequent actions in a secondary surface. Confirm
   destructive actions only if the game cannot easily undo them.
5. **Show each player what they need.** Players need the current turn and
   any public status. The GM may also need secret HP, hidden enemies and setup
   controls. Use a [player-scoped panel](/docs/scripting-ui#ui-for-one-player)
   to deliver private data. A closed window, a hidden launcher or a disabled
   button is a presentation choice. Check authorization in the game logic too.

Avoid using colour alone to identify teams, danger or active turns. Pair it
with a name, icon or mark. Keep counts and state labels short, and verify the
UI with a longer translation and with a narrower viewport or larger UI scale.

## Worked example: an encounter

Use a map decal for the road, native dice for rolls, pawn portraits for the
creatures and flat tokens for wounds or conditions. The stock bat can serve
until the module needs distinct portrait art. Put the adventure handout
on one readable tablet if the group should share and inspect it. Store each
creature's initiative and state in one encounter record.

The players' **Army of the Damned** window uses a **List**, with a row per
creature and a mark beside the current turn:

```text
Army of the Damned · Round 4
▶ Skeletal Bat 2       19
  Stensian Scout       18
  Skeletal Bat 3       14
  Skeletal Bat 1        8
```

On the same ribbon tab, the GM opens **Keeper's screen**. The **Control panel**
shows the current encounter and **Start combat** before play. During combat it
shows the round, the current creature and its HP, with **Next turn** as the sole
primary button. **End combat** sits in its own section. Keep any demo tools in
the authoring workflow so they stay out of live sessions.

Paste this into an empty Global script to try the pattern. The public list
contains initiative but keeps HP in the GM's private panel. Turn changes update
the same windows, and adjusting HP updates just its counter.

```lua
local creatures = {
  {id = "bat-2", name = "Skeletal Bat 2", initiative = 19, hp = 22},
  {id = "scout", name = "Stensian Scout", initiative = 18, hp = 12},
  {id = "bat-3", name = "Skeletal Bat 3", initiative = 14, hp = 22},
  {id = "bat-1", name = "Skeletal Bat 1", initiative = 8, hp = 22},
}
local round, turn = 0, 1

local function isKeeper(player)
  local p = tw.getPlayer(player)
  return p and p:getColor() == "black" and p:can("edit")
end

local function refreshInitiative()
  local rows = {}
  for i, creature in ipairs(creatures) do
    rows[i] = {type = "item", id = creature.id, label = creature.name,
               value = creature.initiative, active = round > 0 and i == turn}
  end
  tw.createPanel({
    id = "initiative", layout = "list",
    title = round > 0 and ("Army of the Damned · Round " .. round) or "Army of the Damned",
    launcher = {tab = "Encounter", group = "Combat", label = "Initiative"},
    elements = rows,
  })
end

local function refreshKeeper(player)
  if not isKeeper(player) then
    tw.closePanel("keeper", player)
    return
  end
  local elements = {
    {type = "section", label = "Setup"},
    {text = "Road to Shadowgrange"},
    {button = "Start combat", priority = "primary", onClick = "startCombat"},
  }
  if round > 0 then
    local creature = creatures[turn]
    elements = {
      {type = "section", label = "Round " .. round},
      {text = creature.name},
      {counter = "HP", id = "hp", min = 0, max = 999, value = creature.hp, onChange = "updateHP"},
      {button = "Next turn", priority = "primary", onClick = "nextTurn"},
      {type = "section", label = "Combat"},
      {button = "End combat", onClick = "endCombat"},
    }
  end
  tw.createPanel({
    id = "keeper", title = "Keeper's screen", layout = "controls",
    scope = "player", player = player,
    launcher = {tab = "Encounter", group = "Combat"},
    elements = elements,
  })
end

local function refreshKeepers()
  for _, player in ipairs(tw.getPlayers()) do refreshKeeper(player) end
end

local function refreshCombat()
  refreshInitiative()
  refreshKeepers()
end

function onLoad()
  tw.ribbon.addTab("Encounter", {})
  refreshCombat()
end
function onPlayerConnect(player) refreshKeeper(player) end
function onPlayerChangeColor() refreshKeepers() end
function onPlayerChangeCaps() refreshKeepers() end

function startCombat(player)
  if not isKeeper(player) or round ~= 0 then return end
  round, turn = 1, 1
  refreshCombat()
end

function nextTurn(player)
  if not isKeeper(player) or round == 0 then return end
  turn = turn % #creatures + 1
  if turn == 1 then round = round + 1 end
  refreshCombat()
end

function updateHP(player, value)
  if not isKeeper(player) or round == 0 then return end
  if type(value) ~= "number" or value < 0 or value > 999 or value % 1 ~= 0 then return end
  creatures[turn].hp = value
  tw.setPanelValue("keeper", "hp", value, player)
end

function endCombat(player)
  if not isKeeper(player) or round == 0 then return end
  round = 0
  refreshCombat()
end
```

## Author through Lua or MCP

- In the table's script editor or the Workbench **Script** tab, choose
  **Window templates** for a working starting point. Edit the inserted Lua
  to match your game and try the launcher in **Home → Module**.
- For reusable assets, inspect the library first. Lua exposes
  `tw.getTemplates()` and `tw.spawnTemplate()`. In MCP, use
  `library_list` before importing or spawning. Filter by `component` to find
  dice, pawns, flat tokens or tablets even when templates have unrelated names.
  Use template IDs returned by the live library.
- When you need new flat art, upload the image and use the native token
  fields. In MCP, pass `spec.kind: "token"` and `spec.token` to `objects_spawn`.
  For a pawn, spawn the native base and apply the uploaded image with
  `pawnset` and `pawn.front`. Workbench can derive a collider from the art.
- Build one representative piece and one small UI flow first. Verify the
  footprint, behaviour and appearance before copying the pieces across the
  table. Check the window's launcher with
  `state_read(section: "script_windows")` and check the Lua console after
  script installation. Try the actual flow from a player client and from a
  GM client.
