Commit Graph

36 Commits

Author SHA1 Message Date
hypercross 20993d3b72 feat: add BaseGameClient for external integration
Introduces `BaseGameClient` to allow external environments (like C#)
to interact with the game engine. It provides mechanisms for:
- Reactive state selection via `select`
- Async event interception via `use`
- Lifecycle management and status tracking
- Interruption handling for async game loops

Updated `middleware.ts` to allow unregistering middleware via the
returned function from `use`.
2026-04-25 17:31:15 +08:00
hyper fb3c98b1ef refactor: update GameHost to use generic state and result types
Decouple GameHost from GameState and GameResult types by introducing
generic parameters for TState and TResult. This improves type safety
and flexibility when defining GameModules.
2026-04-23 16:03:49 +08:00
hyper 5c1ef232fd export GameState and GameResult types from game-host 2026-04-23 15:36:25 +08:00
hyper b009189b9a Extract PromptContext from GameHost into separate module
The prompt system is now managed by a dedicated PromptContext instead of
being embedded in GameHost. This simplifies the API by removing
individual prompt signals and consolidating prompt logic into a reusable
context that can be shared between components.
2026-04-23 15:09:06 +08:00
hypercross e8c995f74f feat: add spawner utility
Introduce `createSpawner` and `spawnerEffect` to manage the lifecycle
of side effects based on a collection of IDs. `spawnerEffect` uses
Preact signals to automatically trigger spawners when IDs are added
to an iterable and cleanup functions when they are removed.
2026-04-23 10:20:13 +08:00
hypercross 63733bc62d refactor: update imports and add starting items to desert sample
- Convert single quotes to double quotes for local imports
- Reformat barrel exports in `src/index.ts` for better readability
- Add `startingItems` to the desert sample data in `slay-the-spire-like`
2026-04-19 13:51:03 +08:00
hypercross 0222b66bed feat: export middleware chain 2026-04-17 17:27:46 +08:00
hypercross cbf6dce237 fix: export more stuff 2026-04-08 09:28:44 +08:00
hypercross 6352977791 chore: add more tests 2026-04-06 16:11:26 +08:00
hypercross 70b1ac1e43 refactor: change how we define command 2026-04-06 10:06:04 +08:00
hypercross c4290841e5 refactor: clean up exports 2026-04-05 10:41:42 +08:00
hypercross 9e2947a8d6 refactor: prompt validation 2026-04-04 21:38:07 +08:00
hypercross 467a56bd84 fix: fix tic tac toe tests 2026-04-04 18:42:21 +08:00
hypercross de7006ef19 refactor: api change 2026-04-04 18:33:44 +08:00
hypercross 97ef1df4fb refactor: moveRegion & add csv loader 2026-04-04 17:51:26 +08:00
hypercross 25f9992be6 refactor: remove host options 2026-04-04 14:06:27 +08:00
hypercross ae98e0735a chore: add GameModule type 2026-04-04 11:06:41 +08:00
hypercross 697d23e932 feat: add game host 2026-04-04 00:55:09 +08:00
hypercross 50c146964d chore: update tests and imports 2026-04-03 17:56:35 +08:00
hypercross 118007168a fix: export command result as well 2026-04-03 15:12:51 +08:00
hypercross 4bf6eb2f6b refactor: add some part management utilities 2026-04-03 15:00:25 +08:00
hypercross 86714e7837 refactor: entity -> MutableSignal 2026-04-03 14:19:44 +08:00
hypercross eb0ebf5411 refactor: transition to non child entity format 2026-04-03 12:46:50 +08:00
hyper b71ba12454 feat: add new functions 2026-04-02 21:58:11 +08:00
hypercross 06c801e6ae refactor: improve tic tac toe with region entity 2026-04-02 16:52:58 +08:00
hypercross 4f49599527 fix: fix imports 2026-04-02 15:36:32 +08:00
hypercross 0948e5a742 fix: fix game/region tests. 2026-04-02 15:16:30 +08:00
hypercross 1cb7fa05ec refactor: rewrite game & tic tac toe 2026-04-02 11:06:29 +08:00
hypercross 40788d445d refactor: replace rule.ts with a command runner based solution 2026-04-02 09:33:03 +08:00
hypercross 3bc35df63c feat: add command runner and registry 2026-04-02 08:58:11 +08:00
hypercross ff9d9bd9a1 refactor: fix command parsing 2026-04-02 00:14:43 +08:00
hypercross 170217db30 feat: rule dispatch 2026-04-01 22:20:38 +08:00
hyper 95015b090c feat: add command schema 2026-04-01 18:54:02 +08:00
hyper df9698b67b feat: rng & commands impl & tests 2026-04-01 17:34:21 +08:00
hyper d0d051f547 feat: add rule engine & tic tac toe test 2026-03-31 18:20:18 +08:00
hyper d27948fbfc Initial commit: boardgame-core with build fixes
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-31 18:01:57 +08:00