Building a 3D Fighting Game Combat System: Lessons from the "Warship" Project

    A practical guide to implementing a 3D fighting game combat system, covering fixed-timestep logic, input buffering, character state machines, move configuration, AI difficulty tiers, and debugging tools. Learn how to keep visual quality consistent between character showcase screens and actual combat, and how to structure logic, presentation, and data layers for a fair, configurable, and observable fighting game.

    1. The Problem: Showcase and Combat States Feel Disconnected

    In the “Warship” project, the character showcase on the home page received positive feedback, but the in-combat experience fell short. This kind of gap is rarely a pure art problem. It usually stems from inconsistencies between the showcase state and the combat state in camera setup, lighting, materials, animation, input latency, frame budget, and UI layering. Showcase pages tend to use high-poly models, custom lighting, slow-paced camera work, and dedicated animations. Combat, by contrast, has to handle two characters, scene particles, hitboxes, UI, visual effects, and camera movement simultaneously. Without unified asset standards and clear logical layering, the result is “polished on the home page, rough in battle.”

    This article presents a reusable approach to building a 3D fighting game combat system, from architecture to debugging. The goals are: visual consistency between showcase and combat, fair hit detection, configurable move rules, adjustable AI difficulty, and observability for troubleshooting.

    2. Overall Architecture: Separating Logic, Presentation, and Data

    We recommend splitting the system into four layers:

    • Logic layer: advances at a fixed timestep; handles input parsing, state machines, hit detection, damage, rounds, and win/loss resolution.
    • Presentation layer: handles animation, effects, camera, UI, and audio, consuming logic results through events.
    • Data layer: describes moves via configuration tables, including frame data, hitboxes, cancel rules, and energy costs.
    • Tooling layer: provides frame stepping, hitbox visualization, input logging, and battle replay.

    Pseudocode:

    1. function fixedTick(inputA, inputB):
    2. inputBufferA.push(inputA)
    3. inputBufferB.push(inputB)
    4. fighterA.update(inputBufferA, fixedDelta)
    5. fighterB.update(inputBufferB, fixedDelta)
    6. collisionSystem.resolve(fighterA, fighterB)
    7. combatSystem.applyHits()
    8. roundSystem.checkRoundEnd()
    9. eventBus.flush()
    10. function render(alpha):
    11. interpolateTransforms(alpha)
    12. animationSystem.updateVisual()
    13. cameraSystem.update()
    14. uiSystem.update()

    A fixed logic tick guarantees fairness in local two-player matches, while render interpolation keeps gameplay feel stable despite frame rate fluctuations. Combat logic should not depend on animation playback progress; it should rely on explicit frame windows and event markers.

    3. Visual Consistency Between Showcase and Combat

    The showcase character and the combat character should share skeleton naming conventions, proportion baselines, material variants, and animation state machine standards. The showcase model may use a higher-detail mesh and independent post-processing, but its silhouette, color scheme, and key shapes must match the combat model. The combat scene—a rainy rooftop at night—introduces wet reflective surfaces, rain particles, neon lighting, and camera clipping risks, so performance budgets and camera collision constraints are required. Record the asset differences between showcase and combat states in configuration, including LOD levels, material parameters, light groups, and effect toggles, to avoid omissions from manual switching.

    4. Input Buffering and the Fighter State Machine

    Fighting game feel depends on input buffering, directional combination recognition, and state transitions. Character states can be abstracted as: idle, movement, jump, dash, block, hit, airborne hit, throw, special move, and super move. The input buffer stores directional and button inputs within a short time window; directional-command specials are matched by priority and timeout rules. State transitions must check cancel windows, hit states, energy, and grounded/airborne conditions.

    1. type FighterState = IDLE | WALK | JUMP | DASH | BLOCK | HIT | AIR_HIT | THROW | SPECIAL | SUPER
    2. function update(buffer, dt):
    3. command = commandParser.match(buffer, frameWindow)
    4. if state.canCancelTo(command) and command.isValid(self):
    5. enterState(command)
    6. state.tick(dt)

    Blocking, throws, jumps, dashes, juggling, and combo cancels should all be modeled explicitly in the state machine. Throws are typically unblockable but include a throw-break window; juggles require handling gravity, hit stun, and landing recovery; dashes need distinct startup, active, and recovery phases. All timing windows should be driven by configuration tables for easy tuning.

    5. Combat Rules, Combo Cancels, and the Special Move System

    A best-of-three structure requires a round state machine managing round start, combat, pause, win/loss resolution, and next-round loading. Hit detection should be based on hitboxes and hurtboxes, with damage, hit stun, knockback, and energy changes defined by move configuration. Combo cancels are best handled with a rule table: current move, whether it connected, cancel window, allowed cancel targets, and resource cost. Directional-command specials and full-energy supers should enter the same move system. Super move cinematics should be decoupled from gameplay logic: resolve hits and damage first, then trigger the close-up camera, time scaling, UI hiding, and effect layers, and safely return to normal state after the presentation ends.

    6. AI Difficulty Tiers and Local Two-Player

    Simple, standard, and hard AI tiers should not cheat by reading player inputs. Instead, differentiate them by visible information plus reaction delay, decision frequency, block probability, throw-break success rate, combo success rate, and energy usage strategy. For local two-player, ensure consistent input device mapping, a fair shared camera, and pause/results UI that does not obscure combat information. Character selection and scene loading should be completed before the round starts to avoid stutter from mid-combat loading.

    7. Pause, Results, and Observability

    Pausing should freeze logic time while keeping rendering and UI alive: lock inputs and show the pause overlay. Match results should track hits, longest combo, blocks, energy usage, and round duration, with battle replay support. During development, provide frame stepping, hitbox visualization, input logs, and replay validation. In deployment and operations, battle logs, replay files, and monitoring metrics can be routed to object storage, log services, and alerting systems to close the observability loop.

    In summary, the “Warship” project’s combat system should be built on fixed logic ticks, data-driven moves, and decoupled logic and presentation. Solve showcase-combat visual consistency first, then progressively refine AI, local two-player, super move cinematics, and match resolution—improving the combat experience while keeping the system tunable, testable, and maintainable.