Sprite Management
Relevant source files
The following files were used as context for generating this wiki page:
Sprite Management in the ChapterMaster project encompasses the organization, formatting, and technical implementation of 2D graphical assets. This system handles various image types, including UI icons, chapter-specific splash art, and complex armor livery textures. The system relies heavily on standardized .png files and specific directory structures to ensure assets are correctly loaded and rendered by the GameMaker engine.
The architecture differentiates between core game content and user-provided custom files. Core assets are integrated via datafiles and JSON configurations, while custom assets—such as chapter icons—are loaded from local application data folders.
Image Formatting and Technical Constraints
All graphical assets must adhere to specific formatting rules to be compatible with the game's engine. A critical constraint identified is that while MS Paint can save files as .png, the resulting encoding is often unreadable by the game, necessitating the use of alternative image editing software.
File Requirements and Specifications
- Format: Must be
.pngwith specific encoding. - Resolution: Varies by asset type (e.g., icons are generally 141x141 pixels).
- Subimages: Certain files contain multiple subimages within a single strip (e.g.,
creation_icons.pngcontains 23 subimages).
Sources: datafiles/images/creation/instructions.txt:1-5, datafiles/README.md:3-8, datafiles/images/instructions.txt:1-5
Image Dimension Registry
| File Name | Dimensions (px) | Subimages | Purpose |
|---|---|---|---|
creation_icons.png | 3243 x 141 | 23 | UI icons for chapter creation |
main[1-9].png | 374 x 713 | 1 | Main display sprites |
slate[1-2].png | 850 x 860 | 1 | UI slate backgrounds |
title_splash.png | 1600 x 900 | 1 | Main title screen splash |
custom*.png | >= 141 x 141 | 1 | Custom user-added icons |
Sources: datafiles/images/creation/instructions.txt:7-26, datafiles/images/instructions.txt:7-7, datafiles/README.md:3-6
Asset Integration via JSON Data
Chapter-specific sprites and colors are defined in chapter JSON files. These configurations link the logic to specific sprite indices and color palettes.
Chapter Asset Pointers
JSON files use integer pointers to reference splash images located in \images\creation\chapters\splash. For example, the splash ID 33 corresponds to the Deathwatch art.
Complex Livery Data
The system manages "Complex Livery," which defines color and pattern overrides for different unit roles (e.g., Veteran, Captain, Sergeant). These entries specify indices for lenses, patterns, and primary/secondary armor colors.
| Field | Description |
|---|---|
helm_pattern | Index for the helmet sprite pattern |
helm_primary | Index for the primary color palette |
helm_secondary | Index for the secondary color palette |
helm_lens | Index for the eye lens glow/color |
Sources: datafiles/main/chapters/37.json:57-93, datafiles/main/chapters/33.json:56-82
Sprite Processing and Rendering Pipelines
The project utilizes specialized shaders and external tools for sprite processing and rendering.
SDF Shaders
The project includes a Signed Distance Field (SDF) shader prefab. This system is used for high-quality rendering effects, including blurring and specialized text/sprite effects.
The yymanifest confirms the presence of three specific SDF-related shaders: __yy_sdf_blur_shader, __yy_sdf_effect_shader, and __yy_sdf_shader.
Sources: prefabs/io.gamemaker.sdfshaders-1.0.0/yymanifest.xml:6-14
External Asset Management
The project uses "Gobo," a GML formatter, to ensure that the code managing these sprites remains standardized. Additionally, a configuration file (stitch.config.json) manages console logs related to sprite cropping issues, specifically noting that sprites used by the "Spine" animation system must be uncropped.
Sources: run_gobo.ps1:4-8, stitch.config.json:15-15
Custom File Management
Users can extend the sprite library by adding custom icons to the local AppData directory. The game automatically attempts to load files matching the custom*.png pattern (where * is 1-99).
- Path:
C:\Users\<UserName>\AppData\Local\ChapterMaster\Custom Files\Custom Icons\ - Behavior: Non-square icons are "smooshed" to fit the display area as needed.
Sources: datafiles/README.md:3-13
Summary
Sprite Management in ChapterMaster is a structured system combining strict image formatting requirements with flexible JSON-based data associations. By utilizing SDF shaders for rendering and supporting external custom directories for user content, the system facilitates both technical precision for core assets and extensibility for player-created chapters. All management is centralized through directory conventions and JSON pointers that map specific roles and chapter IDs to their respective graphical representations.