Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DennisSSDev
Copy link
Member

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

  • Created a Debug module that will be used for future real-time debug draws and widget displays.
  • Should not be used for in-editor windows. Only runtime debug windows and 3D vis.

Widget Module

  • Created a Widget module that will store all the generic widgets associated with the Janus Framework.
  • If you want to create a BP widget associated with the Janus Framework, it must inherit from the given abstract NujasWidget

@DennisSSDev DennisSSDev added the enhancement New feature or request label Sep 17, 2019
@DennisSSDev DennisSSDev requested a review from louisgv September 17, 2019 04:25
@DennisSSDev DennisSSDev self-assigned this Sep 17, 2019
UFUNCTION(BlueprintImplementableEvent, Category = "Aggressive")
bool OnTurnCalm();

// helper func to determine the AI's priority. The priority is usually set manually depending on the AI
Copy link
Member Author

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.

Copy link
Member Author

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();
Copy link
Member Author

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();
Copy link
Member Author

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
Copy link
Member Author

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

Copy link
Member

@louisgv louisgv left a 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"),
Copy link
Member

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.

Copy link
Member Author

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 :/

Copy link
Member

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?

Copy link
Member

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:

https://github.com/ProjectBorealis/PBCharacterMovement/blob/master/Source/PBCharacterMovement/Private/Character/PBPlayerMovement.cpp#L17-L18

#include "NujasAIGlobals.generated.h"

UINTERFACE(Blueprintable)
class NUJASAI_API UAggressive : public UInterface
Copy link
Member

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"
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants