About:
The "Minimum Input Combo Attack" project in Unity enables smooth, responsive combo attacks with simplified input. By chaining moves with minimal commands, it enhances accessibility and fluidity in combat, creating engaging gameplay with intuitive, streamlined control.
Project Info:
Role:
Game Programmer
Team Size
1
Time Frame:
1 week
Used:
Unity Engine, C#
Project Overview
I developed this combo attack system in Unity as a personal challenge to design an intuitive and efficient combat mechanic. The system features minimum input recognition, dynamic combo progression, and seamless animation transitions, all built within a modular framework. This project emphasizes scalability and precision, making it adaptable for various action-based games.
Challenges and Learnings:
This project enhanced my skills in several key areas:
-
Input Handling and Timing: Learned how to accurately capture and process real-time player inputs for executing combo attacks, ensuring responsiveness and fluidity.
-
Scalable System Design: Built a modular combo system that allows easy addition or modification of attack sequences, ensuring flexibility for future expansions.
-
Animation Integration: Overcame challenges in synchronizing animations with combo execution, ensuring smooth visual feedback for players.
-
Debugging and Fine-Tuning: Refined problem-solving skills by troubleshooting input inconsistencies and optimizing combo logic for real-time gameplay scenarios.
-
Code Structure and Reusability: Emphasized writing clean, reusable, and well-documented code, making the system maintainable and easy to extend.
This project provided valuable insights into input handling, animation synchronization, and modular design, serving as a strong foundation for implementing advanced mechanics in action-oriented games.
Key Features:
-
Modular Combat System:
-
The entire system is designed with modularity in mind, ensuring:
-
Ease of Integration: Can be incorporated into different game genres or projects with minimal adjustments.
-
Independent Components: Attack logic, input handling, and animation systems function independently for better maintainability.
-
-
​
-
Scriptable Object-Based Attack Configuration:
-
Quick Prototyping: Easily create, modify, or swap attacks without altering the code.
-
Reusability: Attack configurations can be shared across characters or used in multiple projects.
-
​
-
Support for Melee and Ranged Attacks:
-
Provides a framework for both melee and ranged attack creation, offering
-
Diverse Combat Options: Simplifies the implementation of unique attack mechanics for varied gameplay experiences.​
-
Customizable Parameters: Fine-tune attributes like damage, range, cooldown, and more.
-
-
​
-
Minimum Input Combo Execution:
-
Recognizes the minimum required input for executing combos, delivering:
-
Player-Friendly Controls: Reduces complexity while maintaining depth in combat.​
-
Precision and Consistency: Ensures reliable detection of input sequences for smooth combo activation.
-
-
​
-
Animation Integration:
-
Tightly links attack configurations with animations, ensuring:
-
Smooth Transitions: Animations sync perfectly with attack logic for a cohesive experience.
-
Clear Visual Feedback: Enhances the player's understanding of attack timing and effects.
-
-
​
This modular system allows for rapid prototyping and customization, empowering developers to create versatile and polished combat mechanics with ease.
Code Breakdown
Player Combat Dynamics
-
The PlayerCombatDynamic script controls the player's combat interactions, including combo attacks, energy handling, and animation integration. It effectively manages input detection, attack execution, and energy consumption.
-
Key Components:
-
Combo Management: Tracks input for combo sequences and executes corresponding attacks.
-
Energy Management: Uses energy-based attacks (e.g., projectiles, AOE) by selecting energy types.
-
Animation Control: Plays attack animations based on the current combat state.
-
Example:
-
void PerformPowerAttack()
{
if (energyAttacks.Count == 0)
return;
EnergySO selectedAttack = energyAttacks[mainAtkComboStream - 1];
EnergyHandler energyHandler = GetHandlerForType(selectedAttack.energyType);
if (energyHandler != null)
{
​ Transform spawnPoint = GetSpawnPoint(selectedAttack.energyType); energyHandler.Execute(selectedAttack, spawnPoint, GetTarget());
}
playerAnimationHandler.PowerAttack(energyAttacks[mainAtkComboStream - 1]);
energyAttackForwardStep = energyAttacks[mainAtkComboStream - 1].forwardStep;
}​
}
​Efficiently manages energy-based attacks with flexible spawn points and animation handling, demonstrating your ability to manage complex gameplay mechanics.
​​
​​
Energy Object Pooling
-
The EnergyPool system optimizes memory usage and game performance by reusing energy-based attack objects (e.g., projectiles). This pooling system minimizes instantiation overhead, improving frame rates.
-
Key Components:
-
Pooling: Recycles energy objects to avoid excessive instantiation and destruction.
-
Dynamic Sizing: Automatically adjusts the pool size based on gameplay needs.
-
Example: In the game, each state (such as the gameplay state or the game-over state) is a separate class that inherits from a State interface. Here's how the GameState class might be implemented:
-
public class EnergyPool : MonoBehaviour
{
private Queue<GameObject> projectilePool = new Queue<GameObject>();
public GameObject GetProjectile()
{
if (projectilePool.Count == 0)
{
AddProjectiles(1);
}
}
return projectilePool.Dequeue();
public void ReturnProjectile(GameObject projectile)
{
projectile.SetActive(false);
projectilePool.Enqueue(projectile);
}
​
private void AddProjectiles(int count)​
{
for (int i = 0; i < count; i++)
{
GameObject projectile = Instantiate(projectilePrefab); projectile.SetActive(false);
projectilePool.Enqueue(projectile);
}
}
}​
​​
-
Demonstrates strong understanding of performance optimization through object pooling, ensuring smooth gameplay and resource management.
​
Projectile Handling​
​​
-
The Projectile script governs projectile behavior, including movement, collision detection, and damage application. It integrates with the energy system to launch attacks efficiently.
-
Key Components:
-
Movement: Controls projectile speed and trajectory based on attack properties.
-
Collision Handling: Detects target impact and applies damage.
-
Pool Integration: Returns projectiles to the pool for reuse.
-
public class Projectile : MonoBehaviour
{
private float speed;
private float damage;
public void Initialize(EnergySO energySO, Vector3 direction)
{
speed = energySO.forwardStep;
damage = energySO.damage;
}
​
In this way, game states are handled cleanly and separated logically, improving maintainability and making the game structure scalable for future additions.
​
HandleInput()​
​​
-
Example: In GameState, the HandleInput() function is used to capture player actions, like pressing the spacebar to make the bird flap. For instance:
void GameState::HandleInput()
{
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) // Main loop
{
bird.flap(); // Make the bird flap if the spacebar is pressed
}
}
​
This function checks for specific keypresses (e.g., spacebar for flapping the bird) and responds accordingly.
-
-
Efficient handling of meshes and textures to ensure that the procedural generation runs smoothly:​
-
Conclusion:
The Minimum Input Combo Attack Unity project demonstrates a robust and efficient approach to game development using Unity and C#. Key highlights include:
-
Modular Combat System: Implementing a flexible and scalable combat system that allows dynamic handling of multiple energy attack types, such as projectiles, AOEs, and stuns, using reusable scriptable objects and energy handlers.
-
Performance Optimization: Leveraging object pooling to efficiently manage projectile instances, reducing unnecessary memory allocations and improving overall game performance.
-
Animation and Energy Integration: Seamlessly integrating combat animations with energy-based attack mechanics, ensuring smooth transitions and consistent gameplay experience.
-
Dynamic Input Handling: Managing complex input combinations for combo attacks while providing responsive feedback to the player during combat.
-
Handler Assignment and Extensibility: Using modular handler assignment for different energy types, enabling easy expansion and modification of attack mechanics without altering core systems.
This project highlights your ability to implement efficient systems for combat, animation, performance optimization, and extensibility, making it a solid foundation for building action-packed games in Unity using C#.

