Warship Project: Optimizing the Combat System of a 3D Fighting Game Prototype

    This article describes how to optimize the combat system of a 3D fighting game prototype called "Warship." It covers separating showcase and gameplay budgets, a five-layer architecture with fixed-timestep logic, asset handoff between character showcase and combat, state machines with combo cancels, input buffering for direction-based special moves, tiered AI and local two-player flow, and performance and acceptance criteria for making the prototype playable, tunable, and extensible.

    1. Problem Definition: Showcase and Gameplay Are Not the Same Budget

    In the “Warship” 3D fighting game prototype, the homepage character showcase often makes a strong first impression: a single character, fixed camera, controlled lighting, full materials, and a high-detail model, with rendering and animation updates all serving the “showcase.” But once actual combat begins, the scene simultaneously contains two characters, stage environment, effects, UI, AI, hitboxes, camera follow, and input handling, and the resource budget and update frequency change instantly. If the showcase state and combat state share the same character assets and update logic, problems quickly appear: stiff animation transitions, unstable input response, chaotic camera, effects occluding hit detection, and loading stalls.

    The core principle is: the showcase state pursues visual ceilings; the playable state pursues stability and consistency. The two states can share character metadata, bone mappings, and move configurations, but must use different asset tiers, rendering budgets, and update strategies. Combat logic should run on a fixed timestep, with the presentation layer consuming logic events, so that frame rate fluctuation never directly affects hit detection or input.

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

    The prototype should be split into five layers: input, combat logic, presentation, UI flow, and resources. The combat logic layer advances at a fixed timestep and emits events such as hits, blocks, cancels, and KO; the presentation layer plays animations, effects, camera work, and sound in response to those events; the UI flow layer handles character select, pause, round count, and results; the resource layer handles preloading, tiered loading, and object pooling.

    The character data model should include: base stats, state enums, animation mappings, move frame data, hitboxes, hurtboxes, cancel tags, resource slots, and AI configuration. Move frame data should explicitly describe startup, active, and recovery frames, hitstun, blockstun, cancel windows, and meter gain. Pseudocode:

    1. struct MoveData {
    2. startupFrames
    3. activeFrames
    4. recoveryFrames
    5. hitboxList
    6. damage
    7. hitstun
    8. blockstun
    9. cancelTags
    10. meterGain
    11. }
    12. function tickBattle(entities, inputFrame):
    13. for e in entities:
    14. e.input = consumeBuffer(e, inputFrame)
    15. e.stateMachine.update(e.input)
    16. e.physics.step()
    17. resolveHits(entities)
    18. emitEvents()

    The key here is not the code itself but data-driven design: character differences should live in configuration as much as possible, with the state machine handling only generic rules. This reduces the disconnect of “looks great on the homepage, hard to tune in combat.”

    3. Bridging Assets from Showcase to Combat

    The showcase scene can typically use high-detail models, complex materials, and dedicated lighting; the combat scene should use tiered detail levels, material variants, object pooling, and preloading of critical assets. The character select screen can show high-quality previews, but before entering combat you must finish preloading the combat model, frequently used move animations, hit effects, sounds, and stage dependencies. The loading flow should include placeholders, progress feedback, and failure fallback, avoiding “black screen or stall after clicking Start.”

    Meanwhile, the showcase and combat states should share the same character skeleton and animation retargeting rules, with the combat state using simplified presentation. This preserves character recognizability while controlling the budget for multiple characters on screen. For stages like a rainy rooftop, also watch out for environmental particles, reflections, and lighting occluding combat detection—presentation effects must never change logic-layer coordinates.

    4. Core Combat State Machine and Combo Cancels

    The state machine should cover idle, movement, jump, dash, block, throw, attack, hit, airborne hit, and KO states, with clear transition priorities. The attack state is subdivided into startup, active, and recovery phases; hit registration needs deduplication to prevent the same move resolving multiple times. Block, throw, jump, and dash need explicit rock-paper-scissors relationships; airborne hits should enter a dedicated state; combo cancels are controlled through cancel tags and windows.

    1. enum State { Idle, Walk, Jump, Dash, Block, Throw, Attack, Hit, AirHit, KO }
    2. function onHit(attacker, defender, move):
    3. if defender.state == Block and move.blockable:
    4. defender.enter(Block, move.blockstun)
    5. else:
    6. defender.enter(Hit or AirHit, move.hitstun)
    7. attacker.meter += move.meterGain
    8. if move.cancelTags contains attacker.currentCancelTag:
    9. attacker.openCancelWindow()

    Combo cancels should not let all moves chain freely into one another. Tags and windows constrain them, ensuring combo routes are designable, testable, and replayable.

    5. Input System and Direction-Combination Special Moves

    Feel problems often come from a mismatch between input buffering and state acceptance conditions. Use a ring buffer to record inputs over a short window; implement direction-combination special moves via sequence matching; use distinct thresholds and directional tolerance to separate dashes from jumps. Pausing should屏蔽 inputs with a unified policy for clearing or freezing the buffer, avoiding accidental triggers after resuming.

    1. buffer.push(action, frame)
    2. if state.canAccept(action):
    3. if buffer.matchSequence(requiredDirections, withinWindow):
    4. state.transition(SpecialMove)
    5. else if buffer.consume(action, withinWindow):
    6. state.transition(action)

    6. AI Tiers and Local Two-Player Flow

    AI should drive characters through virtual inputs rather than modifying state directly. The easy tier reduces reaction frequency and defensive and combo behavior; the standard tier adds spacing management and punish logic; the hard tier emphasizes resource management, combos, and mixups. The three tiers should be configurable and verified with replay tests. Local two-player needs device mapping, a shared camera, and independent UI indicators; character select, stage select, best-of-three rounds, pause, and win/loss resolution are wired together through an event bus. Match results should track stats like hits, max combo, and remaining meter to support tuning.

    7. Super Move Cinematics, Performance, and Acceptance

    Full-meter super moves can include cinematic close-ups, but logic and presentation must stay separated: lock or buffer inputs during the cinematic, drive camera, depth of field, and UI hiding from a timeline, and let hit detection still be triggered by logic events. For performance, use a fixed timestep, logic/render separation, object pooling, tiered detail, and asynchronous loading; testing should cover frame data, input latency, two-player flow, all three AI tiers, and result/restart flows. During acceptance, focus on: whether entering combat is stable, whether input is predictable, whether combos are reproducible, whether cinematics occlude detection, and whether pause/resume misbehaves. With these changes, the “Warship” prototype can progress from “looks good in showcase” to an engineering state where combat is playable, tunable, and extensible.