Real-Time Rendering and Combat System Design for 3D Fighting Games

    This article presents a reusable engineering framework for 3D fighting games, focusing on why games often look impressive in the main menu but perform poorly in actual matches. It explains a five-layer architecture that decouples logic from rendering and runs combat on a fixed timestep, asset strategies that convert showcase models and stages into battle-ready resources, core combat mechanics such as frame data, blocking, throws, juggling, cancels, and super-move cutscenes, three-tier AI difficulty based on decision quality, local two-player synchronization, and performance and quality assurance practices. Readers will gain a practical approach to building deterministic, self-consistent combat systems.

    1. Background: Why Games Look Great in the Menu but Break in Combat

    During development of many 3D fighting games, teams pour resources into the main-menu character showcase: high-precision models, detailed materials, atmospheric stages like a rainy rooftop, slow camera pushes, and character close-ups. These elements are easy to approve in static or semi-static scenes because rendering pressure is manageable and complex interactions do not need to be handled. Once a match begins, however, problems surface all at once: frame rate fluctuations, inconsistent hit detection, input latency, and state machine errors. The player experience degrades quickly.

    From an engineering perspective, the gap usually has three root causes:

    1. Coupling between the presentation layer and the logic layer: Animations and effects built for the showcase are reused directly in combat, without resource tiers optimized for real-time competition.
    2. Lack of determinism in combat logic: Mechanics such as juggling, combo cancels, and throws are sensitive to frame-level timing. Using unstable floating-point accumulation or depending on the render frame leads to “the same input producing different results.”
    3. Rough AI and input handling: Difficulty is implemented only through numerical scaling, with no behavioral differences, making the easy tier too passive and the hard tier’s reactions feel off.

    This article offers a reusable design framework from a general technical perspective.

    2. Overall Architecture: Layering and Determinism First

    Split the system into five layers that communicate through clear interfaces:

    • Presentation layer: models, materials, effects, camera, UI.
    • Animation layer: a state machine driving skeletal animation and frame events.
    • Logic layer: advances combat state at a fixed step and produces hit results.
    • Input layer: abstracts local gamepad/keyboard input and AI decisions into a unified “command stream.”
    • Platform layer: common capabilities such as asset loading, logging, and monitoring.

    The key principle is decoupling logic from rendering and running logic at a fixed step. Illustrative pseudocode:

    1. fixed_step = 1/60
    2. accumulator += real_delta
    3. while accumulator >= fixed_step:
    4. input_sample = input_layer.poll()
    5. ai_output = ai_layer.decide(state_snapshot)
    6. command = merge(input_sample, ai_output)
    7. battle.step(command, fixed_step)
    8. accumulator -= fixed_step
    9. render(battle.interpolate(alpha=accumulator/fixed_step))

    This way, render frame rate fluctuations do not change hit results, laying the groundwork for online play and replays.

    3. Characters and Stages: From Showcase Assets to Combat Assets

    Menu characters and battle characters should use different resource strategies. Showcase characters can load high-poly models, high-resolution textures, and complex effects; battle characters need to be downgraded to medium-precision models, compressed textures, and merged materials, with a limit on the number of simultaneously active effects. For stages, a scene like a rainy rooftop can be optimized as follows:

    • Bake the distant view into a static background, keeping only the interactive ground and a few dynamic light sources;
    • Use instanced rendering for repeated objects (railings, floor tiles, rain particles);
    • Approximate reflections and refractions in screen space to avoid redrawing the scene multiple times.

    The character selection screen can reuse battle models but switch to showcase-specific animations and camera work, avoiding the need to maintain two sets of assets.

    4. Core Combat Mechanics Design

    4.1 State Machine and Frame Data

    Each character state should include startup frames, active frames, recovery frames, cancel windows, and a list of hurtboxes. All detection is measured in logic frames. Example structure:

    1. State {
    2. name, startup, active, recovery,
    3. cancel_window: [start, end],
    4. hitbox: [{frame_range, shape, damage, hitstun, blockstun}],
    5. hurtbox: [{frame_range, shape}]
    6. }

    4.2 Blocking, Throws, and Priority

    Blocking is divided into standing block and crouching block, and high/low attacks must be distinguished correctly. Throws should be designed to break guard but be countered by throw breaks or a tech window, forming a triangle: strikes beat throws, throws beat blocks, blocks beat strikes. The detection order should be fixed as: throws > strikes > blocks, with ties sorted by attacker index within the same frame to guarantee determinism.

    4.3 Juggling, Combos, and Cancels

    The juggle state records gravity and damping parameters, and hitstun is calculated based on the current juggle height when hit. Combo cancels rely on a dual limit of “cancel window” and “cancels already used” to prevent infinite combos. Pseudocode:

    1. if state.can_cancel and cancel_count < limit and input.is_special:
    2. transition_to(input.special)
    3. cancel_count += 1

    4.4 Energy, Specials, and Close-Up Camera

    The energy bar grows from landing hits, being hit, and successful blocks. When full energy triggers a super move, the logic layer first locks both characters’ states and advances a segment of “cutscene frames,” and the presentation layer plays close-up camera work and full-screen effects accordingly; normal logic resumes after the cutscene ends. Make sure input during the cutscene is recorded but not executed immediately, to prevent state corruption.

    5. AI Design: Real Differences Across Three Difficulty Tiers

    Difficulty should not be just a damage multiplier, but a difference in decision quality:

    • Easy: longer reaction delay, fewer combos, higher chance to retreat after being hit;
    • Standard: uses basic combos and blocking, occasionally attacks proactively;
    • Hard: recognizes player habits, performs optimal combos within cancel windows, and uses throws to break guard appropriately.

    Implementation can use a “behavior tree + finite state machine,” with AI output sharing the same command structure as player input to ensure fairness.

    6. Local Two-Player and Synchronization

    For local two-player, use the same logic clock and sample each player’s input separately to avoid the complexity of network synchronization. If online play is added later, an input-delay scheme can be built on the fixed step, and replay data can be retained for troubleshooting. Character selection, best-of-three rounds, pause, and results should all be logic-layer events subscribed to by the presentation layer, preventing UI and combat state from falling out of sync.

    7. Performance and Quality Assurance

    • Use a fixed step and object pools to reduce GC/memory jitter;
    • Set tiered quality for particles, shadows, and post-processing;
    • Build a frame-data-table-driven configuration for easy designer tuning;
    • Add automated regression: record input sequences and verify per-frame state and hit results;
    • Use logs and monitoring alerts to track frame rate, stutter, and abnormal states, and when necessary use the general logging and monitoring capabilities offered by Baidu AI Cloud for centralized analysis.

    8. Conclusion

    The quality of a 3D fighting game does not depend on how flashy the main menu is, but on whether the combat logic is deterministic, the mechanics are self-consistent, and the AI is believable. Only by layering presentation and logic, driving everything with a fixed step, managing frame data with data tables, and letting AI and players share the same command system can you fundamentally eliminate the gap of “the game feels wrong once you start playing.”