3D Fighting Game Engine Architecture and Implementation
This article explains how to architect a 3D fighting game so that it performs reliably in real matches, not just in menus. It covers a five-layer system design, character and stage data specifications, finite state machines and frame-based hit detection, tiered AI design, and input buffering, camera handling, and engineering practices. The focus is on rule consistency and verifiable states to avoid frame drops and broken logic once gameplay begins.
1. The Problem: Great-Looking Menus, Broken Matches
A common pattern in 3D fighting game development is a home screen and character showcase that look excellent, followed by a sharp drop in frame rate, inconsistent hit detection, and stiff AI behavior as soon as the actual battle scene loads. The root cause is usually not the art, but the architecture. A showcase scene is controlled static rendering, while a battle scene is a tightly coupled system of real-time input, physics, state machines, and AI. Fixing this requires refactoring the project from a pile of scenes into a layered, testable system.
2. Overall Layered Architecture
Split the system into five layers. Each layer depends on the layers above it and provides capabilities to the layers below it:
- Presentation layer: character models, skeletal animation, stage scenes, close-up cameras, and post-processing.
- Combat logic layer: state machines, hitboxes, combo and cancel rules, energy and round management.
- Input layer: local two-player keyboard/gamepad mapping, directional combination recognition, buffering, and priority.
- AI layer: difficulty-based decisions, distance management, offensive/defensive tendencies, and reaction delay.
- Infrastructure layer: asset loading, object pools, logging and monitoring, and configuration data tables.
Key principle: the combat logic layer must not depend directly on rendering objects. It depends only on logical frames and numeric configuration, so both AI and network play can reuse the same ruleset.
3. Character and Stage Construction Standards
Each character should be split into three data sets: skeleton and animation assets, numeric configuration (health, attack speed, displacement, hitstun), and hit configuration (attack boxes, hurtboxes, throw range). A stage must provide an explicit ground height, boundaries, and lighting presets to prevent logical coordinates from drifting away from visual coordinates. The character select screen and the battle scene should share the same configuration source, eliminating any split between “showcase values” and “combat values.”
4. Combat State Machine and Hit Detection
Use a finite state machine to manage each character’s behavior: idle, walk, jump, block, hitstun, throw, special move, juggle, knockdown, and wake-up. Every state transition needs an explicit cancel window and hitstun frames. Drive attack detection with logical frames:
class AttackState:startup = 6 # startup framesactive = 4 # active framesrecovery = 10 # recovery framescancel_window = (8, 12) # cancel window
Run hit detection once per logical frame during the active frames. On hit, the target enters hitstun or juggle state, and the combo table determines whether the next move is allowed. Best-of-three round management should be independent of the combat state machine, handling win counting, pause, and results.
5. Implementing Tiered AI Difficulty
Three difficulty tiers should differ in decision quality, not just numeric bonuses:
- Easy: high reaction delay, rarely attacks proactively, low block probability.
- Normal: maintains mid-range distance, occasionally uses special moves, can complete basic combos.
- Hard: actively closes distance, predicts jumps, links combos inside cancel windows, and manages when to spend energy.
Implement this as a three-stage perceive-decide-act pipeline. The perception stage samples both sides’ distance and state. The decision stage picks a behavior using difficulty weights. The execution stage translates the behavior into virtual input and reuses the same input pipeline as a human player, keeping the rules consistent.
6. Input, Camera, and Engineering Safeguards
Directional combination special moves need input buffering and directional sequence matching. A 120–150 ms buffer window with priority override is recommended. When a full-energy super move triggers a close-up camera, temporarily reduce non-essential rendering load and lock logical input so hit detection does not misbehave during the cutscene. On the engineering side, use object pools to reuse effects and hit objects, drive values from configuration tables, and use logs and monitoring alerts to track down frame rate and state anomalies. If needed, use container platforms and object storage for asset distribution and version management.
7. Conclusion
The core competitive strengths of a 3D fighting game are rule consistency and state verifiability. Decoupling presentation from combat, unifying AI and human input, and moving all values into configuration is what fundamentally removes the gap between an impressive menu and a weak in-game experience.
