-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
created initial setup and algo for agg system #7
base: master
Are you sure you want to change the base?
Conversation
UFUNCTION(BlueprintImplementableEvent, Category = "Aggressive") | ||
bool OnTurnCalm(); | ||
|
||
// helper func to determine the AI's priority. The priority is usually set manually depending on the AI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is also set based on distance. i.e the designer could say that a draugr's priority at 5 meters away from the target is 10 but at 100 meters the priority is 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That value is determined on the Bot's side. This function just returns it
|
||
// helper func to tell how many tokens does an AI take. | ||
UFUNCTION(BlueprintImplementableEvent, Category = "Aggressive") | ||
int32 GetTokenTax(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A static number that a designer could set on the Bot's side. Usually, the Tax should never change during the runtime of the game
|
||
// helper func to determine if the actor is in a state that would prevent them from becoming aggressive | ||
UFUNCTION(BlueprintImplementableEvent, Category = "Aggressive") | ||
bool CanBecomeAggressive(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evaluated Bot Side. Examples when the AI cannot become aggressive: Stunned
, Dead
, Stuck
, etc.
|
||
} | ||
|
||
// heapify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really necessary to heapify. I could just sort them based on their priority and be done with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have some minimal change request but overall looks like a good start to me.
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. | ||
PrimaryActorTick.bCanEverTick = true; | ||
IConsoleManager::Get().RegisterConsoleVariable( | ||
TEXT("nujas.AI"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this into a static variable to avoid magic string (i,e, on line 31). I would make it a const string. Also I would recommend using nujas.ai
instead, make it faster to type on console lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use a static variable for it, but it actually wouldn't end up registering the variable :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try with just a string CV_NUJAS_AI = "nujas.AI" and pass that into TEXT(CV_NUJAS_AI) and see if that works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think you should register console var outside of onbegin play to avoid multiple instance. We don't want to register it multiple time:
#include "NujasAIGlobals.generated.h" | ||
|
||
UINTERFACE(Blueprintable) | ||
class NUJASAI_API UAggressive : public UInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a total of 96 results for : public UInterface
https://github.com/EpicGames/UnrealEngine/search?q=%22+%3A+public+UInterface%22&unscoped_q=%22+%3A+public+UInterface%22
There are 59 resutls for Interface : public UInterface
https://github.com/EpicGames/UnrealEngine/search?q=%22Interface+%3A+public+UInterface%22&unscoped_q=%22Interface+%3A+public+UInterface%22
This shows that the naming convention with the variable name postfixed with Interface
is the majority
Since the PlatformInterface we have is also using the majority convention: https://github.com/nujas/TheJanusFramework/blob/f7f455342b102c86f840e0c201f9d1dbb2295e33/Source/NujasCore/Public/PlatformInfoInterface.h
I would suggest rename this to UAggressiveInterface
|
||
#pragma once | ||
|
||
#include "UserWidget.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I would recommend using Blueprint/UserWidget.h like in the doc:
https://docs.unrealengine.com/en-US/API/Runtime/UMG/Blueprint/UUserWidget/index.html
Just to give it a bit more clarity that this is a BP class.
Aggression System SETUP
This PR should not be merged yet.
AI Module + Aggressive Score Component
Created an actor component that will be attached to a character against which the aggressive AIs will be evaluated.
The algorithm is written out in the cpp and will be removed after completion
Aggression Interface
Created an Aggression interface that will be attached to a type of bot that is capable of going aggressive
Allows each AI type to define their own token tax and distance-based priority which is crucial to be changed by designers
Debug Module
Widget Module
NujasWidget