docs: sanitize documentation and generalize upstream reference server citations
This commit is contained in:
1 parent
7f106dbe46
commit
d1f8beac6f
18 files changed
+87
-87
No files matched your search
@@ -11,10 +11,10 @@ This directory contains complete, code-level architectural specifications and cr
|
||||
| File | Target Project & Stack | Core Capabilities & Focus Area |
|
||||
| :--- | :--- | :--- |
|
||||
| **[lunarcore_architecture_deep_dive.md](./lunarcore_architecture_deep_dive.md)** | **LunarCore**<br>*(Java 17 / Netty / KCP)* | Full game server architecture: 16-byte framing, MT19937 stream cipher, KCP networking, scene/world entities, PVE battle orchestration, Morphia MongoDB ODM. |
|
||||
| **[march7thhoney_architecture_deep_dive.md](./march7thhoney_architecture_deep_dive.md)** | **March7thHoney**<br>*(.NET 10 / NativeAOT)* | High-performance server: Roslyn Source Generators, zero-reflection packet routing, MemoryPack cache, Calyx FreeSR scenario injection, Muip API, Divergent Universe. |
|
||||
| **[firefly_protoc_deep_dive.md](./firefly_protoc_deep_dive.md)** | **FireflyProtoc**<br>*(C# .NET 9/10 / AST Pipeline)* | Obfuscation-aware Protobuf compiler: AST lowering (HIR $\rightarrow$ MIR $\rightarrow$ LIR), symbolic algebraic `ExpressionInverter`, `meta` fields, $O(1)$ `MessageFactory` jump table. |
|
||||
| **[csharp_nativeaot_server_architecture.md](./csharp_nativeaot_server_architecture.md)** | **C# NativeAOT Reference Server**<br>*(.NET 10 / NativeAOT)* | High-performance server: Roslyn Source Generators, zero-reflection packet routing, MemoryPack cache, Calyx scenario injection, Admin API, Endgame orchestration. |
|
||||
| **[protobuf_ast_compiler_pipeline.md](./protobuf_ast_compiler_pipeline.md)** | **Protobuf AST Compiler Pipeline**<br>*(C# .NET 9/10 / AST Pipeline)* | Obfuscation-aware Protobuf compiler: AST lowering (HIR $\rightarrow$ MIR $\rightarrow$ LIR), symbolic algebraic `ExpressionInverter`, `meta` fields, $O(1)$ `MessageFactory` jump table. |
|
||||
| **[honkai_dumper_deep_dive.md](./honkai_dumper_deep_dive.md)** | **honkai-dumper**<br>*(Rust cdylib / In-Process)* | In-process IL2CPP dumper: non-blocking DLL injection, pattern scanning in `UnityPlayer.dll` (`48 8B 05 ...`), RIP-relative math, ECMA-335 bitmask decompiler, `methods.json`. |
|
||||
| **[firefly_static_parser_deep_dive.md](./firefly_static_parser_deep_dive.md)** | **Firefly-Static-Parser**<br>*(Rust CLI / Offline)* | Pure offline static parser: reverse-engineers `b"MHY\0"` container, PE layout discovery, Dynamic Semantic Key Derivation via `<Module>`/`ValueType`, QWORD stream cipher. |
|
||||
| **[static_pe_metadata_parser.md](./static_pe_metadata_parser.md)** | **Static PE Metadata Parser**<br>*(Rust CLI / Offline)* | Pure offline static parser: reverse-engineers `b"MHY\0"` container, PE layout discovery, Dynamic Semantic Key Derivation via `<Module>`/`ValueType`, QWORD stream cipher. |
|
||||
| **[static_cmdid_dumper_deep_dive.md](./static_cmdid_dumper_deep_dive.md)** | **StaticCmdIdDumper**<br>*(C# .NET 8 / Zero-Dep)* | Static Opcode extractor: zero-dep PE parser, x86-64 machine-code disassembly (`66 B8 [imm16]` $\rightarrow$ `mov ax, imm16`), RVA-to-file-offset translation. |
|
||||
| **[dumpcs2protobuf_deep_dive.md](./dumpcs2protobuf_deep_dive.md)** | **Dumpcs2Protobuf**<br>*(C# .NET 8 / Regex AST)* | Schema reverse-engineering: inverts Google.Protobuf C# codegen, pairs field constants with properties, resolves `oneof` unions, recovers `[OriginalNameAttribute]` enums. |
|
||||
|
||||
@@ -28,7 +28,7 @@ The following diagram illustrates how all 7 tools connect to form an automated p
|
||||
flowchart TD
|
||||
subgraph S1["1. Binary & Metadata Extraction"]
|
||||
GA["GameAssembly.dll + Metadata"]
|
||||
GA -->|Offline Analysis| FSP["Firefly-Static-Parser<br/>(Rust CLI)"]
|
||||
GA -->|Offline Analysis| FSP["Static PE Metadata Parser<br/>(Rust CLI)"]
|
||||
GA -->|In-Process Injection| HD["honkai-dumper<br/>(Rust DLL)"]
|
||||
FSP --> DUMP_CS["dump.cs<br/>(C# Class Definitions)"]
|
||||
FSP --> METHODS_JSON["methods.json<br/>(Method RVAs)"]
|
||||
@@ -52,13 +52,13 @@ flowchart TD
|
||||
end
|
||||
|
||||
subgraph S5["5. High-Performance Compilation"]
|
||||
ANNOTATED_PROTO --> FP["FireflyProtoc<br/>(Symbolic Inversion Compiler)"]
|
||||
ANNOTATED_PROTO --> FP["Protobuf AST Compiler<br/>(Symbolic Inversion Pipeline)"]
|
||||
FP --> STUBS["Compiled Protocol Stubs<br/>(Zero-Allocation Deserializers)"]
|
||||
end
|
||||
|
||||
subgraph S6["6. Authoritative Game Server"]
|
||||
STUBS --> GAC["GaC-hkrpg-go (Go / KCP)"]
|
||||
STUBS --> M7H["March7thHoney (.NET 10)"]
|
||||
STUBS --> M7H["C# NativeAOT Reference Server"]
|
||||
STUBS --> LC["LunarCore (Java 17)"]
|
||||
end
|
||||
```
|
||||
@@ -104,5 +104,5 @@ To decrypt custom `b"MHY\0"` metadata without hardcoding version-specific keys,
|
||||
|
||||
When building or updating the Go server implementation in this repository:
|
||||
1. **Zero-Reflection Protocol Routing**: Implement an array-indexed jump table in Go (`[65536]PacketHandlerFunc`) instead of `map[uint16]any` or reflection-based deserialization.
|
||||
2. **Calyx Battle Override Pattern**: Port March7thHoney's `CalyxOverrideManager` to inject external JSON battle scenarios into world Calyxes for dynamic combat simulation without client modification.
|
||||
2. **Calyx Battle Override Pattern**: Apply modular scenario injection to inject external JSON battle scenarios into world Calyxes for dynamic combat simulation without client modification.
|
||||
3. **Configuration Compliance (`AGENTS.md`)**: Ensure all network IPs, ports, and asset directories are loaded via `server.json` and overridable via `server.local.json` or environment variables without hardcoded machine paths.
|
||||
+23
-23
@@ -1,7 +1,7 @@
|
||||
# รายงานการวิเคราะห์สถาปัตยกรรมและการทำงานของ March7thHoney (Deep-Dive Technical Specification)
|
||||
# รายงานการวิเคราะห์สถาปัตยกรรมและการทำงานของ Reference C# AOT Server (Deep-Dive Technical Specification)
|
||||
|
||||
> **เอกสารอ้างอิงทางเทคนิคระดับลึกสำหรับวิศวกรซอฟต์แวร์และโมเดลปัญญาประดิษฐ์ (AI Systems)**
|
||||
> วิเคราะห์จากซอร์สโค้ดของโครงการ: [Mar7thLover/March7thHoney-OpenSource](https://github.com/Mar7thLover/March7thHoney-OpenSource)
|
||||
> วิเคราะห์จากซอร์สโค้ดของโครงการ: โครงสร้างสถาปัตยกรรมอ้างอิง C# .NET 10 (Reference Architecture)
|
||||
> ครอบคลุมสถาปัตยกรรม .NET 10, Roslyn Source Generators (NativeAOT), KcpSharp, SQLite/MySQL Storage Pipeline, Lua Client Injection, Calyx/FreeSR Scenario Injection, Muip GM API และโหมดเกมเวอร์ชันใหม่ (Apocalyptic Shadow, Divergent Universe, Currency War)
|
||||
|
||||
---
|
||||
@@ -29,14 +29,14 @@
|
||||
- 9.1 Muip GM Protocol (RSA-Encrypted Remote Command Execution)
|
||||
- 9.2 Built-in Embedded Web Admin & Registration Portal
|
||||
- 9.3 Cluster Deployment via ServerExchange Secret
|
||||
10. [ตารางเปรียบเทียบเชิงลึก: LunarCore vs March7thHoney](#10-ตารางเปรียบเทียบเชิงลึก-lunarcore-vs-march7thhoney)
|
||||
10. [ตารางเปรียบเทียบเชิงลึก: LunarCore vs Reference C# AOT Server](#10-ตารางเปรียบเทียบเชิงลึก-lunarcore-vs-Reference C# AOT Server)
|
||||
11. [คู่มือการต่อยอดเชิงวิศวกรรมสำหรับ AI (AI Implementation Guidelines)](#11-คู่มือการต่อยอดเชิงวิศวกรรมสำหรับ-ai-ai-implementation-guidelines)
|
||||
|
||||
---
|
||||
|
||||
## 1. ภาพรวมสถาปัตยกรรมระดับสูง (High-Level Architecture & Tech Stack)
|
||||
|
||||
**March7thHoney** เป็นโครงการ Server Reimplementation สำหรับเกม *Honkai: Star Rail* ที่เขียนขึ้นใหม่ทั้งหมดด้วยภาษา **C# บน .NET 10** โดยมุ่งเน้นที่:
|
||||
**Reference C# AOT Server** เป็นโครงการ Server Reimplementation สำหรับเกม *Honkai: Star Rail* ที่เขียนขึ้นใหม่ทั้งหมดด้วยภาษา **C# บน .NET 10** โดยมุ่งเน้นที่:
|
||||
1. **ประสิทธิภาพสูงสุด (Extreme Performance)**: ลด Allocation ของหน่วยความจำผ่าน `Span<T>`, `Memory<T>`, `ArrayPool<byte>`, และหลีกเลี่ยง Reflection
|
||||
2. **NativeAOT Readiness**: คอมไพล์เป็นเนทีฟไบนารีเบ็ดเสร็จ (Single self-contained binary) ได้โดยไม่ต้องใช้ JIT Runtime
|
||||
3. **ฟีเจอร์เวอร์ชันใหม่ (Modern Game Modes)**: รองรับคอนเทนต์เวอร์ชันใหม่ (2.x ถึง 4.x) เช่น Apocalyptic Shadow, Divergent Universe, Currency War, Penacony Clockie Dial, Critter Pick (Cat Cake Catch)
|
||||
@@ -59,7 +59,7 @@ flowchart TB
|
||||
KCPClient["KCP/UDP Traffic"]
|
||||
end
|
||||
|
||||
subgraph March7thHoney[".NET 10 Server Architecture"]
|
||||
subgraph Reference C# AOT Server[".NET 10 Server Architecture"]
|
||||
subgraph WebServerModule["WebServer (ASP.NET Core Kestrel)"]
|
||||
DispatchCtrl["DispatchRoutes (/query_dispatch)"]
|
||||
GatewayCtrl["GateServerRoutes (/query_gateway)"]
|
||||
@@ -69,7 +69,7 @@ flowchart TB
|
||||
end
|
||||
|
||||
subgraph KcpNetworkLayer["KCP Transport (KcpSharp)"]
|
||||
KcpListener["March7thHoneyListener"]
|
||||
KcpListener["Reference C# AOT ServerListener"]
|
||||
Connection["Connection (ArrayPool & MT19937 Xor)"]
|
||||
HandlerMgr["HandlerManager (Generated Registry)"]
|
||||
end
|
||||
@@ -114,7 +114,7 @@ flowchart TB
|
||||
2. กินแรมมาก
|
||||
3. **คอมไพล์ NativeAOT ไม่ได้** เพราะ Reflection รันไทม์ถูกตัดทิ้ง (Trimmed)
|
||||
|
||||
March7thHoney แก้ปัญหานี้โดยสร้างคอมไพลเลอร์เสริม **Roslyn Source Generator (`SourceGen/`)**:
|
||||
Reference C# AOT Server แก้ปัญหานี้โดยสร้างคอมไพลเลอร์เสริม **Roslyn Source Generator (`SourceGen/`)**:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
@@ -139,7 +139,7 @@ flowchart LR
|
||||
## 3. เลเยอร์เครือข่ายและการเข้ารหัสขั้นสูง (Network, KcpSharp & Crypto)
|
||||
|
||||
### 3.1 KcpSharp Transport และการจัดการบัฟเฟอร์ ArrayPool
|
||||
March7thHoney ใช้ **`KcpSharp`** ซึ่งถูกปรับแต่งให้รันบน .NET 10:
|
||||
Reference C# AOT Server ใช้ **`KcpSharp`** ซึ่งถูกปรับแต่งให้รันบน .NET 10:
|
||||
- ในลูปรับข้อมูล `ReceiveLoop()` มีการใช้ `ArrayPool<byte>.Shared.Rent(result.BytesReceived)`
|
||||
- ข้อมูลที่ประมวลผลเสร็จแล้วจะถูก `ArrayPool<byte>.Shared.Return(buffer)` คืนสู่พูลทันทีเพื่อป้องกันการจัดสรรแรมซ้ำซ้อน (Zero-Garbage Collection Pressure)
|
||||
|
||||
@@ -163,7 +163,7 @@ March7thHoney ใช้ **`KcpSharp`** ซึ่งถูกปรับแต
|
||||
> [!CAUTION]
|
||||
> **การป้องกัน Memory Exhaustion Attack ใน BinaryReader (`Connection.cs`):**
|
||||
> `BinaryReader.ReadBytes(n)` ใน .NET จะจัดสรร Memory ตามค่า `n` ที่อ่านได้ทันที หากไคลเอนต์ประสงค์ร้ายส่งค่า `payloadLength` สูงผิดปกติ (เช่น 2 GB) เซิร์ฟเวอร์จะเกิด Out-Of-Memory Crash ทันที
|
||||
> March7thHoney จึงเพิ่มระบบป้องกัน:
|
||||
> Reference C# AOT Server จึงเพิ่มระบบป้องกัน:
|
||||
> ```csharp
|
||||
> var remaining = br.BaseStream.Length - br.BaseStream.Position;
|
||||
> if (headerLength + (long)payloadLength > remaining) {
|
||||
@@ -185,7 +185,7 @@ March7thHoney ใช้ **`KcpSharp`** ซึ่งถูกปรับแต
|
||||
|
||||
## 4. กลไกการฉีดสคริปต์เข้าไคลเอนต์ (Client Lua Script Injection Engine)
|
||||
|
||||
ฟีเจอร์เด่นของ March7thHoney คือการสื่อสารกับ Unity Client โดยตรงผ่านการส่งโค้ดภาษา Lua ผ่าน `HandshakePacket` ซึ่งไคลเอนต์เกมจะรันสคริปต์นี้บนตัวเครื่องโดยอัตโนมัติ:
|
||||
ฟีเจอร์เด่นของ Reference C# AOT Server คือการสื่อสารกับ Unity Client โดยตรงผ่านการส่งโค้ดภาษา Lua ผ่าน `HandshakePacket` ซึ่งไคลเอนต์เกมจะรันสคริปต์นี้บนตัวเครื่องโดยอัตโนมัติ:
|
||||
|
||||
### 1. ระบบ Watermark (`BuildWatermarkLua`):
|
||||
เซิร์ฟเวอร์ส่งโค้ด Lua ไปค้นหา GameObject ของ Unity ในหน้าต่างเกม:
|
||||
@@ -195,7 +195,7 @@ local function modify_texts()
|
||||
if vGo == nil then return end
|
||||
local vt = vGo:GetComponent("Text")
|
||||
vt.supportRichText = true
|
||||
vt.text = "<color=#FEC6DF>March7thHoney</color> | UID: 10001"
|
||||
vt.text = "<color=#FEC6DF>Reference C# AOT Server</color> | UID: 10001"
|
||||
vt.fontSize = 18
|
||||
end
|
||||
pcall(modify_texts)
|
||||
@@ -210,12 +210,12 @@ pcall(modify_texts)
|
||||
## 5. ระบบจัดเก็บข้อมูลและการจำลองฐานข้อมูล (Persistence & Database Pipeline)
|
||||
|
||||
### 5.1 Dual-Engine: SQLite & MySQL
|
||||
March7thHoney รองรับทั้งฐานข้อมูลเดี่ยว (SQLite สำหรับ Local/Single-player) และฐานข้อมูลเซิร์ฟเวอร์ (MySQL สำหรับ Production):
|
||||
Reference C# AOT Server รองรับทั้งฐานข้อมูลเดี่ยว (SQLite สำหรับ Local/Single-player) และฐานข้อมูลเซิร์ฟเวอร์ (MySQL สำหรับ Production):
|
||||
- กำหนดใน `config.json` $\rightarrow$ `Database.DatabaseType`: `"sqlite"` หรือ `"mysql"`
|
||||
- ตารางทั้งหมดถูกสร้างขึ้นอัตโนมัติเมื่อเริ่มระบบผ่าน `EntityStores.Map.Values.EnsureTable(conn)`
|
||||
|
||||
### 5.2 In-Memory Dirty Cache & Asynchronous Periodic Flusher
|
||||
เพื่อลด I/O คอขวด March7thHoney ไม่เขียนข้อมูลลงดิสก์ทุกครั้งที่มีการเปลี่ยนไอเทม แต่ใช้สถาปัตยกรรม **In-Memory Cache ร่วมกับ Dirty Tracking**:
|
||||
เพื่อลด I/O คอขวด Reference C# AOT Server ไม่เขียนข้อมูลลงดิสก์ทุกครั้งที่มีการเปลี่ยนไอเทม แต่ใช้สถาปัตยกรรม **In-Memory Cache ร่วมกับ Dirty Tracking**:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
@@ -241,14 +241,14 @@ sequenceDiagram
|
||||
> [!TIP]
|
||||
> **NativeAOT Thread Safepoint Fix (`DatabaseHelper.cs`):**
|
||||
> ใน .NET 10 โค้ดที่รันวนลูปแน่น (Tight Loop) ภายใต้ NativeAOT จะไม่มีจุด Safepoint สำหรับ Garbage Collector ทำให้เกิดสภาวะ Deadlock
|
||||
> March7thHoney จึงใส่ `Thread.Sleep(1000)` ใน `SaveThread` เพื่อเปิดช่อง Safepoint ให้ GC ทำงานได้อย่างสมบูรณ์
|
||||
> Reference C# AOT Server จึงใส่ `Thread.Sleep(1000)` ใน `SaveThread` เพื่อเปิดช่อง Safepoint ให้ GC ทำงานได้อย่างสมบูรณ์
|
||||
|
||||
---
|
||||
|
||||
## 6. ระบบแคชทรัพยากรเกมความเร็วสูง (High-Speed Binary Resource Cache)
|
||||
|
||||
โดยทั่วไป เซิร์ฟเวอร์เกมต้องอ่านไฟล์ JSON นับร้อยไฟล์จาก `ExcelOutput/` ซึ่งใช้เวลา 30 ถึง 60 วินาทีในทุกครั้งที่เปิดเครื่อง
|
||||
March7thHoney แก้ปัญหานี้ด้วย **`ResourceCache.cs`**:
|
||||
Reference C# AOT Server แก้ปัญหานี้ด้วย **`ResourceCache.cs`**:
|
||||
|
||||
1. **First Boot (สร้างแคชครั้งแรก)**:
|
||||
- อ่าน JSON จาก `Resources/ExcelOutput/` และ `Resources/ExcelOutputGameCore/`
|
||||
@@ -271,7 +271,7 @@ March7thHoney แก้ปัญหานี้ด้วย **`ResourceCache.cs`
|
||||
- รองรับด่านหลากหลายรูปแบบ: Mainline, Cocoon (ฟาร์มของ), FarmElement, BattleCollege (บทเรียนการต่อสู้)
|
||||
|
||||
### 7.2 Calyx Override & FreeSR JSON Scenario Injection
|
||||
ฟีเจอร์ระดับสูงที่สำคัญที่สุดใน March7thHoney คือ **`CalyxOverrideManager.cs`** และ **`FreesrShared.cs`**:
|
||||
ฟีเจอร์ระดับสูงที่สำคัญที่สุดใน Reference C# AOT Server คือ **`CalyxOverrideManager.cs`** และ **`FreesrShared.cs`**:
|
||||
- ผู้พัฒนาสามารถใส่ไฟล์สถานการณ์จำลองในรูปแบบ **FreeSR JSON** ไว้ในไดเรกทอรี `Config/Json/*.json`
|
||||
- เมื่อเปิดใช้งานผ่านคำสั่ง `/calyx` หรือ `CalyxOverrideManager.Enable()`:
|
||||
- เซิร์ฟเวอร์จะดักจับการเข้าด่าน Calyx (ดอกไม้ฟาร์มเงิน/EXP) ในโลกเปิด
|
||||
@@ -283,7 +283,7 @@ March7thHoney แก้ปัญหานี้ด้วย **`ResourceCache.cs`
|
||||
|
||||
## 8. ระบบโหมดการเล่นขั้นสูง (Modern End-Game Modes)
|
||||
|
||||
March7thHoney เป็นหนึ่งในเซิร์ฟเวอร์ไม่กี่แห่งที่รองรับโหมดการเล่นระดับ Endgame ยุคใหม่ของ Honkai: Star Rail:
|
||||
Reference C# AOT Server เป็นหนึ่งในเซิร์ฟเวอร์ไม่กี่แห่งที่รองรับโหมดการเล่นระดับ Endgame ยุคใหม่ของ Honkai: Star Rail:
|
||||
|
||||
### 8.1 ChallengePeak (Apocalyptic Shadow & Anomaly Arbitration)
|
||||
- ควบคุมผ่าน `ChallengePeakManager.cs`
|
||||
@@ -305,7 +305,7 @@ March7thHoney เป็นหนึ่งในเซิร์ฟเวอร์
|
||||
## 9. การจัดการระยะไกลและหน้าต่างควบคุม (Muip Protocol & Admin Dashboard)
|
||||
|
||||
### 9.1 Muip GM Protocol (RSA-Encrypted Remote Command Execution)
|
||||
March7thHoney พัฒนาระบบ Muip (Management User Interface Protocol) เพื่อให้แอปพลิเคชันภายนอก, Bot Discord หรือเว็บแอดมิน ติดต่อสั่งการเซิร์ฟเวอร์ได้อย่างปลอดภัยผ่านการเข้ารหัส **RSA Public/Private Key (PKCS#1)**:
|
||||
Reference C# AOT Server พัฒนาระบบ Muip (Management User Interface Protocol) เพื่อให้แอปพลิเคชันภายนอก, Bot Discord หรือเว็บแอดมิน ติดต่อสั่งการเซิร์ฟเวอร์ได้อย่างปลอดภัยผ่านการเข้ารหัส **RSA Public/Private Key (PKCS#1)**:
|
||||
|
||||
1. `POST /muip/create_session`:
|
||||
- เซิร์ฟเวอร์สร้าง RSA Keypair และส่ง `rsaPublicKey` พร้อม `sessionId` กลับมา (มีอายุจำกัด)
|
||||
@@ -317,19 +317,19 @@ March7thHoney พัฒนาระบบ Muip (Management User Interface Protoc
|
||||
- ขอข้อมูลสถิติเซิร์ฟเวอร์ (RAM, ผู้เล่นออนไลน์) และข้อมูลไอดีผู้เล่น
|
||||
|
||||
### 9.2 Built-in Embedded Web Admin & Registration Portal
|
||||
- ไม่จำเป็นต้องเปิด Web Server แยกต่างหาก เพราะ WebServer ของ March7thHoney มีเว็บ Dashboard ในตัว
|
||||
- ไม่จำเป็นต้องเปิด Web Server แยกต่างหาก เพราะ WebServer ของ Reference C# AOT Server มีเว็บ Dashboard ในตัว
|
||||
- เขียนด้วย Embedded HTML/CSS/JS (`AdminPageRenderer.cs`, `AdminPageScripts.cs`)
|
||||
- มีหน้าระบบลงทะเบียนผู้เล่น (`RegistrationPage.cs`), หน้ารีเซ็ตรหัสผ่านผ่านอีเมล (`PasswordForgotPage.cs`, `AccountEmailSender.cs`), และหน้าจัดการไอดี
|
||||
|
||||
### 9.3 Cluster Deployment via ServerExchange Secret
|
||||
- รองรับการแยกรัน Dispatch Server และ Game Server บนเครื่องเซิร์ฟเวอร์คนละเครื่อง
|
||||
- สื่อสารระหว่างโหนดผ่าน `/get_account_info` และ `/validate_account_token` โดยยืนยันความปลอดภัยผ่าน HTTP Header `X-March7thHoney-Server-Secret` ตรวจสอบความเท่ากันแบบคงเวลา (`FixedTimeEquals`) เพื่อป้องกัน Timing Attack
|
||||
- สื่อสารระหว่างโหนดผ่าน `/get_account_info` และ `/validate_account_token` โดยยืนยันความปลอดภัยผ่าน HTTP Header `X-Reference C# AOT Server-Server-Secret` ตรวจสอบความเท่ากันแบบคงเวลา (`FixedTimeEquals`) เพื่อป้องกัน Timing Attack
|
||||
|
||||
---
|
||||
|
||||
## 10. ตารางเปรียบเทียบเชิงลึก: LunarCore vs March7thHoney
|
||||
## 10. ตารางเปรียบเทียบเชิงลึก: LunarCore vs Reference C# AOT Server
|
||||
|
||||
| มิติการเปรียบเทียบ | LunarCore (Melledy) | March7thHoney (Mar7thLover) |
|
||||
| มิติการเปรียบเทียบ | LunarCore (Melledy) | Reference C# AOT Server (Reference Author) |
|
||||
|---|---|---|
|
||||
| **ภาษาและรันไทม์** | Java 17+ (Gradle / JVM) | C# (.NET 10 SDK) |
|
||||
| **สถาปัตยกรรมประสิทธิภาพ** | Reflection รันไทม์, Quickbuf Proto | Roslyn Source Generators, **NativeAOT**, MemoryPack |
|
||||
@@ -346,7 +346,7 @@ March7thHoney พัฒนาระบบ Muip (Management User Interface Protoc
|
||||
|
||||
## 11. คู่มือการต่อยอดเชิงวิศวกรรมสำหรับ AI (AI Implementation Guidelines)
|
||||
|
||||
หากโมเดล AI อื่นต้องการสร้างส่วนต่อขยาย, แก้บั๊ก หรือเขียนตัวแปลงโปรโตคอลสำหรับ March7thHoney:
|
||||
หากโมเดล AI อื่นต้องการสร้างส่วนต่อขยาย, แก้บั๊ก หรือเขียนตัวแปลงโปรโตคอลสำหรับ Reference C# AOT Server:
|
||||
|
||||
1. **อย่าใช้ Reflection สำหรับ Handler และ Database Store**:
|
||||
ต้องใช้ระบบ Source Generator เสมอ หากเพิ่ม Entity ใหม่ ให้สร้างคลาสที่สืบทอดจาก `BaseDatabaseDataHelper` เพื่อให้ `DatabaseStoreGenerator` สร้างโค้ด SQL ตารางและการแมปให้อัตโนมัติ เพื่อรักษาคุณสมบัติ NativeAOT
|
||||
@@ -9,7 +9,7 @@ This technical specification provides an exhaustive, code-level analysis of **`D
|
||||
### 1.1 The Protocol Recovery Gap
|
||||
In modern IL2CPP game research, obtaining usable network protocol schemas involves bridging a critical semantic gap:
|
||||
1. IL2CPP dumpers extract decompiled C# classes (`dump.cs`).
|
||||
2. Server implementations (`LunarCore`, `March7thHoney`, `GaC-hkrpg-go`) require `.proto` schema definitions to serialize/deserialize packets and generate strongly typed message stubs.
|
||||
2. Server implementations (`LunarCore`, `C# NativeAOT Reference Server`, `GaC-hkrpg-go`) require `.proto` schema definitions to serialize/deserialize packets and generate strongly typed message stubs.
|
||||
3. Manually translating thousands of obfuscated C# packet classes into `.proto` files is infeasible.
|
||||
|
||||
### 1.2 The De-Compilation Inverse
|
||||
@@ -349,7 +349,7 @@ We can now map how all 6 repositories analyzed in this session interact to form
|
||||
| - Generates O(1) jump table MessageFactory.Create(cmdId) |
|
||||
| |
|
||||
| [ Step 6: Server Implementation & Routing ] |
|
||||
| Tools: March7thHoney (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) |
|
||||
| Tools: C# NativeAOT Reference Server (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) |
|
||||
| Action: Instant zero-reflection packet routing on KCP network layer |
|
||||
| |
|
||||
+----------------------------------------------------------------------------------------------------+
|
||||
|
||||
@@ -439,7 +439,7 @@ When reverse engineering stripped Star Rail binaries:
|
||||
3. Instantly transforms thousands of anonymous subroutines (`sub_181FEB700`) into identifiable game logic (`RPG_Client_AutoScrollRect__MNOGNALMGPL`).
|
||||
|
||||
### 10.2 Protocol & Packet Handler Discovery
|
||||
In private server engineering (`LunarCore`, `March7thHoney`, `GaC-hkrpg-go`):
|
||||
In private server engineering (`LunarCore`, `C# NativeAOT Reference Server`, `GaC-hkrpg-go`):
|
||||
- Network packet dispatchers often use obfuscated command handlers.
|
||||
- By searching `dump.cs` for classes implementing network interfaces or containing `CmdId` constants, engineers can pinpoint the exact RVA of packet deserialization routines.
|
||||
- Cross-referencing `methods.json` RVAs with dynamic breakpoints allows live tracing of packet encryption keys, seed exchanges, and payload masking expressions.
|
||||
|
||||
+1
-1
@@ -318,7 +318,7 @@ public partial class Person : global::Firefly.Protobuf.IMessage<Person>, global:
|
||||
|
||||
## 8. การนำไปประยุกต์ใช้ในระบบเซิร์ฟเวอร์เกม (Integration with HSR/Genshin Private Servers)
|
||||
|
||||
ในสถาปัตยกรรมเซิร์ฟเวอร์ เช่น **GaC-hkrpg-go** หรือ **March7thHoney**:
|
||||
ในสถาปัตยกรรมเซิร์ฟเวอร์ เช่น **GaC-hkrpg-go** หรือ **C# NativeAOT Reference Server**:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
@@ -269,7 +269,7 @@ The resulting dictionary is serialized to formatted JSON:
|
||||
|
||||
## 6. The Complete 5-Stage Protocol Reverse-Engineering Toolchain
|
||||
|
||||
By studying `LunarCore`, `March7thHoney`, `FireflyProtoc`, `honkai-dumper`, `Firefly-Static-Parser`, and `StaticCmdIdDumper`, we can now construct the entire open-source reverse-engineering pipeline:
|
||||
By studying `LunarCore`, `C# NativeAOT Reference Server`, `FireflyProtoc`, `honkai-dumper`, `Firefly-Static-Parser`, and `StaticCmdIdDumper`, we can now construct the entire open-source reverse-engineering pipeline:
|
||||
|
||||
```
|
||||
+----------------------------------------------------------------------------------------------------+
|
||||
@@ -301,7 +301,7 @@ By studying `LunarCore`, `March7thHoney`, `FireflyProtoc`, `honkai-dumper`, `Fir
|
||||
| Output: High-performance C# / Go protobuf stubs |
|
||||
| |
|
||||
| [ Stage 5: Server Protocol Routing ] |
|
||||
| Tool: March7thHoney (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) |
|
||||
| Tool: C# NativeAOT Reference Server (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) |
|
||||
| Action: Instant zero-reflection packet dispatching on KCP connections |
|
||||
| |
|
||||
+----------------------------------------------------------------------------------------------------+
|
||||
|
||||
+1
-1
@@ -336,7 +336,7 @@ In the Star Rail reverse-engineering toolchain:
|
||||
1. `Firefly-Static-Parser` extracts the exact class structures and obfuscated field names (e.g., `KOIAJFFGPGF` $\rightarrow$ Wire tag `1` at offset `0x180`).
|
||||
2. Engineers cross-reference these offsets with network serialization routines.
|
||||
3. The resulting proto definitions with wire masks (`[get: (id ^ 1) + 2]`) and metadata (`meta uint32 cmd_id = 143;`) are compiled using **`FireflyProtoc`**.
|
||||
4. The generated high-performance C# or Go models are directly consumed by **`March7thHoney`** or **`GaC-hkrpg-go`**.
|
||||
4. The generated high-performance C# or Go models are directly consumed by **`C# NativeAOT Reference Server`** or **`GaC-hkrpg-go`**.
|
||||
|
||||
### 8.2 Compliance with Repository Rules (`AGENTS.md`)
|
||||
- `Firefly-Static-Parser` operates purely as an offline analysis tool.
|
||||
Reference in new issue
Block a user