Combat System​


Design 

The design of combat for Naja Medjai was primarily focused on battles between enemy AI bosses and the player. Like the Souls-Like style of games, the different attacks and style of movement of the enemy AI bosses provide a learning challenge for the player to overcome, in which the player has to dodge enemy attacks and choose to attack during enemy openings, else the player risk taking large damage from the enemy, risking defeat (Guzsvinecz and Szűcs, 2024). 

Figure One: Footage of the Combat System in Naja Medjai


CombatValues Class and Inherited Classes 

The player has values such as health and stamina, which the enemy AI also have access to. This is achieved through a shared parent class titled CombatValues. From this, the player and enemy AI inherit their own versions which extend the functionality required to the players or enemy needs, along with providing overriding behaviour for setting shared values such as health and stamina. 

CombatValues in general tracks the characters health, stamina, regeneration rates, damage and damage scaling. It also allows for damage to be dealt as a single value, damage dealt over time and whether life can be restored via attack. 

The players inherited version of CombatValues, PlayerValues, provides extended functionality for tracking player combat abilities and combos. 

The enemy inheritance titled BossValues provide for the Behaviour class to be serialised and used to allow the enemy to have a unique resource called aggression, used for modifying the enemy's state flow. 

Furthermore, the CombatValues class provides the polymorphic functionality of allowing damage to be parsed through different CombatValues instances due to the ability via method to deal damage to a given CombatValues class passed as an argument. Further method of dealing damage was through applying damage over time to simulate burning or poison effects, as well as the ability for a character to gain healing from damage dealt. 

 

Do note that the values such as Health and Damage, etc, are assigned at run time via the provied Starting Values scriptable object, and the the live values are displayed as the current values.

Figure Two: Extract of the Enemy CombatValue inherited class, BossValue, as exposed to the Inspector.

Figure Three: Extract of the Players CombatValue inherited class, PlayerValues, as exposed to the Inspector.

 

Allowing Player and Enemy Interaction – 1. Collider Interactions 

The point in the games combat where most player to enemy interaction took place was through allowing for the CombatValues script to call its damage dealing methods from one character to another.  

Within Unity, the game engine Naja Medjai was developed in, there was heavy usage of two main concepts to facilitate this; Collider Interactions and Animation Events (Unity Technologies, n.d.). 

The use of Collision Interactions was the key point at which player and enemy interacted – the collision data allowed for the object colliding with another to determine if the other object was another CombatValue component holder. If it was, then the two characters would allow their CombatValues to parse damage to the others health.  

Colliders were used by characters through being added to points in the characters models, such as Ra’s staff and the player characters sword, or the colliders were added to separate VFX’s which contained scripts allowing them to deal damage for its assigned CharacterValue owner – this can be seen with Geb’s projectiles or Set’s lightning storms. 

Two scripts were used to control the activation or deactivation of colliders used to process collision interactions for allowing damage from and to CombatValue instances.  

The first was the DealDamageOnTriggerEnter script, which was attached to existing character body parts such as weapon or limb models and used Animation Events to signal went collisions should be allowed during the swing of a weapon.  

Figure Four: Player collider attached with the DealDamageOnTriggerEnter script.

Figure Five: Enemy weapon collider also attached with the DealDamageOnTriggerEnter script.

 

The second was the VFX_Base script, which was more sophisticated at controlling the factors in making interactive VFX effects in combat, however the VFX_Base ultimately served the purpose of enabling or disabling collisions for the sake of dealing damage. 

Figure Six: VFX_Base inherited script Strike Over Time attached to VFX object used to deal damage to a CombatValues via attached collider.

Figure Seven: VFX_Base inherited script Projectile attached to VFX object used to deal damage to a CombatValues via attached collider.

 

Allowing Player and Enemy Interaction – 2. Animation Events 

Animation Events served a central role in the combat of Najai Medjai being responsible for controlling when in an animation a collider should allow the collision interaction to be parsed as damage or not, and providing for events to occur at exact frames such as with the instantiation of VFX effects and audio clips. 

 

Figure Eight: Animation Event added to the frames of the attack animation. The highlighted blue event is a method calling on the DealDamageOnTriggerEnter script which activates the weapons collider for parsing damage to another combat values script.

 

Due to the limited number of characters existing at any point in the scene, the downsides of Animation Event compiling the method calls in runtime had negligible effects for performance. 

As Animation Event are only able to call methods on the same component as attached to the Animator, a parent AttackEvents script was created and had many instances of inherited states produced for each character. The AttackEvents script contained the various method for calling Audio Clips and instantiating VFX game objects which provided the enemy AI and player characters with wide ranging and unique attacks beyond the animation alone. 

 

Figure Nine: Extract of the Attack_Event Inspector containing VFX GameObjects Prefabs and Transform locations for where on the AI agent the VFX GameObjects should instantiate. Also included are references to the DealDamageOnTriggerEnter scripts so that damage can be controlled on weapon colliders.

 

Allowing Player and Enemy Interaction – 3. VFX_Base 

The VFX_Base script was the parent of all VFX related game objects that served the purpose of not just controlling the changing shape, timing and movement of VFX effects, but also how and when their associated colliders can provide damage to another CombatValue holding character.  

The VFX_Base and its inherited states could be provided with the source of an associated characters CombatValue to determine the source of damage, along with custom damage scaling, audio and various modification and options that change behaviour, such as; auto-self-destruction, continuous damage, self-destroy on hit, disable damage timer, etc. 

These modifications also were extended via the child functionality. For further details, visit the VFX Implementation page for a full breakdown of the different applications VFX were implemented into the combat system.  

Figure Ten: Showcase of the Visual Effect having effect in combat. Moving effects, damage over time, changing shape are supported via the VFX_Base and its inherited classes.


References 

Guzsvinecz, T. and Szűcs, J. (2024) ‘Game theory and strategic decision-making in the Dark Souls games’, in Game Theory – Computational Aspects and Applications. IntechOpen. Available at: http://dx.doi.org/10.5772/intechopen.1008456 (Accessed: 25 May 2025). 

Unity Technologies (n.d.) Collider interactions. Available at: https://docs.unity3d.com/Manual/collider-interactions.html (Accessed: 25 May 2025). 

Unity Technologies (n.d.) Animation events on imported clips. Available at: https://docs.unity3d.com/6000.1/Documentation/Manual/AnimationEventsOnImportedClips.html (Accessed: 25 May 2025). 

Previous
Previous

General Gamplay

Next
Next

AI System