Skip to content

Reference

Static utility class for discovering and loading sprite packs.

MethodSignatureReturns
discover_packs(root_path: String)PackedStringArray of pack directories
load_pack(pack_path: String)CharacterPack with textures and metadata

CharacterPack fields:

FieldTypeDescription
slugStringSubject identifier (e.g. sera_vale)
display_nameStringHuman-readable name
body_familyStringbipedal, quadruped, etc.
width, heightintSprite dimensions (48×48)
direction_orderPackedStringArray8 canonical direction names
texturesDictionarydirection → { albedo, normal, depth }
canvas_texturesDictionarydirection → CanvasTexture
validboolLoad succeeded
errorStringError message if invalid

JSON-RPC client node. Spawns the Python engine subprocess.

MethodDescription
connect_to_engine()Spawn Python RPC subprocess (python -m portlight.app.cli rpc), returns bool
send_request(method, params)Async JSON-RPC request, returns request int id
call_blocking(method, params)Synchronous RPC call (blocks Godot), returns result or null
shutdown()Clean engine shutdown + process kill

Signals:

SignalParamsDescription
connectedEmitted when engine subprocess launches
disconnectedEmitted after shutdown
response_receivedid: int, result: VariantAsync RPC response arrived
error_receivedid: int, error: DictionaryRPC error received

Exports:

PropertyDefaultDescription
python_path"python"Python executable path
save_slot"default"Game save slot

Sprite2D wrapper with direction switching.

MethodDescription
load_character(pack)Load a CharacterPack and display front sprite
set_direction(name)Set facing by direction name
rotate_direction(offset)Rotate facing (+1 = clockwise)
get_direction_name()Current direction name

Exports:

PropertyDefaultDescription
sprite_scale4.0Display scale for 48px sprites (48 x 4 = 192px on screen)

Main scene script. Discovers packs, creates CharacterNode instances, handles input.

ConstantValueDescription
ASSETS_ROOT"res://assets/characters"Root directory for pack discovery

The scene builds its UI entirely in code during _ready(): background ColorRect, title Label, direction indicator Label, controls hint Label, ground plane, and a PointLight2D for normal-map lighting. Characters are evenly spaced across the 960px viewport width.

Keyboard bindings (handled in _input):

KeyAction
A / LeftRotate selected character counter-clockwise
D / RightRotate selected character clockwise
TabCycle selection to next character
SpaceRotate all characters clockwise
BAttempt engine bridge connection
EscapeQuit

Python utility for importing sprite packs from the foundry exports directory.

Terminal window
python scripts/import_packs.py [--source PATH] [--subjects slug1,slug2]
FlagDefaultDescription
--sourceF:/AI/star-freight-foundry/exportsFoundry exports directory
--subjectsall subjectsComma-separated subject slugs to import

The script finds the latest run directory (by modification time) for each subject, copies it unchanged into assets/characters/{slug}/, and validates the manifest. Re-running replaces existing packs.

Entry point. Instances roster.tscn.

Crew display scene with:

  • Auto-discovery of all packs in res://assets/characters/
  • Evenly spaced character nodes
  • PointLight2D for normal map visualization
  • Keyboard input handling
  • Optional engine bridge connection

The contract is frozen. Do not modify unless runtime pain proves it wrong.

PropertyValue
Schema version1.0.0
Sprite size48×48 pixels
TransparencyRequired (transparent PNG)
Pivotcenter_bottom
Directions8: front, front_left, left, back_left, back, back_right, right, front_right
Layersalbedo (required), normal (optional, used for lighting), depth (optional, reserved)
ChecksumsSHA-256 per file in manifest
ImmutabilityPacks are append-only after creation
Terminal window
bash verify.sh

Validates:

  1. All required project files exist
  2. Every asset pack has a valid manifest (JSON + schema v1.0.0)
  3. GDScript files are valid UTF-8 and non-empty
  4. Scene files are present