Skip to content

Bardic v0.6.0: Joins, Hooks and Undo/Redo

Choose a tag to compare

@katelouie katelouie released this 27 Dec 10:21
· 53 commits to main since this release

v0.6.0 - Joins, Hooks and Undo/Redo

Added

  • Include a game_logic/ directory inside all generated projects from bardic init.

  • bardic play now accepts and auto-compiles .bard files (into memory).

  • Undo/Redo System - Players can now rewind and replay choices

    • engine.undo() / engine.redo() methods for programmatic control
    • engine.can_undo() / engine.can_redo() for UI button state
    • GameSnapshot dataclass captures complete game state (passage, variables, used choices, hooks)
    • Stack-based architecture with configurable depth (default: 50)
    • Redo stack clears on new choices (timeline branching)
    • Snapshots taken before navigation for correct restore point
    • Browser template includes ← → navigation buttons in header
  • Hooks System - Background systems that run every turn

    • @hook event_name PassageName - Register a passage to run on an event
    • @unhook event_name PassageName - Unregister a hooked passage
    • engine.register_hook() / engine.unregister_hook() for programmatic control
    • engine.trigger_event() executes all passages hooked to an event
    • Built-in turn_end event fires after every choose() call
    • FIFO execution order (first registered, first run)
    • Idempotent registration (duplicate hooks ignored)
    • Hooks can self-remove inside @if blocks
    • Hook state included in undo/redo snapshots
  • @join Directive - Inline choice blocks that merge back together (like Ink gathers)

    • + [Choice] -> @join with indented block content below the choice
    • @join marker where all choices merge back together
    • Block content renders only when that choice is selected
    • Variables set in blocks persist after the merge
    • Multiple sequential @join markers per passage (sections)
    • Works with conditional choices (+ {cond} [Text] -> @join)
    • Works with one-time choices (* [Text] -> @join)
    • Compatible with hooks (@hook/@unhook in blocks)
    • Full undo/redo support (section index in snapshots)
    • pytest tests: tests/test_join.py

Changed

Fixed