Space Plunder
Loading...
Searching...
No Matches
AIDataTypes.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Engine/DataTable.h"
8#include "AIDataTypes.generated.h"
9
10DECLARE_LOG_CATEGORY_EXTERN(LogAIToolKit, Display, All);
11
12
14{
15
16
18 inline float TrustLevelFriendly = 100.0f;
20 inline float HostilityLevelFriendly = 0.0f;
21
23 inline float TrustLevelAllied = 40.0f;
26
28 inline float TrustLevelNeutral = 0.0f;
30 inline float HostilityLevelNeutral = 20.0f;
31
33 inline float TrustLevelHostile = -40.0f;
35 inline float HostilityLevelHostile = 100.0f;
36
38 inline float TrustLevelEnemy = -100.0f;
40 inline float HostilityLevelEnemy= 200.0f;
41}
42
43
44
45UENUM(BlueprintType)
46enum class EAIResponse : uint8
47{
49 Command,
50 Trade,
51
52 // Combat,
53 // Fetch,
54};
55
56
57
58UENUM(BlueprintType, meta = (ScriptName = "EAISensePython"))
59enum class EAISense : uint8
60{
61 Sight,
62 Hearing,
63 Damage,
64 Team,
66 Touch,
67 Action,
68 Custom
69};
70
71UENUM(BlueprintType)
72enum class ECharacterType : uint8
73{
74 Human,
75 Alien,
76 Robot,
77 Zombie,
78 Raider,
80};
81
82UENUM(BlueprintType)
83enum class EAIMovementSpeed : uint8
84{
85 Walking,
86 Jogging,
87 Running,
89};
90
91UENUM(BlueprintType)
92enum class EAIMovementType : uint8
93{
94 Normal,
95 Injured,
98};
99
100
101UENUM(BlueprintType)
102enum class EFactionType : uint8
103{
104 Default,
105 Alliance, //- Space cops, Trying to bring peace
106 Militia, //- Military who will forcefully bring peace
107 Vipers, //- Free Roaming Humans who don't obey the law of the alliance, but are not hostile, //
108 Jackals, //- Raiders who will kill anyone
109 TheBrotherhood, //- Kidnap and Sacrifice people to become zombies, keep zombies as weapons have slaves //
110 Robots, //- AI Machines who think humans are destroying themselves, willing to destroy some for the good of all
111 ChurchOfTheMachine, //- Humans who worship Robots and agree, even when the robots don't agree with them //
112 Zombies, //- eat brain //
113 None, //- Vehicle, etc. //
114};
115
116
117//@ TODO Possibly split these into two, AIState - the Alert level state,
118//@ TODO and AITask which would be the current job the AI is trying to do
119UENUM(BlueprintType)
120enum class EAIStateType : uint8
121{
122 Default,
123 Patrol, //- the AI character follows a designated route or area, keeping a vigilant eye for any unusual activities or intruders. They maintain a sense of alertness while monitoring their surroundings and ensuring the designated area remains secure
124 Searching, //- This state occurs when the AI character is actively searching for something specific, such as a missing item, a hidden passage, or a particular individual. They meticulously investigate the surroundings, perform thorough searches, and employ various techniques to locate the desired target or object
125 Protect, //- When in the Protect state, the AI character focuses on safeguarding a specific target or area. This could involve escorting a VIP, defending a valuable asset, or securing a critical location. They actively respond to threats, engage in combat if necessary, and prioritize the protection of the assigned target or area.
126 Hostile, //- the AI character is actively aggressive and ready to engage in combat. They pursue and attack any perceived threats or targets, using their skills and weapons to eliminate adversaries and defend their territory
127 Working, //- character focuses on performing their assigned tasks or duties. This could involve operating ship systems, managing resources, or fulfilling maintenance responsibilities. They carry out their duties efficiently, ensuring the smooth functioning of the ship and its operations.
128 Sleeping, //- character rests and recharges. They find a designated sleeping area, such as crew quarters or sleeping pods, and go through a period of inactivity to restore their energy and stamina.
129 Relaxed, //- character takes a break from their regular duties. They engage in leisure activities, such as reading, listening to music, or enjoying recreational areas on the ship. This state allows them to unwind and rejuvenate before returning to their assigned tasks.
130 Mingle, //- socialize with other crew members, fostering connections and building relationships. They engage in conversations, share stories, and participate in communal activities, contributing to a sense of camaraderie and cohesion among the crew.
131 Investigate, //- This state would be triggered when the AI detects something suspicious or unusual. It would involve the AI moving to the location, examining the area, and potentially alerting others if necessary
132 Alert, //- This state would occur when the AI becomes aware of a potential threat or danger. They would take defensive positions, call for backup, or actively search for the source of the threat.
133 Scavenging, //- In this state, the AI would actively search for resources or valuable items within their environment
134 Training, //- AI characters in this state would be engaged in physical or mental training activities, honing their combat skills, or improving their knowledge and abilities
135 Evading, //- when the AI character is trying to escape or avoid being detected by enemies or pursuing threats
136};
137
138UENUM(BlueprintType)
139enum class ERelationshipStatus : uint8
140{
141 Enemy,
142 Hostile,
144 Neutral,
145 Default,
146 Allied,
147 Friendly,
148};
149
150UENUM(BlueprintType)
151enum class EAlignment : uint8
152{
153 Lawful,
154 Chaotic,
155 Neutral,
156 Good,
157 Evil
158};
159
160// UENUM(BlueprintType)
161// enum class ELookBehavior : uint8
162// {
163// LB_Rotate UMETA(DisplayName="Rotate"),
164// LB_LookAround UMETA(DisplayName="Look Around"),
165// LB_LookUp UMETA(DisplayName="Look Up"),
166// };
167
169static ERelationshipStatus GetRelationship(const float TrustLevel, const float HostilityLevel)
170{
171 //- Hostility is higher or equal than 200.0f OR if Trust is below or equal -100.f //
173 {
175 }
176 //- Hostility is higher or equal than 100.0f OR if Trust is below or equal -40.f //
178 {
180 }
181
182 //- If they have MAX Trust, & No Hostility //
184 {
186 }
187 //- If above 40 Trust, & No Hostility //
189 {
191 }
192 //- If Trust is above or equal 0 & Hostility is Lower or equal than 20 //
194 {
196 }
197 //- Should cover everything else? //
198 //- If Trust is above Hostile (-40.f) & Hostility is Lower than Hostile (100.0f) //
200 {
202 }
204 // //- if Trust is above -40 & Hostility is higher than 100.0f //
205 // if(TrustLevel >= AIRelationShipVars::TrustLevelHostile && HostilityLevel >= AIRelationShipVars::HostilityLevelHostile)
206 // {
207 // return ERelationshipStatus::Hostile;
208 // }
209 // //- if Trust is above -100.0f & Hostility is Higher than 200.0f //
210 // if(TrustLevel >= AIRelationShipVars::TrustLevelEnemy && HostilityLevel >= AIRelationShipVars::HostilityLevelEnemy)
211 // {
212 // return ERelationshipStatus::Enemy;
213 // }
214 // Handle any other case, possibly setting to Default or another status
215}
216
217
218USTRUCT(BlueprintType)
220{
221 GENERATED_BODY()
222
223 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "Stealth")
224 TArray<UAnimMontage*> NonLethalTakedownAnims;
225 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "Stealth")
226 TArray<UAnimMontage*> UnarmedTakedownAnims;
227 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "Stealth")
228 TArray<UAnimMontage*> KnifeTakedownAnims;
229
230
231 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "Stealth")
232 float StealthTakedownDamage = 20000.0f;
233 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "Stealth")
234 float StealthActorDistance = -175.0f;
235 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "Stealth")
236 FName StealthTakedownName = "Stealth_Attack_NonLethal_01";
237
238 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Stealth")
239 AActor* StealthActor = nullptr;
240
241 bool bStealthTakedownAvailable = false;
242 bool bPerformingStealthTakedown = false;
243
244
245
246 class IStealthInterface* StealthActorInterface = nullptr;
247 FTimerHandle StealthTakedownTimerHandle;
248
250 {
251
252 }
253
254 bool SetStealthActor(AActor* Actor)
255 {
256 if(Actor != nullptr)
257 {
258 StealthActor = Actor;
259 IStealthInterface* StealthActorInterfaceRef = Cast<IStealthInterface>(Actor);
260 if(StealthActorInterfaceRef != nullptr)
261 {
262 StealthActorInterface = StealthActorInterfaceRef;
263 return true;
264 }
265 }
266 return false;
267 }
268
269};
270
271
277USTRUCT(BlueprintType)
278struct FFactionRelationship : public FTableRowBase
279{
280 GENERATED_BODY()
281
282
283 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
285
286 //- Faction to Compare to //
287 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
289
290 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
291 float TrustLevel = 0.0f;
292
293 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
294 float HostilityLevel = 0.0f;
295
296 void AddHostility(const float Value)
297 {
298 HostilityLevel += Value;
299 UpdateRelationshipStatus();
300 }
301 void AddTrust(const float Value)
302 {
303 TrustLevel += Value;
304 UpdateRelationshipStatus();
305 }
306
308 {
309 if (TrustLevel >= 100 && HostilityLevel == 0)
310 {
311 RelationshipStatus = ERelationshipStatus::Friendly;
312 }
313 else if (TrustLevel >= 40 && HostilityLevel == 0)
314 {
315 RelationshipStatus = ERelationshipStatus::Allied;
316 }
317 else if (TrustLevel >= 20 && HostilityLevel <= 20)
318 {
319 RelationshipStatus = ERelationshipStatus::Neutral;
320 }
321 else if (TrustLevel == 0 && HostilityLevel >= 40)
322 {
323 RelationshipStatus = ERelationshipStatus::UnFriendly;
324 }
325 else if (TrustLevel <= -40 && HostilityLevel >= 100)
326 {
327 RelationshipStatus = ERelationshipStatus::Hostile;
328 }
329 else if (TrustLevel <= -100 && HostilityLevel >= 200)
330 {
331 RelationshipStatus = ERelationshipStatus::Enemy;
332 }
333 else
334 {
335 // Handle any other case, possibly setting to Default or another status
336 RelationshipStatus = ERelationshipStatus::Default;
337 }
338 }
339
340
341 bool IsHostile() const
342 {
343 if(HostilityLevel >= 100.0f)
344 {
345 return true;
346 }
347 return false;
348 }
349
351 {
352 FFactionRelationship EmptyData;
353 return EmptyData;
354 }
355};
356
357USTRUCT(BlueprintType)
359{
360 GENERATED_BODY()
361
362 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
363 float FearLevel = 0.0f;
364 //- perception
365 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
366 float ReactionTime = 1.0f;
367 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
368 float Accuracy = 1.0f;
369 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
370 float AggressiveLevel = 0.0f;
371 //- higher with lower Intelegence
372 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
373 float RecklessnessLevel = 0.0f;
374 //- perception
375 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
376 float AlertnessLevel = 0.0f;
377 //- Extra Perception //
378 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
379 float KnowledgeOfPlayerLocation = 0.0f;
380};
381
382
383USTRUCT(BlueprintType)
385{
386 GENERATED_BODY()
387
388 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
389 AActor* HostileActor = nullptr;
390 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
391 FVector LastSeenLocation = FVector::ZeroVector;
392
393 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
394 float DetectionLevel = 0.0f;
395 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
396 bool bDetected = false;
397 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
398 bool bInvestigate = false;
399
400 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
401 bool bDead = false;
402
404 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
405 float DamageReceivedByOwner = 0.0f;
406
408 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
409 float DamageDealtToOwner = 0.0f;
410 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
411 float VisibilityScore = 0.0f;
412 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
413 float TotalScore = 0.0f;
414
415 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
416 float TrustScore = 0.0f;
417 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
418 float HostilityScore = 100.0f;
419
420 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
421 float TrustDecreaseFactor = 10.0f;
422 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
423 float HostilityIncreaseFactor = 0.2f;
424
426 {
427
428 };
429 explicit FHostileActorInfo(AActor* Actor)
430 {
431 HostileActor = Actor;
432 };
433 explicit FHostileActorInfo(AActor* Actor, const FFactionRelationship& Relationship)
434 {
435 HostileActor = Actor;
436 TrustScore = Relationship.TrustLevel;
437 HostilityScore = Relationship.HostilityLevel;
438 };
439
440 //- Tracks how much Damage Owner has done to this character //
441 void AddDamageReceivedByOwner(const float Value)
442 {
443 DamageReceivedByOwner += Value;
444 //@TODO current doesn't do anything.
445 }
446
447
448 //- Tracks how much Damage the character has done, Also Adds Detection Level if not Yet Detected //
449 void AddDamageDealtToOwner(const float Value)
450 {
451 DamageDealtToOwner += Value;
452
453 // if(!bDetected)
454 // {
455 // AddDetection(Value, MaxDetection, InvestigateDetection);
456 // }
457
458 //- @TODO Figure out formula for trust changing //
459 TrustScore -= ((DamageDealtToOwner / TrustDecreaseFactor));
460 HostilityScore += (DamageDealtToOwner / HostilityIncreaseFactor);
461 // / (abs(TrustScore) / 100.0f)
462
463 //- Scales, moves slower around 100 and -100 //
464 // const float TrustFactor = abs(MaxTrust / (TrustScore + 0.1f));
465 // FMath::Clamp(TrustFactor, 0.0, 0.0);
466
467
468
469 // const float DecreaseScore = abs(TrustDecreaseFactor * (MaxTrust / (TrustScore + 0.1)) * DamageDealt);
470 // TrustScore -= (DecreaseScore * Value);
471
472
473
474 //- Max Trust = 100.0f
475 // TrustScore = (0.1f + (MaxTrust - TrustScore) / TrustDecreaseFactor) * DamageDealt;
476 }
477 void AddHostility(const float Value)
478 {
479 HostilityScore += Value;
480 }
481
482 void AddVisibility(const float Value)
483 {
484 VisibilityScore += Value;
485 }
486 void AddDetection(const float Value, const float MaxDetection, const float InvestigateDetection)
487 {
488 DetectionLevel += Value;
489 if(DetectionLevel >= InvestigateDetection)
490 {
491 bInvestigate = true;
492 }
493 if(DetectionLevel >= MaxDetection)
494 {
495 bDetected = true;
496 }
497 if(DetectionLevel < 0.0f)
498 {
499 DetectionLevel = 0.0f;
500 }
501 //- Only Save on Increase //
502 if(Value >= 0 && HostileActor != nullptr)
503 {
504 LastSeenLocation = HostileActor->GetActorLocation();
505 }
506 }
508 {
509 if(HostileActor == nullptr){return;}
510 LastSeenLocation = HostileActor->GetActorLocation();
511 }
512
513 void LostTarget(const float InvestigateDetection)
514 {
515 DetectionLevel = InvestigateDetection;
516 bInvestigate = true;
517 }
518
520 {
521 DetectionLevel = 0.0f;
522 bInvestigate = false;
523 bDetected = false;
524 }
525
526
528 {
529 const FHostileActorInfo EmptyData;
530 return EmptyData;
531 }
533 {
534 return HostileActor == Other.HostileActor;
535 }
538 bool IsValid() const
539 {
540 return HostileActor != nullptr;
541 }
542 //@TODO check these, Make Global vars for Numbers
543 bool IsHostile() const
544 {
546 {
547 return true;
548 }
549 return false;
550 }
551 bool IsFriendly() const
552 {
554 {
555 return true;
556 }
557 return false;
558 }
559 bool IsAllied() const
560 {
561 if(TrustScore >= 40.0f && HostilityScore <= 20.0f)
562 {
563 return true;
564 }
565 return false;
566 }
567 bool IsNeutral() const
568 {
569 if(TrustScore <= 0.0f && HostilityScore >= 40.0f)
570 {
571 return true;
572 }
573 return false;
574 }
575
577 {
578 return GetRelationship(TrustScore, HostilityScore);
579 }
580
581 FVector GetLocation() const
582 {
583 if(HostileActor == nullptr && !LastSeenLocation.IsNearlyZero()){return LastSeenLocation;}
584 if(HostileActor == nullptr){return FVector::ZeroVector;}
585 return HostileActor->GetActorLocation();
586 }
587
588
589 // bool IsEnemy() const
590 // {
591 // if(TrustScore <= -100.0f && HostilityScore >= 200.0f)
592 // {
593 // return true;
594 // }
595 // return false;
596 // }
597
598
599};
600
601
602USTRUCT(BlueprintType)
603struct FFactionRelationshipTotal : public FTableRowBase
604{
605 GENERATED_BODY()
606
607 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
609 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
610 TArray<FFactionRelationship> Relationships;
611
613 {
615 return EmptyData;
616 }
617
618};
619
620
621USTRUCT(BlueprintType)
622struct FFactionData: public FTableRowBase
623{
624 GENERATED_BODY()
625
626 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
628 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
629 float Strength = 50.0f;
630 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
631 int32 Members = 100;
632 //- Army size //
633 //- Weapons //
634};
635
636
637//- How One Faction is Seen by Player //
638USTRUCT(BlueprintType)
639struct FFactionStats: public FTableRowBase
640{
641 GENERATED_BODY()
642
643 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
645
646 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
647 float TrustLevel = 0.0f;
648 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
649 float HostilityLevel = 0.0f;
650 //- Will Improve or harm players standing with factions
651 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
652 float ReputationPoints = 0.0f;
653 //- How much Completing Quests for or against influences reputation //
654 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
655 float QuestInfluenceMultiplier = 0.0f;
656 //- Affects Dialogue options, unlocks quests and info //
657 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
658 float DialogueInfluence = 0.0f;
659
660 // TMap<EFactionType, FFactionRelationship> OtherFactionRelationships;
661
662 //TArray<FPerks> EarnedPerks
663
664 // bool IsHostile(const FFactionStats& Other) const
665 // bool IsHostile() const
666 // {
667 // if(HostilityLevel >= 100.0f)
668 // {
669 // return true;
670 // }
671 // return false;
672 // }
673
674 // bool IsFaction(const FFactionStats& Other) const
675 // {
676 // return FactionType == Other.FactionType;
677 // }
678};
679
680
681
682// https://forums.unrealengine.com/t/how-do-i-use-the-ai-perception-teams/120837/2
683// UENUM(BlueprintType)
684// enum class EGameTeam : uint8
685// {
686// Neutral, //Everyone ignores this team
687// RedTeam,
688// BlueTeam,
689// TeamA,
690// TeamB
691// };
692//
693// USTRUCT(BlueprintType)
694// struct FTeamAttitude
695// {
696// GENERATED_BODY()
697// public:
698// UPROPERTY(BlueprintReadWrite, EditAnywhere)
699// TArray<TEnumAsByte<ETeamAttitude::Type>> Attitude;
700//
701// FTeamAttitude() {};
702//
703// FTeamAttitude(std::initializer_list<TEnumAsByte<ETeamAttitude::Type>> attitudes):
704// Attitude(std::move(attitudes))
705// { };
706// };
707
708
709USTRUCT(BlueprintType)
711{
712 GENERATED_BODY()
713
714 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
715 TSubclassOf<APawn> ActorToSpawn;
716 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
717 int32 AmountToSpawn = 1;
718 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
719 float InitialDelay = 0.2f;
720 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
721 float TimeBetweenSpawnsMin = 1.0f;
722 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
723 float TimeBetweenSpawnsMax = 10.0f;
724
725 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
726 FString CharacterName = "Default Name";
727
728
729 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
731 //- Where should the AI stand?
732 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Location")
733 AActor* StationaryLocation = nullptr;
734 //- What path should the AI follow?
735 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Location")
736 TArray<AActor*> PathLocations;
737 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Location")
738 bool bUseSpawnLocations = false;
739 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Location")
740 bool bUseSpawnLocationsGlobal = false;
741 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Location", meta=(EditCondition=bUseSpawnLocations))
742 TArray<FVector> SpawnLocations;
743 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Random")
744 bool bUseRandomSpawnNumber = false;
745 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Random")
746 int32 SpawnMin = 0;
747 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Random")
748 int32 SpawnMax = 1;
749
750};
751
752// USTRUCT(BlueprintType)
753// struct FActorPerceptionInfoBP
754// {
755// GENERATED_BODY()
756//
757//
758// TWeakObjectPtr<AActor> Target;
759//
760// // TArray<FAIStimulus> LastSensedStimuli;
761//
762// /** if != MAX indicates the sense that takes precedense over other senses when it comes
763// to determining last stimulus location */
764// // FAISenseID DominantSense;
765//
766// /** indicates whether this Actor is hostile to perception holder */
767// uint32 bIsHostile : 1;
768//
769// // FActorPerceptionInfo(AActor* InTarget = NULL)
770// // : Target(InTarget), DominantSense(FAISenseID::InvalidID())
771// // {
772// // LastSensedStimuli.AddDefaulted(FAISenseID::GetSize());
773// // }
774//
775// /** Retrieves last known location. Active (last reported as "successful")
776// * stimuli are preferred. */
777// // FVector GetLastStimulusLocation(float* OptionalAge = NULL) const
778// // {
779// // FVector Location(FAISystem::InvalidLocation);
780// // float BestAge = FLT_MAX;
781// // bool bBestWasSuccessfullySensed = false;
782// // for (int32 Sense = 0; Sense < LastSensedStimuli.Num(); ++Sense)
783// // {
784// // const float Age = LastSensedStimuli[Sense].GetAge();
785// // const bool bWasSuccessfullySensed = LastSensedStimuli[Sense].WasSuccessfullySensed();
786// //
787// // if (Age >= 0 && (Age < BestAge
788// // || (bBestWasSuccessfullySensed == false && bWasSuccessfullySensed)
789// // || (Sense == DominantSense && bWasSuccessfullySensed)))
790// // {
791// // BestAge = Age;
792// // Location = LastSensedStimuli[Sense].StimulusLocation;
793// // bBestWasSuccessfullySensed = bWasSuccessfullySensed;
794// //
795// // if (Sense == DominantSense && bWasSuccessfullySensed)
796// // {
797// // // if dominant sense is active we don't want to look any further
798// // break;
799// // }
800// // }
801// // }
802// //
803// // if (OptionalAge)
804// // {
805// // *OptionalAge = BestAge;
806// // }
807// //
808// // return Location;
809// // }
810//
811// /** it includes both currently live (visible) stimulus, as well as "remembered" ones */
812// // bool HasAnyKnownStimulus() const
813// // {
814// // for (const FAIStimulus& Stimulus : LastSensedStimuli)
815// // {
816// // // not that WasSuccessfullySensed will return 'false' for expired stimuli
817// // if (Stimulus.IsValid() && (Stimulus.WasSuccessfullySensed() == true || Stimulus.IsExpired() == false))
818// // {
819// // return true;
820// // }
821// // }
822// //
823// // return false;
824// // }
825//
826// /** Indicates currently live (visible) stimulus from any sense */
827// // bool HasAnyCurrentStimulus() const
828// // {
829// // for (const FAIStimulus& Stimulus : LastSensedStimuli)
830// // {
831// // // not that WasSuccessfullySensed will return 'false' for expired stimuli
832// // if (Stimulus.IsValid() && Stimulus.WasSuccessfullySensed() == true && Stimulus.IsExpired() == false)
833// // {
834// // return true;
835// // }
836// // }
837// //
838// // return false;
839// // }
840//
841// // /** Retrieves location of the last sensed stimuli for a given sense
842// // * @param Sense The AISenseID of the sense
843// // *
844// // * @return Location of the last sensed stimuli or FAISystem::InvalidLocation if given sense has never registered related Target actor or if last stimuli has expired.
845// // */
846// // FORCEINLINE FVector GetStimulusLocation(FAISenseID Sense) const
847// // {
848// // return LastSensedStimuli.IsValidIndex(Sense) && (LastSensedStimuli[Sense].IsValid() && (LastSensedStimuli[Sense].IsExpired() == false)) ? LastSensedStimuli[Sense].StimulusLocation : FAISystem::InvalidLocation;
849// // }
850//
851// /** Retrieves receiver location of the last sense stimuli for a given sense
852// * @param Sense The AISenseID of the sense
853// *
854// * @return Location of the receiver for the last sensed stimuli or FAISystem::InvalidLocation if given sense has never registered related Target actor or last stimuli has expired.
855// */
856// FORCEINLINE FVector GetReceiverLocation(FAISenseID Sense) const
857// {
858// return LastSensedStimuli.IsValidIndex(Sense) && (LastSensedStimuli[Sense].IsValid() && (LastSensedStimuli[Sense].IsExpired() == false)) ? LastSensedStimuli[Sense].ReceiverLocation : FAISystem::InvalidLocation;
859// }
860//
861// UE_DEPRECATED(4.23, "This method is identical to IsSenseActive and will be removed in future versions. Please use IsSenseActive to check for a currently active stimuli or HasKnownStimulusOfSense for an active or remembered stimuli.")
862// FORCEINLINE bool IsSenseRegistered(FAISenseID Sense) const
863// {
864// return LastSensedStimuli.IsValidIndex(Sense) && LastSensedStimuli[Sense].IsActive();
865// }
866//
867// /** Indicates a currently active or "remembered" stimuli for a given sense
868// * @param Sense The AISenseID of the sense
869// *
870// * @return True if a target has been registered (even if not currently sensed) for the given sense and the stimuli is not expired.
871// */
872// FORCEINLINE bool HasKnownStimulusOfSense(FAISenseID Sense) const
873// {
874// return LastSensedStimuli.IsValidIndex(Sense) && (LastSensedStimuli[Sense].IsValid() && (LastSensedStimuli[Sense].IsExpired() == false));
875// }
876//
877// /** Indicates a currently active stimuli for a given sense
878// * @param Sense The AISenseID of the sense
879// *
880// * @return True if a target is still sensed for the given sense and the stimuli is not expired.
881// */
882// FORCEINLINE bool IsSenseActive(FAISenseID Sense) const
883// {
884// return LastSensedStimuli.IsValidIndex(Sense) && LastSensedStimuli[Sense].IsActive();
885// }
886//
887// /** takes all "newer" info from Other and absorbs it */
888// void Merge(const FActorPerceptionInfo& Other);
889// };
890//
EAIResponse
Definition AIDataTypes.h:47
EAlignment
Definition AIDataTypes.h:152
EAIMovementSpeed
Definition AIDataTypes.h:84
static ERelationshipStatus GetRelationship(const float TrustLevel, const float HostilityLevel)
Definition AIDataTypes.h:169
EAIStateType
Definition AIDataTypes.h:121
EAIMovementType
Definition AIDataTypes.h:93
ERelationshipStatus
Definition AIDataTypes.h:140
DECLARE_LOG_CATEGORY_EXTERN(LogAIToolKit, Display, All)
EAISense
Definition AIDataTypes.h:60
ECharacterType
Definition AIDataTypes.h:73
EFactionType
Definition AIDataTypes.h:103
Definition StealthInterface.h:17
Definition AIDataTypes.h:14
float HostilityLevelFriendly
Definition AIDataTypes.h:20
float HostilityLevelAllied
Definition AIDataTypes.h:25
float TrustLevelFriendly
Definition AIDataTypes.h:18
float HostilityLevelHostile
Definition AIDataTypes.h:35
float HostilityLevelNeutral
Definition AIDataTypes.h:30
float TrustLevelHostile
Definition AIDataTypes.h:33
float TrustLevelEnemy
Definition AIDataTypes.h:38
float HostilityLevelEnemy
Definition AIDataTypes.h:40
float TrustLevelAllied
Definition AIDataTypes.h:23
float TrustLevelNeutral
Definition AIDataTypes.h:28
Definition AIDataTypes.h:711
Definition AIDataTypes.h:359
Definition AIDataTypes.h:623
Definition AIDataTypes.h:279
float HostilityLevel
Definition AIDataTypes.h:294
void UpdateRelationshipStatus()
Definition AIDataTypes.h:307
bool IsHostile() const
Definition AIDataTypes.h:341
void AddTrust(const float Value)
Definition AIDataTypes.h:301
float TrustLevel
Definition AIDataTypes.h:291
static FFactionRelationship Empty()
Definition AIDataTypes.h:350
Definition AIDataTypes.h:604
Definition AIDataTypes.h:640
Definition AIDataTypes.h:385
ERelationshipStatus GetRelationshipStatus() const
Definition AIDataTypes.h:576
void AddVisibility(const float Value)
Definition AIDataTypes.h:482
bool operator==(const FHostileActorInfo &Other) const
Definition AIDataTypes.h:532
void AddDamageDealtToOwner(const float Value)
Definition AIDataTypes.h:449
bool IsAllied() const
Definition AIDataTypes.h:559
FHostileActorInfo(AActor *Actor, const FFactionRelationship &Relationship)
Definition AIDataTypes.h:433
bool IsHostile() const
Definition AIDataTypes.h:543
void LostTarget(const float InvestigateDetection)
Definition AIDataTypes.h:513
void AddDetection(const float Value, const float MaxDetection, const float InvestigateDetection)
Definition AIDataTypes.h:486
FVector GetLocation() const
Definition AIDataTypes.h:581
void ClearDetection()
Definition AIDataTypes.h:519
bool IsValid() const
Definition AIDataTypes.h:538
void AddDamageReceivedByOwner(const float Value)
Definition AIDataTypes.h:441
static FHostileActorInfo Empty()
Definition AIDataTypes.h:527
bool IsNeutral() const
Definition AIDataTypes.h:567
FHostileActorInfo(AActor *Actor)
Definition AIDataTypes.h:429
void LostSightOnTarget()
Definition AIDataTypes.h:507
void AddHostility(const float Value)
Definition AIDataTypes.h:477
bool IsFriendly() const
Definition AIDataTypes.h:551
Definition AIDataTypes.h:220
bool SetStealthActor(AActor *Actor)
Definition AIDataTypes.h:254