A Beat Em Up prototype made for fun. Created a combat framework which contains modular structures for adding new attacks, Finishers, Counter Executions, Camera controls, State machine that handles states for the player and AI. Animations and art are taken from the asset store.
The goal of the project was to build a solid foundation for a 3D fighting game with a robust combat system, AI control, and environment interaction. The architecture needed to be data-driven and modular, which makes it easier for you to expand the game’s features and content in the future.
Core Design:
-
Object-Oriented: The core architecture is built around a well-defined object-oriented structure, with base classes like Character for common functionality and derived classes (e.g., PlayerCharacter, AICharacter) for specific behaviors.
-
Component-Based: Game elements are broken down into components that handle specific aspects of functionality. This is evident in classes like CharacterMovement, CharacterPhysics, CharacterVisuals, and CharacterCombat.
-
Event-Driven: Events are extensively used to communicate between components and objects. Characters have events like OnDeath, OnStateChanged, OnInitialized, etc. This allows for decoupled logic and more modular design.
-
StateMachine: The game heavily relies on state machines to manage character behavior. Both PlayerCharacter and AICharacter have their own state machines to control actions like Idle, Attack, Dodge, Block, and more.
Gameplay Mechanics:
-
Character Control: The code uses a robust system for controlling characters. The KinematicCharacterController library handles collisions, grounding, and rigidbody interaction. The CharacterMovement class provides the interface for controlling a character’s movement, jumping, and rolling.
-
Combat: A highly detailed combat system is implemented using ScriptableObjects, which define specific attack actions, combos, and animation timing.
-
Parry: A parry system allows the player to interrupt enemy attacks with precise timing.
-
AI: AI characters are controlled by a state machine that triggers different behaviors based on the character’s difficulty settings and gameplay state.