TGS Integration
Relevant source files
The following files were used as context for generating this wiki page:
TGS Integration connects the BandaStation game server with Tgstation Server (TGS) management tools. This system manages server life cycles, automated deployments, and cross-platform communication between the BYOND engine and external management APIs.
Sources: README.md, code/modules/tgs/v5/README.md
System Architecture
The integration utilizes a DMAPI (Dream Maker Application Programming Interface) to facilitate communication between the game world and the TGS host. This API uses HTTP GET requests for bridge communications and includes specialized handling for large data sets through chunking.
This diagram shows the communication flow between the BYOND engine, the TGS DMAPI, and the external management server.
Sources: code/modules/tgs/v5/README.md:1-12, tools/tgs_test/Program.cs:150-180
DMAPI Components
The DMAPI consists of several specialized modules that handle specific integration tasks:
| Component | Purpose |
|---|---|
api.dm | Contains the primary API logic and core functions. |
bridge.dm | Handles bridge requests to the TGS host. |
chunking.dm | Splits large data sets into processable chunks for BYOND. |
commands.dm | Manages /datum/tgs_chat_command objects. |
serializers.dm | Converts interop datums into JSON-encodable lists. |
topic.dm | Processes incoming topic requests from TGS. |
Sources: code/modules/tgs/v5/README.md:3-12
Automated Deployment and Testing
BandaStation uses a specialized test utility (tools/tgs_test/Program.cs) to validate TGS integration during CI (Continuous Integration) workflows. This utility automates the environment setup and validates that the repository configuration matches the TGS requirements.
Integration Validation Flow
The deployment utility performs the following sequential actions to ensure a valid server state:
- Version Verification: Compares the BYOND version defined in
.tgs.ymlagainst the project'sdependencies.sh. - Instance Connection: Establishes a connection to the TGS API using administrative credentials.
- Repository Sync: Clones the targeted GitHub repository branch and applies any specified test merges.
- Environment Setup: Installs the required BYOND engine version and configures security levels.
- Static File Management: Populates the
GameStaticFilesdirectory structure. - Compilation and Launch: Triggers the DreamMaker compiler and starts the DreamDaemon process.
This sequence diagram illustrates the automated validation and launch process performed by the TGS test tool.
Sources: tools/tgs_test/Program.cs:60-260, tools/tgs_test/README.md
Configuration and Security
The TGS integration relies on specific configuration files and parameters to define its operational environment.
.tgs.yml Configuration
The .tgs.yml file acts as the primary configuration manifest for the management server. It defines:
- BYOND Version: The required engine version (e.g., version 516.1685).
- Security Level: The API validation security level (e.g.,
TrustedorSafe). - EventScripts: Platform-specific scripts (Windows/Linux) executed during server events.
- Static Files: Directories that must be populated or created within the instance path.
Sources: tools/tgs_test/Program.cs:72-115, dependencies.sh:6-8
Server Settings
The game's config/config.txt provides additional parameters for TGS interaction:
| Option | Description |
|---|---|
ROUNDS_UNTIL_HARD_RESTART | Sets the number of round reboots before TGS restarts the DreamDaemon process. |
PUBLIC_ADDRESS | Defines the address shown in the TGS check command. |
CHANNEL_ANNOUNCE_* | Configures TGS chat channels for game start/end announcements. |
Sources: config/config.txt:314-315, config/config.txt:435-442
Summary
TGS Integration provides a robust management layer for BandaStation, enabling automated deployments through .tgs.yml manifests and reliable communication via the DMAPI v5. By synchronizing BYOND versions across dependencies.sh and TGS configurations, the system ensures environment consistency and allows for automated validation of server stability during development cycles.
Sources: tools/tgs_test/README.md, code/modules/tgs/v5/README.md