Skip to main content

Lyra Integration Guide

Complete guide to integrating the AI Turret plugin with Epic Games' Lyra sample project.

Overview

The AI Turret plugin can be seamlessly integrated with Lyra, Epic's advanced multiplayer shooter sample project. This integration allows you to add intelligent defensive turrets to your Lyra-based games, complete with team-based targeting and Gameplay Ability System (GAS) compatibility.

What This Integration Enables

  • Team-based AI turrets that recognize friend vs foe
  • GAS integration for damage dealing through Gameplay Effects
  • Lyra's advanced networking support for multiplayer scenarios
  • Professional game-ready defensive systems

Prerequisites

Before starting this integration, ensure you have:

  • Lyra project set up and running
  • AI Turret plugin installed and enabled
  • Basic Lyra knowledge (teams, GAS, ShooterCore)
  • Blueprint editing experience

Step-by-Step Integration

1. Install AI Turret Plugin

First, install the AI Turret plugin in your Lyra project following the standard Setup Guide.

2. Add Plugin Dependency

Configure the plugin dependency to access ShooterCore functionality:

  1. Right-click the ShooterCore Content folder
  2. Select PluginEdit
  3. Under Dependencies, add AITurret
  4. Save and restart Unreal Engine

3. Create Damage Gameplay Effect

Create a custom Gameplay Effect for turret damage:

  1. Navigate to AITurret Content folder
  2. Create a new Gameplay Effect blueprint
  3. Copy ShooterCore/Content/Weapons/Rifle/GE_Damage_RifleAuto
  4. Paste it to the AITurret Content folder
  5. Rename it to GE_Damage_Turret
  6. (Optional) Modify damage values as needed

4. Modify B_TurretPawn Event Graph

Update the turret pawn to apply damage through the Gameplay Ability System:

OnProjectileImpact Event Implementation

Blueprint showing the OnProjectileImpact event handling with authority checks and GAS integration.

5. Configure B_TurretAIController

Either delete the GetTeamAttitude function entirely (so the default C++ implementation is used) or ensure the AI controller uses proper team attitude detection by calling the parent implementation.

GetTeamAttitude Function Override

Blueprint showing the GetTeamAttitude function override that ensures proper team recognition in Lyra.

6. Configure Team Settings

Set up proper team identification:

  1. Place B_TurretPawn in your level
  2. Set the Team ID to match one of your teams (e.g., Team 1)
  3. Ensure player characters have corresponding team IDs
  4. Test team recognition in play mode

7. Fine-tune Performance Settings

Optimize turret behavior for your Lyra project:

  • Projectile Velocity: 10000 (for fast projectiles)
  • Damage Amount: Adjust in GE_Damage_Turret
  • Sight Radius: 1500-3000 (depending on map size)
  • Peripheral Vision Angle: 90-135 degrees
  • Hearing Range: Match your game's audio design

Video Demonstration

Watch this comprehensive demonstration of the Lyra integration in action:

The video shows the complete integration process and demonstrates the turrets working within a Lyra environment.

Blueprint Code Reference

B_TurretPawn OnProjectileImpact Implementation

Click to expand full BlueprintUE code to copy&paste into UE
Begin Object Class=/Script/BlueprintGraph.K2Node_Event Name="K2Node_Event_3"
EventReference=(MemberParent="/Script/CoreUObject.Class'/Script/AITurret.TurretPawn'",MemberName="OnProjectileImpact")
bOverrideFunction=True
NodePosX=-496
NodePosY=269
NodeGuid=72A4765F458C18C224D904943496E3EC
End Object

Begin Object Class=/Script/BlueprintGraph.K2Node_MacroInstance Name="K2Node_MacroInstance_0"
MacroGraphReference=(MacroGraph="/Script/Engine.EdGraph'/Engine/EditorBlueprintResources/ActorMacros.ActorMacros:Switch Has Authority'")
NodePosX=-160
NodePosY=272
NodeGuid=473B6B00493F50173027459CE3741B70
End Object

Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0"
bIsPureFunc=True
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/GameplayAbilities.AbilitySystemBlueprintLibrary'",MemberName="GetAbilitySystemComponent")
NodePosX=-160
NodePosY=400
NodeGuid=D54A5D9C4A6C097D5A6C92A0622F3568
End Object

Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_2"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/GameplayAbilities.AbilitySystemComponent'",MemberName="BP_ApplyGameplayEffectToSelf")
NodePosX=448
NodePosY=254
NodeGuid=790AC521482AA03EA707BCA5E8ACF4EF
End Object

B_TurretAIController GetTeamAttitude Implementation

Click to expand full BlueprintUE code to copy&paste into UE
Begin Object Class=/Script/BlueprintGraph.K2Node_FunctionEntry Name="K2Node_FunctionEntry_0"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/AITurret.TurretAIController'",MemberName="GetTeamAttitude")
NodeGuid=A3B829E8409F398E70A9278C7ED41C89
End Object

Begin Object Class=/Script/BlueprintGraph.K2Node_CallParentFunction Name="K2Node_CallParentFunction_0"
bIsPureFunc=True
bIsConstFunc=True
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/AITurret.TurretAIController'",MemberName="GetTeamAttitude")
NodePosX=240
NodePosY=80
NodeGuid=D6949BF94958AD47EC745781D05B1D18
End Object

Begin Object Class=/Script/BlueprintGraph.K2Node_FunctionResult Name="K2Node_FunctionResult_0"
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/AITurret.TurretAIController'",MemberName="GetTeamAttitude")
NodePosX=512
NodeGuid=9283AF6844D355D5D1D04B87BDAF9272
End Object

Troubleshooting

Common Issues and Solutions

Turrets Not Recognizing Teams

  • Problem: Turrets attack friendly players
  • Solution: Verify Team IDs match between turrets and players
  • Check: Ensure GetTeamAttitude function is properly overridden

Damage Not Applied

  • Problem: Projectiles hit but don't deal damage
  • Solution: Verify GE_Damage_Turret is properly configured
  • Check: Ensure target has a valid Ability System Component

Performance Issues

  • Problem: Frame drops with multiple turrets
  • Solution: Reduce sight radius and tick frequency
  • Optimization: Use LOD system for distant turrets

Networking Problems

  • Problem: Turrets behave differently on client vs server
  • Solution: Ensure all damage logic runs on server (Authority check)
  • Verification: Test in multiplayer environment

Best Practices

  1. Always use Authority checks for damage dealing
  2. Test in multiplayer early and often
  3. Optimize sight ranges based on your map size
  4. Use consistent team IDs across all actors
  5. Profile performance with multiple turrets active

Advanced Customization

Custom Damage Types

You can create specialized damage effects for different scenarios (suggestions):

  • GE_Damage_Turret_Heavy - High damage, slow rate of fire
  • GE_Damage_Turret_Rapid - Low damage, high rate of fire
  • GE_Damage_Turret_Explosive - Area damage effects

Team-Specific Behaviors

Implement different turret behaviors per team:

  • Defensive turrets - Protect specific areas
  • Aggressive turrets - Hunt down enemies
  • Support turrets - Provide covering fire

Next Steps

After successful integration:

  1. Test thoroughly in multiplayer scenarios
  2. Balance damage values for your game
  3. Create custom turret variants for different roles
  4. Integrate with your HUD for turret status display
  5. Add sound effects and visual feedback

Community Support

Need help with Lyra integration?


This integration showcases the professional-grade compatibility of the AI Turret plugin with Epic's advanced game frameworks.