Bardic v0.6.0: Joins, Hooks and Undo/Redo
v0.6.0 - Joins, Hooks and Undo/Redo
Added
-
Include a
game_logic/directory inside all generated projects frombardic init. -
bardic playnow accepts and auto-compiles.bardfiles (into memory). -
Undo/Redo System - Players can now rewind and replay choices
engine.undo()/engine.redo()methods for programmatic controlengine.can_undo()/engine.can_redo()for UI button stateGameSnapshotdataclass 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 passageengine.register_hook()/engine.unregister_hook()for programmatic controlengine.trigger_event()executes all passages hooked to an event- Built-in
turn_endevent fires after everychoose()call - FIFO execution order (first registered, first run)
- Idempotent registration (duplicate hooks ignored)
- Hooks can self-remove inside
@ifblocks - Hook state included in undo/redo snapshots
-
@join Directive - Inline choice blocks that merge back together (like Ink gathers)
+ [Choice] -> @joinwith indented block content below the choice@joinmarker 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
@joinmarkers per passage (sections) - Works with conditional choices (
+ {cond} [Text] -> @join) - Works with one-time choices (
* [Text] -> @join) - Compatible with hooks (
@hook/@unhookin blocks) - Full undo/redo support (section index in snapshots)
- pytest tests:
tests/test_join.py