Engineering a 3D Fighting Game: A Practical Implementation Path

    This article breaks down the engineering structure behind 3D fighting games and explains why a polished main menu often contrasts with a poor in-match experience. It covers a layered, data-driven architecture, fixed-step simulation, character and stage preparation, combat systems such as blocking, throws, cancels and command inputs, AI difficulty design, camera and pause handling, and observability for production readiness.

    1. The Starting Problem: Why a Great Homepage Often Leads to a Broken Match

    In 3D fighting game development, a common pattern appears: the character showcase and scene rendering on the main menu look impressive, but visual quality, controls, and stability drop noticeably once a match begins. The situation described in the original article—two well-crafted characters on the homepage but a disappointing in-game experience—is not merely an art issue. It is a typical engineering structure problem.

    There are usually three root causes:

    1. Mismatched asset loading strategy: The homepage only needs a few high-precision models and showcase animations, while a match must load two characters, the stage, effects, and UI at the same time, causing memory and VRAM pressure to spike.
    2. Tight coupling between logic and presentation: Combat detection, state machines, and animation presentation are written in the same layer, so any presentation adjustment can affect detection stability.
    3. Lack of observability: Without frame timing, detection logs, and state snapshots, problems can only be reproduced visually, making fixes extremely inefficient.

    Therefore, the first step in engineering is not “optimizing the visuals,” but fully separating the presentation layer from the logic layer and establishing a measurable, reproducible debugging pipeline.

    2. Overall Architecture: Layering and Data-Driven Design

    A four-layer structure is recommended, with layers communicating only through clear interfaces:

    • Presentation layer: Models, materials, animations, effects, and cameras.
    • Logic layer: State machines, hit detection, energy, and round rules.
    • Input layer: Key mapping, input buffering, and isolation of local input for two players.
    • Platform layer: Asset loading, logging, monitoring and alerting, and saves.

    The logic layer must be purely data-driven, as illustrated below:

    1. FighterState {
    2. hp, energy, position, velocity,
    3. state_id, frame_index,
    4. hitbox_active, hurtbox_active
    5. }

    The key point is that animation frames only “drive” logic frames, not the other way around. Logic advances at a fixed step (for example, a fixed simulation of 1/60 second per frame), while the presentation layer performs interpolation. This way, even if rendering drops frames, hit detection will not drift. This is the prerequisite for stable controls in a fighting game.

    3. Characters and Stages: From “Showcase” to “Playable”

    Homepage characters look good because they only need one set of showcase animations and a close-up camera. Once in a match, characters must be fully playable, which requires:

    1. Independent character configurations: Two characters (such as independently designed characters like Yin Shilin and Jiang Yina) should each have their own attribute tables, move lists, and animation sets, avoiding a shared configuration that makes their controls feel the same.
    2. Stage atmosphere: For a scene like a rainy rooftop at night, the focus is not model precision but atmospheric consistency—rain particles, ground reflections, blurred background, and unified color temperature. It is recommended to split the stage into three parts: “geometry + lighting presets + particle layers,” making it easier to scale down by performance tier.
    3. Performance tiers: Set low/medium/high tiers for stages and effects. The low tier disables reflections and some particles to prioritize match frame rate.

    4. Combat System: Detection, States, and Combos

    This is the core of a fighting game. The following concepts should be clearly defined:

    • Blocking: Distinguish standing block from crouching block. The defender enters hitstun frames and cannot be infinitely pressured.
    • Throws: Throws ignore blocking but require close-range detection. The thrown player can input a throw escape within a few frames before being hit.
    • Jumping and dashing: A jump has three phases: takeoff, airborne, and landing. A dash has invincibility frames and recovery frames to prevent infinite rushing.
    • Juggle and combo cancels: Gravity parameters are configured independently after a juggle. The cancel mechanism uses a dual limit of “cancel window + number of cancels used” to avoid infinite combos.
    • Special moves and super moves: Direction-based special moves are parsed by an input recognizer. A super move requires a full energy gauge and triggers a close-up camera sequence.

    For input recognition, a directed graph + time window approach is recommended instead of simple string matching:

    1. CommandGraph:
    2. node: direction/button
    3. edge: allowed follow-up input
    4. window: allowed frame interval

    This naturally supports tolerance for direction-based special moves and maintains isolation for local two-player input.

    5. AI and Difficulty: Three Tiers Should Feel Different

    Single-player AI supports easy, normal, and hard tiers. The differences should not be mere numerical scaling, but behavioral strategy differences:

    • Easy: High reaction delay, low blocking probability, short combos.
    • Normal: Can block and counterattack, medium combos, occasionally uses super moves.
    • Hard: Predicts inputs, actively cancels, and manages resources more aggressively.

    For implementation, it is recommended to split AI into three stages: “perception—decision—execution.” The decision output is a command sequence isomorphic to the player’s, ensuring that AI and players go through the same logic layer and avoiding an unfair feeling of “AI cheating.”

    6. Camera, Pause, and Match Settlement

    • Close-up camera: When a super move is triggered, the camera switches. It must be ensured that logic either continues to advance or is explicitly paused. Choose one and document the rule clearly.
    • Pause: Pause must freeze the logic clock. On resume, reset the input buffer to prevent accidental triggers at the moment of recovery.
    • Best of three and settlement: Round states are managed by an explicit state machine (character select → round start → match → round end → full match settlement). Win/loss determination is based on logic-layer data, and the presentation layer is only responsible for playback.

    7. Observability and Launch Readiness

    It is recommended to integrate a combination of common capabilities: a logging service records detection and state snapshots, monitoring and alerting tracks frame timing and crash rate, and object storage saves replays and configurations. Combined with general cloud capabilities such as Baidu AI Cloud, this can turn “manual reproduction” into “data-driven diagnosis,” which is a key step from a demo to an operable product.

    In summary, the lower bound of a 3D fighting game is determined by architecture, while the upper bound is determined by control polish. Once layering, fixed-step simulation, and observability are solid, the gap between the homepage and in-match experience will naturally narrow.