Engineering 3D Fighting Games: Architecture and Performance Optimization
This article explains why a 3D fighting game can look impressive on the main menu yet run poorly in combat, and how to fix it through engineering rather than art changes. It covers a four-layer architecture with a per-frame budget, explicit state machines for combat feel, a frame-data-driven hit detection system, three-tier AI difficulty design, energy and cinematic camera handling, local two-player match flow, and a practical performance optimization checklist. Readers will learn how to separate showcase and combat pipelines and validate both stability and visual quality independently.
1. Problem Definition: Why the Main Menu Looks Great but Gameplay Does Not
A common pattern: the two character showcases on the home screen look excellent, but the experience drops noticeably once the actual battle scene loads. This is not an art problem; it is an engineering pipeline problem. The home screen is static or semi-static and only needs one high-quality render, a few skeletal poses, and gentle camera easing. A combat scene must simultaneously handle two full skeletal animation sets, per-frame collision checks, particles and post-processing, camera effects, and AI decisions. The load is on a completely different scale.
There are four common root causes:
- No combat-state asset trimming: the high-poly models and 4K textures used on the home screen go straight into combat, quickly saturating VRAM and bandwidth.
- Logic coupled with rendering: hit detection, animation, and effects all live in the same frame callback, so any single stall is amplified across the whole frame.
- Rough state machine design: guard, throws, juggle, and cancel states interleave without clear priority or interrupt rules, causing actions to “stick” or hit windows to be dropped.
- No performance budget: without per-character, per-scene, and per-effect frame-time caps, optimization has no target.
The fix is to split the “showcase state” and the “combat state” into two separate asset and logic pipelines, and to define an explicit budget table for every frame.
2. Overall Architecture: Layers and Frame Budget
A four-layer structure is recommended, with layers communicating only through data and events:
- Presentation layer: skeletal animation, materials, particles, post-processing, close-up cameras.
- Logic layer: state machine, hit detection, energy and round management.
- Input layer: local two-player key mapping, input buffering, and command parsing.
- Platform layer: asset loading, object pools, logging, and monitoring alerts.
Example frame budget (capped at 60 FPS, 16.6 ms):
Input sampling and command parsing <= 1.0 msLogic and hit detection <= 3.0 msAnimation and skeletal blending <= 4.0 msRendering and post-processing <= 7.0 msHeadroom (GC / scheduling jitter) >= 1.6 ms
When a layer exceeds its budget, trigger a degradation strategy instead of dropping frames: reduce particle counts, disable secondary post-processing, or swap distant characters to low-poly models.
3. Characters and State Machines: The Core of Fighting Game Feel
Almost all of a fighting game’s “feel” comes from how rigorous the state machine is. Use an explicit finite state machine with layered sub-states, and define four attributes for every state: entry condition, interruptible set, movement rules, and hit-frame window.
Main states can be abstracted as: idle, walk, jump, crouch, guard, hitstun, juggle, knockdown, throw startup, throw active, special move, super move, and result.
Example key rules:
State priority: result > super > throw active > hitstun/juggle > special > guard > normal movementInterrupt rule: a state may be canceled only when the target is in the "interruptible set"Cancel window: 3-6 frames after a normal move connects, a special can be chained, consuming energy
Guard must distinguish high and low attacks. Throws should ignore guard but remain subject to the risk of being beaten during the throw startup frames. The juggle state must record gravity parameters and a hit-count limit to prevent infinite combos. Combo cancels are constrained by both a cancel window and a resource cost, preserving an execution ceiling while preventing mindless loops.
4. Hit Detection: Collision Shapes and Frame Data
Keep hit detection decoupled from animation and drive it from an independent frame data table. Each attack action includes: startup frame, active frame range, recovery frames, damage, knockback vector, hit stop, and whether it is cancelable.
The collision shape principle is “good enough is enough”: capsules for limbs, boxes for the torso, spheres for the head, avoiding per-vertex checks. To reduce cost, use a two-stage broad phase plus narrow phase structure, and enable object pools to reuse collision objects, reducing runtime allocation jitter.
Hit stop is central to impact feel: on contact, freeze both sides’ logic for a few frames while playing a slight camera shake and particles, which noticeably improves the quality of the “I hit it” feedback.
5. AI Difficulty: Three Tiers by Design, Not Simple Numeric Scaling
Three difficulty tiers should not be mere damage multipliers; they should be layers of decision quality:
- Easy: longer reaction delay, low guard probability, combos limited to fixed short strings.
- Normal: basic guarding and counterattacks, able to complete medium-length combos, occasionally uses throws to break guard.
- Hard: adds distance management and resource management, can chain optimally inside cancel windows, and applies lightweight statistical bias against player habits.
Implementation can use a behavior tree plus utility scoring: the behavior tree keeps the structure clear, utility scoring rates candidate actions, and difficulty-specific noise and delay are layered on top so the three tiers feel noticeably different.
6. Energy, Supers, and Close-Up Cameras
Energy is best sourced from three streams: accumulation on hit, accumulation when hit, and a small time-based increase, with a fixed cap to avoid numeric inflation. A super consumes all energy and triggers a brief close-up: the camera cuts to a tight shot, time scaling drops, the background blurs, and the character gets a signature camera move. The key implementation point is to make the close-up an interruptible “presentation state”: the logic layer keeps advancing while input is temporarily blocked, then the camera eases back to the combat view to avoid disorienting jumps.
7. Local Two-Player Matches and Round Flow
Local two-player play needs independent input mapping and input buffering (6-8 frames is recommended). Too short a buffer swallows commands; too long makes controls feel sluggish. Matches are best-of-three, with the state flow: character select → load → opening countdown → battle → win/loss result → next round or return to select. Pause must freeze both the logic and audio clocks; on resume, feed one frame of input first to prevent an empty command at the moment of recovery.
8. Performance Optimization Checklist
- Use low-poly models and compressed textures in combat; reserve home-screen high-poly assets for showcase only.
- Use layered blending for skeletal animation to reduce per-frame sampling.
- Set count limits and priorities for particles and post-processing, trimming by priority when limits are exceeded.
- Use deferred rendering with baked lighting for scenes; screen-space approximation is sufficient for rainy-night reflections.
- Wire logging services and monitoring alerts across the whole pipeline, with dashboards built on frame time, hit-check counts, and allocation volume.
- Serve asset loading from object storage plus a content delivery network, with versioned directories for easy rollback.
9. Acceptance and Iteration
Maintain three tables: a frame data table, a state transition table, and a performance budget table. Each iteration should first run automated match recording and replay to check hit-detection consistency and combo reachability, then review whether the performance dashboard is out of bounds. Treat “a stunning main menu” as an art goal and “stable combat” as an engineering goal, and accept them on separate tracks, which is the only way to avoid an experience collapse once the player enters the game.
