Team System
Team System
Section titled “Team System”Team Framework Implementation
Section titled “Team Framework Implementation”With AI characters now using projectiles alongside players, implementing a team system prevents friendly fire and ensures proper combat targeting.
Team Enumeration Setup
Section titled “Team Enumeration Setup”Team Categories
Section titled “Team Categories”Create enumeration for team identification:
E_Team Enumeration
Section titled “E_Team Enumeration”- Player: Player character team
- Enemy: AI character team
- Neutral: Non-combatant characters (NPCs, environmental)
This simple structure supports most combat scenarios while remaining extensible for future team types.
Projectile Team Integration
Section titled “Projectile Team Integration”Team-Aware Projectiles
Section titled “Team-Aware Projectiles”Modify projectile system to respect team allegiance:
Projectile Team Variables
Section titled “Projectile Team Variables”- Team Variable: Team enumeration type
- Instance Editable: Allow runtime team assignment
- Expose on Spawn: Set team when projectile spawns
Team Validation Logic
Section titled “Team Validation Logic”// Projectile Team CheckingOnProjectileHit(OtherActor) {if (OtherActor != Owner) {other_actor_team = OtherActor.Interface_Get_Team();
if (other_actor_team != projectile_team) {// Different teams - apply damageApplyDamage(OtherActor);} else {// Same team - projectile passes throughContinueMovement();}}}
Character Team Assignment
Section titled “Character Team Assignment”Master Character Team System
Section titled “Master Character Team System”Implement team identification for all characters:
Interface Function
Section titled “Interface Function”- Interface_Get_Team: Returns character’s team enumeration
- Team Variable: Store team assignment in master character
- Default Values: Set appropriate defaults for different character types
Character Team Setup
Section titled “Character Team Setup”// Character Team Configuration// Player Character Class Defaults:Team = Player;
// AI Master Character Class Defaults:Team = Enemy;
// NPC Character Class Defaults:Team = Neutral;
Projectile Spawn Integration
Section titled “Projectile Spawn Integration”Team Assignment During Spawn
Section titled “Team Assignment During Spawn”Ensure projectiles inherit shooter’s team:
Spawn Function Updates
Section titled “Spawn Function Updates”Modify F_Spawn_Projectile function to include team assignment:
// Team-Aware Projectile SpawningF_Spawn_Projectile(Parameters...) {shooter_team = GetTeam();spawned_projectile = SpawnActor(ProjectileClass, Location, Rotation);spawned_projectile.Team = shooter_team;}
Automatic Team Inheritance
Section titled “Automatic Team Inheritance”- Owner Team: Projectiles automatically inherit owner’s team
- Consistent Behavior: All projectile types respect team assignments
- No Manual Assignment: Team assignment happens automatically during spawn
Combat Integration
Section titled “Combat Integration”Friendly Fire Prevention
Section titled “Friendly Fire Prevention”Team system prevents accidental damage between allies:
AI vs AI Combat
Section titled “AI vs AI Combat”- Team Matching: AI characters on same team ignore each other’s attacks
- Projectile Passthrough: Friendly projectiles don’t trigger hit events
- Melee Exclusion: Melee attacks exclude same-team targets
Player Protection
Section titled “Player Protection”- Allied NPCs: If NPCs set to player team, they won’t be damaged by player
- Environmental Safety: Neutral team entities unaffected by combat
Team System Testing
Section titled “Team System Testing”Validation Scenarios
Section titled “Validation Scenarios”Test team system functionality:
Multi-AI Testing
Section titled “Multi-AI Testing”- Spawn multiple AI characters
- Verify AI projectiles don’t damage each other
- Confirm AI projectiles damage player character
- Test player projectiles damage AI but not other players (in multiplayer scenarios)
Team Switching
Section titled “Team Switching”- Runtime Changes: Verify team changes work correctly
- Projectile Updates: Existing projectiles maintain original team assignment
- State Consistency: Team changes don’t break existing combat interactions
The team system provides essential combat organization while maintaining simple, extensible architecture for future gameplay modes requiring faction-based or team-based mechanics.