Files
AIC-Project/docs/superpowers/specs/2026-08-10-fighter3d-networked-minigame-design.md
T

53 lines
2.7 KiB
Markdown

# Fighter3D Networked MiniGame Design
## Goal
Implement a first playable networked 2.5D fighting mini game using the existing `XGame.MiniGame` hot-update framework.
## Scope
This version adapts `Doc/minigame/横版3D格斗小游戏_开发设计文档.md` into the networked mini game architecture described by `Client/Assets/Doc/MiniGameDevelopmentDesign.md`.
The first deliverable is a server-authoritative MVP:
- Two-player room through the existing gateway and room lifecycle.
- Pure C# shared Core with deterministic state, input, snapshot encoding, hit resolution, block, damage, KO, and timeout.
- Server room owns authoritative battle progression and accepts only player input intent.
- Client hot-update DLL displays server snapshots and sends local input.
- Publish metadata follows the existing `RockPaperScissors` mini game structure.
## Architecture
`Fighter3D.Core` contains no Unity references. It owns fighter state, frame stepping, input application, simple attack timing, block checks, damage, pushback, and binary snapshot codec.
`Fighter3D.Server` implements `XWorld.Framework.IGameServerRoom`. It maps room players to seats, advances Core on room ticks, broadcasts snapshots, and ends the room when Core reaches KO or timeout.
`Fighter3D.Client` implements `XWorld.Framework.IGameClient`. It loads a minimal UI asynchronously through `ctx.Assets.Load`, falls back to runtime-created UI if the prefab is missing, sends input commands through `ctx.Send`, and renders the latest server snapshot.
## First-Playable Rules
- Horizontal 2.5D lane with two mirrored fighters.
- Inputs: left, right, guard, light attack, heavy attack.
- Movement is server-authoritative with stage bounds and facing updates.
- Light and heavy attacks have startup, active, recovery, damage, hit stun, block stun, and pushback values.
- Guard succeeds only when the defender holds away from the attacker.
- KO ends the room and uses the winner player id for settlement.
- Timeout awards the win to the higher-health fighter, or a draw when tied.
## Out Of Scope
- Jumping, crouch, projectiles, command recognition, specials, supers, multi-hit moves, replay tooling, and polished 3D characters.
- Client-side authoritative combat decisions.
- New Unity-managed prefabs, materials, scenes, or binary assets created by hand.
## Testing
Core and server behavior will be covered by automated .NET tests before implementation:
- Core movement clamps to stage bounds.
- Attack hit applies damage and enters stun.
- Holding away blocks and applies chip or no direct hit damage according to MVP rule.
- Server room broadcasts snapshots and ends with the expected winner on KO.
Unity visual verification is limited to code compilation unless a running Editor is available through the Unity pipeline.