x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I use the FGameplayTagContainer and Tag Editor?

So I found this very nice module and I have two questions:

  1. Is it finished ? The editor part seem lack of the ability to actually add tags.

  2. Or tags are added by other means. If so, how ?

Product Version: Not Selected
Tags:
more ▼

asked May 09 '14 at 04:21 PM in C++ Programming

avatar image

iniside
1.4k 89 84 171

avatar image scha Jan 27 '16 at 02:16 PM

Did someone managed to use gameplay tags? We managed to import them and see them in BT nodes, but no idea how to add them to actors.

avatar image Simone13 Mar 25 '16 at 10:08 AM

Almost two years later. No updated info anywhere on if or how Gameplay Tags work?

avatar image Dave Ratti ♦♦ STAFF Jun 30 '16 at 01:57 PM

The tag system is a little hard to get into, but is pretty powerful. I apologize this isn't more user friendly, but this is what I would recommend:

In your DefaultEngine.ini, add this:

[GameplayTags] ImportTagsFromConfig=true

This allows tags to be created in the editor and saved to an ini file, DefaultGameplayTags.ini. The other option is to import them from FGameplayTagTableRow data tables. This is harder to setup though and I think the .ini approach is superior.

With ImportTagsFromConfig enabled, you should be able to add tags directly in the editor. Edit -> Project Settings -> GameplayTags. You can also add or remove them inline when editing a GameplayTag or GameplayTagContainer property.

Tags themselves are very generic and can be used for a lot of different things. The basic idea is that they are strings with a hierarchical relationship. E.g., they can have a parent. An example tag would be "A.B.C" or "Damage.Physical.Pierce". That is really all tags are themselves. They hold no other data on their own.

avatar image Dave Ratti ♦♦ STAFF Jun 30 '16 at 01:57 PM

There is functionality for querying tags. For example, you could say something like "If I take Damage.Physical.* damage, do X". Which would match on Damage.Physical.Pierce but not Damage.Magic.Fire.

Tags can be dealt with individually (FGameplayTag) or in containers (FGameplayTagContainer). So for example, you could have a container describing a spell and then write a query that, by looking at the spell's tag container, acts on "spells that have Damage.Magic.Fire AND SpellRange.AOE tags".

That is basically it for tags themselves. They are used in lots of places. In the ability system for example, tags are pretty important:

They can describe GameplayEffect assets ("This will set you on fire"). They can be granted by GameplayEffects to things with Ability System Component ("This person is now on fire"). They can be used to specify requirement for activating abilities (E.g, must not have "Status.Fire" to activate the ability). They are used to invoke GameplayCue events (which do cosmetic, client side things like spawn particles. E.g, GameplayCue.Fire).

In Paragon we also use them for very specific Paragon things. We tag our heroes with tags in order to see what roles or affinities they can use.

Hope that helps!

avatar image Meristic Sep 07 '16 at 01:45 PM

Can you at least describe the import process using FGameplayTagTableRows? Also, is there any way to limit the scope of the tag editor to a specific set of parent tags via metadata? Obviously there's manual filtering, but this doesn't allow programmers to limit the scope of what tags 'should' be used to designers.

This thread is literally the only documentation for using Gameplay Tags whatsoever. Does this mean we probably shouldn't be utilizing them, as they're not fully supported? I like the hierarchical set up of this system and the ability to set-up well-defined per-project tags that are centralized, but we could probably develop a similarly capable system if it's not fully online.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Sorry for the confusion guys - GameplayTags are a separate, unrelated system to Actor Tags. GameplayTags is a more advanced/robust system but requires data assets to populate the tag lists. We haven't written any docs or tutorials on GameplayTags yet.

To create tags in the editor you need to import them from a CSV file. They cannot be edited/created directly in the editor (for now at least). To import from a CSV, you need to right click in the content browser and select import, then locate a .CSV with tag data (see below), select DataTable -> GameplayTagTable.

Here is an example for the GameplayTagTable format. Internally we use Excel to maintain these tables and export them as CSVs with macros. Again this is stuff our game teams have been using but not really a feature of the engine that has been given much polish for outside consumption. Over time we expect this to evolve into a more user friendly system.

 ,Tag,CategoryText
 0,Damage.Burning,
 1,Damage.Poison,
 2,Damage.Ice,
 3,Cooldown.Global,
 4,Cooldown.TestAbility,
 5,ResouceCost.Mana.TestAbility,

Save that into a .CSV - you should be able to import it into the engine.

more ▼

answered May 11 '14 at 02:47 AM

avatar image

Dave Ratti ♦♦ STAFF
213 6 3 7

avatar image Dave Ratti ♦♦ STAFF May 11 '14 at 02:52 AM

Sorry, forgot more. The idea is that you have 1 dictionary of gameplay tags (added/imported like above). Somewhere in your game code on startup, you need to tell the GameplayTags system. Something like this:

 IGameplayTagsModule& GameplayTagsModule =  IGameplayTagsModule::Get();
     GameplayTagsModule.GetGameplayTagsManager().LoadGameplayTagTable(GameplayTagTableName);


This needs to be done at editor startup too... so the correct way is to make a UEngine subclass for your game. But that is a lot of steps. It is probably easiest to stick the above line somewhere in UEngine::Init.

avatar image iniside May 15 '14 at 06:05 PM

Thanks. That means I have to build engine from source ? Not an big deal for me, but seems bit daunting to put such specific game thing, this high in engine hierarchy.

In any case I started using this module, for my project and I must say it is extremely useful I love it. Would love it even more if the ability to add tags was easier, preferably directly in editor (:.

avatar image Dave Ratti ♦♦ STAFF May 15 '14 at 06:22 PM

Yeah, future versions will make this easier. Technically you don't need to build engine source - you can subclass UEngine and UEditorEngine in your project and do your dictionary loading in UYourGameEngine::Init().

The problem isn't trivial since the global dictionary needs to be loaded before your game assets try to load (or rather, the dictionary needs to be specified since references to tags in your dictionary only store the index into the dictionary, not a reference to the dictionary itself).

As this system was brought up in our projects which already had their own UEngine/UEditorEngine subclasses, it was easy to specify the global dictionaries there. For smaller team projects where they won't need to their own engine subclasses, we will need to find a better way of loading the global dictionary.

Edit - Index is actually wrong. I believe tags are stored as text but they need to resolve to a stable index independent of load order. A solvable problem in many ways, the easiest being right now to specify a dictionary before loading any.

avatar image iniside May 15 '14 at 10:34 PM

I downloaded new preview build (4.2) and tried to to actually include GameplayTags in GameEngine.cpp Init function.

But seems like I have trouble to get it working.I tried adding "GameplayTags", in Engine.Build.cs in various places (DynamicallyLoaded, Private, Public), As well ad adding public and private IncludePaths.

I somehwat managed to compile it but then:

Classes/GameplayTagsManager.h(5): fatal error C1083: Cannot open include file: 'GameplayTagsManager.generated.h'

Could explain in few words what's wrong ?

avatar image Dave Ratti ♦♦ STAFF May 15 '14 at 11:19 PM

Did the file get generated and just can't be found, or is it not getting generated? It would be here:

Engine\Intermediate\Build\Win64\Inc\GameplayTags\GameplayTagContainer.generated.h

avatar image iniside May 16 '14 at 05:46 AM

It got generated it just Couldn't be found. Now I changed few things and I have link error, here is exact setup I'm using right now: Engine.build.cs:

     PrivateIncludePathModuleNames.AddRange(
         new string[] {
             (...)
         "GameplayTags"
         }

 PublicIncludePaths.AddRange(
 new string[] {
         "Runtime/GameplayTags/Public"
                     // ... add public include paths required here ...
                 }
 );

     PrivateIncludePaths.AddRange(
         new string[] {
             (..)
         "Runtime/GameplayTags/Private"
         }
     );


in GameEngine.cpp:

 #include "GameplayTagsModule.h"
 #include "GameplayTags.h"


 void UGameEngine::Init(IEngineLoop* InEngineLoop)
 {
     DECLARE_SCOPE_CYCLE_COUNTER(TEXT("UGameEngine Init"), STAT_GameEngineStartup, STATGROUP_LoadTime);
 
     // Call base.
     UEngine::Init(InEngineLoop);
 
     //GameplayTags:
     IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get();
     GameplayTagsModule.GetGameplayTagsManager().LoadGameplayTagTable("Tags");


Module.Engine.9_of_44.cpp.obj : error LNK2019: unresolved external symbol "public: class UDataTable const __cdecl UGameplayTagsManager::LoadGameplayTagTable(class FString)" (?LoadGameplayTagTable@UGameplayTagsManager@@QEAAPEBVUDataTable@@VFString@@@Z) referenced in function "public: virtual void __cdecl UGameEngine::Init(class IEngineLoop )" (?Init@UGameEngine@@UEAAXPEAVIEngineLoop@@@Z)

edit:I changed where the "GameplayTags" is to:

     DynamicallyLoadedModuleNames.AddRange(
         new string[]
         {
                 (..)
         "GameplayTags"
         }
     );

I get this error: GameplayTagAssetInterface.h(5): fatal error C1083: Cannot open include file: 'GameplayTagAssetInterface.generated.h': No such file or directory

And the file is in Intermediate folder.

avatar image Dave Ratti ♦♦ STAFF May 16 '14 at 01:46 PM

Can you try just adding "GameplayTags" to the PublicDependencyModuleNames array?

I am not an expert on the UnrealBuiltTool chain. Its a very odd problem though. The intermediate directories should be auto included. If the above doesn't do anything I will get someone with more UBT knowledge to help.

avatar image iniside May 16 '14 at 03:27 PM

When I add it to PublicDependencyModuleNames I get huge list of unresolved dependencies, and it don't it even start compilation.

avatar image Dave Ratti ♦♦ STAFF May 16 '14 at 06:12 PM

Err yeah, that is probably introducing a cyclic dependency. Sorry, I've never set up a project like this. You may need to subclass UEngine for your project. I can noodle with this a bit if I get time this weekend, or you may just want to wait until this is a more polished/complete module.

avatar image iniside May 16 '14 at 06:24 PM

It would nice if you could post crash course to what is needed to implement custom engine class. Which functions to overload and how to get the custom engine class load. From that point I should be able to just rewrite engine class from source. It's not pressing, but I'd really like to get it working.

In any case thanks for your help!

avatar image iniside May 17 '14 at 09:26 AM

Ok My previous issue is solved. I managed to override engine classes. Wasn't that hard after all, I just specified wrong paths to classes in DefaultEngine.ini in my project.

I added in init section:

 IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get();
 GameplayTagsModule.GetGameplayTagsManager().LoadGameplayTagTable("Tags'");

But it seems like It doesn't work.

I have this Table of tags (thanks for sample data!) DataTable'/Game/Blueprints/Tags.Tags'

And in LoadGameplayTagsTable I tried few variations, including full path Tags.Tags, just Tags, but it seems like my table is not loaded

I have debugged it and it seems like LoadGameplayTagTable, can't find my table.

Is there anything special, about where that data should be stored, or how should I specify path to it ?

avatar image Dave Ratti ♦♦ STAFF May 19 '14 at 01:31 PM

You'll need to specify the full path. So try:

GameplayTagsModule.GetGameplayTagsManager().LoadGameplayTagTable("/Game/Blueprints/Tags.Tags'");

avatar image iniside May 19 '14 at 03:50 PM

Hm it seems, like tags are not loaded. I fallowed debug, and function is fired, but it seems it can't resolve the path for asset and do not read tags from file.

Unless it is intended behavior that tags do not show up, when I click Edit button in editor ?

Edit:

After re importing assets, tags show, in the tag editor. So I guess it is bug.

avatar image Dave Ratti ♦♦ STAFF May 19 '14 at 08:55 PM

So when UGameplayTagsManager::LoadGameplayTagTable is getting called, and the call to LoadObject is failing? That would be the thing to debug. I would suspect its either not finding the asset or its not recognizing the asset as a DataTable type. Both seem unlikely =\

avatar image iniside Jul 01 '14 at 04:55 PM

Hey I repoen the issue. As of version 4.3 (the preview release from github), the tags are still not loading on startup.

Here is my code from my custom editor engine class:

 void UAREditorEngine::Init(IEngineLoop* InEngineLoop)
 {
     Super::Init(InEngineLoop);
     //DataTable'/Game/Blueprints/Data/GameTags.GameTags'
     IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get();
     FString Tags = "DataTable'/Game/Blueprints/Data/GameTags.GameTags'";
     TArray<FString> TagsList;
     TagsList.Add(Tags);
     GameplayTagsModule.GetGameplayTagsManager().LoadGameplayTagTables(TagsList);
 }

And tags are not loaded upon editor startup. The workaround I'm aware of for now is to, manualy reimport tags table, so they get loaded properly.

avatar image Ixiguis Nov 06 '15 at 12:28 PM

Hey,

I wonder if there has been any changes to this gameplay tags system?

I noticed you can now create Data Tables directly in the editor (rather than importing a csv file), but it still seems overly complicated to get those Data Tables loading into Gameplay Tags. I didn't manage to extend UEngine and UEditorEngine (actually, I couldn't get the engine to use my extended classes rather than the default, even after changing DefaultEngine.ini). Trying to modify from source directly now.

I need this for behavior trees: the Run Behavior Dynamic task requires Gameplay Tags.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

How can I add GameplayTag to an Actor? I cant find any interface or function to actually do that.

more ▼

answered Sep 16 '16 at 12:29 PM

avatar image

intoxicat3
593 65 79 140

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Actors should have Tags array that is accessed via C++ and blueprints, i believe.

You can add tags via Defaults tab in blueprint editor or inside Details panel by going to Actor category and expanding it, you'll see the same Tags property.

more ▼

answered May 09 '14 at 04:59 PM

avatar image

BiggestSmile
1.5k 51 32 102

avatar image iniside May 09 '14 at 05:21 PM

It's now what I have in mind here. This is what I'm talking about: Engine/Source/Runtime/GameplayTags

avatar image Hyperloop May 10 '14 at 05:33 AM

I can't seem to add tags to an asset unless it's actually ON the map - is it possible to add tags to a static mesh or the like even if it's not on the map? I'd like to be able to do that so I can check for these tags when manipulating the object in a construction script.

avatar image BiggestSmile May 10 '14 at 08:37 AM

alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question