Game Entities API¶
Each Entity type in Foundry Virtual Tabletop extends the base :class:
Entity class. These implementations and related
functionality are detailed on the following pages.
- Entity and Collection Abstractions
- The User Entity
- The Scene Entity
- The Actor Entity
- The Item Entity
- The Audio Playlist Entity
- Compendium Content Packs
Database Operation Workflow¶
Entities are managed through a set of API methods which allow for create, update, and delete operations. These methods follow a standardized workflow:
- Client A dispatches a request by calling the entity manipulation method, for example
- A pre-creation hook
preCreateActoris triggered which can allow modules or systems to modify the contents of
actorDatabefore it is dispatched to the server.
- A server-side event handler processes the request and updates the database. Once the database write is successful, the handler responds to the requesting client (A) with an “acknowledgement” indicating the request was completed. Furthermore, the handler broadcasts the event to all other connected clients, informing other users that a change was made.
- Updated data is received by all connected clients and for each client a post-update hook, in this case
createActoris triggered which allows modules or systems to take follow-up actions in response to the change.
The workflow diagram below illustrates this process for the example event of an Actor creation.