I don't have a ton of bools on my character blueprint, so they work well for me. I love how I can directly see the names and know what they do instantly, and can right click and find references to easily see where they're being used, no extra steps or anything needed. I can see though your system would be great for a heavier game project
yeah, you shouldn't use tags as a replacement for every bool. but if there are bools that can make use of the parent/child structure tags have, or bools that are present on multiple different classes, it's worth doing. With tags you can read and write them to actors without needing to cast, unlike a bool too which is a huge upside. All heavily depends on context which option is the best to implement though
@@thegamedevcave There is also a cool decorator in the behavior tree called "Gameplay Tag Condition" which will make a task run depending on whether the target actor has a specific gameplay tag on it or no
Just starting out and I was already hoping that there would be a better way to clean up my variable space. I had no idea this existed. Thank you so much!
Thanks for explaining this! I've always been curious about tags, but haven't had a reason to use them yet. Also, thank you for responding to your comments. Every single question I had was asked by someone else and answered already. Great job!
Glad it was helpful! Always happy to help out but I apricate you looking through the comments first to avoid double questions! XD btw i recognized your profile pic, I've seen some of your videos pop up on my feed before! :)
It really feels like something that should be included as part of the base actor class and probably everything else. Very nice and easy to use system nonetheless.
One option to using an interface is to put the Gameplay Tag Container on an actor component instead. Then you still avoid hard references, and you can more easily select for instance "All actors with game tags".
all actors have a gameplay tag container by default and an interface for them I believe so you dont need to set that up yourself, you can apply gameplay tags directly to actors that way instead of copying the method in this video with a separate container variable (although, still could be useful to have multiple tag containers in some cases) :)
Ah ok, that's awesome. I see there are some node types like "Matching all tags" to do logic with multiple containers. You can even create them on the fly in blueprints. @@thegamedevcave
if you have an actor variable, you can get a few interface messege functions which should work I believe (although you may have to implement the interface for them on the classes you're using them for, i can't 100% remember if the actor class itself implements them in any way). these are the names of those functions: Get owned gameplay tags has all matching gameplay tags has any matching gameplay tags has matching gameplay tag it'd make msot sense that you do have to implement the "gameplay tag asset interface" in the classes that use it and provide it with the prober container there.
Guess you would have a generic enemy actor and apply the interface and gameplay tag container on that one. Duplicate if you need to have separate Parent Actor.
Its always a good idea to try and have a good inheretance for your classes but the point of if you use an interface is that you can use it instead of normal function overrides, and with it youre no longer limited to only children of a certain class :) so you could put that interface on anything, not just children of the generic enemy class
@@thegamedevcave Yeah, but imagine doing that for 40 different classes. If we are going to do that anyway, might as well add it into a base class to get it automatically.
@@thelawgameplaywithcommenta2654 true, saves you some headache! just wanted to point that interfaces are meant to be like override functions without being limited to parent/child classes :)
Why would you use a variable at all, and not event dispatches with interfaces and an intermediary "manager" that manages broadcasts of statuses and transmits it to any subscribers in order to minimize dependencies?
Works more or less like I thought gameplay tags would work. My eventual box characters running about in their box world fighting box enemies will be thankful for this video.... eventually. Still working out how to get a randomized layout of buildings for NPC built cities, so tags on the back burner for now. Good video none the less though adding it to my Unreal playlist. Future me will thank you.
I've upgraded to having boxes with specific unit sizes to help with determining scale of my eventual non box entities in their otherwise boxy world currently. Small steps. Which coincidently I did use this video for as those scaled up boxes have the gameplay tag "building" to them :P. @@diliupg
So if you just make a variable inside the actor and assign it a gameplay tag the whole actor automatically caries that tag or am I missing something? I'm trying to loop trough actors with tag. Do I just write the gameplay tag in there?
you might be confusing actor tags (which is an array of strings that every actor has) with these gameplay tags. they're both called tags but are totally separate systems that don't have anything to do with each other. the variable we make is just a gameplay tag container and when we check if an actor has a certain gameplay tag, we sample if from that container variable :) nothing here has to do with "the whole actor" having anything.
@@thegamedevcave I understand that, but what I was asking is, how does something knows it has a gameplay tag attached to it. For example.. nvm while typing this I just realized gameplay tag use. So I if I get poisoned I add the tag then I can stack tags and when that effect is done I remove the tag. Sorry I'm pretty new to the concept and did what you mentioned in the video, adding bools for states of effects.
they're stored on the actor so like any other value and variable yours should be able to get them into your animation blueprints without issue. (although for things like this you're better off using an enum, like the way the character movement component that unreal provides you with does, since you'll only ever by in only 1 of these states at a time anyway)
Thanks for the video, gameplay tags are pretty usefull, one doubt isnt gameplay tags unoptimized , like checks are comparing strings ig like in low level, but enums are int checks, also it doesnt have index like enum just asking, even i have used tons of gameplay tags in my game, just wanted to know if its correct way(i have around 100 of tags) also all my code are in c++, used native gameplay tags
on a low level it preforms the same as using Name variables, so more expensive than a bool check. But not to a degree where you're likely to notice any performance different at all unless you're doing a WHOLE lot of tag checks on the tick event on actors that you have 100s or 1000s of instances of. If your code is neatly done you'll usually only have to querry your tags once, and then go on to do something with them , like enable a damage timer, and then turn it off again after X time. On a very low level technical look bools are cheaper, but bothersome to work with on scale. (which isn't to say that you should always use a tag instead of a bool, something like a value on a door "canOpen" should 100% be a bool for instance, but things that apply to multiple different objects in your project, or things that you want to be able to check in a hierarchy, that's where tags are useful)
Nice explanation, now I now how they can be used. I like to use enums better because of the switch or select functions, so I don’t have to make a lot of if statements/branches
enums have their upsides, doing a switch statement for an enum is much nicer than a bunch of if statements for sure but the downside is that an enum is a simple variable and as such can only have 1 value at a time :)
An enum only can have 1 value at a time. So it cant be set to both poisoned and burnt at the same time, unless you make an array of them but thats still a rather clunky work around. Youre also missing out on the ability to check for parent tags.
no real performance impact either way. any performance difference between the 2 is purely theoretical and won't likely have any actual impact. this is just a workflow thing. and make it easier to setup interfaces to toggle the tags instead of having to cast to acces the bool variables (which, depending on how you do it, can lead to a noticeable performance hit)
Ok, explaining what tags are is ok, but what next? It's a pity that the tutorial ends so abruptly. There are no more than a dozen seconds left, what to do on the other actor side. Many tutorials deal only with the player actor, which is often enough, but in the case of Tag it makes no sense. So beginners, don't stress. On the other actor side, you start an event from the ~GetGamePlayCotainer~ interface and promote it to the ~TagConteiner~ variable. Then you add this variable to the Blueprint and attach it to ~HasTag~ and in HasTag you select our Tag `status.stuned`, and then your logic decides what to do with True or False on the HasTag output
Nice, so by doing this it also removes hard references? Like i have my character bp, and my firearm bp, and i want to check certain evenrs like: firing, reloading, aiming, so
Probably a lot more flexible to work with, that said... if you only ever want 1 status effect at a time to be in effect, having it as an enum can be nice because that can only ever be set to 1 value, instead of bools or gameplay tags which have to be turned on and off individually. Of course, that's also the reason I personally prefer gameplay tags, because it doesn't limit you in that way :)
I concur I use mostly enums, I used to use gameplaytags in the past and they are very functional and make for clean code. But require to be enabled and disabled every time which for me was annoying, but I work mostly in C++. I did find using gameplaytags in Anim BP to be also useful for different state transitions. I think Gameplay tags are really at their best with gameplay ability, personal opinion though. very instructive video.
assuming these can be saved and loaded, it looks like a good way of unlocking levels. I've got multiple boolean arrays in a game for level unlocking. With this I could have named them and grouped them between different modes much easier. maybe in the sequel
i'm not sure abuot saving them, that may be possible, if so this works fine for that. Usually though tags are used more for things that different actors need to keep track of, either on themselves or eachother. But hey, of course we can use it in whatever way we come up with!
Hey, I'm wondering what would be the design pattern to adapt booleans which are OnRep variable in multiplayer ? I feel like it doesn't make sense in that case
Gameplay tags will replicate just as well and I believe (you will have to double check) if you apply tags directly to the actor instead of a container variable like this is may replicate them automatically as it is
Great video ! I just struggle to understand the last part when it comes to interface. Does it setup one and only single "variable" accessible from every blueprint where the interface is implemented ?
sort of, it's a function that every class that implements it can put it's own code in so they all just give their tag container as a return value. you can check out my video on interfaces here where i use it to set up a basic interaction system : ua-cam.com/video/4sLJOorUI8w/v-deo.html
@@thegamedevcave I did at the end of this video and if I know how to use basic interface, I still don't understand how to use gameplay tag container with interface, without casting from one blueprint to another. Anyway, I'll figure out. Keep on the good work :)
@@dylanc.1712 you make an interface with a function that returns a tag container, then on every blueprint that implements that interface you create the definition for that function to simply return it's tag container. you can call interface functions without casting and if the object you're calling it on has the interface, it'll run that objects definition of the function, in this case, giving you it's tag container without having to cast.
Do you know the background implementation for this tag container? How much space does it occupy with those strings? How are these strings compared? What data structure lies beneath it? What algorithm is used for searching a specific tag, is it optimal when done multiple times a second? If the answer to these is not O(1) with no extra space spent then having a ton for booleans is the better solution when it comes to performance. If however these are going to be checked occasionally then tags are the superior choice
These are index as Fnames, meaning the comparing isn’t a string comparison but rather an int comparison. There shouldn’t be any real performance impact. I mean if you’re checking for every tag on every actor during every frame you’ll notice a difference but at that point the tags aren’t the issue, the mess of code would be the issue. on a purely theoretical level, tags are slightly more expensive but in the real world, it’s impact is near 0. That kind of super low level optimisation is super important in data center software development, for a video game, I wouldn’t worry about the minimal difference:)
U can use inheritance for your bool problem well. I suppose it would be faster than using tags. I used tags for different purposes in UE4, it was very slow.
that still limits you to only child classes. you could just make a child of character and make everything in your game a child of that. that fixes a lot of issues but then also potentially heavily limits you if for any reason you need a normal actor or a pawn. and if you make your class with all the bools on it a child of Actor, now you're losing out on all the build in functionary of the Pawn and Character class, meaning a huge portion of the engine is suddenly worthless. If you can get away with it, doing what you suggest certainly works (although you're still missing out on being able to check for parent tags like Status.X for ANY status instead of a specific one, doing that with bools get really clunky really fast)
@@thegamedevcaveMaybe you are right, I don't know, I haven't tried out the new engine yet. I just recalled the OOP principles, and it makes sense when separation of concerns is in mind.
What Unreal Engine should do to improve this is to make every actor have access to the gameplay tags WITHOUT needing to create an explicit variable everywhere.
every actor i believe already has a gameplay tag container setup by default that you can access through an interface so you can apply and remove tags without needing to cat and such
learning GAS is what finally forced me to start using them and now I want to invent a time machine to go back and slap my pre-GAS self in the face for not learning about them sooner XD
Gameplay Tags are great but they're so much more work compared to Actor Tags, especially for smaller games. It's weird I have to add a variable to every actor that needs a tag, then if I don't want to cast everytime I need to check if an actor has a gameplay tag from another actor then I need to make an interface and attatch it to every actor that has them. I think sometimes an Actor Tag is a simpler and more viable solution, but mostly for smaller games, I would never use Actor tags for large games. Anyway just adding my 2 cents, you did a great video covering the basics.
yeah they can be a bit of a handful to work with, i still think for a lot of things it's very much worth it to do but only for things that are reoccurring on a project wide basis. If one actor just needs to tag another actor as something which nobody else cares about, just using actor tags makes way more sense as i understand (I dont really use them much myself). And when/if using GAS, that will pretty much make your whole workflow centered around gameplay tags (which can be great, but also frustrating at times)
Nice, I was using a map variable string/bool and string/other to store basically everything. Nice trick, I would have to invest more time with the new unreal tag system. Thanks for share the knowledge
great function, I confess that I didn't know that, but we must agree that good practices and a clean and organized code ends up being better than this functionality, as sometimes we need certain properties that only by creating a variable will we have access to, such as depriving a variable, But I must also agree that in certain cases this knowledge will make a difference, but in my view I will continue to value good practices and clean code, sometimes shortening solutions can double their size
of course this is not a replacement for booleans, but where it makes sense you probably should try using gameplay tags, it's not exactly going against any best practices or bad for performance in any way.
if you have any sort of thing in your games that you need to keep track of that are like "states" , that being like in this video "is burnt" or "is healing" But also things like actions like "is attacking" or "is searching for player". You probably should be using gameplay tags. I have a hard time imagining going through years of development and never running into a usecase for this.
@@thegamedevcave "I have a hard time imagining going through years of development and never running into a usecase for this." 😅 Because I don't worth anything, I try to make games for almost a decade but since I'm not game designer I start projects and give them up because I don't know where I'm going, so I use enums if needed when I start a new project and it is good enough. I think real devs have plans before begining to code. I'll never be a real dev despite all my endeavors.
Since it is stored as an ini file by default, does that means it also saves immediately when changed? For example, if I wanted to use this for level or weapon/equipment unlocks would that be possible or are these only appropriate for temporary changes such as status effects like you listed?
No, the types of tags are stored in a .ini file, but those tag containers are just structs like any other variable that youll have to store and save like you would any other data. What youre asking about sounds more like data assets :)
It does not save immediately when changed. You have to restart your engine as it's an engine level construct that only loads when the engine is initialized. GameplayTags can absolutely be used for what you're describing. GameplayTags can be assigned to GameplayTag containers. The most common GameplayTag container is the AbilitySystemComponent, but you can create your own. I can imagine an UUnlockedAbilities actor component that has a gameplay tag container, and then you add and remove tags to that container as necessary. Saving this would be as easy as saving the actor component's state into an FArchive and serializing and deserializing it as necessary. Make sure to do it a background thread so that you don't block the main gameplay loop.
yeah the tag container is like any other variable and each instance has it's own set of values for it. as long as you replicate it like any other variable it should work for multiplayer/networking.
I have worked almost 10 years with UNREAL and this is the best way to handle booleans, even character states and avoid the use of global enumerators (not local scope enumerators) and it is pretty standard in the industry today (in UE5). It should be noted that for systems like GAS (or similar), where it is necessary to validate several conditions to use a skill or modify an attribute, this way allows to simply add them in a FGameplayTagContainer and that's it.
What should be used for 100 weapon unlocks? Because if a mock bool (yes/no) is stored in an INI file, then the player can hack the file to unlock weapons. Whereas if the Bool is stored in a [what type of file/asset] - we can make the unlocks unhackable?
the actual state of a bool isn't stored in an .ini file, it's just the list of possible tags that exist in that ini file that the engine uses, once you compile the game, even that .ini file isn't accessible for players. That said, these tags probably aren't the best solution for unlocking weapons either, though it does heavily depends on the kind game you're making. If it's a simple singleplayer game I'd probably look into something where the weapon information is stored with data assets and that data asset simply includes a bool for "isUnlocked". but again, there's a lot of variables at play to decide what works best for your project.
@@thegamedevcave "bool for "isUnlocked"." Thanks for the confirm. Im using a DT made from a Struct that has weapon variables + bools. But for status effects, I see that your meth is better.
As far as i know data tables are read only assets so you wouldnt be able to write to them to chamge the unlock status of a entry. If youve found a way to write to a data altable though im interested to hear about it because if that works i do think it may be the best option
@@thegamedevcave You're correct. Im still prototyping and it uses DT to load, but not save (yet). Are Structs writeable? I believe I bought an asset that saves DTs, or it loads the DT into another file type, and saves that. I'll have to get back to you. And/or there may be a free method to load DT info to other asset > save that asset.
Is the tags INI file readable by players in a packaged game? Is there a free way to encrypt the text (names) so that we can have a secret status (not readable from players opening the INI file)?
the Gameplaytags.INI file isn't readable for players. So no need to worry about any of that, players would need to decompile the game to get access to any of that and unreal has a build in feature to encrypt your game when you package it if you feel like that's needed
@@thegamedevcave Thanks for the reply. Never packaged yet. So UE has a built in encrypt option. But I found this: "I-wanna-fuck-SCP1471 ·3 mo. ago There's no real "need" to encrypt the game PAKs, especially since AES encryption can be broken in seconds" "botman ·3 mo. ago It's not actually breaking the AES encryption. Epic simply puts the key into the executable and it's fairly trivial to find the AES key to unencrypt the package" Video idea: So can you give info or make a vid about working encryption methods in UE5/2024? And show these INI files to show us what is/isnt seen in packaged games (with/without encrpyt)? I saw assets on the Market. But unsure of the quality or if they are as hackable as Epic's method. (Nothing is hackproof, but I want a way to hide game name variables and player progress unlocks from most players.) Ty
idk, in the end there is no such thing as 100% secure encryption and for anyone that's not a mega studio spending millions on developing a game, i dont think you should worry about it too much.
you'll likely have to get an array that keeps track of all actors (on begin play simply get all actors of class and store that in a variable so you dont have to do it every time you need to check). Then for each loop through that array and check for their the tag you want. If youre spawning in any new actors or any actors get destroyed, do make sure you add and remove them from that array though. Doing any operation on all actors in a level isn't ideal though so you gotta be careful with doing that and only do it if you really have to.
unreal has an interface set up for gameplay tags so you can check gameplay tags on any actor without needing to cast to them at all. Gameplay tags also easily allow for Parent/child relationships where you can check either for a very specific tag (like Status.Stunned.Long) or any more broad parent tags (so you can also check for just Status.Stunned to check if the actor has ANY of the child tags of stunned or just check Status to check if there are any status conditions at all) Behaviour trees also have a prebuilt decorator that can check gameplay tags on the Pawn they're running on so its' easy to check "if character is burnt, run this behavior"
Dude not only am I your fan for life now, but you've actually gotten me super pissed at a few buddies that have been in the game a bit longer than me. I'm been curious about trying the GP tags instead of the crappy digital post it's they can't seem to decide are actual tags or names for other things or even sometimes just a pretty color, but only when you have absolutely zero use for them. When you need to use the functionality I feel like rainman is teaching me to count cards. my asshole friends i'll be rolling up to the bar in the old folks home with in 30 years said the other gameplay tags are even worse and i was better off not getting to play with the puppy before having to put it down so I sort of forgot about them. they work freaking perfectly don't they??? Jeez always go with your gut i guess, even experts don't know squat sometimes. Keep up the phenomenal and too the point videos dude. We are loving it this side of the pond!
seems like you've had a pretty rough time with it XD really sucks about your friends steering you away from gameplay tags for no good reason :( hopefully you can use them going forward!
hahaha thanks man nah they rock sorry if i sounded like i trauma dumping haha. Yes I totally ditched the solution i was failing at before to keep track of multiple npc's and their status in a sort of game of old school 'tag' and sure enough i'm asking myself why anyone would stick with the pinky tags or infinite bools thanks again and keep up the rocking tuts brother! @@thegamedevcave
enum list kind of works too, depending on the situation but it's rather clunky compared to gameplay tags. But if you have something to "tag" or keep track off that is very specific to a certain type of actor , doing it with enums or a method like it probably does make more sense than gameplay tags. For values that are relevant to a lot of different classes though, gameplay tags are a lot nicer to work with
@@thegamedevcave Indeed, unfortunately many older links that can still help rely on old forums which where replaced by "community forums" which bricked all docs and now we have to explore UE like after server wipe xD
@@arthurbulhak1266 it's really annoying that they just wiped those old servers because So often when i'm troubleshooting an issue I find the answer and it turns out to be a dead link XD so I 100% feel you there!
@@thegamedevcave Exactly, I guess at this point the best way to debug stuff, albeit definitely "advanced" (well default if you at least understand C++ :D) is to download debug symbols (aka 40 more GB), double-click on every blueprint giving trouble, looking at code directly and then going to UE5 codebase docs. Quite more annoying but extremely rewarding
sometimes I struggle a lot to get variables from other places/actors and such... since this is "global", this might be the best solution at first glance dayum
the setup for what tags exist is global, the actual values are still on a per actor basis so i dont think this helps with that honestly. If you need actors to share information you should just made a reference variable to them and link them up inside the level editor.
Great video as always really helpful, I've tried using tags, but i ran into a bit of issue, how do you delete a tag if you're no longer using it, every time i try i get this error that its still in use and its absolutely not, it brings up this new window that ive never seen (im still very new to UE5) and i dont seem to be able to edit anything there either D: edit : i deleted all the GE_effects it claimed to be referencing and the error went away, a bit annoying but an easy fix, leaving this here incase anyone else runs into the same problem
probably easier to close the engine, find the .ini file that stores the tags and remove it there, only if you're SURE nothing is using it anymore. Also can be good to generally make sure all the classes referencing the tag are saved and compiled and restarting the engine before you try to remove it.
I'm curious to know more about why you don't use the default "Actor GameplayTags" and make your own struct. It basically creates a free interface for you so you don't have to cast to get gameplay tags off the actor if another actor is curious (like a sprinkler turning on if something overlaps with burning tag). Additionally the actor tags iirc will interface with gameplay effects in GAS so you can set yourself up to move more easily to that system if the scope makes it worth it.
Yeah tbh that’s probably better, just wanted to show this in case you for whatever reason you have 2 containers on a blueprint you do this. But I’ll happily admit that’s a pretty unlikely scenario xd
I dont understand. I follow all instructions and i have access to tag names from characterBP and levelBP. but i can only assign tags values from each blueprints. even if they have the same tags they are completely as stand alone since changing a tag value in one BP does not affect value in the other BP in any way. is this where the interface comes in to play because i setup the interface also and there is still no value change from one BP to the other which would be the point of this exercise right??
No I think you might have misunderstood. Every actor has its own tag container to keep track of its own values for the tags so setting a tag on 1 actor only sets it on that actor, the on/off values of the tags aren’t a universal thing. If you want something like that simply put a tag container in the game mode or game instance so every actor can access it easily and read it write to it.
@@ng28181 the .ini file only declares the tags, it sets up what tags exists. the actual tag container is what stores each tag's true of false state on a per actor basis
personally haven't looked into c++ use for them, I assume it's pretty straight forward though. I mostly use tags for the Gameplay Ability system at the moment and in Behavior trees.
i can see where you get that comparison, but this is something else. This is just a bool that's a little bit smarter and can be declared on a project wide scope, instead of on a specific blueprint. A switch statement is something that decides the flow of 1 input into 1 of many outputs based on the value provided, so using a switch on a bool or a gameplay tag would still just be a true or a false, same as an if statement (branch node)
crapy part about gameplay tags is that if you migrate a progect using tags the tags will not recreate and you need to manually re sett all the tags . you can always move the tag.ini first but not always making edits in the config folder is the best way to go . i loooove tags tho dont get me wrong . unreal just need a fix, if a tag dont exist well just create it
yeah when you migrate it really should move over the .ini file first so the gameplay tags don't break... that's a really good point, unreal should fix that!
i do believe BTs already do a pretty good job. unreal has a standard decorator that checks if an object has a certain key and it's pretty easy to make tasks or services to set keys if need be. If you want a blackboard key for gameplay tags, that may be a slight bit more of an issue though, i'm not sure but I also dont see much reason to have a gameplay tag (container) as a key on the blackboard.
@@thegamedevcave well gameplay tags replace enums, like AI state, it's alot more flexible to add new stuff to gameplay tags than edit enums that also can corrupt structs, if everything is gameplay tags you can edit it as you want not killing a huge struct. I ended up using BT they are handy for sure but then again you need to manually write and remember where Gameplay tags is more like a huge enum drop down of posebilities. (Cursed Enums)
@@Atl3m Well, i personally am not sure I would use gameplay tags as a replacement for enums like that. Of course it's possible but not really it's intended use. But even if you want to use it like that, unreal already does have that support build in right? there literally already is a decorator that checks if something as a certain gameplay tag. (That might be a decorator added by the gameplay ability system though, which could be why I have it in my project) either way, it's pretty simple to write a few things to make use of gameplay tags for your AI :)
you can add new tags in a lot of places, I believe there is a place for it in settings too, there is also a specific window you can add that's for managing your tags. in the end they all simply get added to a .ini file, regardless of what way you're adding them :)
Good job, but tags are not accessible from Get Class Defaults, which means all of this stuff is "cool" but basically useless, as a lot of Unreal Engine features. Apparently this works ONLY for instantiated Actors, which totally kill their potential. LIke if you want to have a clothing system and use tags for special booleans like "is fullbody", we'll still have to stick to booleans.
wasn't aware that this wouldn't work with class defaults. that's a bit strange. But I also don't really think that using class defaults is a very common thing to do, and for what thee gameplay tags are useful for especially. As i show in the video, it is most useful for keeping track of state changes, not as a blanket replacement for all bools, and those have no relevance in class defaults anyway
Enums work pretty well for keeping track of states, since it can only hold 1 value at a time , for status' this works better, adding a new entry to a list of enum's can be haard to follow if you ever need to debug. but in the end, if it works, it works :)
Thanks for the video, I didn't know about these! Some of my "bool swamp" values are accessed on event tick. Any ideas of the performance of reading a tag from a Gamplay Tag Container versus a simple bool property?
i'm sure it's somewhat more expensive but not to a degree where it's worth bothering about honestly. I'd be more inclined to refactor the code to prevent checking things in tick if possible to improve performance. (of course, sometimes you simply do have to check every frame on something, but very often even tick ends up being a shortcut that's rather expensive)
I think I have tried to keep the logic in the player character event ticks to a minimum (even when a lot of UA-cam guides seem to add more and more!). The other place is the "Update Animation" event where bools are checked for the purposes of the animation state engine. Perhaps the tag system would only become an issue if you grew the game tag container "array" to a very large size...?
@@garfy1000 in all Likelyhood you shouldn't need to look at your tags for animation related things. Unless you have (as an example) a specific animation that plays when your character is burnt that loops for at long as they keep the burnt status (like a panicked, waving their arms around "I'm burning to death" kind of animation), something like that you should be able to check for tags for if you need. All together, the difference between checking a bool and a tag by itself shouldn't make any notable impact really though
gotten this comment a lot, but everyone seems to skip over the fact that an enum doesn't have the upside of the parent/child tag hierarchy, and more importantly, it only has 1 value at a time, so if you use it for status effects like the example in this video, you can't be both burnt AND poisoned. if you use it for a wider use case where you also have tags for when you're attacking, now you suddenly can't attack while you have any other effect applied to you, or you need to disable the effects whenever you do an attack. using enums for this is honestly a more messy setup than sticking with the idea of using a whole bunch of bools.
@@thegamedevcave state machines are generally not happy with multi dimensional statusses anyways, its a way better practice to split them . sm's for buff and debuf, movement, health for example. Modularize instead of spaghetti'ing it. That makes it easier to add on one of them later too if you are going to do dlc or even if there is a cool new idea you want to add later in development.
@@viwesvideos not sure where states machines suddenly came from? none of this really has to do with state machines. Take a look at the gameplay ability system for more in depth uses of tags, it's useful stuff. if you insist on not using them you're of course free to do it in any way you prefer but I think you are fundamentally misunderstanding what these tags are and how I show them in this video. Tags are easily expandable and really don't cause any spaghetti code so i'm not quite sure where you're coming from. that's the whole point of the parent/child tag thing. you can check for parent tags so instead of checking " is character X doing Y attack" you can simply check if it's doing ANY attack, so if you want to add something new to that, you simply add a new child tag, anything that involves that new thing directly can check for that while everything that just checks for attacks in general will now also pick up on this one.
@@thegamedevcave i gave the tip to use enums instead of checking bools, because this works across any and all engines. If one would use enums, you should use them in state machines. This way you dont have to check single statusses over and over. For character status controls, sm's are widely used for the speed amd ease of use. In visual scripting its a bit hard to recognise but underlying it still works the same as in just coding it. Not saying that what you explained in the video is any less valid or usefull, just giving an alternative tip
@@viwesvideos I would still recommend looking into unreal's gameplay ability system to see a more worked out implementation of how and why tags can be useful. the thing i you're not checking for a bunch of tags constantly, when you want to apply a certain action or effect, you check if there already is a tag active , and based on that you can write some logic to do, whatever you want really. does a character have a tag for healbock? you can just check for that tag in any healing ability and if it is present, cancel that ability. Is a character already attacking? simply disallow other attacking abilities to active, but it also works the other way around of course, checking if a tag is present to allow certain abilities. It's much deeper than the example I give in this video of course because all that hardly fits in a simple video. But getting a feel for gameplay tags , knowing they're an option and if you plan to use G.A.S. pretty much a requirement, it's just good to know how they work. Doing all that in a state machine would be a nightmare. it's pretty unreal specific though you're right about that without a doubt, but i'm making unreal tutorials so of course i'm not overly worried about other engines. I know that unity at least ahs something similar to this tag system though. All that to say, enums are great of course and you should use them, but they dont really fill the same roll as gameplay tags so if you're looking for an alternative to tags, i think enums are more bothersome in this specific use and role than a simple list of bools (which is messy, hence the idea for this video in the first place)
I generally do not like tags, becasue they are strings (costly and prone to errors via typos). I usually make my own systems with enums. But this is pretty cool, I will definitely keep this in mind!
@@thegamedevcave I mostly worked in Unity before, there tags have this danger. I started prerly learning Unreal not too long ago, and I always wonder at all the solutions that are pre-built in the engine. Such as these game tags.
@@thegamedevcaveUE5 professional gamedev here... This is wrong actually, you don't really need to use strings ever with Tags. Sure, they have a FName internally and you could have a typo, but the only associated risk is to have a typo-ed tag and that's a very easy fix. See, when you declare & define a tag natively, you associate it with an actual variable name that your autocompleter (and of course compiler) will ensure you don't miss-type, ever. And on the editor side the property editor for tags just doesn't allow you to make a typo by nature. As for performances, tag comparisons between one another and against a container are much faster than a string comparison : FNames are "indexed" internally. It's their whole point. It's not at all the same as if you were to just express the state of your actor (or whatever else !) with a bunch of strings.
Tags use FName under the hood, which are strings that get indexed in a global table at construction. Each FName that has the same case-insensitive string gets the same index. Equality comparison is done using the index, not the underlying string.
@@thegamedevcave Was gonna say bitmask enum, I'm disapointed that Blueprints don't seem to support this, unless I'm missing something. Edit: I was missing something, bitmasks are supported but the value is stored as an integer
My new motto has become that you can tell how good of a programmer someone is by how many booleans are in their classes. GameplayTags are a way better and more flexible option. Great for anything using data as well(Maps, DataTable rows, DataAssets, etc)
If you are a game developer, and your initial idea of grouping multiple booleans describing status of your actor is not using for example a map of string/name to boolean or a struct, but an array of unnamed bools the indices of which you remember/write down, then it's probably time to uninstall Unreal and try carpeting or something :) The map one is a decent solution, but no, both aren't decent solutions ;)
ah yes, because gatekeeping beginner's on a tutorial video is always a good thing to do. Of course both methods, just a list of bools (if they're unnamed in an array, that is much worse), and the map with string/bools are workable if you're just getting started, there are so many more important things to put your attention on, those bad solutions work, and that's whats important , and then whenever people are a few steps further into learning game development, it becomes important to not get stuck with those sub-par solutions and put a little effort into learning The better solution like gameplay tags. Telling people who are learning that they're not good enough is a toxic as hell and unproductive way to teach them. do better.
i do use c++, so jokes on you? I just use blueprint for tutorials because its easier to understand for some people and c++ user can figure out the c++ functions for any given nodes easily
Never used tags before and i started using UE a year ago and you just changed that. Thank You!!!
Happy to help!
I don't have a ton of bools on my character blueprint, so they work well for me. I love how I can directly see the names and know what they do instantly, and can right click and find references to easily see where they're being used, no extra steps or anything needed. I can see though your system would be great for a heavier game project
yeah, you shouldn't use tags as a replacement for every bool. but if there are bools that can make use of the parent/child structure tags have, or bools that are present on multiple different classes, it's worth doing.
With tags you can read and write them to actors without needing to cast, unlike a bool too which is a huge upside. All heavily depends on context which option is the best to implement though
@@thegamedevcave There is also a cool decorator in the behavior tree called "Gameplay Tag Condition" which will make a task run depending on whether the target actor has a specific gameplay tag on it or no
You are right! I worked in a big and complex unreal project, and guess what, they were using tags.
Just starting out and I was already hoping that there would be a better way to clean up my variable space. I had no idea this existed. Thank you so much!
I was getting started learning how to use gameplay tags, your video really helped. Nice job
Glad it helped!
1:17, don’t mind me, just leaving a checkpoint!
Thanks for explaining this! I've always been curious about tags, but haven't had a reason to use them yet.
Also, thank you for responding to your comments. Every single question I had was asked by someone else and answered already. Great job!
Glad it was helpful! Always happy to help out but I apricate you looking through the comments first to avoid double questions! XD
btw i recognized your profile pic, I've seen some of your videos pop up on my feed before! :)
i recognize your name
It really feels like something that should be included as part of the base actor class and probably everything else. Very nice and easy to use system nonetheless.
One option to using an interface is to put the Gameplay Tag Container on an actor component instead. Then you still avoid hard references, and you can more easily select for instance "All actors with game tags".
all actors have a gameplay tag container by default and an interface for them I believe so you dont need to set that up yourself, you can apply gameplay tags directly to actors that way instead of copying the method in this video with a separate container variable (although, still could be useful to have multiple tag containers in some cases) :)
Ah ok, that's awesome. I see there are some node types like "Matching all tags" to do logic with multiple containers. You can even create them on the fly in blueprints. @@thegamedevcave
Actually, I can't see that all actors have a gameplay tag in the editor. @@thegamedevcave
if you have an actor variable, you can get a few interface messege functions which should work I believe (although you may have to implement the interface for them on the classes you're using them for, i can't 100% remember if the actor class itself implements them in any way).
these are the names of those functions:
Get owned gameplay tags
has all matching gameplay tags
has any matching gameplay tags
has matching gameplay tag
it'd make msot sense that you do have to implement the "gameplay tag asset interface" in the classes that use it and provide it with the prober container there.
I'm a fan of using a data table and structure for storage of gameplay tags
Guess you would have a generic enemy actor and apply the interface and gameplay tag container on that one. Duplicate if you need to have separate Parent Actor.
Its always a good idea to try and have a good inheretance for your classes but the point of if you use an interface is that you can use it instead of normal function overrides, and with it youre no longer limited to only children of a certain class :) so you could put that interface on anything, not just children of the generic enemy class
@@thegamedevcave
Yeah, but imagine doing that for 40 different classes. If we are going to do that anyway, might as well add it into a base class to get it automatically.
@@thelawgameplaywithcommenta2654 true, saves you some headache! just wanted to point that interfaces are meant to be like override functions without being limited to parent/child classes :)
Why would you use a variable at all, and not event dispatches with interfaces and an intermediary "manager" that manages broadcasts of statuses and transmits it to any subscribers in order to minimize dependencies?
of course that would be better! just a little beyond the scope of this video.
...I mostly use tags and strings, thank you for this tutorial because I was not aware of this...👍👍👍
This channel is pure gold
Thanks!
Works more or less like I thought gameplay tags would work.
My eventual box characters running about in their box world fighting box enemies will be thankful for this video.... eventually.
Still working out how to get a randomized layout of buildings for NPC built cities, so tags on the back burner for now.
Good video none the less though adding it to my Unreal playlist. Future me will thank you.
don't let yourself get boxed in.. or out....😜
I've upgraded to having boxes with specific unit sizes to help with determining scale of my eventual non box entities in their otherwise boxy world currently.
Small steps.
Which coincidently I did use this video for as those scaled up boxes have the gameplay tag "building" to them :P.
@@diliupg
So if you just make a variable inside the actor and assign it a gameplay tag the whole actor automatically caries that tag or am I missing something? I'm trying to loop trough actors with tag. Do I just write the gameplay tag in there?
you might be confusing actor tags (which is an array of strings that every actor has) with these gameplay tags. they're both called tags but are totally separate systems that don't have anything to do with each other. the variable we make is just a gameplay tag container and when we check if an actor has a certain gameplay tag, we sample if from that container variable :) nothing here has to do with "the whole actor" having anything.
@@thegamedevcave I understand that, but what I was asking is, how does something knows it has a gameplay tag attached to it. For example.. nvm while typing this I just realized gameplay tag use. So I if I get poisoned I add the tag then I can stack tags and when that effect is done I remove the tag. Sorry I'm pretty new to the concept and did what you mentioned in the video, adding bools for states of effects.
Easily one of the best vids I have seen as to why to use this system
I need to check if these tags also work across animation scripts, so I can create custom statuses like flying and swimming.
they're stored on the actor so like any other value and variable yours should be able to get them into your animation blueprints without issue. (although for things like this you're better off using an enum, like the way the character movement component that unreal provides you with does, since you'll only ever by in only 1 of these states at a time anyway)
Thanks for the video, gameplay tags are pretty usefull, one doubt
isnt gameplay tags unoptimized , like checks are comparing strings ig like in low level, but enums are int checks, also it doesnt have index like enum
just asking, even i have used tons of gameplay tags in my game, just wanted to know if its correct way(i have around 100 of tags)
also all my code are in c++, used native gameplay tags
on a low level it preforms the same as using Name variables, so more expensive than a bool check. But not to a degree where you're likely to notice any performance different at all unless you're doing a WHOLE lot of tag checks on the tick event on actors that you have 100s or 1000s of instances of.
If your code is neatly done you'll usually only have to querry your tags once, and then go on to do something with them , like enable a damage timer, and then turn it off again after X time. On a very low level technical look bools are cheaper, but bothersome to work with on scale. (which isn't to say that you should always use a tag instead of a bool, something like a value on a door "canOpen" should 100% be a bool for instance, but things that apply to multiple different objects in your project, or things that you want to be able to check in a hierarchy, that's where tags are useful)
I feel so called out in the first minute of the video lmfao
we've all been there XD
Nice explanation, now I now how they can be used. I like to use enums better because of the switch or select functions, so I don’t have to make a lot of if statements/branches
enums have their upsides, doing a switch statement for an enum is much nicer than a bunch of if statements for sure but the downside is that an enum is a simple variable and as such can only have 1 value at a time :)
I still don't see how gameplay tags are different from enums in terms of usage.
I believe I can get the same functionality with enums to an extent.
An enum only can have 1 value at a time. So it cant be set to both poisoned and burnt at the same time, unless you make an array of them but thats still a rather clunky work around. Youre also missing out on the ability to check for parent tags.
So apart from using tons of booleans as flags, are there any other performance boosts to using gameplay tags, other than cleaning up the variables?
no real performance impact either way. any performance difference between the 2 is purely theoretical and won't likely have any actual impact. this is just a workflow thing. and make it easier to setup interfaces to toggle the tags instead of having to cast to acces the bool variables (which, depending on how you do it, can lead to a noticeable performance hit)
@@thegamedevcave Thanks, that helps, I'll have to start using that and see how much cleaner I can keep my blueprints.
Thank you very much, man. Invaluable upgrade!
Glad you like it!
Ok, explaining what tags are is ok, but what next? It's a pity that the tutorial ends so abruptly. There are no more than a dozen seconds left, what to do on the other actor side. Many tutorials deal only with the player actor, which is often enough, but in the case of Tag it makes no sense. So beginners, don't stress. On the other actor side, you start an event from the ~GetGamePlayCotainer~ interface and promote it to the ~TagConteiner~ variable. Then you add this variable to the Blueprint and attach it to ~HasTag~ and in HasTag you select our Tag `status.stuned`, and then your logic decides what to do with True or False on the HasTag output
Nice, so by doing this it also removes hard references? Like i have my character bp, and my firearm bp, and i want to check certain evenrs like: firing, reloading, aiming, so
if you use an interface to get the tags on other actors you prevent hard references yeah :)
Thank you. 👍
I love finding solutions, even better when they are built in.
You bet!
What a coincidence! I'm changing all my status enums to Gameplay Tags now!
Probably a lot more flexible to work with, that said... if you only ever want 1 status effect at a time to be in effect, having it as an enum can be nice because that can only ever be set to 1 value, instead of bools or gameplay tags which have to be turned on and off individually. Of course, that's also the reason I personally prefer gameplay tags, because it doesn't limit you in that way :)
@@thegamedevcave Yeah! No more .h file every where, whenever or wherever you need them, they are right there for you! Cheers!
I concur I use mostly enums, I used to use gameplaytags in the past and they are very functional and make for clean code. But require to be enabled and disabled every time which for me was annoying, but I work mostly in C++. I did find using gameplaytags in Anim BP to be also useful for different state transitions. I think Gameplay tags are really at their best with gameplay ability, personal opinion though. very instructive video.
Jesus this is amazing - time to rebuild my whole character, genuine thanks! 😀
assuming these can be saved and loaded, it looks like a good way of unlocking levels. I've got multiple boolean arrays in a game for level unlocking. With this I could have named them and grouped them between different modes much easier. maybe in the sequel
i'm not sure abuot saving them, that may be possible, if so this works fine for that. Usually though tags are used more for things that different actors need to keep track of, either on themselves or eachother. But hey, of course we can use it in whatever way we come up with!
Hey, I'm wondering what would be the design pattern to adapt booleans which are OnRep variable in multiplayer ? I feel like it doesn't make sense in that case
Gameplay tags will replicate just as well and I believe (you will have to double check) if you apply tags directly to the actor instead of a container variable like this is may replicate them automatically as it is
Great video ! I just struggle to understand the last part when it comes to interface. Does it setup one and only single "variable" accessible from every blueprint where the interface is implemented ?
sort of, it's a function that every class that implements it can put it's own code in so they all just give their tag container as a return value. you can check out my video on interfaces here where i use it to set up a basic interaction system : ua-cam.com/video/4sLJOorUI8w/v-deo.html
@@thegamedevcave I did at the end of this video and if I know how to use basic interface, I still don't understand how to use gameplay tag container with interface, without casting from one blueprint to another. Anyway, I'll figure out. Keep on the good work :)
@@dylanc.1712 you make an interface with a function that returns a tag container, then on every blueprint that implements that interface you create the definition for that function to simply return it's tag container. you can call interface functions without casting and if the object you're calling it on has the interface, it'll run that objects definition of the function, in this case, giving you it's tag container without having to cast.
Do you know the background implementation for this tag container? How much space does it occupy with those strings? How are these strings compared? What data structure lies beneath it? What algorithm is used for searching a specific tag, is it optimal when done multiple times a second? If the answer to these is not O(1) with no extra space spent then having a ton for booleans is the better solution when it comes to performance. If however these are going to be checked occasionally then tags are the superior choice
These are index as Fnames, meaning the comparing isn’t a string comparison but rather an int comparison. There shouldn’t be any real performance impact. I mean if you’re checking for every tag on every actor during every frame you’ll notice a difference but at that point the tags aren’t the issue, the mess of code would be the issue.
on a purely theoretical level, tags are slightly more expensive but in the real world, it’s impact is near 0. That kind of super low level optimisation is super important in data center software development, for a video game, I wouldn’t worry about the minimal difference:)
U can use inheritance for your bool problem well. I suppose it would be faster than using tags. I used tags for different purposes in UE4, it was very slow.
that still limits you to only child classes. you could just make a child of character and make everything in your game a child of that. that fixes a lot of issues but then also potentially heavily limits you if for any reason you need a normal actor or a pawn. and if you make your class with all the bools on it a child of Actor, now you're losing out on all the build in functionary of the Pawn and Character class, meaning a huge portion of the engine is suddenly worthless.
If you can get away with it, doing what you suggest certainly works (although you're still missing out on being able to check for parent tags like Status.X for ANY status instead of a specific one, doing that with bools get really clunky really fast)
@@thegamedevcaveMaybe you are right, I don't know, I haven't tried out the new engine yet. I just recalled the OOP principles, and it makes sense when separation of concerns is in mind.
You should do a video on Lyra's gameplay tag implementation
What Unreal Engine should do to improve this is to make every actor have access to the gameplay tags WITHOUT needing to create an explicit variable everywhere.
every actor i believe already has a gameplay tag container setup by default that you can access through an interface so you can apply and remove tags without needing to cat and such
@@thegamedevcave oh yeah? You should have included that in the vid! (unless it's there, as I didn't watch it all the way through yet)
@@dorondavid4698 yeah i shouldve mentioned it, kinda figured that would be obvious but a few people have asked about that so apparently not XD
@@thegamedevcave ha yeah, it's hard to know what to mention when making a video
Classic, good solution from Gameplay ability system
learning GAS is what finally forced me to start using them and now I want to invent a time machine to go back and slap my pre-GAS self in the face for not learning about them sooner XD
Gameplay Tags are great but they're so much more work compared to Actor Tags, especially for smaller games. It's weird I have to add a variable to every actor that needs a tag, then if I don't want to cast everytime I need to check if an actor has a gameplay tag from another actor then I need to make an interface and attatch it to every actor that has them. I think sometimes an Actor Tag is a simpler and more viable solution, but mostly for smaller games, I would never use Actor tags for large games.
Anyway just adding my 2 cents, you did a great video covering the basics.
yeah they can be a bit of a handful to work with, i still think for a lot of things it's very much worth it to do but only for things that are reoccurring on a project wide basis. If one actor just needs to tag another actor as something which nobody else cares about, just using actor tags makes way more sense as i understand (I dont really use them much myself).
And when/if using GAS, that will pretty much make your whole workflow centered around gameplay tags (which can be great, but also frustrating at times)
Nice, I was using a map variable string/bool and string/other to store basically everything. Nice trick, I would have to invest more time with the new unreal tag system. Thanks for share the knowledge
that's what I did before figuring this out too. still has it's uses of course but tags are wonderful in most cases!
great function, I confess that I didn't know that, but we must agree that good practices and a clean and organized code ends up being better than this functionality, as sometimes we need certain properties that only by creating a variable will we have access to, such as depriving a variable, But I must also agree that in certain cases this knowledge will make a difference, but in my view I will continue to value good practices and clean code, sometimes shortening solutions can double their size
of course this is not a replacement for booleans, but where it makes sense you probably should try using gameplay tags, it's not exactly going against any best practices or bad for performance in any way.
For years I've been wondering what was gameplay tags. But I never use string/bool combination so I guess I will never use gameplay tags either
if you have any sort of thing in your games that you need to keep track of that are like "states" , that being like in this video "is burnt" or "is healing" But also things like actions like "is attacking" or "is searching for player". You probably should be using gameplay tags. I have a hard time imagining going through years of development and never running into a usecase for this.
@@thegamedevcave "I have a hard time imagining going through years of development and never running into a usecase for this." 😅 Because I don't worth anything, I try to make games for almost a decade but since I'm not game designer I start projects and give them up because I don't know where I'm going, so I use enums if needed when I start a new project and it is good enough. I think real devs have plans before begining to code. I'll never be a real dev despite all my endeavors.
Since it is stored as an ini file by default, does that means it also saves immediately when changed? For example, if I wanted to use this for level or weapon/equipment unlocks would that be possible or are these only appropriate for temporary changes such as status effects like you listed?
No, the types of tags are stored in a .ini file, but those tag containers are just structs like any other variable that youll have to store and save like you would any other data. What youre asking about sounds more like data assets :)
It does not save immediately when changed. You have to restart your engine as it's an engine level construct that only loads when the engine is initialized.
GameplayTags can absolutely be used for what you're describing. GameplayTags can be assigned to GameplayTag containers. The most common GameplayTag container is the AbilitySystemComponent, but you can create your own. I can imagine an UUnlockedAbilities actor component that has a gameplay tag container, and then you add and remove tags to that container as necessary.
Saving this would be as easy as saving the actor component's state into an FArchive and serializing and deserializing it as necessary. Make sure to do it a background thread so that you don't block the main gameplay loop.
Fixing old habits be hard
it really is!
@@thegamedevcave with people like gorka and matt aspland posting, these bad habits are extra hard to break for a lot of people
dam, this thing will change my life
This is amazing! I will start to use them now 👀
I have a question. Is this possibile to use on multiplayer? Is the Tags Source personal to each blueprint, so that each character has his own status?
yeah the tag container is like any other variable and each instance has it's own set of values for it. as long as you replicate it like any other variable it should work for multiplayer/networking.
I have worked almost 10 years with UNREAL and this is the best way to handle booleans, even character states and avoid the use of global enumerators (not local scope enumerators) and it is pretty standard in the industry today (in UE5).
It should be noted that for systems like GAS (or similar), where it is necessary to validate several conditions to use a skill or modify an attribute, this way allows to simply add them in a FGameplayTagContainer and that's it.
What should be used for 100 weapon unlocks? Because if a mock bool (yes/no) is stored in an INI file, then the player can hack the file to unlock weapons.
Whereas if the Bool is stored in a [what type of file/asset] - we can make the unlocks unhackable?
the actual state of a bool isn't stored in an .ini file, it's just the list of possible tags that exist in that ini file that the engine uses, once you compile the game, even that .ini file isn't accessible for players.
That said, these tags probably aren't the best solution for unlocking weapons either, though it does heavily depends on the kind game you're making. If it's a simple singleplayer game I'd probably look into something where the weapon information is stored with data assets and that data asset simply includes a bool for "isUnlocked". but again, there's a lot of variables at play to decide what works best for your project.
@@thegamedevcave "bool for "isUnlocked"."
Thanks for the confirm. Im using a DT made from a Struct that has weapon variables + bools. But for status effects, I see that your meth is better.
As far as i know data tables are read only assets so you wouldnt be able to write to them to chamge the unlock status of a entry. If youve found a way to write to a data altable though im interested to hear about it because if that works i do think it may be the best option
@@thegamedevcave You're correct. Im still prototyping and it uses DT to load, but not save (yet).
Are Structs writeable?
I believe I bought an asset that saves DTs, or it loads the DT into another file type, and saves that. I'll have to get back to you.
And/or there may be a free method to load DT info to other asset > save that asset.
Phew! So glad I found your channel. Great explanation, thank you!
Glad it was helpful!
Very clear explanation, thank you!
Glad it was helpful!
Is the tags INI file readable by players in a packaged game?
Is there a free way to encrypt the text (names) so that we can have a secret status (not readable from players opening the INI file)?
the Gameplaytags.INI file isn't readable for players. So no need to worry about any of that, players would need to decompile the game to get access to any of that and unreal has a build in feature to encrypt your game when you package it if you feel like that's needed
@@thegamedevcave Thanks for the reply.
Never packaged yet. So UE has a built in encrypt option. But I found this:
"I-wanna-fuck-SCP1471
·3 mo. ago
There's no real "need" to encrypt the game PAKs, especially since AES encryption can be broken in seconds"
"botman
·3 mo. ago
It's not actually breaking the AES encryption. Epic simply puts the key into the executable and it's fairly trivial to find the AES key to unencrypt the package"
Video idea: So can you give info or make a vid about working encryption methods in UE5/2024?
And show these INI files to show us what is/isnt seen in packaged games (with/without encrpyt)?
I saw assets on the Market. But unsure of the quality or if they are as hackable as Epic's method. (Nothing is hackproof, but I want a way to hide game name variables and player progress unlocks from most players.) Ty
idk, in the end there is no such thing as 100% secure encryption and for anyone that's not a mega studio spending millions on developing a game, i dont think you should worry about it too much.
How would you quickly find all actors on the map that have a specific tag?
you'll likely have to get an array that keeps track of all actors (on begin play simply get all actors of class and store that in a variable so you dont have to do it every time you need to check).
Then for each loop through that array and check for their the tag you want. If youre spawning in any new actors or any actors get destroyed, do make sure you add and remove them from that array though.
Doing any operation on all actors in a level isn't ideal though so you gotta be careful with doing that and only do it if you really have to.
@@thegamedevcave Thanks for the reply.
Why not use struct with all params defined there? Why tags are better?
unreal has an interface set up for gameplay tags so you can check gameplay tags on any actor without needing to cast to them at all.
Gameplay tags also easily allow for Parent/child relationships where you can check either for a very specific tag (like Status.Stunned.Long) or any more broad parent tags (so you can also check for just Status.Stunned to check if the actor has ANY of the child tags of stunned or just check Status to check if there are any status conditions at all)
Behaviour trees also have a prebuilt decorator that can check gameplay tags on the Pawn they're running on so its' easy to check "if character is burnt, run this behavior"
How did you shout out your interact video and not put it in the description, acting like I'm not going straight to that video next! great video
Good point! i added a link to it in the info card now!
Dude not only am I your fan for life now, but you've actually gotten me super pissed at a few buddies that have been in the game a bit longer than me. I'm been curious about trying the GP tags instead of the crappy digital post it's they can't seem to decide are actual tags or names for other things or even sometimes just a pretty color, but only when you have absolutely zero use for them. When you need to use the functionality I feel like rainman is teaching me to count cards. my asshole friends i'll be rolling up to the bar in the old folks home with in 30 years said the other gameplay tags are even worse and i was better off not getting to play with the puppy before having to put it down so I sort of forgot about them. they work freaking perfectly don't they??? Jeez always go with your gut i guess, even experts don't know squat sometimes. Keep up the phenomenal and too the point videos dude. We are loving it this side of the pond!
seems like you've had a pretty rough time with it XD really sucks about your friends steering you away from gameplay tags for no good reason :( hopefully you can use them going forward!
hahaha thanks man nah they rock sorry if i sounded like i trauma dumping haha. Yes I totally ditched the solution i was failing at before to keep track of multiple npc's and their status in a sort of game of old school 'tag' and sure enough i'm asking myself why anyone would stick with the pinky tags or infinite bools thanks again and keep up the rocking tuts brother!
@@thegamedevcave
Enumeration lists and Blueprint interfaces is the way.
enum list kind of works too, depending on the situation but it's rather clunky compared to gameplay tags. But if you have something to "tag" or keep track off that is very specific to a certain type of actor , doing it with enums or a method like it probably does make more sense than gameplay tags.
For values that are relevant to a lot of different classes though, gameplay tags are a lot nicer to work with
@@thegamedevcave I watched the video a second time. You’re right.
The more you know xD. Thanks for telling about another baked-in feature I've never ever seen.
unreal does a great job having so many baked in features, and a terrible job letting you know about them XD I guess that's my job though! :p
@@thegamedevcave Indeed, unfortunately many older links that can still help rely on old forums which where replaced by "community forums" which bricked all docs and now we have to explore UE like after server wipe xD
@@arthurbulhak1266 it's really annoying that they just wiped those old servers because So often when i'm troubleshooting an issue I find the answer and it turns out to be a dead link XD so I 100% feel you there!
@@thegamedevcave Exactly, I guess at this point the best way to debug stuff, albeit definitely "advanced" (well default if you at least understand C++ :D) is to download debug symbols (aka 40 more GB), double-click on every blueprint giving trouble, looking at code directly and then going to UE5 codebase docs. Quite more annoying but extremely rewarding
Terrific tutorial. Again, learned lot from these.
Thanks! I'm glad it helped you out!
sometimes I struggle a lot to get variables from other places/actors and such... since this is "global", this might be the best solution at first glance
dayum
the setup for what tags exist is global, the actual values are still on a per actor basis so i dont think this helps with that honestly. If you need actors to share information you should just made a reference variable to them and link them up inside the level editor.
I need more pros, its like a struct of tags.
It kind of is I suppose, but that should be a good thing
Great video as always really helpful, I've tried using tags, but i ran into a bit of issue, how do you delete a tag if you're no longer using it, every time i try i get this error that its still in use and its absolutely not, it brings up this new window that ive never seen (im still very new to UE5) and i dont seem to be able to edit anything there either D:
edit : i deleted all the GE_effects it claimed to be referencing and the error went away, a bit annoying but an easy fix, leaving this here incase anyone else runs into the same problem
probably easier to close the engine, find the .ini file that stores the tags and remove it there, only if you're SURE nothing is using it anymore.
Also can be good to generally make sure all the classes referencing the tag are saved and compiled and restarting the engine before you try to remove it.
I'm curious to know more about why you don't use the default "Actor GameplayTags" and make your own struct. It basically creates a free interface for you so you don't have to cast to get gameplay tags off the actor if another actor is curious (like a sprinkler turning on if something overlaps with burning tag).
Additionally the actor tags iirc will interface with gameplay effects in GAS so you can set yourself up to move more easily to that system if the scope makes it worth it.
Yeah tbh that’s probably better, just wanted to show this in case you for whatever reason you have 2 containers on a blueprint you do this. But I’ll happily admit that’s a pretty unlikely scenario xd
I dont understand. I follow all instructions and i have access to tag names from characterBP and levelBP. but i can only assign tags values from each blueprints. even if they have the same tags they are completely as stand alone since changing a tag value in one BP does not affect value in the other BP in any way. is this where the interface comes in to play because i setup the interface also and there is still no value change from one BP to the other which would be the point of this exercise right??
No I think you might have misunderstood. Every actor has its own tag container to keep track of its own values for the tags so setting a tag on 1 actor only sets it on that actor, the on/off values of the tags aren’t a universal thing. If you want something like that simply put a tag container in the game mode or game instance so every actor can access it easily and read it write to it.
@@thegamedevcave oh i see. Thank you
@@thegamedevcave its weird that i cant access values fron other blueprint since its all in the same single .ini file
@@ng28181 the .ini file only declares the tags, it sets up what tags exists. the actual tag container is what stores each tag's true of false state on a per actor basis
@@thegamedevcave once again, thank you so much for your time.
Great thing. Now i will go research how to make it in C++
personally haven't looked into c++ use for them, I assume it's pretty straight forward though. I mostly use tags for the Gameplay Ability system at the moment and in Behavior trees.
As a Halo modder, im really used to tags, and it's good to see i can use them in UE.
So this gameplay tags feature is basically the same as a switch function?
i can see where you get that comparison, but this is something else. This is just a bool that's a little bit smarter and can be declared on a project wide scope, instead of on a specific blueprint.
A switch statement is something that decides the flow of 1 input into 1 of many outputs based on the value provided, so using a switch on a bool or a gameplay tag would still just be a true or a false, same as an if statement (branch node)
Omg I wish I knew about these forever ago
crapy part about gameplay tags is that if you migrate a progect using tags the tags will not recreate and you need to manually re sett all the tags . you can always move the tag.ini first but not always making edits in the config folder is the best way to go . i loooove tags tho dont get me wrong . unreal just need a fix, if a tag dont exist well just create it
yeah when you migrate it really should move over the .ini file first so the gameplay tags don't break... that's a really good point, unreal should fix that!
also they need to expose tags for full support in ai behaivor tree @@thegamedevcave
i do believe BTs already do a pretty good job. unreal has a standard decorator that checks if an object has a certain key and it's pretty easy to make tasks or services to set keys if need be. If you want a blackboard key for gameplay tags, that may be a slight bit more of an issue though, i'm not sure but I also dont see much reason to have a gameplay tag (container) as a key on the blackboard.
@@thegamedevcave well gameplay tags replace enums, like AI state, it's alot more flexible to add new stuff to gameplay tags than edit enums that also can corrupt structs, if everything is gameplay tags you can edit it as you want not killing a huge struct. I ended up using BT they are handy for sure but then again you need to manually write and remember where Gameplay tags is more like a huge enum drop down of posebilities. (Cursed Enums)
@@Atl3m Well, i personally am not sure I would use gameplay tags as a replacement for enums like that. Of course it's possible but not really it's intended use.
But even if you want to use it like that, unreal already does have that support build in right? there literally already is a decorator that checks if something as a certain gameplay tag. (That might be a decorator added by the gameplay ability system though, which could be why I have it in my project)
either way, it's pretty simple to write a few things to make use of gameplay tags for your AI :)
didn't u previously add these tags in the project settings?
you can add new tags in a lot of places, I believe there is a place for it in settings too, there is also a specific window you can add that's for managing your tags. in the end they all simply get added to a .ini file, regardless of what way you're adding them :)
Salut c'est trop bien ta technique incroyable pour gérer les booléen
Good job, but tags are not accessible from Get Class Defaults, which means all of this stuff is "cool" but basically useless, as a lot of Unreal Engine features.
Apparently this works ONLY for instantiated Actors, which totally kill their potential. LIke if you want to have a clothing system and use tags for special booleans like "is fullbody", we'll still have to stick to booleans.
wasn't aware that this wouldn't work with class defaults. that's a bit strange. But I also don't really think that using class defaults is a very common thing to do, and for what thee gameplay tags are useful for especially. As i show in the video, it is most useful for keeping track of state changes, not as a blanket replacement for all bools, and those have no relevance in class defaults anyway
Gameplay Tags are accessible from Get Class Defaults. I tested it just now to double check.
@@VampiricBard good to know, i planned to double check but entirely forgot about this, thanks that you took the time to correct this!
Thanks! Just in time. And how did I miss it before?
Exactly what I wondered when I found out about these a while ago XD
That's cool. I create enum lists for character and AI status. This is pretty good either. But I saved your method. I ll need that later ^^
Enums work pretty well for keeping track of states, since it can only hold 1 value at a time , for status' this works better, adding a new entry to a list of enum's can be haard to follow if you ever need to debug. but in the end, if it works, it works :)
Yeah. Developers Master Faith; Do not change if it works :D Have a good works
Very useful thing to know !
Thx you.
Glad i could help!
thank you for this, this was very helpful
My pleasure :D !
Wonderful just wonderful!
Thanks for the video, I didn't know about these!
Some of my "bool swamp" values are accessed on event tick. Any ideas of the performance of reading a tag from a Gamplay Tag Container versus a simple bool property?
i'm sure it's somewhat more expensive but not to a degree where it's worth bothering about honestly. I'd be more inclined to refactor the code to prevent checking things in tick if possible to improve performance. (of course, sometimes you simply do have to check every frame on something, but very often even tick ends up being a shortcut that's rather expensive)
I think I have tried to keep the logic in the player character event ticks to a minimum (even when a lot of UA-cam guides seem to add more and more!).
The other place is the "Update Animation" event where bools are checked for the purposes of the animation state engine.
Perhaps the tag system would only become an issue if you grew the game tag container "array" to a very large size...?
@@garfy1000 in all Likelyhood you shouldn't need to look at your tags for animation related things. Unless you have (as an example) a specific animation that plays when your character is burnt that loops for at long as they keep the burnt status (like a panicked, waving their arms around "I'm burning to death" kind of animation), something like that you should be able to check for tags for if you need.
All together, the difference between checking a bool and a tag by itself shouldn't make any notable impact really though
Brilliant, thanks.
Great guide!
Glad you think so!
Excellent tutorial.
Thank you! Cheers!
stunned by hammer ...... was that a MH reference XD?
It wasnt but... it is now xd
pog@@thegamedevcave
thanks
Just use an enum.... solved. works in ANY engine.
gotten this comment a lot, but everyone seems to skip over the fact that an enum doesn't have the upside of the parent/child tag hierarchy, and more importantly, it only has 1 value at a time, so if you use it for status effects like the example in this video, you can't be both burnt AND poisoned. if you use it for a wider use case where you also have tags for when you're attacking, now you suddenly can't attack while you have any other effect applied to you, or you need to disable the effects whenever you do an attack. using enums for this is honestly a more messy setup than sticking with the idea of using a whole bunch of bools.
@@thegamedevcave state machines are generally not happy with multi dimensional statusses anyways, its a way better practice to split them . sm's for buff and debuf, movement, health for example. Modularize instead of spaghetti'ing it. That makes it easier to add on one of them later too if you are going to do dlc or even if there is a cool new idea you want to add later in development.
@@viwesvideos not sure where states machines suddenly came from? none of this really has to do with state machines. Take a look at the gameplay ability system for more in depth uses of tags, it's useful stuff. if you insist on not using them you're of course free to do it in any way you prefer but I think you are fundamentally misunderstanding what these tags are and how I show them in this video.
Tags are easily expandable and really don't cause any spaghetti code so i'm not quite sure where you're coming from. that's the whole point of the parent/child tag thing. you can check for parent tags so instead of checking " is character X doing Y attack" you can simply check if it's doing ANY attack, so if you want to add something new to that, you simply add a new child tag, anything that involves that new thing directly can check for that while everything that just checks for attacks in general will now also pick up on this one.
@@thegamedevcave i gave the tip to use enums instead of checking bools, because this works across any and all engines. If one would use enums, you should use them in state machines. This way you dont have to check single statusses over and over. For character status controls, sm's are widely used for the speed amd ease of use. In visual scripting its a bit hard to recognise but underlying it still works the same as in just coding it.
Not saying that what you explained in the video is any less valid or usefull, just giving an alternative tip
@@viwesvideos I would still recommend looking into unreal's gameplay ability system to see a more worked out implementation of how and why tags can be useful. the thing i you're not checking for a bunch of tags constantly, when you want to apply a certain action or effect, you check if there already is a tag active , and based on that you can write some logic to do, whatever you want really. does a character have a tag for healbock? you can just check for that tag in any healing ability and if it is present, cancel that ability. Is a character already attacking? simply disallow other attacking abilities to active, but it also works the other way around of course, checking if a tag is present to allow certain abilities. It's much deeper than the example I give in this video of course because all that hardly fits in a simple video. But getting a feel for gameplay tags , knowing they're an option and if you plan to use G.A.S. pretty much a requirement, it's just good to know how they work.
Doing all that in a state machine would be a nightmare.
it's pretty unreal specific though you're right about that without a doubt, but i'm making unreal tutorials so of course i'm not overly worried about other engines. I know that unity at least ahs something similar to this tag system though.
All that to say, enums are great of course and you should use them, but they dont really fill the same roll as gameplay tags so if you're looking for an alternative to tags, i think enums are more bothersome in this specific use and role than a simple list of bools (which is messy, hence the idea for this video in the first place)
yea Thank u
I generally do not like tags, becasue they are strings (costly and prone to errors via typos). I usually make my own systems with enums. But this is pretty cool, I will definitely keep this in mind!
if you're working in c++, that does increase the odds of things going wrong with typo's for sure XD something to be mindful of
@@thegamedevcave I mostly worked in Unity before, there tags have this danger. I started prerly learning Unreal not too long ago, and I always wonder at all the solutions that are pre-built in the engine. Such as these game tags.
@@thegamedevcaveUE5 professional gamedev here... This is wrong actually, you don't really need to use strings ever with Tags. Sure, they have a FName internally and you could have a typo, but the only associated risk is to have a typo-ed tag and that's a very easy fix. See, when you declare & define a tag natively, you associate it with an actual variable name that your autocompleter (and of course compiler) will ensure you don't miss-type, ever. And on the editor side the property editor for tags just doesn't allow you to make a typo by nature. As for performances, tag comparisons between one another and against a container are much faster than a string comparison : FNames are "indexed" internally. It's their whole point. It's not at all the same as if you were to just express the state of your actor (or whatever else !) with a bunch of strings.
Tags use FName under the hood, which are strings that get indexed in a global table at construction. Each FName that has the same case-insensitive string gets the same index. Equality comparison is done using the index, not the underlying string.
Looking through names is vastly faster than looking through strings, hence epics use of name variables in tags. Just to simplify the last comment 😂
why not just use enums?
Enum can only have 1 value at a time
@@thegamedevcave Was gonna say bitmask enum, I'm disapointed that Blueprints don't seem to support this, unless I'm missing something. Edit: I was missing something, bitmasks are supported but the value is stored as an integer
Subscibed !
I love you
Basic, interesting, nice.
This is amazing!... stunned for being stupid. Thank you! 😂
it's amazing how easy it is to overlook simple things isn't it XD Glad I could help!
So much British 😁😍
i'm not but thanks anyway XD
My new motto has become that you can tell how good of a programmer someone is by how many booleans are in their classes. GameplayTags are a way better and more flexible option. Great for anything using data as well(Maps, DataTable rows, DataAssets, etc)
like for stunned for being stupid
If you are a game developer, and your initial idea of grouping multiple booleans describing status of your actor is not using for example a map of string/name to boolean or a struct, but an array of unnamed bools the indices of which you remember/write down, then it's probably time to uninstall Unreal and try carpeting or something :)
The map one is a decent solution, but no, both aren't decent solutions ;)
ah yes, because gatekeeping beginner's on a tutorial video is always a good thing to do.
Of course both methods, just a list of bools (if they're unnamed in an array, that is much worse), and the map with string/bools are workable if you're just getting started, there are so many more important things to put your attention on, those bad solutions work, and that's whats important , and then whenever people are a few steps further into learning game development, it becomes important to not get stuck with those sub-par solutions and put a little effort into learning The better solution like gameplay tags.
Telling people who are learning that they're not good enough is a toxic as hell and unproductive way to teach them. do better.
@@thegamedevcave Great response. I can't stand gatekeeping.
dont tell me what to do - you would also not listen if i tell you to use c++ instead of these awful nodes
i do use c++, so jokes on you? I just use blueprint for tutorials because its easier to understand for some people and c++ user can figure out the c++ functions for any given nodes easily
@@thegamedevcave wish you good
This tutorial can be significantly reduced. Lots of unnecessary fat
Unity is better hehe.
it is for people that REAAAALLLY like dying on hills