152 Commits
v1.1.0 ... main

Author SHA1 Message Date
bridge
4abc639aa6 feat: shallow ref vue
Some checks failed
Tests / test (push) Failing after 10m52s
2026-02-06 22:51:58 +08:00
bridge
8a06e950a3 fix: add translation 2026-02-06 22:46:15 +08:00
bridge
26f44b8f74 update: version 2026-02-06 22:31:24 +08:00
bridge
77a6dfcb7c chore: make heartbeat invisible 2026-02-06 22:29:46 +08:00
bridge
b7dad2d725 fix: screen init 2026-02-06 22:23:10 +08:00
bridge
2ffd6301f8 feat: save and load button 2026-02-06 22:19:33 +08:00
Zihao Xu
67b559ac5a feat: improve save/load interface with custom names and metadata (#128)
* feat: improve save/load interface with custom names and metadata

- Add custom save name support with input validation
- Extend save metadata with avatar counts, protagonist info, and event count
- Add quick save button alongside named save option
- Enhance save list display with richer information
- Add sanitize_save_name and find_protagonist_name helpers
- Update API endpoints to support new features
- Add i18n translations for new UI elements

Closes #95

* test: add comprehensive tests for save custom name feature

- Add 37 tests for sanitize_save_name, find_protagonist_name
- Add tests for custom name API endpoints
- Add tests for enhanced metadata
- Fix unused NIcon import in SaveLoadPanel
- Add zh-TW translations for new save_load keys

* test(frontend): add SaveLoadPanel component tests

- Add 21 tests for SaveLoadPanel component
- Cover save mode, load mode, display, validation
- Mock naive-ui components, stores, and API
2026-02-06 22:03:41 +08:00
bridge
ef926594c7 feat: auto clear death avatar after 20 years 2026-02-06 22:03:15 +08:00
bridge
741a88d174 fix: death avatar gets alive after loading 2026-02-06 21:57:53 +08:00
bridge
a143ed8a80 refactor: save & load 2026-02-06 21:51:55 +08:00
bridge
07e9b40645 update: readme 2026-02-06 21:40:33 +08:00
bridge
955dac0c69 update: require 2026-02-06 00:48:37 +08:00
bridge
2cc456f6b3 refactor: i18n archi 2026-02-06 00:43:08 +08:00
bridge
07d1cfbee2 feat(i18n): enhance localization with new actions and descriptions
- Added new action translations for "assassinate", "attack", "breakthrough", "cultivate", "escape", and "self-heal" in English, Simplified Chinese, and Traditional Chinese.
- Included detailed descriptions and requirements for each action to improve gameplay clarity.
- Updated the translation extraction and compilation process to utilize the polib library for better handling of PO files.
2026-02-05 22:41:01 +08:00
bridge
7e8a737402 refactor(i18n): streamline PO to MO compilation process
- Removed the subprocess call to msgfmt and simplified the compilation process using the polib library exclusively.
- Updated error messages for clarity regarding the installation of required libraries.
- Enhanced the main function to directly compile PO files without toggling between methods.
2026-02-05 22:17:03 +08:00
4thfever
7630174820 Feat/relation (#139)
* update relation

* feat: add relation_type to avatar info structure and update related components

- Added `relation_type` to the avatar structured info in `info_presenter.py`.
- Updated `AvatarDetail.vue` to utilize the new `relation_type` for displaying avatar relationships.
- Modified `RelationRow.vue` to accept `type` as a prop for enhanced relationship representation.
- Updated `core.ts` to include `relation_type` in the `RelationInfo` interface.

Closes #
2026-02-05 22:14:44 +08:00
bridge
a9d9288432 chore: customize llm 2026-02-05 21:12:56 +08:00
Zihao Xu
bd6f7e67d5 feat(server): make server host and port configurable (#127)
* feat(server): make server host and port configurable

Support configuring server binding address via environment variables
and config files. Priority: ENV > local_config.yml > config.yml > default.

- Add host and port options to system section in config.yml
- Read SERVER_HOST and SERVER_PORT from environment variables
- Default to 127.0.0.1:8002 for security

Set host to "0.0.0.0" to allow LAN access.

* test(server): add comprehensive tests for server binding config

Add 28 test cases covering:
- Environment variable priority (SERVER_HOST, SERVER_PORT)
- Config file reading (system.host, system.port)
- Default value fallback
- OmegaConf integration
- Edge cases (IPv6, empty values, invalid ports)

* docs: add mobile/LAN access instructions

- Add mobile access section to README and EN_README
- Configure Vite to listen on 0.0.0.0 for LAN access in dev mode
- Link to Issue #130 for mobile UI compatibility tracking
2026-02-04 21:47:17 +08:00
Zihao Xu
f15ee94559 test(web): add comprehensive frontend tests for Phase 3 (#129)
- Add component tests: EntityRow, RelationRow, StatItem, StatusBar, StatusWidget, TagList
- Add store tests: setting
- Enhance existing tests: socket (toast, alert handling), useGameInit (polling, initialization)
- Update vitest.config.ts to exclude config files from coverage
- Coverage improved from 13.39% to 32.49% (tested files achieve 95%+ coverage)
2026-02-04 01:01:58 -08:00
Zihao Xu
51472c0580 chore: add web/coverage to gitignore (#126)
Ignore Vitest test coverage reports generated by frontend tests.
2026-02-04 00:07:45 -08:00
bridge
c2c1ce46d1 chore: remove unused Docker and localization files
- Deleted Dockerfiles for backend and frontend, along with the associated Nginx configuration and localization debugging script, to streamline the project structure and eliminate unnecessary files.
2026-02-03 21:44:17 +08:00
bridge
f2c4b5609d chore: update readme 2026-02-03 21:33:51 +08:00
bridge
a59f6837ca fix(battle): correct killer name in death handling logic
- Updated the killer name reference in the handle_death function to use the winner's name instead of the attacker's name, ensuring accurate death reason reporting in battle scenarios.
2026-02-03 20:53:59 +08:00
bridge
d4cc50962c chore: update compression 2026-02-02 22:24:02 +08:00
bridge
56015265c6 chore: update version 2026-02-02 22:15:35 +08:00
bridge
fe47cdb442 refactor(StoryTeller): streamline template path handling and improve code clarity
- Replaced hardcoded template paths with a static method to dynamically construct paths based on filenames.
- Updated references to template paths throughout the class to enhance maintainability and readability.
- Improved organization of template file management for better localization support.
2026-02-02 22:14:22 +08:00
bridge
4ce32c8b94 feat(StatusBar): implement phenomenon selection and update StatusWidget for direct trigger
- Added functionality to open a phenomenon selector and handle selection changes in StatusBar.
- Updated StatusWidget to support disabling the popover for direct click actions, enhancing user interaction.
- Cleaned up unused code in StatusBar for improved readability.
2026-02-02 22:06:28 +08:00
bridge
99c0af1a9b feat(i18n): update localization files for English and Chinese
- Updated binary localization files for English, Simplified Chinese, and Traditional Chinese to include new translations and enhancements.
- Ensured consistency and accuracy across all language files to improve user experience.
2026-02-02 21:55:56 +08:00
bridge
2cbe7660e7 feat(i18n): add story styles localization for English and Chinese
- Translated and added various story styles to localization files for English, Simplified Chinese, and Traditional Chinese.
- Updated the StoryTeller class to utilize the translation function for story styles, enhancing the storytelling experience across different languages.
2026-02-02 21:54:56 +08:00
bridge
26332003e5 fix(StatusWidget): increase popover max-width for better content display 2026-02-02 21:49:49 +08:00
bridge
ade1379448 feat(misfortune): enhance misfortune themes and localization support
- Refactored misfortune theme identifiers for clarity and consistency.
- Introduced a new function `_get_misfortune_theme` to handle theme translations.
- Updated `_pick_misfortune_theme` to utilize theme IDs and improved localization for misfortune results.
- Added new entries in localization files for English and Chinese, covering various misfortune themes and result messages.
- Improved user experience by ensuring all misfortune-related texts are properly translated and formatted.
2026-02-02 21:47:03 +08:00
bridge
4f377551e8 feat(avatar): implement region ownership management in AvatarManager and Avatar classes
- Added `owned_regions` attribute to the Avatar class to track regions owned by avatars.
- Introduced `occupy_region` and `release_region` methods for managing region ownership and ensuring proper relationship handling.
- Updated AvatarManager to clear relationships when an avatar is released, ensuring no lingering references.
- Refactored region ownership logic in the Occupy action and Simulator to utilize the new methods for better clarity and maintainability.
- Enhanced game loading process to establish ownership relationships correctly during game state restoration.
2026-02-02 21:34:02 +08:00
bridge
7143b27a0a feat(i18n): enhance zh-TW localization with new hidden domain entries and UI updates
- Added new hidden domain names and descriptions to the zh-TW translation files.
- Updated StatusWidget to display cooldown years with proper localization.
- Enhanced zh-TW JSON localization with new labels for hidden domains, improving user experience.
2026-02-02 21:08:06 +08:00
teps3105
be6e3d43c0 fix(i18n): add missing zh-TW frontend components and configs (#117)
* fix(i18n): add zh-TW to language options in settings menu

* fix(i18n): add zh-TW to language options in splash layer

* fix(i18n): add zh-TW support to setLocale function

* feat(i18n): add zh-TW game config files (names)

* feat(i18n): add zh-TW AI prompt templates

* docs:修正 glossary 繁中欄位

* docs:解決 glossary 衝突

* fix(i18n):補齊 zh-TW world info 標題
2026-02-02 20:56:21 +08:00
bridge
d9e7d824a6 chore: add discord 2026-02-02 20:46:12 +08:00
bridge
9ee049c377 docs: enhance README files with detailed Docker setup and application access instructions
- Added a new section in EN_README.md for Docker Compose usage, outlining the steps to clone the repository and start the service.
- Updated README.md to include application access details for both frontend and backend after installation.
- Improved clarity and organization of setup instructions in both README files.
2026-02-01 13:38:19 +08:00
bridge
4674cbe930 docs: update README files with new cloning instructions and LLM configuration details
- Updated cloning URL in both EN_README.md and README.md to reflect the correct repository.
- Enhanced LLM configuration section in EN_README.md with recommended frontend setup and local deployment options.
- Improved formatting and clarity of setup instructions in README.md.
2026-02-01 13:35:53 +08:00
bridge
15bb9ca874 docs: update CONTRIBUTORS.md to include new contributor @MarkYangKp 2026-02-01 13:29:18 +08:00
teps3105
f0b6b62de5 feat(i18n): add Traditional Chinese (zh-TW) locale support (#116)
* feat(i18n): add zh-TW locale support (backend infrastructure)

- 新增 LanguageType.ZH_TW 枚舉值
- 擴展 _lang_to_locale() 映射支援 zh-TW
- 創建 zh_TW 翻譯檔案結構 (messages.po + game_configs.po)
Closes #114

* feat(i18n): add zh-TW locale support (translation completion)

完成繁體中文語言的完整翻譯工作:

## 後端翻譯
- 將 messages.po 和 game_configs.po 轉換為繁體中文
- 編譯生成對應的 .mo 檔案
- 使用 OpenCC 's2t' 轉換器進行簡繁轉換

## 前端翻譯
- 新增 zh-TW.json 語言檔案
- 更新 index.ts 註冊 zh-TW 語言
- 修正 UI 語言標籤為「繁體中文」

## 翻譯統計
- messages.po: 701 個 msgid(動態字串、戰鬥、奇遇等)
- game_configs.po: 2972 個 msgid(遊戲配置)
- zh-TW.json: 347 行(前端 UI)

* feat(i18n): add zh-TW optimizations and tests

## 可選優化 1:用語本地化
- 修正前端 UI 詞彙為台灣繁體習慣
- 主要修正項目:
  - 菜單 -> 選單
  - 設置 -> 設定
  - 加載 -> 載入
  - 保存 -> 儲存
  - 程序 -> 程式
  - 其他 UI 用語調整

## 可選優化 2:測試覆蓋
- 新增 test_i18n_zh_tw.py 測試檔案
- 涵蓋 13 個測試用例:
  - 語言枚舉驗證
  - 語言切換測試
  - 日期格式驗證
  - 動態翻譯測試
  - 境界/動作/情緒翻譯測試
  - 檔案完整性檢查
  - 翻譯覆蓋率驗證
  - 回退機制測試

## 測試結果
- 所有 13 個測試用例通過
- 翻譯覆蓋率 > 95%

* fix(i18n): add polib skip check to translation coverage test

* feat(i18n): add zh-TW column to glossary with Taiwan localization
2026-02-01 13:28:18 +08:00
MarkYangkp
c981aff863 feat: 添加 Docker 一键部署支持,包括后端和前端 Dockerfile、docker-compose 配置及 Nginx 配置 (#112)
* feat: 添加 Docker 支持,包括后端和前端 Dockerfile、docker-compose 配置及 Nginx 配置

* feat: 添加 .dockerignore 文件,更新 Dockerfile 和 docker-compose 配置以支持数据持久化保存
2026-02-01 12:55:39 +08:00
bridge
666310e7b4 feat: enhance hidden domains with additional properties and UI updates
- Updated `HiddenDomainInfo` interface to include `cd_years` and `open_prob` properties for better domain management.
- Modified `serialize_active_domains` function to serialize new properties.
- Enhanced `StatusWidget` to display additional information about hidden domains, including cooldown years and open probability.
- Updated localization files for English and Chinese to reflect new status labels for hidden domains.
2026-02-01 12:41:47 +08:00
bridge
07dacb8876 feat: enhance hidden domains serialization and UI representation
- Updated `serialize_active_domains` to include both active and inactive hidden domains, adding an `is_open` property for each domain.
- Modified `StatusBar` and `StatusWidget` components to reflect the new domain state, displaying appropriate labels and colors based on the activation status.
- Adjusted localization files for English and Chinese to align with the updated hidden domain features.
2026-02-01 12:26:43 +08:00
bridge
d53d5885c0 feat: add active domains serialization and UI integration
- Implemented `serialize_active_domains` function to gather and format active hidden domains from the game world.
- Updated `game_loop` to include active domains in the broadcast state.
- Enhanced `StatusBar` component to display active domains with a new `StatusWidget`, including dynamic labels and colors based on the number of active domains.
- Added localization support for hidden domain messages in both English and Chinese.
- Updated the world store to manage active domains state and synchronize with the backend.
2026-02-01 12:20:27 +08:00
4thfever
bc3ebc006c Refactor/i18n (#115)
重构i18n,现在game configs的配表,除了姓名这种外,都是统一的配表了。
对应的配表的名称和desc需要去i18n里取,但是其他配置不需要重复配置了。
这大大简化了之后新增i18n的心智负担。
2026-02-01 01:09:24 +08:00
bridge
5d46b47672 chore: update readme shields 2026-01-31 21:00:19 +08:00
bridge
24ded1d40f chore: update readme shields 2026-01-31 20:58:38 +08:00
bridge
b6104f4fce chore: update readme 2026-01-31 20:54:51 +08:00
bridge
15e831a471 Merge branch 'main' of https://github.com/4thfever/cultivation-world-simulator 2026-01-31 20:44:36 +08:00
bridge
3580968bfa chore: update version 2026-01-31 20:44:22 +08:00
4thfever
0315dca6e6 Feat/hidden domain (#113)
Summary
新增秘境探索,属于多人活动,每N年触发一次
Closes #105
2026-01-31 20:43:42 +08:00
bridge
efa663febe add: i18n msgid test 2026-01-31 13:36:14 +08:00
bridge
3a4c1a5dcb refactor: contributors 2026-01-31 00:24:25 +08:00
bridge
aa0e6aa32f update: remove useless file 2026-01-30 23:31:14 +08:00
teps3105
3ddd7868b6 feat: add avatar metrics tracking feature (#111)
* feat: add avatar metrics tracking feature (#110)

Add AvatarMetrics dataclass for tracking avatar state snapshots

- Add AvatarMetrics dataclass for recording monthly snapshots
- Add metrics_history field to Avatar with opt-in tracking
- Implement automatic monthly snapshot recording in Simulator
- Add backward compatibility support for existing save files
- Set default tracking limit to 1200 months (100 years)
- Add comprehensive tests with 100% coverage
- Move documentation to specs directory with simplified chinese

* fix: convert Traditional Chinese comments to Simplified Chinese

修正程式碼中的繁體中文註解為簡體中文,以符合專案規範。

Fix Traditional Chinese comments to Simplified Chinese in codebase.
2026-01-30 23:07:45 +08:00
4thfever
202de66654 Feat/play (#109)
* refactor: play
2026-01-29 22:52:35 +08:00
bridge
6cb9e5c4e9 fix: death rate to 100% after reaching max age 2026-01-29 21:12:12 +08:00
bridge
a59f6f816f update: add hellogithub shield into readme 2026-01-29 20:57:18 +08:00
bridge
cd9f16527b update: add hellogithub shield into readme 2026-01-29 20:56:28 +08:00
bridge
c28e9e2d73 update: personas and world info 2026-01-28 21:56:56 +08:00
bridge
54714a5ace chore: add openai pre-settings 2026-01-27 23:13:34 +08:00
bridge
3947dfde7b add: roadmap 2026-01-27 22:58:27 +08:00
bridge
57d1f9a704 fix: green point for connecting showing 2026-01-26 23:25:20 +08:00
bridge
64783e018f fix: map location 2026-01-26 23:22:14 +08:00
4thfever
84027fc1d7 Feat/retreat (#104)
* feat: add retreat
2026-01-26 23:18:11 +08:00
Zihao Xu
406d62f983 test(web): add tests for utility functions (#102)
Add tests for utility modules:
- formatters/number.ts: formatHp, formatAge
- mapStyles.ts: REGION_STYLES, getRegionTextStyle
- procedural.ts: getClusteredTileVariant
- theme.ts: GRADE_COLORS, getEntityColor

Total: 52 new tests added

Closes #87
2026-01-26 10:01:38 +08:00
Zihao Xu
c3ac584a90 feat: add spec-interview skill for requirement gathering (#103) 2026-01-25 15:39:39 -08:00
bridge
4a4c45c428 update: en screenshot gif 2026-01-25 19:06:10 +08:00
Zihao Xu
c406d2988f feat: add draggable sidebar resizer (#100)
* feat: add draggable sidebar resizer

- Add resizer handle between map and event panel
- Sidebar width adjustable from 300px to 50% screen width
- Default width remains 400px
- Auto-adjust on window resize

* fix: preserve map zoom when resizing sidebar

Only update viewport screen size without re-fitting the map

* fix: use window size for canvas to prevent map scaling on resize

- Canvas size now based on window instead of container
- Sidebar resize only clips the visible area, map stays same size
- Remove CSS stretch on canvas element

* docs: update sidebar-resizer spec with canvas fix
2026-01-25 18:44:54 +08:00
Zihao Xu
aaa636a08e fix: use str() instead of .value for realm i18n display (#98)
* fix: use str() instead of .value for realm i18n display

Fix bug where user-facing messages displayed raw enum values like
"FOUNDATION_ESTABLISHMENT" instead of translated names like "筑基".

The Realm and Stage classes already have __str__ methods that return
i18n translated text, but several places were incorrectly using
.value which returns the raw enum string.

Changed files:
- src/classes/single_choice.py: item exchange messages
- src/classes/kill_and_grab.py: loot messages
- src/classes/fortune.py: fortune discovery messages
- src/classes/avatar/inventory_mixin.py: purchase error messages

Also added unit tests and integration tests to prevent regression.

* test: add integration tests for all modified files

Add tests covering:
- kill_and_grab.py: context string realm display
- fortune.py: weapon/auxiliary intro realm display
- inventory_mixin.py: can_buy_item error message realm display
2026-01-25 18:44:13 +08:00
Zihao Xu
2b5ec24455 test(web): add tests for all composables (#101)
Add comprehensive tests for Vue composables:
- useSharedTicker (100% coverage)
- useTextures (97% coverage)
- useGameControl (92% coverage)
- useGameInit (69% coverage)

Tests cover:
- Lifecycle hooks (mount/unmount)
- State management
- Function exports
- Error handling
- LLM configuration flow
- Keyboard event handling

Closes #86
2026-01-25 01:17:02 -08:00
Zihao Xu
5fa8016334 docs: add test coverage guidelines to test-validate skill (#99) 2026-01-24 23:29:40 -08:00
Zihao Xu
0d8a001f8c feat: add Gemini preset template for LLM settings (#97)
* feat: add Gemini preset template for LLM settings

* docs: add comment explaining Gemini /openai suffix requirement

* feat: update Gemini preset to use latest 3-pro and 3-flash models

* docs: improve comment to reference backend client.py implementation
2026-01-24 22:42:46 -08:00
Zihao Xu
e286d249c4 feat: add claude-compatible skills for git-pr and test-validate (#96) 2026-01-24 17:21:42 -08:00
Zihao Xu
a2f2010ee5 feat: auto npm install in dev mode to sync dependencies (#94) 2026-01-24 17:19:44 -08:00
bridge
8af763531b update: mode 2026-01-24 23:40:54 +08:00
bridge
547cc01aef fix: pack i18n 2026-01-24 14:44:45 +08:00
bridge
b772fe0c3a update: version 2026-01-24 14:08:47 +08:00
bridge
1224dd2fcb feat: more weapons 2026-01-24 14:06:03 +08:00
bridge
339f6a655e fix: auxiliary in frontend 2026-01-24 13:58:29 +08:00
4thfever
e1091fdf5a Feat/i18n (#92)
* feat: add vue-i18n

* feat: add vue-i18n

* feat: add vue-i18n

* feat: add language class

* add: en templates and configs

* add: en names

* refactor: name gender id and sect id

* feat(i18n): add gettext infrastructure for dynamic text translation (#81)

* feat(i18n): add gettext infrastructure for dynamic text translation

- Add src/i18n/ module with t() translation function
- Add .po/.mo files for zh_CN and en_US locales
- Update LanguageManager to reload translations on language change
- Add comprehensive tests (14 tests, all passing)
- Add implementation spec at docs/specs/i18n-dynamic-text.md

Phase 1 of i18n dynamic text implementation.

* feat(i18n): expand .po files with comprehensive translation entries

Add translation messages for:
- Battle result messages (fatal/non-fatal outcomes)
- Fortune event messages (item discovery, cultivation gains)
- Misfortune event messages (losses, damage, regression)
- Death reason messages
- Item exchange messages (equip, sell, discard)
- Single choice context and option labels
- Common labels (weapon, auxiliary, technique, elixir)

Both zh_CN and en_US locales updated with matching entries.

* test: add .po file integrity tests

* feat: i18n for actions

* feat: i18n for effects

* feat: i18n for gathering

* feat: i18n for classes

* feat: i18n for classes

* feat: i18n for classes

* feat: i18n for classes

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* update csv

* update world info

* update prompt

* update prompt

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Zihao Xu <xzhseh@gmail.com>
2026-01-24 13:47:23 +08:00
Zihao Xu
6f4b648d6e test(web): add comprehensive tests for all Pinia stores (#90)
* test(web): add comprehensive tests for all Pinia stores

* test(web): add edge case tests for Pinia stores

* test(web): document race condition bugs in ui and world stores

* fix(web): fix race condition bugs in ui and world stores

- ui.ts: Add detailRequestId counter to prevent stale responses from
  overwriting fresh data when reselecting the same target
- world.ts: Add eventsRequestId counter to prevent stale responses
  when filter changes rapidly via resetEvents
- Update tests to verify the fix works correctly

* fix(web): fix race condition in fetchInitStatus

- Add fetchStatusRequestId counter to prevent stale responses from
  overwriting fresh data when fetchInitStatus is called rapidly
- Add test that first proves the bug exists, then verifies the fix

* fix(web): fix race condition in fetchState

Add fetchStateRequestId counter to prevent stale responses from
overwriting fresh data when fetchState is called rapidly.

* test(web): add missing edge case tests for world store

- Add changePhenomenon API failure test
- Add initialize concurrent calls test
- Add getPhenomenaList concurrent calls test

Total: 108 tests

* test(web): add comprehensive socket store tests

- Add init() duplicate call guard test
- Add setup listener tests
- Add message handling tests (tick, game_reinitialized)
- Add status change handling tests

Total: 118 tests

* test(web): add missing socket message handling tests

- Add llm_config_required message tests
- Add unknown message type test

Total: 121 tests

* test(web): add handleTick edge case tests

- Add test for avatars without id (ignored)
- Add test for empty events array
- Add test for events filtered to empty

Total: 124 tests
2026-01-23 03:07:33 -08:00
Zihao Xu
00c8860c56 test: add edge case tests for game initialization (#83)
* test: add edge case tests for game initialization

* test: add 3 more edge case tests for game initialization

* test: add 8 more edge case tests for comprehensive coverage

* docs: add comprehensive coverage report to test file header
2026-01-21 00:18:52 -08:00
Zihao Xu
38327c1b10 test: add game initialization integration tests (#82)
Add 17 tests covering the complete init_game_async flow:
- Phase progress updates (4 tests)
- Full initialization success (2 tests)
- History processing (2 tests)
- LLM check failure handling (1 test)
- Avatar generation (2 tests)
- Error handling (3 tests)
- Sect initialization (1 test)
- Phase name constants (2 tests)

Closes #72
2026-01-21 00:03:42 -08:00
Zihao Xu
ec71310588 docs: update LLM config section in README (#80)
* docs: update LLM config section in README

* fix: use deepseek as example (matches default config)
2026-01-21 15:35:12 +08:00
Zihao Xu
666e19215d test: add comprehensive LLM failure scenario tests (#79)
* test: add comprehensive LLM failure scenario tests

Add 29 tests covering:
- HTTP errors: 401, 403, 404, 500, timeout, connection refused
- Parse errors: invalid JSON, empty response, array instead of object
- Retry logic: retry on parse failure, max retries exceeded
- Connectivity test: friendly error messages for common failures
- Configuration validation: missing base URL, URL normalization
- Async call_llm: success and error propagation
- Exception classes: LLMError, ParseError

Closes #71

* refactor: add comment explaining unreachable code for type checker
2026-01-20 23:27:04 -08:00
Zihao Xu
189e675711 test: add comprehensive WebSocket handler tests (#78)
Add 31 tests covering:
- ConnectionManager: connect, disconnect, broadcast, auto-pause
- WebSocket endpoint: connection, ping/pong, LLM config required message
- Control API: pause, resume, reset endpoints
- State/Map API: error handling, data serialization
- Event serialization: empty list, full fields, minimal fields

Closes #70
2026-01-20 23:00:48 -08:00
bridge
2b8812852c feat: code owner 2026-01-20 23:23:14 +08:00
bridge
64732d6912 update: license & contributing 2026-01-20 21:12:55 +08:00
Zihao Xu
6ed614814f feat: add i18n glossary in CSV format (Phase 0) (#67) 2026-01-20 20:54:33 +08:00
Zihao Xu
498249e83b fix: handle overlapping avatar names in highlightAvatarNames (#77)
Use single-pass regex replacement instead of multiple replaceAll calls.
This prevents shorter names from matching inside already-replaced longer names.

For example, with names '张三' and '张三丰', the text '张三丰是大师' now
correctly highlights only '张三丰', not '张三' within it.
2026-01-19 23:46:42 -08:00
Zihao Xu
d4b9b7303d ci: add frontend tests to CI workflow (#68)
* ci: add frontend tests to CI workflow

* chore: sync package-lock.json with test dependencies

* test: skip failing overlapping names test (known bug)
2026-01-19 23:32:23 -08:00
Zihao Xu
a1241a9156 fix: make cooldown_action decorator properly await async finish() (#75)
* fix: make cooldown_action decorator properly await async finish()

The decorator was incorrectly wrapping the async finish() method with a sync
wrapper, causing cooldown to be recorded BEFORE the action actually executed.

This fix:
- Changes wrapper to async def finish()
- Awaits original_finish() before recording cooldown
- Ensures cooldown is only recorded on successful execution

Fixes #74

* test: add test to verify cooldown not recorded on failure

This test actually reveals the async/await bug:
- Creates a FailingAction that raises in finish()
- Verifies cooldown is NOT recorded when action fails
- Fails with buggy sync wrapper, passes with async fix
2026-01-20 15:32:14 +08:00
Zihao Xu
5f236361dc feat: add Ollama preset for local LLM deployment (#76) 2026-01-19 23:31:36 -08:00
Zihao Xu
a8666950b1 test: add comprehensive tests for mutual actions (talk, spar, impart) (#73)
- Talk: 31% -> 98% coverage
- Spar: 49% -> 100% coverage
- Impart: 37% -> 95% coverage
- Add 30 new test cases
- Overall coverage: 58.64% -> 60% (meets CI threshold)

Testing strategy: Mock LLM calls via call_llm_with_task_name

Closes #69
2026-01-19 23:09:38 -08:00
bridge
325c72e513 update: readme 2026-01-20 01:01:45 +08:00
bridge
2c9ef96c36 update: contributing 2026-01-19 21:56:09 +08:00
bridge
a7ab18ea1c fix: package bug 2026-01-19 21:26:09 +08:00
bridge
bf13cdf2d2 fix: incorrect relationship for new avatar 2026-01-19 21:14:20 +08:00
Zihao Xu
31d0c060e8 feat: enhance README with activity graph and contributor avatars (#65) 2026-01-19 20:50:33 +08:00
Zihao Xu
7f31d9884f test: add comprehensive tests for ai.py (13% -> 98% coverage) (#64)
- Test LLM response parsing (list and dict formats)
- Test null params conversion to empty dict
- Test invalid format handling and skipping
- Test emotion update logic with all emotion types
- Test fallback to CALM on invalid/missing emotion
- Test batch avatar processing
- Test AI.decide wrapper returns NULL_EVENT
- Test thinking field variants (avatar_thinking vs thinking)
- Add testing strategy documentation to test file

Closes #63
2026-01-19 20:49:24 +08:00
Zihao Xu
665d94addb test(web): add example frontend tests (#61)
* test(web): setup frontend test infrastructure

- Add testing dependencies (vitest, vue-test-utils, testing-library, jsdom, msw)
- Create vitest.config.ts with jsdom environment and coverage settings
- Create setup.ts with Pinia initialization and fake timers
- Add test scripts to package.json (test, test:run, test:coverage)

Closes #56, closes #57

* test(web): add example frontend tests

- Add system store tests (initial state, getters, togglePause)
- Add eventHelper utility tests (processNewEvents, mergeAndSortEvents, avatarIdToColor, highlightAvatarNames)

Closes #59
2026-01-19 20:48:43 +08:00
Zihao Xu
8bf5f64bc3 test(web): setup frontend test infrastructure (#60)
- Add testing dependencies (vitest, vue-test-utils, testing-library, jsdom, msw)
- Create vitest.config.ts with jsdom environment and coverage settings
- Create setup.ts with Pinia initialization and fake timers
- Add test scripts to package.json (test, test:run, test:coverage)

Closes #56, closes #57
2026-01-19 20:48:28 +08:00
Zihao Xu
9677055faa fix: use sect_id instead of sect in fortune technique filter (#55)
PR #32 changed Technique.sect (str) to Technique.sect_id (int), but
fortune.py was not updated. This caused AttributeError when fortune
event triggered and tried to access t.sect.

Error: 'Technique' object has no attribute 'sect'
2026-01-19 20:48:05 +08:00
Zihao Xu
8f7c2cfa66 docs: add Codecov coverage badge to README (#54)
Closes #49
2026-01-19 20:47:49 +08:00
Zihao Xu
ee2964e151 ci: add coverage reporting, 60% threshold, and Codecov integration (#53)
- Add pytest-cov to CI dependencies
- Generate coverage report (xml + terminal)
- Set minimum coverage threshold to 60% (current: 63%, target: 90%)
- Upload coverage to Codecov
- Add 10 minute timeout

Closes #46, closes #47, closes #48
2026-01-19 20:47:26 +08:00
Zihao Xu
daa7a20679 test: add fixed_random_seed fixture with autouse=True (#52)
Ensures all tests have deterministic random behavior by setting
random.seed(42) before each test. This prevents flaky tests caused
by random number generation.

Closes #44
2026-01-19 20:46:59 +08:00
Zihao Xu
ed2d8720aa chore: configure coverage settings in pyproject.toml (#51)
- Add [tool.coverage.run] with source and branch coverage
- Add [tool.coverage.report] with exclude patterns and show_missing

Closes #43
2026-01-19 20:46:42 +08:00
Zihao Xu
5a82a186a7 chore: add pytest-cov to requirements (#50)
Closes #42
2026-01-19 20:46:09 +08:00
Zihao Xu
1a34b7724b feat(web): make avatar names in event log clickable (#41)
When avatars overlap (e.g., during sparring, talking, dual cultivation),
it's hard to click on them directly. This adds the ability to click on
colored avatar names in the event panel to open their detail view.

- Modify highlightAvatarNames to include data-avatar-id attribute
- Add click event delegation in EventPanel
- Add hover styles for clickable names
2026-01-19 20:45:44 +08:00
bridge
2e04b718e8 update: splash 2026-01-18 21:49:13 +08:00
bridge
a075c1cc59 update: history prompt 2026-01-18 21:44:47 +08:00
bridge
bc6725b302 update: version 2026-01-18 17:25:27 +08:00
4thfever
6185d314af refactor: remove region_names dict, use regions traversal instead (#40)
The region_names dictionary was a redundant index that needed manual
sync when HistoryManager modified region names. This caused bugs where
resolve_query couldn't find regions by their new (history-modified) names.

Instead of maintaining two data structures (regions[id] and region_names[name]),
we now only use regions[id] as the single source of truth. The _resolve_region
function iterates over regions.values() to find matches by name.

This approach:
- Eliminates the sync bug entirely
- Simplifies the codebase
- Has negligible performance impact (region count is small)

Co-authored-by: Zihao Xu <xzhseh@gmail.com>
2026-01-18 17:13:28 +08:00
Zihao Xu
b68403e601 fix: mock StoryTeller in mock_llm_managers to prevent flaky test (#36)
The test_passive_update_loop test was flaky because when misfortune
randomly triggers during sim.step(), it calls StoryTeller.tell_story
which wasn't mocked, causing real LLM API calls to fail in CI.

Added StoryTeller.tell_story to the mock_llm_managers fixture.
2026-01-18 17:00:42 +08:00
Zihao Xu
ce64c6b048 fix(web): decouple manual pause state from system pause behavior (#37)
The pause indicator was showing 'paused' while the game was still running
because isManualPaused was being modified by both user actions (clicking
pause button) and system actions (opening menu).

Changes:
- systemStore: pause()/resume() no longer modify isManualPaused, only
  togglePause() does (with optimistic update + rollback on failure)
- useGameControl: consolidate 3 overlapping watches into 1 clean watch
  that only handles menu open/close without polluting manual pause state
- App.vue: explicitly call resumeGame() API when game initializes
2026-01-18 16:59:44 +08:00
bridge
47ad330b35 feat: data reload system 2026-01-18 16:53:24 +08:00
bridge
094a8fdd00 feat: data reload system 2026-01-18 16:47:54 +08:00
bridge
eb2c715069 feat: data reload system 2026-01-18 16:37:08 +08:00
bridge
bd563b10f4 feat: add splash mp4 video 2026-01-18 16:11:34 +08:00
Zihao Xu
e3bf36bcd4 test: add tests for Avatar._init_known_regions (#34)
Verify that:
1. Avatar without sect knows current location's region
2. Avatar with sect knows their sect headquarters
3. Avatar without sect does not automatically know sect regions
4. Avatar only knows their own sect's headquarters, not others
2026-01-18 15:31:41 +08:00
Zihao Xu
7edae9188b fix(misc): CSV column name mismatches in data loading (#32)
* fix: CSV column name mismatches in data loading

- sect.py: Fix headquarter_name/headquarter_desc -> name/desc when reading sect_region.csv
- sect.py: Move sid initialization before technique lookup to fix unbound variable bug
- technique.py: Change sect (name) to sect_id (int) to match technique.csv column
- elixir.py: Remove redundant get_int(row, "id") that reads non-existent column

These fixes ensure:
1. Sect headquarters display correct location names (e.g., "大千光极城" instead of "不夜城")
2. Sect techniques are correctly associated and displayed
3. Technique sect restrictions work properly

* fix: update main.py to use sect_id, add CSV loading tests

- main.py: Change technique.sect to technique.sect_id in API response
- Add tests/test_csv_loading.py to verify CSV column names match code

* test: add API test for /api/meta/game_data endpoint

Verify that techniques in API response use sect_id field (not sect)

* fix: add None check for hq_region in AvatarFactory

Remove redundant code that adds sect headquarters to known_regions.
This logic is already handled by Avatar._init_known_regions() which
uses sect_id matching (more reliable than name-based lookup).

The removed code was causing a flaky test (~1% failure rate) because
resolve_query returns None in test environments with simplified maps.
2026-01-18 15:31:15 +08:00
bridge
0acf72a313 fix: remove tmp 2026-01-18 14:42:45 +08:00
bridge
4fea4b6a9b update: contributing md 2026-01-15 09:35:34 +08:00
bridge
e5ed418949 update: readme 2026-01-15 09:01:02 +08:00
bridge
9b294ccba3 fix: game control bug 2026-01-15 08:55:01 +08:00
bridge
e900c3e098 fix pytest 2026-01-14 17:17:21 +08:00
4thfever
df8b1b9433 Refactor/event (#31)
重构事件机制和部分拍卖会机制
2026-01-14 16:58:50 +08:00
4thfever
63fc2f828e Feat/auction (#30)
Add gathering events, in which multiple avatars participate
Add auction event

Closes #24
2026-01-14 02:33:13 +08:00
4thfever
0d34b27fff Feat: Add splash layer (#29)
Add splash layer, support game start, settings, exit
Modify settings layer, add "go back to splash" and "exit"
Add character threshold for history input
Closes #28
2026-01-13 22:00:23 +08:00
bridge
224e3e76f0 fix: pytest llm error only existed in github online CI 2026-01-13 00:08:42 +08:00
4thfever
bb2e010930 refactor readme (#26)
refactor readme, simulate style of
https://github.com/vladelaina/Catime
Closes #23
2026-01-13 00:03:09 +08:00
4thfever
95e1f11502 Refactor/history (#25)
add multi process history modification
2026-01-12 23:25:53 +08:00
4thfever
176fa95425 Merge pull request #21 from AI-Cultivation/feat/history
Feat/history
2026-01-12 00:40:56 +08:00
bridge
2caa5586be refactor history archi 2026-01-12 00:36:10 +08:00
bridge
287f9d2ae4 update history pytest 2026-01-12 00:20:15 +08:00
bridge
57cf5ca51a add history class 2026-01-11 23:53:26 +08:00
bridge
5241f70ef3 refactor item ids 2026-01-11 23:12:48 +08:00
bridge
fa4c0340fd fix pytest 2026-01-11 22:48:05 +08:00
bridge
19b9ddd8ba refactor frontend 2026-01-11 22:44:05 +08:00
bridge
879a3c0d1f refactor frontend (not done) 2026-01-11 22:29:53 +08:00
bridge
08e28f52c7 refactor frontend (not done) 2026-01-11 22:15:45 +08:00
bridge
f33cfab0d5 refactor frontend (not done) 2026-01-11 22:08:01 +08:00
bridge
488758764e fix pytest for new awaken avatars 2026-01-11 21:03:02 +08:00
bridge
090e8fe32c fix remove avatar bug 2026-01-11 20:45:51 +08:00
bridge
5143266442 fix remove avatar bug 2026-01-11 20:40:53 +08:00
bridge
3a0e432b02 refactor gift 2026-01-11 20:33:54 +08:00
bridge
2056538375 uncomment protagonists 2026-01-11 19:56:26 +08:00
4thfever
2d9f073435 Merge pull request #20 from AI-Cultivation/fix-misorder-events
fix: incorrect order in event panel
2026-01-11 19:27:55 +08:00
bridge
ff6038b786 fix: incorrect order in event panel 2026-01-11 19:26:05 +08:00
bridge
88cc7cd966 feat: add color to map avatar names 2026-01-11 18:54:34 +08:00
bridge
ed7d16b4f3 feature: log print version 2026-01-11 18:27:41 +08:00
bridge
a0cfb3b9da make better conversation template 2026-01-10 01:41:13 +08:00
638 changed files with 70238 additions and 5262 deletions

View File

@@ -0,0 +1,30 @@
---
name: git-pr
description: Create a pull request with proper remote handling
---
## Pre-flight
```bash
git remote -v
# If origin URL is outdated, fix it:
# git remote set-url origin https://github.com/AI-Cultivation/cultivation-world-simulator.git
```
## Commands
```bash
git checkout main && git pull origin main
git checkout -b <github-username>/<branch-name>
git add <files>
git commit -m "<type>: <description>"
git push -u origin <github-username>/<branch-name>
gh pr create --head <github-username>/<branch-name> --base main --title "<type>: <description>" --body "<body>"
```
## Notes
- Always branch off from `main`, not from current branch
- Follow PR template in `.github/PULL_REQUEST_TEMPLATE.md`
- `<github-username>`: e.g., `xzhseh`
- `<type>`: `feat` | `fix` | `refactor` | `test` | `docs`

View File

@@ -0,0 +1,51 @@
---
name: spec-interview
description: Conduct an in-depth interview to gather requirements and write a detailed spec
---
## Overview
Conduct a thorough interview using `AskUserQuestion` to deeply understand a feature, system, or idea before writing a specification document.
## Core Principles
1. **Use your judgment** - Adapt question depth and focus based on the topic. A small UI change needs different questions than a new authentication system.
2. **Ask non-obvious questions** - Skip surface-level questions. Probe for:
- Hidden assumptions the user hasn't articulated
- Edge cases they haven't considered
- Tradeoffs they're implicitly making
- Constraints they forgot to mention
- Failure modes and recovery paths
3. **Follow interesting threads** - When an answer reveals complexity or uncertainty, dig deeper before moving on.
4. **Challenge gently** - Ask "what if X fails?" or "why not Y instead?" to stress-test the design.
5. **Know when to stop** - End the interview when you have enough clarity to write a useful spec. Not every topic needs exhaustive coverage.
## Question Areas (use as needed, not as a checklist)
- **Problem & motivation**: Why now? What's the cost of not doing this?
- **Technical design**: Data model, state, APIs, performance, migrations
- **User experience**: Error states, loading, edge cases, accessibility
- **Integration**: What else does this touch? Security? Observability?
- **Tradeoffs**: What are you NOT building? What debt are you accepting?
- **Risks**: What assumptions could be wrong? What would make this a failure?
## Interview Flow
1. Start with 2-4 questions per round via `AskUserQuestion`.
2. Synthesize answers and follow up on gaps or ambiguities.
3. Periodically summarize to confirm understanding.
4. When sufficiently complete, confirm with the user and write the spec.
## Output
Write the spec to `docs/specs/<feature-name>.md` (or ask user for preferred path). Include whatever sections are relevant — don't force a rigid template.
## Invocation
```
/spec-interview [topic]
```

View File

@@ -0,0 +1,33 @@
---
name: test-validate
description: Run Python tests using the project venv
---
## Commands
```bash
# Run all tests
.venv/bin/pytest
# Run specific test file
.venv/bin/pytest tests/test_<name>.py -v
# Run with coverage
.venv/bin/pytest --cov=src
# Run server (dev mode)
.venv/bin/python src/server/main.py --dev
```
## Test Coverage Guidelines
After making code changes, consider whether tests are needed:
| Change Type | Test Recommendation |
|-------------|---------------------|
| Bug fix | Add regression test to prevent recurrence |
| New feature | Unit tests + integration test if affects multiple modules |
| Refactor | Existing tests should pass; add tests if behavior changes |
| Config/docs | Usually no tests needed |
For bug fixes, ensure the test would have **failed before the fix** and **passes after**.

40
.dockerignore Normal file
View File

@@ -0,0 +1,40 @@
# 忽略不需要的文件
.git
.gitignore
node_modules
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
.env
.env.local
.DS_Store
Thumbs.db
# 开发文件
README.md
ROADMAP.md
CONTRIBUTING.md
.github/
.vscode/
.idea/
*.md
# 构建产物
web/dist/
web/node_modules/
dist/
build/
# 日志
*.log
logs/
# 测试
tests/
pytest_cache/
.coverage
htmlcov/

2
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,2 @@
/README.md wangxin4qiao@163.com
/EN_README.md wangxin4qiao@163.com

View File

@@ -9,10 +9,12 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
# --- Backend Tests ---
- name: Set up Python
uses: actions/setup-python@v5
with:
@@ -24,10 +26,34 @@ jobs:
enable-cache: true
cache-dependency-glob: "requirements.txt"
- name: Install dependencies
- name: Install Python dependencies
run: |
uv pip install --system -r requirements.txt
uv pip install --system pytest
uv pip install --system pytest pytest-cov
- name: Run tests
run: pytest -v
- name: Run backend tests with coverage
run: pytest -v --cov=src --cov-report=xml --cov-report=term --cov-fail-under=60
# --- Frontend Tests ---
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: web/package-lock.json
- name: Install Node dependencies
working-directory: web
run: npm ci
- name: Run frontend tests with coverage
working-directory: web
run: npm run test:coverage
# --- Upload Coverage ---
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml,./web/coverage/coverage-final.json
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

20
.gitignore vendored
View File

@@ -152,4 +152,22 @@ local_config.yml
台本/
笔记/
tmp*/
tmp*/
#############################
# Docker
#############################
# Docker data directories
saves/
logs/
# Docker environment files
.env
#############################
# Frontend (web/)
#############################
# Test coverage reports generated by Vitest.
web/coverage/

View File

@@ -1,6 +1,10 @@
# 贡献指南 (Contributing Guide)
感谢你对 **Cultivation World Simulator** (修仙模拟器) 感兴趣!欢迎任何形式的贡献,包括修复 Bug、改进文档或开发新功能。
感谢你对 **Cultivation World Simulator** (修仙模拟器) 感兴趣!欢迎任何形式的贡献,包括提出Bug、修复 Bug、改进文档或开发新功能。
> **重要**:任何新功能提交,特别是业务功能提交,请务必提前在 issue 中讨论清楚,得到维护者确认后,再进行贡献。
在开始贡献之前,建议先查看 [项目路线图](./ROADMAP.md),了解项目的发展方向和计划,这有助于你的贡献与项目目标保持一致。
为了保持代码库的健康和风格统一,请在贡献前阅读以下指南。
@@ -17,9 +21,38 @@
在提交 Pull Request 之前,请务必确保所有测试通过。这是保证代码质量的关键。
**运行后端测试:**
```bash
pytest tests/
```
本项目在 CI 环境中使用 Python 3.11。
1. 确保已安装测试依赖(包含在 requirements.txt 中):
```bash
pip install -r requirements.txt
```
2. 运行测试并检查覆盖率(需满足 60% 覆盖率要求):
```bash
pytest -v --cov=src --cov-report=term --cov-fail-under=60
```
**运行前端测试 (Vue/Vitest)**
前端测试位于 `web/` 目录。
1. 进入前端目录并安装依赖:
```bash
cd web
npm install
```
2. 运行单元测试:
```bash
npm run test:run
```
3. 运行测试并查看覆盖率:
```bash
npm run test:coverage
```
请确保所有测试用例都能通过PASS。如果你添加了新功能建议同时也添加相应的测试用例。
@@ -50,4 +83,4 @@ pytest tests/
5. 推送 (Push) 到你的远程分支。
6. 在 GitHub 上发起 **Pull Request**
感谢你的贡献!一起打造更好修仙世界。
感谢你的贡献!一起打造更好玩有趣的AI修仙世界。

6
CONTRIBUTORS.md Normal file
View File

@@ -0,0 +1,6 @@
# 贡献者 (Contributors)
* **Aku** - 世界观 & 玩法设计与讨论
* **[@xzhseh](https://github.com/xzhseh)** - 代码与repo维护
* **[@teps3105](https://github.com/teps3105)** - 代码贡献
* **[@MarkYangKp](https://github.com/MarkYangkp)** - 代码贡献

View File

@@ -9,19 +9,12 @@
![GitHub stars](https://img.shields.io/github/stars/4thfever/cultivation-world-simulator?style=social)
[![Bilibili](https://img.shields.io/badge/Bilibili-Watch_Video-FB7299?logo=bilibili)](https://space.bilibili.com/527346837)
![QQ Group](https://img.shields.io/badge/QQ%20Group-1071821688-deepskyblue?logo=tencent-qq&logoColor=white)
![Last Commit](https://img.shields.io/github/last-commit/4thfever/cultivation-world-simulator)
![Commit Activity](https://img.shields.io/github/commit-activity/y/4thfever/cultivation-world-simulator)
![Repo Size](https://img.shields.io/github/repo-size/4thfever/cultivation-world-simulator)
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
![Status](https://img.shields.io/badge/Status-Alpha-tomato)
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
[![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289da?logo=discord&logoColor=white)](https://discord.gg/shhRWmZR)
[![License](https://img.shields.io/badge/license-CC%20BY--NC--SA%204.0-lightgrey)](LICENSE)
![Genre: Xianxia](https://img.shields.io/badge/Genre-Xianxia-red)
![Powered by LLM](https://img.shields.io/badge/Powered%20by-LLM-0077B5)
![AI Agent](https://img.shields.io/badge/AI-Agent-orange)
![OpenAI Compatible](https://img.shields.io/badge/OpenAI%20API-Compatible-412991)
![Powered by LLM](https://img.shields.io/badge/Powered%20by-LLM-0077B5)
![Python](https://img.shields.io/badge/Python-3.10%2B-blue?style=flat&logo=python&logoColor=white)
![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=flat&logo=fastapi&logoColor=white)
![Vue](https://img.shields.io/badge/Vue.js-3.x-4FC08D?style=flat&logo=vuedotjs&logoColor=white)
@@ -30,11 +23,17 @@
![PixiJS](https://img.shields.io/badge/PixiJS-E72264?style=flat&logo=pixijs&logoColor=white)
<p align="center">
<img src="assets/screenshot.gif" alt="Game Demo" width="100%">
<img src="assets/en-US/screenshot.gif" alt="Game Demo" width="100%">
</p>
> **An AI-driven cultivation world simulator that aims to create a truly living, immersive xianxia world.**
<p align="center">
<a href="https://hellogithub.com/repository/4thfever/cultivation-world-simulator" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=d0d75240fb95445bba1d7af7574d8420&claim_uid=DogxfCROM1PBL89" alt="FeaturedHelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
## 📖 Introduction
This is an **AI-driven open-world cultivation simulator**.
@@ -51,34 +50,45 @@ You don't need to personally fight monsters or level up. Instead, you observe al
<table border="0">
<tr>
<td width="33%" valign="top">
<h4 align="center">Character Panel</h4>
<img src="assets/角色.png" width="100%" />
<br/><br/>
<h4 align="center">Personality Traits</h4>
<img src="assets/特质.png" width="100%" />
</td>
<td width="33%" valign="top">
<h4 align="center">Sect System</h4>
<img src="assets/宗门.png" width="100%" />
<img src="assets/en-US/screenshots/宗门.png" width="100%" />
<br/><br/>
<h4 align="center">City Region</h4>
<img src="assets/en-US/screenshots/城市.png" width="100%" />
<br/><br/>
<h4 align="center">Life Experiences</h4>
<img src="assets/经历.png" width="100%" />
<img src="assets/en-US/screenshots/经历.png" width="100%" />
</td>
<td width="33%" valign="top">
<h4 align="center">Independent Thinking</h4>
<img src="assets/思考.png" width="100%" />
<h4 align="center">Character Panel</h4>
<img src="assets/en-US/screenshots/角色.png" width="100%" />
<br/><br/>
<h4 align="center">Short/Long Term Goals</h4>
<img src="assets/目标.png" width="100%" />
<h4 align="center">Personality Traits</h4>
<img src="assets/en-US/screenshots/特质.png" width="100%" />
<br/><br/>
<h4 align="center">Independent Thinking</h4>
<img src="assets/en-US/screenshots/思考.png" width="100%" />
<br/><br/>
<h4 align="center">Nicknames</h4>
<img src="assets/绰号.png" width="100%" />
<img src="assets/en-US/screenshots/绰号.png" width="100%" />
</td>
<td width="33%" valign="top">
<h4 align="center">Dungeon Exploration</h4>
<img src="assets/en-US/screenshots/洞府.png" width="100%" />
<br/><br/>
<h4 align="center">Short/Long Term Goals</h4>
<img src="assets/en-US/screenshots/目标.png" width="100%" />
<br/><br/>
<h4 align="center">Elixirs/Treasures/Weapons</h4>
<img src="assets/en-US/screenshots/丹药.png" width="100%" />
<img src="assets/en-US/screenshots/法宝.png" width="100%" />
<img src="assets/en-US/screenshots/武器.png" width="100%" />
</td>
</tr>
</table>
### Why make this?
### 💭 Why make this?
The worlds in cultivation novels are fascinating, but readers can only ever observe a corner of them.
Cultivation games are either completely scripted or rely on simple state machines designed by humans, often resulting in forced and unintelligent behaviors.
@@ -87,13 +97,147 @@ With the advent of Large Language Models, the goal of making "every character al
I hope to create a pure, joyful, direct, and living sense of immersion in a cultivation world. Not a pure marketing tool for some game company, nor pure research like "Stanford Town", but an actual world that provides players with real immersion.
## Contact
## 📞 Contact
If you have any questions or suggestions, feel free to open an Issue or Pull Request.
You're also welcome to leave a message on my [Bilibili account](https://space.bilibili.com/527346837)!
You can also join the QQ group for discussion: 1071821688. Verification answer is my Bilibili nickname.
You can also join the QQ group for discussion: 1071821688. Verification answer: 肥桥今天吃什么
Join our Discord community: [https://discord.gg/shhRWmZR](https://discord.gg/shhRWmZR)
## Development Progress
## 🚀 Usage
### ⚙️ Run Steps
#### Option 1: Docker Compose (Recommended)
If you have Docker installed, this is the easiest way:
1. **Clone the repo**
```bash
git clone https://github.com/AI-Cultivation/cultivation-world-simulator.git
cd cultivation-world-simulator
```
2. **Start Service (Auto build & run)**
```bash
docker-compose up -d --build
```
#### Option 2: Manual Installation
1. Clone the repo:
```bash
git clone https://github.com/AI-Cultivation/cultivation-world-simulator.git
cd cultivation-world-simulator
```
2. Install dependencies:
```bash
# Backend dependencies
pip install -r requirements.txt
# Frontend dependencies (Node.js environment required)
cd web && npm install
```
3. Configure LLM:
**Recommended: Configure directly in the frontend (supports quick preset filling)**
<img src="assets/en-US/llm_config.png" alt="Frontend LLM Config" width="100%">
You can also manually configure it in `static/local_config.yml` (OpenAI compatible format):
```yaml
llm:
base_url: https://api.deepseek.com # API addr
key: your-api-key-here # your api key
model_name: deepseek-chat # normal model name
fast_model_name: deepseek-chat # fast model name
mode: default # run mode (default/normal/fast)
```
Supports all API providers compatible with OpenAI interface format (e.g., Qwen, DeepSeek, SiliconFlow, OpenRouter, etc.)
**Local Deployment (Ollama):** Also supports connecting to local Ollama, just select "Ollama (Local)" preset in the frontend.
4. Run:
```bash
# Start service (Recommended dev mode, automatically starts frontend)
python src/server/main.py --dev
```
The browser will automatically open the web frontend.
### 🌐 Access Application
Frontend: `http://localhost:8123`
Backend API: `http://localhost:8002`
### 📱 Mobile / LAN Access
You can access the game from other devices on the same network (e.g., phone, tablet).
> ⚠️ **Note**: The mobile UI is not optimized yet. See [Issue #130](https://github.com/4thfever/cultivation-world-simulator/issues/130).
**Configuration steps:**
1. Add to `static/local_config.yml`:
```yaml
system:
host: "0.0.0.0" # Allow LAN access
```
2. If using dev mode (`--dev`), also add to `web/vite.config.ts` in the `server` config:
```typescript
server: {
host: '0.0.0.0', // Add this line
proxy: { ... }
}
```
3. After starting the server, access from your phone:
```
http://<your-computer-lan-ip>:5173 # Dev mode
http://<your-computer-lan-ip>:8002 # Production mode
```
4. Find your computer's LAN IP:
```bash
# macOS
ipconfig getifaddr en0
# Linux
hostname -I
# Windows
ipconfig
```
> 💡 Make sure your phone and computer are on the same WiFi, and the firewall allows the corresponding port.
## 📊 Project Status
![Repobeats analytics](https://repobeats.axiom.co/api/embed/91667dce0fca651a7427022b2d819d20dd17c5e3.svg "Repobeats analytics image")
## ⭐ Star History
If you find this project interesting, please give us a Star ⭐! It will motivate us to keep improving and adding new features.
<div align="center">
<a href="https://star-history.com/#4thfever/cultivation-world-simulator&Date">
<img src="https://api.star-history.com/svg?repos=4thfever/cultivation-world-simulator&type=Date" alt="Star History Chart" width="600">
</a>
</div>
## 👥 Contributors
<a href="https://github.com/4thfever/cultivation-world-simulator/graphs/contributors">
<img src="https://contrib.rocks/image?repo=4thfever/cultivation-world-simulator&max=100&columns=12" />
</a>
For more details on contributions, please see [CONTRIBUTORS.md](CONTRIBUTORS.md).
## 📋 Development Progress
### 🏗️ Foundation
- ✅ World map basics, time, event system
@@ -105,7 +249,9 @@ You can also join the QQ group for discussion: 1071821688. Verification answer i
- ✅ Menu bar & Save & Load
- ✅ Flexible custom LLM interface
- ✅ Support macOS
- [ ] Support multi-language localization
- Support multi-language localization
- ✅ Start Game Page
- [ ] Mod Support
### 🗺️ World System
- ✅ Basic tile mechanics
@@ -137,7 +283,6 @@ You can also join the QQ group for discussion: 1071821688. Verification answer i
- [ ] Taming
- [ ] Evolving skills
- [ ] Mortals
- [ ] Prodigies (stronger abilities and AI)
### 🏛️ Organizations
- [ ] Sect system
@@ -164,8 +309,8 @@ You can also join the QQ group for discussion: 1071821688. Verification answer i
### 🎭 Event System
- ✅ Heaven-earth Qi fluctuations
- [ ] World-scale events:
- [ ] Auctions
- [ ] Secret realm exploration
- Auctions
- ✅ Hidden domain exploration
- [ ] Martial tournaments
- [ ] Sect grand competition
- [ ] Sudden events
@@ -204,10 +349,9 @@ You can also join the QQ group for discussion: 1071821688. Verification answer i
### 🏛️ World Lore
- ✅ Inject basic world knowledge
- [ ] Dynamic worldview generation
- [ ] Dynamic generation of techniques, equipment, sects, and maps based on user input history
- ✅ User input history, dynamic generation of techniques, equipment, sects, and region info
### Specials
### Specials
- ✅ Fortuitous encounters
- ✅ Tribulations & Heart devils
- [ ] Possession & Rebirth
@@ -221,56 +365,7 @@ You can also join the QQ group for discussion: 1071821688. Verification answer i
- [ ] World Secrets & World Laws (Flexible customization)
- [ ] Gu Refining
- [ ] World-ending Crisis
- [ ] Become a Legend of Later Ages
### 🔭 Long-term
- [ ] Novelization/imagery/video for history and events
- [ ] Avatar calling MCP tools on their own
## Usage
### Run Steps
1. Clone the repo:
```bash
git clone https://github.com/your-username/cultivation-world-simulator.git
cd cultivation-world-simulator
```
2. Install dependencies:
```bash
# Backend dependencies
pip install -r requirements.txt
# Frontend dependencies (Node.js environment required)
cd web && npm install
```
3. Configure LLM:
Edit `static/config.yml`:
```yaml
llm:
key: "your-api-key-here" # your api key
base_url: "https://api.xxx.com" # API addr
model_name: "normal_model_name"
fast_model_name: "fast_model_name"
```
Supports all API providers compatible with OpenAI interface format (e.g., Qwen, DeepSeek, SiliconFlow, OpenRouter, etc.)
You can also configure LLM parameters directly in the frontend:
<img src="assets/llm_config.png" alt="Frontend LLM Config" width="100%">
4. Run:
```bash
# Start service (Recommended dev mode, automatically starts frontend)
python src/server/main.py --dev
```
The browser will automatically open the web frontend.
## Contributors
- Aku, for world design & discussion
- [@xzhseh](https://github.com/xzhseh), contributed code
## Acknowledgments
- Referenced some UI elements from ailifeengine
- [ ] Avatar calling MCP tools on their own

168
LICENSE
View File

@@ -1,21 +1,155 @@
MIT License
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
Copyright (c) 2024 cultivation-world-simulator
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (“Public License”). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Section 1 Definitions.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
b. Adapters License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. BY-NC-SA Compatible License means a license listed at CreativeCommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
k. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
l. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
m. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
n. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use of the Licensed Material, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures applied by the Licensor. For purposes of this Public License, making modifications authorized by this Section 2(a)(4) does not produce Adapted Material.
b. Other rights.
1. Moral rights, whether asserted or not, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives the right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves the right to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate that the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapters License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapters License You apply.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
1. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
2. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b);
3. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
1. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material “as-is” and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
2. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
3. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. Term.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Reinstatement.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. The Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed to.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
---
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at https://creativecommons.org.

256
README.md
View File

@@ -2,6 +2,9 @@
<h3 align="center">
<a href="README.md">🇨🇳 中文</a> · <a href="EN_README.md">🇺🇸 English</a>
</h3>
<blockquote align="center">
This project now supports English. Don't hesitate to give it a try!
</blockquote>
<p align="center">— ✦ —</p>
# 修仙世界模拟器 (Cultivation World Simulator)
@@ -9,19 +12,12 @@
![GitHub stars](https://img.shields.io/github/stars/4thfever/cultivation-world-simulator?style=social)
[![Bilibili](https://img.shields.io/badge/Bilibili-%E6%9F%A5%E7%9C%8B%E8%A7%86%E9%A2%91-FB7299?logo=bilibili)](https://space.bilibili.com/527346837)
![QQ Group](https://img.shields.io/badge/QQ%E7%BE%A4-1071821688-deepskyblue?logo=tencent-qq&logoColor=white)
![Last Commit](https://img.shields.io/github/last-commit/4thfever/cultivation-world-simulator)
![Commit Activity](https://img.shields.io/github/commit-activity/y/4thfever/cultivation-world-simulator)
![Repo Size](https://img.shields.io/github/repo-size/4thfever/cultivation-world-simulator)
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
![Status](https://img.shields.io/badge/Status-Alpha-tomato)
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
[![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289da?logo=discord&logoColor=white)](https://discord.gg/shhRWmZR)
[![License](https://img.shields.io/badge/license-CC%20BY--NC--SA%204.0-lightgrey)](LICENSE)
![Genre: Xianxia](https://img.shields.io/badge/Genre-Xianxia-red)
![Powered by LLM](https://img.shields.io/badge/Powered%20by-LLM-0077B5)
![AI Agent](https://img.shields.io/badge/AI-Agent-orange)
![OpenAI Compatible](https://img.shields.io/badge/OpenAI%20API-Compatible-412991)
![Powered by LLM](https://img.shields.io/badge/Powered%20by-LLM-0077B5)
![Python](https://img.shields.io/badge/Python-3.10%2B-blue?style=flat&logo=python&logoColor=white)
![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=flat&logo=fastapi&logoColor=white)
![Vue](https://img.shields.io/badge/Vue.js-3.x-4FC08D?style=flat&logo=vuedotjs&logoColor=white)
@@ -31,11 +27,17 @@
<p align="center">
<img src="assets/screenshot.gif" alt="游戏演示" width="100%">
<img src="assets/zh-CN/screenshot.gif" alt="游戏演示" width="100%">
</p>
> **一个AI驱动的修仙世界模拟器旨在创造一个真正活着的、有沉浸感的仙侠世界。**
<p align="center">
<a href="https://hellogithub.com/repository/4thfever/cultivation-world-simulator" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=d0d75240fb95445bba1d7af7574d8420&claim_uid=DogxfCROM1PBL89" alt="FeaturedHelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
## 📖 简介
这是一个 **AI 驱动的开放世界修仙模拟器**
@@ -54,43 +56,43 @@
<tr>
<td width="33%" valign="top">
<h4 align="center">宗门体系</h4>
<img src="assets/screenshots/宗门.png" width="100%" />
<img src="assets/zh-CN/screenshots/宗门.png" width="100%" />
<br/><br/>
<h4 align="center">城市区域</h4>
<img src="assets/screenshots/城市.png" width="100%" />
<img src="assets/zh-CN/screenshots/城市.png" width="100%" />
<br/><br/>
<h4 align="center">生平经历</h4>
<img src="assets/screenshots/经历.png" width="100%" />
<img src="assets/zh-CN/screenshots/经历.png" width="100%" />
</td>
<td width="33%" valign="top">
<h4 align="center">角色面板</h4>
<img src="assets/screenshots/角色.png" width="100%" />
<img src="assets/zh-CN/screenshots/角色.png" width="100%" />
<br/><br/>
<h4 align="center">性格特质</h4>
<img src="assets/screenshots/特质.png" width="100%" />
<img src="assets/zh-CN/screenshots/特质.png" width="100%" />
<br/><br/>
<h4 align="center">自主思考</h4>
<img src="assets/screenshots/思考.png" width="100%" />
<img src="assets/zh-CN/screenshots/思考.png" width="100%" />
<br/><br/>
<h4 align="center">江湖绰号</h4>
<img src="assets/screenshots/绰号.png" width="100%" />
<img src="assets/zh-CN/screenshots/绰号.png" width="100%" />
</td>
<td width="33%" valign="top">
<h4 align="center">洞府探秘</h4>
<img src="assets/screenshots/洞府.png" width="100%" />
<img src="assets/zh-CN/screenshots/洞府.png" width="100%" />
<br/><br/>
<h4 align="center">长短期目标</h4>
<img src="assets/screenshots/目标.png" width="100%" />
<img src="assets/zh-CN/screenshots/目标.png" width="100%" />
<br/><br/>
<h4 align="center">丹药/法宝/武器</h4>
<img src="assets/screenshots/丹药.png" width="100%" />
<img src="assets/screenshots/法宝.png" width="100%" />
<img src="assets/screenshots/武器.png" width="100%" />
<img src="assets/zh-CN/screenshots/丹药.png" width="100%" />
<img src="assets/zh-CN/screenshots/法宝.png" width="100%" />
<img src="assets/zh-CN/screenshots/武器.png" width="100%" />
</td>
</tr>
</table>
### 为什么要做这个?
### 💭 为什么要做这个?
修仙网文中的世界很精彩,但读者永远只能观察到一隅。
修仙品类游戏要么是完全的预设剧本,要么依靠人工设计的简单规则状态机,有许许多多牵强和降智的表现。
@@ -99,12 +101,146 @@
希望能够创造出纯粹的、快乐的、直接的、活着的修仙世界的沉浸感。不是像一些游戏公司的纯粹宣传工具,也不是像斯坦福小镇那样的纯粹研究,而是能给玩家提供真实代入感和沉浸感的实际世界。
## 联系方式
## 📞 联系方式
如果您对项目有任何问题或建议,欢迎提交 Issue 或 Pull Request。
欢迎给我的[B站账号](https://space.bilibili.com/527346837)留言!
也可以加入QQ群进行讨论1071821688。进群需要输入我的B站昵称。
也可以加入QQ群进行讨论1071821688。进群问题的答案:肥桥今天吃什么
加入 Discord 社区:[https://discord.gg/shhRWmZR](https://discord.gg/shhRWmZR)
## 功能开发进度
## 🚀 使用方法
### ⚙️ 运行步骤
#### 方式一Docker Compose 一键部署(推荐)
如果你已经安装了 Docker这是最简单的方式
1. **克隆项目**
```bash
git clone https://github.com/AI-Cultivation/cultivation-world-simulator.git
cd cultivation-world-simulator
```
2. **启动服务(自动构建并运行)**
```bash
docker-compose up -d --build
```
#### 方式二:手动安装运行
1. 克隆项目到本地:
```bash
git clone https://github.com/AI-Cultivation/cultivation-world-simulator.git
cd cultivation-world-simulator
```
2. 安装依赖:
```bash
# 后端依赖
pip install -r requirements.txt
# 前端依赖 (需Node.js环境)
cd web && npm install
```
3. 配置LLM
**推荐方式:在前端直接配置(支持快速填充预设)**
<img src="assets/zh-CN/llm_config.png" alt="前端LLM配置" width="100%">
也可以在 `static/local_config.yml` 中手动配置OpenAI兼容格式
```yaml
llm:
base_url: https://api.deepseek.com # API地址
key: your-api-key-here # 你的API密钥
model_name: deepseek-chat # 智能模型名称
fast_model_name: deepseek-chat # 快速模型名称
mode: default # 运行模式 (default/normal/fast)
```
**本地部署 (Ollama)** 也支持对接本地 Ollama在前端选择 "Ollama (本地)" 预设即可。
4. 运行:
```bash
# 启动服务 (推荐开发模式,会自动启动前端)
python src/server/main.py --dev
```
浏览器会自动打开网页前端。
### 🌐 访问应用
无论使用哪种方式运行,启动后都可以通过以下地址访问:
前端:`http://localhost:8123`
后端 API`http://localhost:8002`
### 📱 手机/局域网访问
支持从局域网内的其他设备(如手机、平板)访问游戏。
> ⚠️ **注意**:移动端 UI 目前未做适配优化,体验可能不佳。详见 [Issue #130](https://github.com/4thfever/cultivation-world-simulator/issues/130)。
**配置步骤:**
1. 在 `static/local_config.yml` 中添加:
```yaml
system:
host: "0.0.0.0" # 允许局域网访问
```
2. 如果使用开发模式(`--dev`),还需在 `web/vite.config.ts` 的 `server` 配置中添加:
```typescript
server: {
host: '0.0.0.0', // 添加这一行
proxy: { ... }
}
```
3. 启动服务器后,在手机浏览器访问:
```
http://<电脑局域网IP>:5173 # 开发模式
http://<电脑局域网IP>:8002 # 生产模式
```
4. 查看电脑局域网 IP
```bash
# macOS
ipconfig getifaddr en0
# Linux
hostname -I
# Windows
ipconfig
```
> 💡 确保手机和电脑连接同一个 WiFi且防火墙已放行对应端口。
## 📊 项目状态
![Repobeats analytics](https://repobeats.axiom.co/api/embed/91667dce0fca651a7427022b2d819d20dd17c5e3.svg "Repobeats analytics image")
## ⭐ Star History
如果你觉得这个项目有趣,请给我们一个 Star ⭐!这将激励我们持续改进和添加新功能。
<div align="center">
<a href="https://star-history.com/#4thfever/cultivation-world-simulator&Date">
<img src="https://api.star-history.com/svg?repos=4thfever/cultivation-world-simulator&type=Date" alt="Star History Chart" width="600">
</a>
</div>
## 👥 贡献者
<a href="https://github.com/4thfever/cultivation-world-simulator/graphs/contributors">
<img src="https://contrib.rocks/image?repo=4thfever/cultivation-world-simulator&max=100&columns=11" />
</a>
更多贡献细节请查看 [CONTRIBUTORS.md](CONTRIBUTORS.md)。
## 📋 功能开发进度
### 🏗️ 基础系统
- ✅ 基础世界地图、时间、事件系统
@@ -116,8 +252,9 @@
- ✅ 菜单栏 & 存档 & 读档
- ✅ 灵活自定义LLM接口
- ✅ 支持mac os
- [ ] 支持多语言本地化
- [ ] 开始游戏时的游戏设定栏
-多语言本地化
- ✅ 开始游戏页
- [ ] Mod支持
### 🗺️ 世界系统
- ✅ 基础tile地块系统
@@ -149,7 +286,6 @@
- [ ] 饲养
- [ ] 技能可升级
- [ ] 凡人系统
- [ ] 天骄系统更强能力更强AI
### 🏛️ 组织系统
- [ ] 宗门系统
@@ -175,9 +311,9 @@
### 🎭 事件系统
- ✅ 天地灵气变动
- [ ] 世界范围大事件:
- [ ] 拍卖会
- [ ] 秘境探索
- ✅ 多人大事件:
- 拍卖会
- 秘境探索
- [ ] 比武大会
- [ ] 宗门大比
- [ ] 突发事件
@@ -216,10 +352,9 @@
### 🏛️ 世界背景系统
- ✅ 注入基础世界知识
- [ ] 动态世界观生成
- [ ] 基于用户输入历史的动态功法、装备、宗门、地图生成
- ✅ 用户输入历史,动态生成功法、装备、宗门、区域信息
### 特殊
### 特殊
- ✅ 奇遇
- ✅ 天劫 & 心魔
- [ ] 夺舍 & 重生
@@ -236,51 +371,4 @@
### 🔭 远期展望
- [ ] 历史/事件的小说化&图片化&视频化
- [ ] MCP agent化修士自行调用工具
## 使用方法
### 运行步骤
1. 克隆项目到本地:
```bash
git clone https://github.com/your-username/cultivation-world-simulator.git
cd cultivation-world-simulator
```
2. 安装依赖:
```bash
# 后端依赖
pip install -r requirements.txt
# 前端依赖 (需Node.js环境)
cd web && npm install
```
3. 配置LLM
在 `static/config.yml` 中配置LLM参数OpenAI格式
```yaml
llm:
key: "your-api-key-here" # 你的API密钥
base_url: "https://api.xxx.com" # API地址
model_name: "normal_model_name" # 智能模型名称
fast_model_name: "fast_model_name" # 快速模型名称
```
也支持在前端直接配入LLM参数
<img src="assets/llm_config.png" alt="前端LLM配置" width="100%">
4. 运行:
```bash
# 启动服务 (推荐开发模式,会自动启动前端)
python src/server/main.py --dev
```
浏览器会自动打开网页前端。
## 贡献者
* Aku, 世界观\玩法设计与讨论
* [@xzhseh](https://github.com/xzhseh), 贡献代码
## 致谢
- 参考了ai life engine部分ui
- [ ] MCP agent化修士自行调用工具

8
ROADMAP.md Normal file
View File

@@ -0,0 +1,8 @@
# 2026Q1
完善宗门体系
世家体系
凡人体系
# 2026Q2
玩家更多的干涉手段
安卓支持
mod支持

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 196 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 191 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 244 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 238 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 218 KiB

After

Width:  |  Height:  |  Size: 218 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 357 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 348 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 335 KiB

After

Width:  |  Height:  |  Size: 335 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 325 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 198 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 281 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 255 KiB

After

Width:  |  Height:  |  Size: 255 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 275 KiB

BIN
assets/en-US/llm_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
assets/en-US/screenshot.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 MiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 318 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 352 KiB

After

Width:  |  Height:  |  Size: 352 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Some files were not shown because too many files have changed in this diff Show More