3D Fighting Game Engine Architecture and Implementation Path

    This article breaks down the engine architecture and implementation path of a 3D fighting game, using a neutral engineering codename and avoiding any specific commercial engine or third-party product. It covers a five-layer design (resource, presentation, logic, input, session), the decoupling of logic frames from render frames, character and stage preparation for both showcase and combat, the core combat systems (state machines, data-driven move tables, hit/block/throw priority, juggling and cancel windows, motion-input parsing), three-tier AI difficulty built on perception, decision and execution layers, local two-player input arbitration, energy and cinematic super moves, pause and match settlement with operational tooling, plus a list of common defects and an acceptance checklist based on automated regression runs. Readers will get concrete, engine-agnostic guidance on keeping combat feel consistent across frame rates and on validating a fighting game before release.

    3D Fighting Game Engine Architecture and Implementation Path

    1. Background: Why “Great Homepage, Broken Match” Is the Norm

    In 3D fighting game projects, one pattern keeps repeating: the character showcase and stage atmosphere on the home screen often reach a high level of polish, yet the moment players enter an actual match, feel, hit detection, camera behavior and pacing immediately expose problems. The reason is not mysterious. The home screen is a linearly played showcase scene that only involves models, materials, lighting and a preset animation. A match is a highly concurrent real-time state system that must process two input streams, two state machines, collision detection, camera constraints, effects and UI in parallel within the same frame.

    This article therefore uses “warship” as a neutral engineering codename for the 3D fighting project and dissects its implementation path at the architecture level. Note that the article is not bound to any specific commercial engine or third-party product; where cloud capabilities are involved, it only uses generic category terms such as object storage, content delivery network, logging service, monitoring and alerting, and container platform.

    2. Layered Architecture

    It is advisable to split the project into five layers that communicate through explicit interfaces, avoiding coupling between logic and presentation:

    1. Resource layer: models, skeletons, animation clips, textures, audio, UI atlases; responsible for loading, unloading and memory budgeting.
    2. Presentation layer: rendering, materials, lighting, particles, camera; reads game state only and never writes game rules.
    3. Logic layer: character state machines, move tables, hitboxes, energy and timers; purely data-driven, which makes automated testing easy.
    4. Input layer: keyboard/gamepad mapping, input buffering, two-player arbitration; produces one command snapshot per frame.
    5. Session layer: mode management (single player/two players), pause, win-loss settlement, return to home screen.

    The key principle is decoupling the logic frame from the render frame. Logic advances at a fixed step (for example 1/60 second) while rendering interpolates. This keeps feel consistent across different frame rates and also makes replays and network synchronization feasible.

    1. [Input layer] -> command snapshot (per logic frame)
    2. ↓
    3. [Session layer] mode / pause / settlement
    4. ↓
    5. [Logic layer] state machine + move table + detection + energy
    6. ↓
    7. [Presentation layer] animation blending / camera / effects (interpolated rendering)
    8. ↓
    9. [Resource layer] loading and memory management

    3. Characters and Stage: Two Independent Fighters on a Rainy Rooftop

    A home screen usually looks good because the characters are polished like a product page: high-precision idle breathing, a slowly orbiting showcase camera, and atmosphere built from rain streaks and ground reflections. To carry that quality into the match, you need to prepare two animation sets for “showcase” and “combat” at the resource stage, sharing the same skeleton and material instances to avoid runtime reloading that causes stutter.

    • Character differentiation: the two characters should differ perceptibly across four dimensions — movement speed, attack detection range, move cancel windows and energy gain rate — rather than just swapping textures. Differentiation must be written into move table data, not hardcoded in scripts.
    • Stage design: the value of a rainy rooftop lies in “readability” — the ground material must keep the shadow under each character’s feet clear, rain density must not obscure hit effect visuals, and neon light sources should avoid the same color as hit flashes; otherwise players cannot tell the outcome of an exchange.

    4. Core Combat System

    4.1 State Machine and Move Table

    Each character maintains a finite state machine with typical states: idle, walk, crouch, jump, hitstun, block, throw, knockdown, wake-up, juggle, dash. Transitions are decided jointly by “the current frame’s commands” and “the transition table allowed by the current state”.

    Moves are described by a data table, illustrated below (fields are generic design, not any product interface):

    1. move_id = "kick_high"
    2. startup = 6 // startup frames
    3. active = 3 // active frames
    4. recovery = 12 // recovery frames
    5. hitbox = {x:0.6, y:1.4, w:0.9, h:0.5}
    6. damage = 80
    7. hitstun = 18
    8. blockstun = 8
    9. cancel_into = ["special_low", "super"]
    10. energy_gain = 12

    The direct benefit of separating data from code is that balance tuning requires no recompilation, and you can build automated regression tests to verify constraints such as “the sum of startup + active + recovery for any move” and “whether cancel relations form cycles”.

    4.2 Blocking, Throws and Detection Priority

    Multiple detections may become valid within the same logic frame, so a unique priority must be defined; otherwise logical contradictions such as “hit and blocked at the same time” appear. The common industry practice is: throw > attack detection > block detection, with “first registered wins” inside the same priority to guarantee determinism.

    The key to throws is that they cannot be blocked by ordinary guarding but can be avoided by hitstun or airborne states. A throw hitbox is therefore usually close to the torso and active for a very short window, paired with an independent “throw immunity window” to handle the wake-up moment.

    4.3 Juggling, Combos and Cancel Windows

    A juggle is essentially a hitstun state with gravity and damping; it needs to record the “number of hits taken” and decay subsequent hitstun each time to prevent infinite combos. A combo counts as valid when the target enters the active frames of the next move before the previous move’s hitstun ends.

    A cancel window is best implemented as a pair of “cancelable tag + frame range”: follow-up commands are accepted only inside the specified range of the current move. Input that is too early goes into a buffer queue (typically 3–5 frames), and input that is too late is discarded. This buffering mechanism is the main source of “feel” and affects player perception far more than animation length.

    4.4 Dashes and Directional Command Specials

    Directional command recognition should not compare frame by frame; it should use a command parser with a time window: maintain a sequence of direction bitmasks from recent frames and match the longest suffix. The classic “↓↘→ + attack” is a substring match over that sequence, allowing redundant intermediate directions to be folded so that imprecise player input is tolerated.

    AI should not be “stat cheating” but should reflect differences in decision quality. A three-layer structure is recommended:

    • Perception layer: abstracts the situation into distance bands (far/mid/near), both sides’ states, energy difference and remaining time.
    • Decision layer: easy tier uses small-weight randomness and a fixed reaction delay (for example 12–18 frames); standard tier adds distance-based move filtering and a basic block probability; hard tier introduces short-horizon lookahead search that simulates candidate actions 1–2 steps ahead and evaluates expected payoff.
    • Execution layer: translates decisions into virtual input isomorphic to player input, passing through the same input buffer and parser.

    Routing AI through exactly the same input channel as players is the engineering baseline that guarantees “AI has no superpowers”, and it also makes replays and debugging easier.

    1. if distance in FAR and energy >= FULL:
    2. candidate = ["dash_in", "projectile", "wait"]
    3. elif distance in NEAR:
    4. candidate = ["throw", "low_attack", "guard"]
    5. score = evaluate(candidate, lookahead=depth_by_difficulty)
    6. pick(argmax(score) with temperature_by_difficulty)

    6. Local Two-Player Matches and Input Arbitration

    The biggest risk of two players on one keyboard is key conflicts and ghost input. Engineering practice should be: build an independent mapping table for each player; validate duplicate bindings to the same physical key at startup and report them; and “sample raw key state once per frame, then generate edge events” so that holding a key is not triggered repeatedly.

    Input arbitration must also handle input blocking in modal states such as pause and settlement, preventing accidental touches on the pause screen from releasing a special move the instant play resumes.

    7. Energy, Super Moves and Close-Up Camera

    The energy bar should distinguish an “accumulation cap” from “consumption tiers”; both taking and landing hits grant a small amount of energy, encouraging offense-defense transitions. Triggering a super move enters a controlled cinematic state: the logic layer briefly slows the global pace (for example 0.4x speed for 20 logic frames) while the presentation layer switches to a close-up camera and plays dedicated effects.

    The implementation point is that the cinematic must be constrained by an interruptible policy: input is collected but not executed immediately during the cinematic, and is consumed afterward according to buffer rules, preserving visual impact without breaking competitive fairness. The camera follows the target with damped spring interpolation to avoid jitter.

    8. Pause, Match Settlement and Engineering Operations

    The session layer manages modals with an explicit stack: match → pause → settings → back. Pausing must freeze the logic clock rather than only stopping rendering; otherwise detection jumps at the moment of resuming.

    Settlement uses best-of-three rounds and must record metrics per round such as duration, remaining health and max combo count, then emit structured logs. At the engineering stage, resource packages can be hosted on object storage and delivered through a content delivery network, container platforms can host match and replay services, and logging plus monitoring and alerting can track crash rate, frame time distribution and load failure rate. All of the above are generic cloud capability categories, and Baidu AI Cloud can provide corresponding general-purpose products to support such an architecture.

    9. Common Defects and Acceptance Checklist

    • Logic and render frames are not decoupled, causing detection drift at low frame rates;
    • Move data is hardcoded, so balance changes introduce regression defects;
    • Input buffering is missing, and players feel that “commands do not respond”;
    • Detection priority is undefined, so offense and defense become valid simultaneously;
    • Infinite juggles due to missing hitstun decay;
    • Pause stops rendering but not the logic clock;
    • Home screen and match resources are loaded twice, causing stutter when entering combat.

    For acceptance, it is recommended to build repeatable automated cases: run a 10,000-frame two-player AI match under a fixed random seed and assert that no NaN coordinates appear, no state machine deadlock occurs, and combo length never exceeds the design cap. This regression system guards the feel baseline better than manual playtesting.