spriteforge/docs/game-integration.md

1.2 KiB

Game integration

Studio Export writes:

exports/
  <asset-id>.sfa
  palettes.sfp
  index.json
  spriteforge_assets.h
  reload.json

The game includes include/sfa.h (or the C++17 RAII include/sfa.hpp) and the generated spriteforge_assets.h. Asset and animation identifiers are compile- time enums, not strings.

At development time the game watches reload.json.sequence. When it changes, reload the listed .sfa files and the palette pack at a safe frame boundary. Production builds copy the export directory into their normal data package.

The intended C++ call site is conceptually:

draw_sprite(SF_ASSET_FIELD_AGENT, SF_ANIM_WALK, direction, frame,
            world_x, world_y, palette, light);

SpriteForge never edits or imports game code. The game supplies an export path, and its tiny runtime owns file I/O and hot-reload policy.

Equipment will use synchronized assets with identical animation/direction/frame coordinates and pivots: body, armour, weapon and effects are loaded separately and blitted in the exported layer order. This avoids baking every possible combination while keeping the generative authoring process reviewable.