3D Fighting Game Architecture: A Practical Guide to Building the Combat Core First
This article explains why AI-generated 3D fighting games often look polished on the home screen but feel broken in actual matches, and how to fix the problem by treating complexity correctly. It proposes a four-layer architecture, data-driven character and move configuration, a deterministic logic-frame combat core with hitbox and hurtbox collision, three AI difficulty tiers based on decision quality, input isolation for local two-player play, frame-data-driven combos and cancels, cinematic handling that runs in parallel with game logic, and observability through match telemetry and cloud services. Readers will learn a practical engineering order and structure for building a reliable real-time fighting system.
1. The Core Problem: Why the Home Screen Impresses but the Fight Falls Apart
A common pattern when using AI coding tools to generate a 3D fighting game is that the home screen looks highly polished—character showcase, visual packaging, and presentation are all strong—but the moment a real match starts, the feel, hit detection, and pacing quickly break down. This is not a limitation of the tool. It is a misjudgment of where the complexity actually lives.
The home screen is essentially a linear showcase: a fixed camera path, deterministic animation playback, and no real-time opposition. Generated quality is naturally high. A live match, by contrast, is a concurrent state system: two character state machines advancing at the same time, input sampling decoupled from the logic frame, collision bodies checked every frame, and AI making decisions on a periodic basis. If any one of these is designed poorly, it gets amplified into an obvious feel problem.
The correct engineering order is therefore to define the match core first and package the home screen afterward. A practical split is four layers:
- Presentation layer: models, animation, VFX, camera, UI;
- Logic layer: state machines, frame data, hit detection, energy and round rules;
- Input layer: key sampling, buffering, and player isolation;
- Platform layer: shared cloud capabilities such as asset loading, logging, and monitoring/alerting.
2. Characters and Stage: Data Structures for Two Independent Fighters
Assume two independent characters (for example, original designs with names of your own) and a rainy-night rooftop stage. Abstract these into three configurations: a character profile, a move table, and a scene configuration. The character profile describes only numeric values and asset references. The move table describes the frame data for each move. The scene configuration describes lighting, ground height, and camera bounds.
{"character": {"id": "role_a","walkSpeed": 4.2,"jumpImpulse": 9.5,"maxHp": 1000,"maxEnergy": 3},"move": {"name": "Rising Dragon Fist","startup": 4,"active": 3,"recovery": 12,"damage": 90,"hitstun": 18,"blockstun": 8,"launch": true,"cancelableFrom": ["normal", "special"]}}
The key idea is to turn “feel” into quantifiable data: startup frames, active frames, recovery frames, hitstun, displacement, and cancel windows. Only when it is data can you tune the experience through repeated parameter adjustments instead of repeated rewrites.
3. Combat Core: Deterministic Logic Frames and Hit Detection
The first principle of a fighting game is determinism. The render frame rate can fluctuate, but the logic must advance at a fixed step (commonly 60Hz). Input, state advancement, collision detection, and damage resolution all complete within the same logic frame, while the presentation layer interpolates.
For collision, a dual-box model of “attack box + hurtbox” is recommended, tested for intersection every frame. Throws should follow a separate distance-and-state check and not enter the normal hurt flow. Defense should distinguish standing block from crouching block, and should include guard damage and a guard-break value so that turtling has a cost.
Illustrative pseudocode:
def step(state):inputs = input_layer.sample() # Sample inputs for this framefor c in state.characters:c.buffer.push(inputs[c.id]) # Push into the input bufferc.fsm.update(c.buffer) # Advance the state machinehits = collide(state.characters) # Box intersection testfor h in hits:apply_hit_or_block(h) # Resolve hit or blockstate.energy.update(hits) # Accumulate energystate.round.check() # Check round and win conditions
4. Three AI Tiers: From “Can Fight” to “Can Calculate”
For single-player against AI, offer easy, normal, and hard tiers. The difference should not be stat bonuses but decision quality:
- Easy: longer decision intervals, basic attacks only, almost no defense;
- Normal: adds distance zoning, a random block probability, and basic combos;
- Hard: introduces resource management (holding energy), combo cancels, and predictive counters against jumps.
Implementation follows a three-stage “perceive–decide–act” structure. The perception layer outputs distance, opponent state, and remaining energy. The decision layer uses a finite state machine plus weighted scoring to select an action. The execution layer converts the action into buffered virtual input that goes through exactly the same channel as human input, keeping behavior explainable and tunable.
5. Local Two-Player and Input Isolation
Local versus play requires two fully isolated input sets, each with its own buffer and key mapping, with no shared mutable state. Character select and best-of-three rounds belong to the pre-round flow and should be managed by a separate scene state to avoid coupling with the match state.
Input buffer length (commonly 3–6 frames) directly affects command leniency. Directional special moves are best matched with a “direction history sequence + timing window” rather than frame-by-frame comparison, so they remain reliable during dashes, juggles, and other states.
6. Combos, Cancels, and Camera Presentation
Whether juggles and combo cancels are legal is determined by frame data: only a move flagged as cancelable enters a cancel window after it hits, and only then may the next move be chained. The system must compute remaining hitstun and available cancel margin in real time, and illegal input is simply discarded rather than raising an error.
When a full-energy super triggers a cinematic close-up, presentation and logic must run in parallel: camera, slow motion, and VFX run in the presentation layer, while the logic layer either keeps advancing at a fixed step or pauses by design. The two synchronize through an event bus, and the normal camera is restored afterward. Pausing and win resolution work the same way, implemented as state transitions rather than boolean flags scattered everywhere.
7. Engineering and Observability
Add match telemetry: per-frame state, hit events, input sequences, and frame timing. Connect logs and monitoring/alerting to general cloud services (for example, a log service, monitoring and alerting, and object storage for archiving match replays) so you can compare how different parameter versions feel through regression analysis. Ship assets and versions through a container platform and pipeline so configurations stay consistent across collaborators.
8. Conclusion
The hard part of a 3D fighting game is not the visuals but the deterministic real-time combat system. Decouple frame data, state machines, input buffers, AI decisions, and camera scheduling into layers, and drive tuning with data—only then does the polish of the home screen carry over into the actual fight.
