Stitch Package Manager
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Stitch system within ChapterMaster serves as a configuration and management framework for game assets and console logging. While the repository uses "Stitch" as a configuration namespace, it integrates closely with the project's data-driven architecture to manage complex entities such as space marine chapters, weaponry, and technological progression.
The primary purpose of the Stitch configuration is to define visual styles for the game console, enabling developers to parse and color-code debug information, warnings, and errors based on specific patterns. This works alongside external scripts like run_gobo.ps1 to maintain code quality and asset consistency across the project's extensive JSON-based database.
Sources: stitch.config.json:1-92, run_gobo.ps1:1-20
Console Styling and Logging Architecture
The core of the Stitch configuration lies in its gameConsoleStyle definition. This system uses regular expressions to identify and style console output. It categorizes logs into levels such as DEBUG, INFO, WARNING, ERROR, and CRITICAL, applying specific hex colors and font weights to each.
Pattern Matching Logic
The system utilizes named capture groups (e.g., ?<time>, ?<level>, ?<caller>, ?<msg>) to decompose raw log strings into structured data that can be styled independently. This allows for a highly readable developer experience where timestamps, calling functions, and messages are visually distinct.
The following flowchart illustrates the log processing and styling flow:
The diagram shows how raw logs are processed through regex patterns to assign specific styles based on severity levels and metadata.
Sources: stitch.config.json:4-88
Console Configuration Schema
| Field | Type | Description |
|---|---|---|
base | String | The default CSS-like style applied to console text. |
pattern | Regex | The search pattern used to identify specific log types. |
styles | Object | A map of capture group names to their respective CSS styles. |
description | String | Metadata describing the purpose of a specific pattern (e.g., "Bscotch Echo"). |
Sources: stitch.config.json:4-89
Data Integration and Formatter Support
The project supports the Stitch ecosystem through automated tooling, specifically for GML (GameMaker Language) formatting. The run_gobo.ps1 script manages the lifecycle of the "Gobo" formatter, which ensures that all .gml files adhere to project standards before being processed or "stitched" into the final build.
Formatting Workflow
The script performs an auto-update check against a GitHub repository (EttyKitty/Gobo), downloads the necessary binaries, and recursively processes files while respecting exclusions like .git and prefabs.
Sequence of events for the automated GML formatting tool integrated with the build environment.
Sources: run_gobo.ps1:10-85
Asset Management and Schema Consistency
The Stitch environment manages a vast array of game data stored in JSON files. This data is highly structured to allow the game engine to interpret chapter definitions, unit statistics, and equipment requirements.
Technology and Forge Requirements
Technological data defines the progression tree for the Chapter's forge. Each entry in technologies.json includes a display_name, a value (research cost), and optional requires_to_forge dependencies.
| Tech ID | Requirement | Resulting Capability |
|---|---|---|
armour_2 | armour_1 | Advanced Ceramite Bonding |
melta_1 | flame_1 | Atomic Chamber Construction |
dreadnought_1 | armour_2 | Sarcophagus Assembly |
vehicle_armaments_1 | heavy_1 | Vehicle Ordnance Integration |
Sources: datafiles/data/technologies.json:1-115
Weaponry and Component Linking
Weapons are defined with complex profiles that include maintenance costs, armor penetration (arp), and required technologies. Some weapons, such as the Assault Chainfist, utilize second_profiles to link to other weapon definitions (e.g., Assault Cannon), effectively "stitching" two weapon systems together.
Sources: datafiles/data/weapons.json:42-55, datafiles/data/mobility.json:96-118
Conclusion
The Stitch Package Manager system, while primarily visible through its configuration of the game's developer console, represents the underlying framework for maintaining structured data and code quality. By combining regex-based log styling, automated GML formatting, and a strict JSON schema for assets and technologies, it provides a stable environment for managing the complex interplay of Space Marine chapter mechanics.