Designing and Building a 3D Fighting Game on a Warship Deck: System Architecture and Implementation
A practical guide to building a lightweight 3D fighting game set on a warship deck, covering game state management, character systems, hit detection, combos, AI difficulty tiers, camera design, local multiplayer, and performance optimization.
1. Project Positioning and Overall Goals
Warship themes naturally offer clear spatial structure, strong visual identity, and a rich combat atmosphere. Combining a ship deck, superstructure, radar equipment, a night ocean, and dynamic lighting makes it possible to build a highly recognizable 3D fighting arena. Compared with typical side-scrolling fighting games, a 3D fighting project must handle not only character animation and attack detection, but also camera tracking, spatial boundaries, character orientation, scene collision, and visual effects.
This project can be positioned as a lightweight 3D fighting game supporting both single-player challenge and local two-player Versus mode. The core goals include:
- Providing two playable characters with clearly distinct traits;
- Supporting single-player matches against AI with Easy, Normal, and Hard difficulty levels;
- Supporting local two-player character selection and best-of-three matches;
- Implementing core fighting mechanics such as blocking, throws, jumping, dashing, launching, and combo cancels;
- Providing directional-input special moves, energy accumulation, super moves, and dramatic close-up moments;
- Completing the basic flow: pause, round settlement, restart, and return to the main menu.
To ensure development efficiency, build a “playable loop” first, then gradually add characters, skill complexity, and visual polish—rather than investing heavily in high-precision models and complex effects from the start.
2. Core Gameplay Loop Design
A single match can be broken down into the following stages:
- Enter the character selection screen;
- Select characters and load the warship deck scene;
- Initialize both players’ health, energy, and round information;
- Enter the fighting state;
- When either player’s health reaches zero, settle the round;
- Update the best-of-three score based on the round result;
- Once the victory condition is met, enter the final settlement screen;
- The player can restart, reselect characters, or return to the main menu.
From an engineering perspective, use an explicit game state manager instead of having UI scripts call each other. States may include:
Main MenuCharacter SelectScene LoadingMatch PreparationFightingRound SettlementFinal SettlementPaused
Each state should only handle its own logic. For example, the Paused state should freeze character input, AI decisions, animation progression, and the match timer, but should not destroy fight objects. Managing the flow with a state machine avoids common problems such as “cannot resume after pausing” or “the settlement screen appearing repeatedly.”
3. Character System and Combat Data
Each character should include at least the following data:
- Base health;
- Movement speed;
- Jump height;
- Dash distance;
- Damage reduction while blocking;
- Throw range;
- Skill damage;
- Skill startup, active, and recovery frames;
- Energy cap and gain methods;
- Hitstun and knockdown duration.
The character’s display object, input handling, animation control, and combat attributes should be separated. A logical structure like this works well:
CharacterRoot├── InputController├── MovementController├── CombatController├── AnimationController├── HitboxManager├── HealthComponent└── EnergyComponent
Here, InputController only reads input and never decides damage; CombatController selects actions based on input and current state; HitboxManager manages attack and hurt ranges; HealthComponent handles health changes and death state. This separation makes it easier to add AI control and local two-player control later, since both only need to provide a different input source.
Character states should include at least idle, walking, jumping, falling, attacking, blocking, hitstun, airborne, knocked down, thrown, dashing, and skill casting. State transitions must have priorities. For example, a character in the death state must not re-enter the attack state; while being controlled by a throw, regular movement input must not immediately interrupt the action.
4. Attack Detection and Combo System
The key to a fighting game is not how complex the animations are, but whether attack detection is stable and understandable. Attack detection should be divided into three categories:
- Hitbox: the area where the current action can deal damage;
- Hurtbox: the area where the character can be struck;
- Throw box: the effective range and direction of throws.
Hitboxes should not rely entirely on the character model’s shape, because skeletal animation and clothing cause detection jitter. A more stable approach is to enable a few simplified colliders at key frames and disable them when the action ends.
When an attack lands, process the following in order:
Detect hitbox vs. hurtbox overlap→ Check for invincibility or blocking state→ Calculate final damage→ Apply hitstun→ Trigger knockback or launch→ Add energy to the attacker→ Play hit effects and sound
The combo system can be built on “action windows.” Each action contains startup frames, active frames, recovery frames, and a cancel window. Only when the next move is input during the cancel window does the system allow switching actions. This preserves input rhythm while preventing players from endlessly interrupting actions through button mashing.
Combo cancels fall into three types:
- Normal cancel: light attack into heavy attack;
- Special cancel: normal attack into a directional-input special move;
- Super cancel: finishing a combo with a high-tier skill when energy conditions are met.
To prevent infinite combos, add hitstun scaling, airborne decay, or increasing knockback. After a target is hit multiple times in a row, subsequent hits should apply progressively less hitstun, or the target should automatically enter a brief protection state.
5. Blocking, Throws, and Movement
Blocking should not simply be “hold a button for full invulnerability.” A more reasonable design is damage reduction with different outcomes depending on the attack type:
- Blocked normal attacks deal minor chip damage;
- Heavy attacks increase block pressure;
- Throws bypass normal blocking;
- Certain directional specials have guard-break or knockback effects;
- Sustained blocking may trigger a guard crush.
Throws must check distance, direction, and the target’s state simultaneously. Typically, a throw cannot connect while the target is jumping, knocked down, or invincible. On a successful throw, both characters should enter a dedicated cinematic state that temporarily locks control, with combat resuming after the animation ends.
The movement system includes left/right movement, jumping, and dashing. Since the scene is a warship deck, clear combat boundaries must be set so characters cannot pass through railings or fall out of the playable area. Boundaries can be implemented with invisible colliders, or by automatically adjusting character positions as they approach the edge.
Dashing should not merely change movement speed; it should include startup, movement, and recovery phases. A brief damage reduction during the dash is acceptable, but prolonged invincibility is not—it would undermine the value of blocking and positioning.
6. Directional Special Moves and the Energy System
Recognizing directional special move inputs requires handling input order, time windows, and error tolerance. Use an input buffer to record recent directions and button presses:
Input sequence:Down → Down-Forward → Forward → AttackRecognition conditions:Directions are in the correct orderInput intervals are within the time windowThe character's current state allows castingSkill resource requirements are met
Input recognition should not be too strict, or players will struggle to consistently perform moves; it also should not be too loose, or ordinary movement will trigger specials accidentally. Minor errors in adjacent directions can be tolerated, but the basic order must be preserved.
Energy can accumulate through landing hits, successful blocks, taking damage, or performing specific actions. To prevent players from turtling to farm energy, make the energy gains from different methods clearly unequal. Before a super move fires, check:
- Whether current energy meets the threshold;
- Whether the character is in an actionable state;
- Whether the target is within the effective range;
- Whether round settlement has already begun;
- Whether cooldown or one-use-per-round restrictions are satisfied.
Super moves can gain impact through brief camera locks, screen close-ups, background dimming, and localized light effects—but the cinematic should not be too long, or it disrupts the fight’s pacing. After the animation ends, correctly restore both characters’ camera, input, and collision states.
7. AI and Three Difficulty Levels
Single-player AI does not need to be overly complex; what matters is that the difficulty levels produce clearly perceptible behavioral differences.
Easy difficulty can:
- Reduce the frequency of proactive attacks;
- Lengthen reaction times;
- Use fewer special moves;
- Not attempt to recognize complex combos;
- Prioritize creating distance after taking hits.
Normal difficulty should have a basic attack-defense loop: closing in, normal attacks, blocking, jumping, and simple skill links.
Hard difficulty can:
- Recognize the player’s attack rhythm faster;
- Punish the player’s recovery frames;
- Use throws and directional specials at the right moments;
- Choose super moves based on its energy state;
- Actively reposition near arena edges.
Note that Hard AI should not achieve “cheating reactions” by reading player inputs. A better approach is behavior selection based on perception range, decision intervals, and state checks. A finite state machine works well:
Idle→ Approach target→ Attack→ Block→ Counterattack→ Create distance→ Cast skill
Defining entry conditions, execution durations, and exit conditions for each state keeps behavior controllable while lowering implementation cost.
8. Warship Deck Scene and Camera Design
The scene’s visual focus should be the deck structure, superstructure, railings, lighting, and the distant ocean. A night environment can use a cool-toned key light with local warm lighting to create clear character silhouettes and prevent characters from blending into the background.
Scene design must also serve gameplay:
- Deck width should accommodate dash and combo distances;
- Background decorations must not obscure characters;
- Railings and equipment must not cause false collisions;
- Ground materials should clearly show character landing points;
- Scene edges should have obvious visual cues.
For the camera, use a two-character-centered follow approach that dynamically adjusts horizontal position and zoom based on the distance between fighters. Zoom out when characters are far apart; tighten slightly when they are close. Camera movement must use smoothing time to avoid jitter when characters move quickly.
Close-up shots should be managed by a separate camera module that saves the camera parameters from before the close-up. Restore the original state after the cinematic ends rather than recalculating an approximate position—this prevents camera drift after the fight concludes.
9. Local Two-Player Mode and Settlement Flow
Local two-player mode requires mapping two input devices to separate controllers and clearly displaying each player’s control status on the character select screen. During battle, both players should have independent input contexts while sharing the same combat rules system.
Best-of-three logic can be implemented as follows:
If Player 1 wins this round:Player 1's round score += 1If Player 2 wins this round:Player 2's round score += 1If either player's score reaches 2:Enter final settlementOtherwise:Reset health, energy, and scene positionsStart the next round
Round resets should not simply reload the entire scene—that increases wait times and risks duplicated resource loading. A better approach is to keep the character objects and reset only health, energy, positions, state machines, and animations.
The pause function should handle keyboard, gamepad, and other input sources simultaneously, and the pause menu itself must remain operable. The settlement screen should clearly show the round result, overall score, and next-step options, so players always know whether a round or the entire match has ended.
10. Performance, Testing, and Iteration
Performance issues in 3D fighting games typically come from effects, animation, collision detection, and camera updates. During development, focus on:
- Frequent creation and destruction of effect objects;
- Iterating over large numbers of colliders every frame;
- Complex models displayed simultaneously at close range;
- Unnecessary animation and physics calculations;
- Heavy stacks of transparent materials during close-ups.
Use object pooling to manage hit effects, energy effects, and floating text, reducing runtime allocations. For collision detection, enable colliders only during active frames instead of keeping all hitboxes active at all times.
Testing should cover at least:
- Whether normal attacks land reliably;
- Whether blocking reduces damage correctly;
- Whether throws are restricted by distance and state;
- Whether launched characters land properly;
- Whether combo cancels allow infinite loops;
- Whether camera and input states recover after a super move;
- Whether the three AI difficulties actually differ;
- Whether two-player mode has input crosstalk;
- Whether states fully reset after each round.
In summary, the key to a warship deck 3D fighting project is not stacking up characters and skills all at once, but building a stable combat foundation first. As long as state management, the input system, the detection system, the camera system, and the round flow are clearly designed, adding characters, scenes, skills, and visual polish later becomes much smoother. Through a modular architecture and incremental iteration, a simple two-character prototype can grow into a 3D fighting game with a complete gameplay loop and ongoing update capability.
