---
title: TabletopGame
framework: tabletopkit
role: symbol
role_heading: Class
path: tabletopkit/tabletopgame
---

# TabletopGame

An object that manages the setup and gameplay of a tabletop game.

## Declaration

```swift
class TabletopGame
```

## Overview

Overview First, create a TableSetup object that represents your game layout and equipment. Add seats for players to occupy, conforming to the TableSeat protocol, and equipment for them to manipulate, conforming to the Equipment protocol. Pass an object that conforms to the Tabletop or EntityTabletop protocol to the TableSetup initializer. let table = Table() root = createRootEntity(table: table.entity) var setup = TableSetup(tabletop: table) Implement your structure to initialize the protocol properties, such as shape, entity, and id properties for the EntityTabletop protocol. struct Table: EntityTabletop {     var shape: TabletopShape     var entity: Entity     var id: EquipmentIdentifier          init() {         self.entity = try! Entity.load(named: "table/table", in: contentBundle)         self.shape = .round(entity: entity)         self.id = .table     } } Then, create the TabletopGame object that represents your game instance by passing the TableSetup object to the init(tableSetup:version:) initializer. game = TabletopGame(tableSetup: setup) Place the localPlayer in a seat at the table using claimSeat(_:) or a similar method. game.claimAnySeat() Next, implement an object that renders your game layout and equipment. Set the game’s renderer, conforming to the TabletopGame.RenderDelegate protocol, using the addRenderDelegate(_:) method. Implement the onUpdate(timeInterval:snapshot:visualState:) method to render the current state of the game. Alternatively, conform to the EntityRenderDelegate protocol. game.addRenderDelegate(self) If needed, you can draw a debug representation of selected items in the game using the debugDraw(options:) method. game.debugDraw(options: [.drawTable, .drawSeats, .drawEquipment]) Then, add actions to the equipment that controls gameplay using the addAction(_:) and addActions(_:) methods. Finally, pass an object to the addObserver(_:) method that conforms to the TabletopGame.Observer protocol. Implement the Observer protocol methods to progress gameplay when players interact with the equipment.

## Topics

### Creating a tabletop game

- [init(tableSetup:version:)](tabletopkit/tabletopgame/init(tablesetup:version:).md)
- [rootPose](tabletopkit/tabletopgame/rootpose.md)
- [update(deltaTime:)](tabletopkit/tabletopgame/update(deltatime:).md)
- [withCurrentSnapshot(_:)](tabletopkit/tabletopgame/withcurrentsnapshot(_:).md)

### Adding equipment to the game

- [equipment](tabletopkit/tabletopgame/equipment.md)
- [equipmentIDs](tabletopkit/tabletopgame/equipmentids.md)
- [equipment(matching:)](tabletopkit/tabletopgame/equipment(matching:).md)
- [equipment(of:)](tabletopkit/tabletopgame/equipment(of:).md)
- [equipment(of:forEntity:)](tabletopkit/tabletopgame/equipment(of:forentity:).md)
- [equipment(of:matching:)](tabletopkit/tabletopgame/equipment(of:matching:).md)

### Managing seats

- [claimAnySeat()](tabletopkit/tabletopgame/claimanyseat().md)
- [claimSeat(_:)](tabletopkit/tabletopgame/claimseat(_:).md)
- [claimSeat(matching:)](tabletopkit/tabletopgame/claimseat(matching:).md)
- [releaseSeat()](tabletopkit/tabletopgame/releaseseat().md)

### Getting the player

- [localPlayer](tabletopkit/tabletopgame/localplayer.md)

### Adding actions

- [addAction(_:)](tabletopkit/tabletopgame/addaction(_:)-10j8v.md)
- [addAction(_:)](tabletopkit/tabletopgame/addaction(_:)-9zgsy.md)
- [addActions(_:)](tabletopkit/tabletopgame/addactions(_:).md)

### Observing actions

- [TabletopGame.Observer](tabletopkit/tabletopgame/observer.md)
- [addObserver(_:)](tabletopkit/tabletopgame/addobserver(_:).md)
- [removeObserver(_:)](tabletopkit/tabletopgame/removeobserver(_:).md)
- [TabletopGame.ActionCancellationReason](tabletopkit/tabletopgame/actioncancellationreason.md)

### Jumping to bookmarks

- [jumpToBookmark(_:)](tabletopkit/tabletopgame/jumptobookmark(_:).md)
- [jumpToBookmark(matching:)](tabletopkit/tabletopgame/jumptobookmark(matching:).md)
- [bookmarks](tabletopkit/tabletopgame/bookmarks.md)

### Starting interactions

- [startInteraction(onEquipmentID:)](tabletopkit/tabletopgame/startinteraction(onequipmentid:).md)

### Canceling interactions

- [cancelAllInteractions()](tabletopkit/tabletopgame/cancelallinteractions().md)
- [cancelInteraction(matching:)](tabletopkit/tabletopgame/cancelinteraction(matching:).md)

### Rendering the table

- [addRenderDelegate(_:)](tabletopkit/tabletopgame/addrenderdelegate(_:).md)
- [removeRenderDelegate(_:)](tabletopkit/tabletopgame/removerenderdelegate(_:).md)
- [TabletopGame.RenderDelegate](tabletopkit/tabletopgame/renderdelegate.md)
- [EntityRenderDelegate](tabletopkit/entityrenderdelegate.md)

### Supporting multiple players

- [attachNetworkCoordinator(_:)](tabletopkit/tabletopgame/attachnetworkcoordinator(_:).md)
- [detachNetworkCoordinator()](tabletopkit/tabletopgame/detachnetworkcoordinator().md)
- [multiplayerDelegate](tabletopkit/tabletopgame/multiplayerdelegate-swift.property.md)
- [TabletopGame.MultiplayerDelegate](tabletopkit/tabletopgame/multiplayerdelegate-swift.protocol.md)

### Enabling group activities

- [coordinateWithSession(_:)](tabletopkit/tabletopgame/coordinatewithsession(_:).md)

### Drawing debug representations

- [debugDraw(options:)](tabletopkit/tabletopgame/debugdraw(options:).md)

## See Also

### Essentials

- [Creating tabletop games](tabletopkit/creating-tabletop-games.md)
- [Synchronizing group gameplay with TabletopKit](tabletopkit/synchronizing-group-gameplay-with-tabletopkit.md)
- [TableSetup](tabletopkit/tablesetup.md)
- [Tabletop](tabletopkit/tabletop.md)
- [EntityTabletop](tabletopkit/entitytabletop.md)
- [TabletopShape](tabletopkit/tabletopshape.md)
