ashish.patel@portfolio:~$ notes

Team-Based Enemy Combat Using FGenericTeamId

While building enemy combat systems in Unreal Engine 5, I needed a way to prevent enemies from damaging allies. This note covers how I implemented team-based AI combat using FGenericTeamId and attitude checks in C++.

Published in Category:

Analysis

Read time:

INTRODUCTION

While building my Unreal Engine 5 gameplay systems, I encountered an issue where enemies could accidentally damage actors from the same faction.

To solve this, I implemented a team-based combat system using Unreal Engine’s built-in FGenericTeamId interface. This allowed AI characters to recognize friendly and hostile targets dynamically during combat.


SYSTEM GOAL

The goal of the system was:

  • Prevent friendly fire

  • Allow enemy factions

  • Support future ally systems

  • Keep combat logic scalable

  • Handle AI attitude checks in C++


IMPLEMENTATION

Each enemy character was assigned a team ID using FGenericTeamId.

The team ID is returned through the IGenericTeamAgentInterface.


CODE BLOCK

virtual FGenericTeamId GetGenericTeamId() const override
{
return FGenericTeamId(EnemyTeamID);
}


ATTITUDE CHECK

Before applying damage, the system compares the attacker and target teams.


SECOND CODE BLOCK

ETeamAttitude::Type Attitude =
FGenericTeamId::GetAttitude(AttackerTeam, TargetTeam);

if (Attitude != ETeamAttitude::Friendly)
{
ApplyDamage();
}


RESULT

This system made enemy combat much more reliable and scalable.

It also prepares the project for:
• allied AI
• companion systems
• faction gameplay
• PvE combat logic
• future multiplayer support


WHAT I LEARNED

Through this system, I improved my understanding of:

• Unreal Engine AI systems
• C++ gameplay architecture
• interface-based programming
• scalable combat logic
• clean gameplay programming practices

Analysis

6 Minute Read

Optimizing Treasure Systems with Object Pooling in Unreal Engine 5

This technical note explores how I implemented an object pooling system in Unreal Engine 5 to optimize treasure spawning from breakable gameplay objects while improving performance and scalability.

Tutorial

7 Minute Read

Implementing Weapon Equip & Combat Systems in Unreal Engine 5

This technical note covers how I built a modular weapon equip and combat system in Unreal Engine 5 using sockets, animation montages, overlap detection, and scalable C++ gameplay logic.

Tutorial

6 Minute Read

Save & Load System Using Unreal Engine 5

To preserve player progress between sessions, I built a complete save and load system in Unreal Engine 5 using SaveGame objects, gameplay state serialization, and slot-based saving in C++.

© Ashish Patel | 2026

Gameplay Programmer • Unreal Engine 5 • C++

Create a free website with Framer, the website builder loved by startups, designers and agencies.