5.7 KiB
5.7 KiB
AI TOOLBOX - Project Long-Term Memory
Project Overview
Honkai Star Rail Game Server (.NET / C# and Rust Architecture & Protocol Simulation).
Core Directives & User Preferences
- Approval Automation: Group tasks into single automated commands or use subagents; avoid asking repetitive approval prompts.
- FreeCam System: Preserve live-reloading of
scripts/freecam.luaviaPlayerHeartBeatScRsp.download_data(CmdID: 62). Maintain user's exact controls and rainbow watermark. - Challenge Unlocks: Keep stages unlocked (
hgpkmhfpmbj: true/is_unlock: true) across Forgotten Hall (Jarilo-VI 15, Xianzhou Luofu 6), MoC (12 floors), Pure Fiction (4 stages), and Apocalyptic Shadow (4 difficulties). - Hotfix Sync: Hotfix URLs are stored in
versions.json. SDK server delivers hotfix payloads for target client versions (e.g.OSBETAWin4.5.51,OSBETAWin4.5.52,CNBETAWin4.3.51..55). - No Code Overwrites: Never blindly wipe or revert user source code without explicit verification.
- External Reference:
https://git.neonteam.dev/amizing/robinsr(Third-party repo used only as an external reference to inspect when game updates break server compatibility). - No Vanity / Slop Logs: Never output fake or vanity console logs pretending handlers or systems are registered/functional when they are placeholders. Only log real operations that actually execute.
- Dimbreath Game Data:
https://gitlab.com/Dimbreath/turnbasedgamedata(Primary source for exact game tables: ExcelOutput, ChallengeMazeConfig, stages, etc.). - Daily Memory Logging (Continuous): Maintain daily logs in
tools/AI TOOLBOX/memory/YYYY-MM-DD.md. Update this file continuously throughout active sessions to ensure all technical discoveries, reverse engineering findings, and architectural shifts are persistently saved across chat resets. - Open Source & Mod-Friendly Data: Do NOT compress or pack game tables into opaque binary blobs like March7th's
Resource.bin. Keep resources open, transparent, and moddable in standard JSON directories (resources/Config,ExcelOutput,TextMap). - MhyKcp Protocol (28-byte Header): HoYoverse games modify standard KCP by inserting a 4-byte
tokenafterconv:conv(4) + token(4) + cmd(1) + frg(1) + wnd(2) + ts(4) + sn(4) + una(4) + len(4)(Little-Endian). Standard KCP libraries cannot read this; use the native C#MhyKcp.cs. - Login Security (login_random): In
PlayerLoginCsReq(CmdId: 34), client sends a 64-bit random number (login_random, Tag 6). The server MUST echo this exact value inPlayerLoginScRsp(CmdId: 25, Tag 14). Failing to do so triggers Error 1001_3. - Dispatch HTTP Server: Must use ASP.NET Core Kestrel on port 21000 to prevent raw TCP
StreamReaderbuffer hangs (which triggers Error 1001_1). - MoC & Endgame Unlock Protocol:
- MoC floors 11–12 require matching actual
RewardIDs inChallengeHistoryMaxLevel.reward_display_type(101201..=101212for level 12). - Apocalyptic Shadow tab requires active schedule in
GetActivityScheduleConfigScRsp(CmdID: 2616) withpanel_id: 21001andactivity_id: 21001..=21030. - Total challenge stages: 790 stages across 101 groups.
- MoC floors 11–12 require matching actual
- Exact Command IDs (4.5.52):
PlayerGetToken: CsReq: 60 -> ScRsp: 16PlayerLogin: CsReq: 34 -> ScRsp: 25PlayerLoginFinish: CsReq: 87 -> ScRsp: 63PlayerHeartBeat: CsReq: 44 -> ScRsp: 62GetCurSceneInfo: CsReq: 1458 -> ScRsp: 1456GetChallenge: CsReq: 1734 -> ScRsp: 1725GetCurChallenge: CsReq: 1715 -> ScRsp: 1742GetBasicInfo: CsReq: 80 -> ScRsp: 67GetActivityScheduleConfig: CsReq: 2625 -> ScRsp: 2616
- Dependency & Pip Installation Tracking:
- Whenever any script, tool, or component requires installing packages via
pip install, ALWAYS record the package and its version inrequirements.txtand note it intools/AI TOOLBOX/memory/YYYY-MM-DD.md. - This ensures friends or other users who receive the project can simply run
pip install -r requirements.txtand execute all scripts/tools without encountering missing module errors.
- Whenever any script, tool, or component requires installing packages via
- Skill & Knowledge Crystallization:
- Whenever a complex protocol mechanism, reverse engineering pattern, build pipeline, or operational workflow is solved, ALWAYS immediately create/update a dedicated Skill in
tools/AI TOOLBOX/skills/<skill-name>/SKILL.mdand write the exact findings into memory. - Never rely on memory alone or re-search from scratch in subsequent sessions; consult and maintain the skill library first.
- Whenever a complex protocol mechanism, reverse engineering pattern, build pipeline, or operational workflow is solved, ALWAYS immediately create/update a dedicated Skill in
- Primary Server is Now Go (
C:/Users/Phitchayut/Desktop/GaC-hkrpg-go): As of 2026-10-07 the active server is the Go port (commit59ea97b). The RustGaC-hkrpg-pscode drifted out of sync with its own proto (old message names likePveBattleResultCsReq/GateServerno longer exist in 4.6.51 proto) - treat Rust as reference only. Data files (freesr-data.json, persistent, res.json, teleports.json, challenge_data.json, mission_unlocks.json, versions.json) are shared between both. - SceneCastSkill Camera Fix (solved): Never reply
battle_info/monster_battle_infofor hit targets that are not real scene monsters. The server tracks real monster entities per session (Session.MonsterEntitiesininternal/gameserver/handlers_battle.go); attacking props/NPCs/player avatars must returnretcode 0with NO battle, or the client's battle camera detaches from the character. - Skill File Single Source: The living lessons doc is
SKILL.mdat each repo root; a synced copy lives intools/AI TOOLBOX/skills/hkrpg-ps-version-update/SKILL.md. Update the root file first, then copy to the toolbox (both projects). Session-scoped prompt docs (HANDOFF/PROMPT/GLM_FIX_PROMPT) were deleted 2026-10-07 - do not recreate them; extend SKILL.md instead.