Using Enums and BitFlags in Unreal Game Development

  Рет қаралды 4,213

GGameDev

GGameDev

Күн бұрын

Пікірлер: 25
@krzysztof5585
@krzysztof5585 Жыл бұрын
Between 15:15 and 15:26 there is quite important bit at the bottom you never mentioned - a macro with overloads ENUM_CLASS_FLAGS(enum) missed it at first and took me way too long to figure out why nothig from the vid was working for me. Aside from that great vid, keep em coming!
@ggamedev
@ggamedev Жыл бұрын
Yes, I probably should have hi-lighted that point. Its one of those things where working with this stuff after a while you become almost blind to it. Consider your comment 'pinned' for the benefit of others 😉
@patrickspencer1143
@patrickspencer1143 Жыл бұрын
This video is incredible! I've been recently diving into bitflags for an RTS and this has been such an amazing find. I really appreciate the pacing of covering so much from the general idea of enums, to how it applies to unreal in both BP and c++, to how they can be used for general problem solving. Your inclusion of explaining how the values of the enums can be set really helped me understand things so much better.
@ggamedev
@ggamedev Жыл бұрын
Excellent. That's just...like... 'My work here is done' 😄
@Shrooblord
@Shrooblord Жыл бұрын
This is genius. Thank you for elucidating a small host of related concepts in a concise format while bringing it all home under the topic of "using bitflags". I'm just diving into bitflags and am losing my mind a little -- but this video is helping me a lot in getting to the bottom of HOW DO THEY WORK??
@ggamedev
@ggamedev Жыл бұрын
Thanks a lot for the positive feedback. It's great you were searching for information on them, because they are one of those areas that people often consider to be 'optional', when in fact a reasonable knowledge of bitflags, and some basic binary in general are good foundations for all programmers to have, and will help you to optimize many data structures and a host of processes, and possibly even speed up your network comms traffic, etc.
@p30virus
@p30virus Жыл бұрын
This was so good, now is more clear how the character movement component handles the movement state.
@ggamedev
@ggamedev Жыл бұрын
The engine uses them all over the place, and once you get used to it you probably will too. Very useful, can help keep your code cleaner and more organised, and save on memory too. And also quite nice if you expose stuff to blueprints. Kinda win-win proposition. ... And thanks for the positive feedback 😀
@karaczan5839
@karaczan5839 11 ай бұрын
I just want to say how good the quality of this video is, also you explained it very well, i have to say this video is very enjoyable. I just want to give you a tip: if you want more views i feel like your thumbnail should be more oriented around the topic, and i say not only the text but most importantly the image itself. I am no youtuber tho, so take it however you want. Great vid!
@blackivy011
@blackivy011 7 ай бұрын
Wow, what a bomb video. Literally had be understanding binary in ways I never have before. Thanks man.
@ggamedev
@ggamedev 7 ай бұрын
Awwww, shucks! 😊
@x3kj705
@x3kj705 Жыл бұрын
thanks for your videos, i like the concise info and practical examples
@ggamedev
@ggamedev Жыл бұрын
Nice to hear that, thanks for taking the time to drop a positive comment 🙂
@spike3627
@spike3627 Жыл бұрын
Thanks!
@ggamedev
@ggamedev Жыл бұрын
You are welcome my friend 👍
@SuperJohnsmith
@SuperJohnsmith Жыл бұрын
I'm trying to set it up so I can assign my flags through the editor, I'm using UPROPERTY(EditAnywhere, meta = (Bitmask, BitmaskEnum = "EDirection)) uint8 Directions with the enum set up how you show here, however when try and check it with the '&' symbol I have to cast it to uint8 and it doesn't seem to work properly at all. if(Direction & (uint8)EDirection::North) On your examples you don't show a cast at all so what is the variable type of "PlayerWounds"?
@ggamedev
@ggamedev Жыл бұрын
You are needing to cast it because you defined the property as a uint8, not as the enum type. So as far as the code is concerned, its a uint8, not your enum. so you are trying to use the & operator on 2 different types (even though they are not actually different as the enum is based on a uint8) I'm not saying that's your fault or anything, it seems to be what you MUST do to make the property work in the editor, with the flags dropdown support. This seems to be an unfortunate situation really - if you are coding in C++ and not trying to expose the flags enum to a uproperty for editing in the editor, then everything is fine, and the code works as it should. If you really must expose it to the editor in a dropdown list, consider this; rather than casting the enum entry to an uint8, why not cast the property value to the enum type, and then test that? This subject can get a little wordy for YT comments, join the discord if you wanna follow up more about this.
@SuperJohnsmith
@SuperJohnsmith Жыл бұрын
@@ggamedev Thanks I appreciate the reply! I think I've worked out the problem now, I was doing everything right, it was just a silly mistake when I call my function responsible for the flag check. A simple case of deleting a !, the results I was getting was reversed of what I actually wanted so I just thought it wasn't returning correct results. Force of habit of adding a ! in guard clauses. 🤣
@davy4842
@davy4842 Жыл бұрын
Hi man nice videos ! I would like to suggest more SQL content with Lyra …could be nice as a practical example!
@ggamedev
@ggamedev Жыл бұрын
I'll consider that. When it was first released, there was a lot of interest immediately in Lyra, and I played around with it a bit, to see what the fuss was about... My main concern though, is that many (*MANY*) people have simply tried to 'asset flip' it, and pass it off as if they had actually made something themselves. I'm pretty sure that wasn't what Epic had in mind for it though 😉
@davy4842
@davy4842 Жыл бұрын
I thought that too but there is like 10 assets on the marketplace that do the same thing…I’m learning gas through it and now I’m interested in using with a database to load info between machines^^
@ggamedev
@ggamedev Жыл бұрын
@@davy4842 That's why I really appreciate comments on the videos, or people chatting on the Discord... Especially regarding Unreal - its such a huge Engine in terms of what it encompasses and more eyes-on is always useful. 👍 I'll take another gander at it certainly. I have to say, I wasn't impressed with GAS, I really tried to like it, but honestly, it came across as a poorly documented 'hot mess', the only reasonable documentation being that provided by helpful users via basically reverse engineering and scouring the source code, rather than directly from Epic - not a great look really. Ultimately I felt that for my own projects it would just be much faster/cleaner to develop my own solution... But my 'jury' is still out on my final decision.
@matthewkeen6281
@matthewkeen6281 Жыл бұрын
nice
@ggamedev
@ggamedev Жыл бұрын
Thanks 🙂
@betabeta7245
@betabeta7245 Жыл бұрын
std::bitset also works in some cases.
Indie 'Studio' Job Scams
21:10
GGameDev
Рет қаралды 1,2 М.
Getting into C++ with Unreal Engine - Part1 - Setting up
34:49
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
Top 10 Unreal Engine 5 Plugins to Speed Up Game Development
28:17
Need to Know Nodes in Unreal 5 Blueprints
48:59
Cason Quisenberry
Рет қаралды 94 М.
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
USE Gameplay Tags
10:38
The Game Dev Cave
Рет қаралды 56 М.
Multiplayer in Unreal Engine: How to Understand Network Replication
22:08
I Struggled With Blueprint Interfaces for Years!! (Unreal Engine 5)
16:48
Glass Hand Studios
Рет қаралды 194 М.
Intro to Data Oriented Design for Games
52:35
Nic Barker
Рет қаралды 15 М.
How to create Modular and Scalable UI systems in Unreal Engine
19:15
AmrMakesGames
Рет қаралды 100 М.