Commit Graph

93 Commits

Author SHA1 Message Date
bridge
ac8c6c1c73 update tips 2026-01-10 00:50:30 +08:00
bridge
33b01fa0e9 fix web 2026-01-10 00:34:44 +08:00
bridge
59824d9cd5 update readme and tips 2026-01-09 00:49:16 +08:00
bridge
f8f0e8a59c update tips 2026-01-08 23:06:36 +08:00
bridge
f7d6554e9b update objective front end 2026-01-08 22:49:23 +08:00
bridge
a4dd29145f update tips 2026-01-08 22:35:42 +08:00
bridge
9c21259577 refactor: add store mixin into city regions & refactor buying action 2026-01-08 22:16:33 +08:00
Zihao Xu
9e75d8dd2e revert: remove SaveLoadPanel.vue changes 2026-01-08 21:12:18 +08:00
Zihao Xu
9485b62cfd feat: add loading screen with progress tracking
- Add async initialization with 6 phases: scanning_assets, loading_map,
  initializing_sects, generating_avatars, checking_llm, generating_initial_events
- Add /api/init-status endpoint for frontend polling
- Add /api/control/reinit endpoint for error recovery
- Add LoadingOverlay.vue component with:
  - Progress ring with gradient
  - Phase text in xianxia style (rotating messages for LLM phase)
  - Tips that rotate every 5 seconds
  - Time-based background transparency (fades to 80% over 20s)
  - Backdrop blur effect
  - Error state with retry button
- Preload map and avatars during LLM initialization for smoother UX
- Add comprehensive tests for init status API
2026-01-08 21:12:18 +08:00
Zihao Xu
8631be501b fix: prevent game from auto-starting to avoid stale initialization events
Problem:
When loading a save (e.g., from year 106), events from year 100 would appear.
This happened because the game auto-started on server startup and client
connection, generating initialization events before the user could load a save.

Solution:
1. Backend: Keep game paused on startup even if LLM check passes
2. Backend: Remove auto-resume on first WebSocket connection
3. Frontend: Start with game paused (isManualPaused = true)

Now the user must explicitly click 'resume' to start a new game, or load a
save first. This prevents the race condition where game_loop generates events
with stale world state.
2026-01-08 21:10:05 +08:00
Zihao Xu
a6b8198c3f Merge branch 'main' into xzhseh/sqlite-event-manager 2026-01-07 20:05:02 -08:00
bridge
b2a021bf8a rename item -> material & refactor buying action 2026-01-07 22:43:26 +08:00
bridge
1dfce734ef fix occupy & gift given bug 2026-01-07 20:11:01 +08:00
Zihao Xu
2e5a2c3c12 style: add comment to separate state and functions in world.ts 2026-01-07 01:02:17 -08:00
Zihao Xu
a1f08dd0ab feat: SQLite event storage with pagination and filtering
Implement SQLite-based event persistence as specified in sqlite-event-manager.md.

## Changes

### Backend
- **EventStorage** (`src/classes/event_storage.py`): New SQLite storage layer
  - Cursor-based pagination with compound cursor `{month_stamp}_{rowid}`
  - Avatar filtering (single and pair queries)
  - Major/minor event separation
  - Cleanup API with `keep_major` and `before_month_stamp` filters

- **EventManager** (`src/classes/event_manager.py`): Refactored to use SQLite
  - Delegates to EventStorage for persistence
  - Memory fallback mode for testing
  - New `get_events_paginated()` method

- **API** (`src/server/main.py`):
  - `GET /api/events` - Paginated event retrieval with filtering
  - `DELETE /api/events/cleanup` - User-triggered cleanup

### Frontend
- **EventPanel.vue**: Scroll-to-load pagination, dual-person filter UI
- **world.ts**: Event state management with pagination
- **game.ts**: New API client methods

### Testing
- 81 new tests for EventStorage, EventManager, and API
- Added `pytest-asyncio` and `httpx` to requirements.txt

## Known Issues: Save/Load is Currently Broken

After loading a saved game, the following issues occur:

1. **Wrong database used**: API returns events from the startup database instead
   of the loaded save's `_events.db` file
2. **Events from wrong time period**: Shows events from year 115 when loaded
   save is at year 114
3. **Pagination broken after load**: `has_more` returns `False` despite hundreds
   of events in the saved database
4. **Filter functionality broken**: Character selection filter stops working
   after loading a game

Root cause: `load_game.py` does not properly switch the EventManager's database
connection to the loaded save's events database.
2026-01-07 00:40:34 -08:00
bridge
649f66213e refactor cast action 2026-01-06 23:06:28 +08:00
bridge
5793c4d2b9 add lode 2026-01-06 23:04:56 +08:00
bridge
8a23dc5576 add lode 2026-01-06 23:01:25 +08:00
bridge
fa909e5a2a update frontend 2026-01-06 01:08:51 +08:00
bridge
b74014f9f2 add emotion 2026-01-04 22:49:20 +08:00
bridge
4fc74b1531 refactor battle strength system 2026-01-04 22:25:25 +08:00
Zihao Xu
fafe1b5997 feat: highlight avatar names with unique colors in event panel 2026-01-04 02:07:47 -08:00
bridge
5b5ea31d87 refactor avatar effect desc 2026-01-03 21:45:19 +08:00
bridge
f562d4ea81 update config 2026-01-01 18:31:47 +08:00
bridge
3837e3eafa update config frontend 2026-01-01 17:42:07 +08:00
bridge
561f1efe21 add emoji to frontend 2026-01-01 15:08:09 +08:00
bridge
7197dd1acb refactor equip 2025-12-31 23:18:47 +08:00
bridge
a3b8dd99aa refactor pack 2025-12-30 22:32:44 +08:00
bridge
d55ada7d66 refactor llm config 2025-12-30 22:20:30 +08:00
bridge
f539b21801 add llm config panel 2025-12-30 21:30:09 +08:00
bridge
b8a4850e80 add llm config panel 2025-12-30 21:23:30 +08:00
bridge
7ee83ebca7 support full screen mode 2025-12-29 23:08:45 +08:00
bridge
c53932966b support full screen mode 2025-12-29 23:07:08 +08:00
bridge
853e74630e fix api key bug 2025-12-29 22:56:49 +08:00
bridge
198b652993 add event handler auto go down logic 2025-12-20 21:30:54 +08:00
bridge
3c586f936c add event handler auto go down logic 2025-12-20 21:25:57 +08:00
bridge
6b0bf25699 fix pngs 2025-12-14 14:59:25 +08:00
bridge
b6bce76c36 update map 2025-12-11 22:28:29 +08:00
bridge
f6bd854eaf fix bug 2025-12-11 00:43:00 +08:00
bridge
a51f0a0ad2 add occupy action 2025-12-10 22:48:52 +08:00
bridge
303bffe413 decide only one avatar each time 2025-12-08 22:08:53 +08:00
bridge
a76c08db95 update cloud 2025-12-06 17:07:39 +08:00
bridge
bb1137a87d add random tiles 2025-12-06 16:11:46 +08:00
bridge
fb173b1f69 add cloud 2025-12-06 15:55:47 +08:00
bridge
b094032eb2 add cloud 2025-12-06 15:52:28 +08:00
bridge
e04be9f012 add dynamic water 2025-12-06 15:31:15 +08:00
bridge
ef0ff24783 refactor frontend 2025-12-04 21:33:14 +08:00
bridge
bdf78bc3d6 add plant and animal 2025-12-04 21:25:55 +08:00
bridge
06e43f2add update map 2025-12-03 22:41:58 +08:00
bridge
9296cdde79 update map 2025-12-03 22:38:53 +08:00