- 125
- 693 342
enigma tutorials
Приєднався 11 лис 2008
Opinions are my own and are in no way associated with my employer. All content here are personal projects with no monetization
Unreal Net Dormancy Explored - UE C++ Tutorial
Dormancy is a useful way to optimize network performance in the Unreal engine.
Dormancy allows an actor to be removed from the list of actors to consider for replication.
Dormancy basically allows you stop sending network updates from the server to the client.
Unless you flush-or-awake and change variables.
Here I explore various Dormancy modes.
I note differences between blueprint and C++ code.
We explore high level over view on a white board.
Then explore documenation for some specifics.
Then I go though a code example of putting an actor dormant and exploring behavior.
Note, you should flush (or awake actor) before changing replicated state.
Doing that ensures the shadow state is correct, and that it can correctly determine what replicated state changes, in order to reliably replicate to the client.
Note there are some a mistakes in the video, that I called out after editing.
1) you should flush or awake an actor before changing replicated state, not after.
2) you should not modify replicated state while an actor is dormant; you can end up missing updates.
I called these out in the video explicitly where they occur. I had already made the video before I realized the mistake.
And while the example isn't the best in terms proper managment of network state, it does show how dormancy will stop replication of properties while an actor is dormant.
So it seems to me that it is worth while to explore dormancy with this less-than-ideal-example, as long as we take note that in practice you shouldn't modify replicated state without flushing or awaking first.
Recorded in UE 5.4
Documentation for this engine version
dev.epicgames.com/documentation/en-us/unreal-engine/actor-network-dormancy-in-unreal-engine?application_version=5.4
0:00 Whiteboard Introduction
3:57 Documentation Highlights
4:30 Documentation flush before change, and don't modify replicated state while dormant
4:54 Documentation Highlights pt2
6:10 Documentation - Waking Guidance
7:00 Documentation Highlights pt3
7:45 Disclaimer, mistakes in video changing replicated state while dormant, and late flushing
8:36 Example 1: Dormancy disables C++ variable replication
9:19 Setting an actor's dormancy to DormantAll stops replication without flushing
9:40 The C++ Code for replicating variable, RPC, and dormancy flush
12:45 Exploring RPC behavior, RPCs essentially cause a flush
13:47 Changing a CODE c++ doesn't flush dormancy like blueprint does
14:20 Frequent changes (eg with tick) can keep your actor from returning to dormancy
16:00 Quick summary of some code specific behaviors
16:14 Testing Legacy replication (previously using push)
16:49 Code Dormancy Summary
17:01 Reminder: Flush before changing, don't modify dormant state
17:15 Blueprint and Dormancy behaviors
18:09 Modifying a blueprint replicated variable forces a flush
19:17 You can bypass the blueprint behavior accidentally, if you modify the variable in a way it can't detect
20:02 RPCs flush dormancy
21:16 Destroying Replicated Components - Example of where you must flush before changing replicated state
23:15 Types of Dormancy
23:57 DORM_Initial - Dormant Initial explored
26:58 DORM_DOrmantPartial - Dormant Partial explored, custom logic for dormancy.
29:09 Closing Summary
30:23 Outro
Dormancy allows an actor to be removed from the list of actors to consider for replication.
Dormancy basically allows you stop sending network updates from the server to the client.
Unless you flush-or-awake and change variables.
Here I explore various Dormancy modes.
I note differences between blueprint and C++ code.
We explore high level over view on a white board.
Then explore documenation for some specifics.
Then I go though a code example of putting an actor dormant and exploring behavior.
Note, you should flush (or awake actor) before changing replicated state.
Doing that ensures the shadow state is correct, and that it can correctly determine what replicated state changes, in order to reliably replicate to the client.
Note there are some a mistakes in the video, that I called out after editing.
1) you should flush or awake an actor before changing replicated state, not after.
2) you should not modify replicated state while an actor is dormant; you can end up missing updates.
I called these out in the video explicitly where they occur. I had already made the video before I realized the mistake.
And while the example isn't the best in terms proper managment of network state, it does show how dormancy will stop replication of properties while an actor is dormant.
So it seems to me that it is worth while to explore dormancy with this less-than-ideal-example, as long as we take note that in practice you shouldn't modify replicated state without flushing or awaking first.
Recorded in UE 5.4
Documentation for this engine version
dev.epicgames.com/documentation/en-us/unreal-engine/actor-network-dormancy-in-unreal-engine?application_version=5.4
0:00 Whiteboard Introduction
3:57 Documentation Highlights
4:30 Documentation flush before change, and don't modify replicated state while dormant
4:54 Documentation Highlights pt2
6:10 Documentation - Waking Guidance
7:00 Documentation Highlights pt3
7:45 Disclaimer, mistakes in video changing replicated state while dormant, and late flushing
8:36 Example 1: Dormancy disables C++ variable replication
9:19 Setting an actor's dormancy to DormantAll stops replication without flushing
9:40 The C++ Code for replicating variable, RPC, and dormancy flush
12:45 Exploring RPC behavior, RPCs essentially cause a flush
13:47 Changing a CODE c++ doesn't flush dormancy like blueprint does
14:20 Frequent changes (eg with tick) can keep your actor from returning to dormancy
16:00 Quick summary of some code specific behaviors
16:14 Testing Legacy replication (previously using push)
16:49 Code Dormancy Summary
17:01 Reminder: Flush before changing, don't modify dormant state
17:15 Blueprint and Dormancy behaviors
18:09 Modifying a blueprint replicated variable forces a flush
19:17 You can bypass the blueprint behavior accidentally, if you modify the variable in a way it can't detect
20:02 RPCs flush dormancy
21:16 Destroying Replicated Components - Example of where you must flush before changing replicated state
23:15 Types of Dormancy
23:57 DORM_Initial - Dormant Initial explored
26:58 DORM_DOrmantPartial - Dormant Partial explored, custom logic for dormancy.
29:09 Closing Summary
30:23 Outro
Переглядів: 216
Відео
The IsValid function, When to use it, and when not to use it - UE C++ Tutorial
Переглядів 450Місяць тому
IsValid() is a useful utility function, when used properly. However, some users of the engine confuse this with other memory protection features in the engine. That misuse can result in crashes, memory stomps, or undefined behavior. So it is important to know what IsValid is useful for, and what it is not useful for. To summarized, IsValid isn't some magical function that can know if an address...
Using Audio in UE C++, UAudioComponent, USoundBase, MetaSoundSource, linking - UE C++ Tutorial
Переглядів 1942 місяці тому
Introduction to playing Audio in gameplay code in c . Here I demonstrate using UAudioComponent, USoundBase, MetaSoundSource. And how to set the module so you don't get linker errors when attempting to use meta sounds. There are a lot of audio features in the engine not covered here, but this should be enough to get started. I also attempt to explain some concepts so that you can be informed and...
Net Relevancy Explained ; Actor Relevancy Explained - UE C++ Tutorial
Переглядів 2882 місяці тому
Exploring how to net relevancy works in the Unreal Engine. Exploring the concept of Actor Relevancy. This can be used to help with optimizing network performance of your game. For a given client, only a subset of server actors are relevant and to a given client. By only sending information for the set of relevant actors, we can save bandwidth for a client. Meaning we can potentially send more n...
Using Niagara particles and vfx in Unreal C++; covering first time set up - UE C++ Tutorial
Переглядів 5923 місяці тому
Here's how to use Niagara assets in C . Covering Gotchas, BP differences, setting up linker, compile errors, including, and the important IsValid distinction. IsValid should be used to determine when particles are no longer valid, not != nullptr. This is because a particle can finish playing before the garbage collector frees the pointer to its component (if it is set to destroy). So the != nul...
Upgrading an Unreal Engine Cpp project - Upgrading 5.3 to 5.4 - UE C++ Tutorial
Переглядів 4724 місяці тому
I walk through my experience upgrading my tutorial project from 5.3 to 5.4 on windows. Depending on your project, you may encounter different compile errors from me. But I hope this can show you how to work through those compile errors. Most of the time, I am able to upgrade this project without any compile errors. But occasionally there are small errors like shown in this video. I hope it help...
All the UInterface types explained in Cpp (Condensed Version) - Unreal Interfaces - UE C++ Tutorial
Переглядів 2964 місяці тому
This is a condensed version of the full video here: ua-cam.com/video/SVGhPtJwBVk/v-deo.html The Unreal engine provides interfaces as a primary feature of the engine. When considering C and blueprint, there's 3 different ways interfaces are used. We have Blueprintable, NotBlueprintable, and Blueprint interfaces. This video goes through the different permutations, the nuances between them, and pr...
All the UInterface types explained in Cpp - Unreal Interfaces - UE C++ Tutorial
Переглядів 6205 місяців тому
The Unreal engine provides interfaces as a primary feature of the engine. When considering C and blueprint, there's 3 different ways interfaces are used. We have Blueprintable, NotBlueprintable, and Blueprint interfaces. This video goes through the different permutations, the nuances between them, and provides mental model to quickly reason about the differences. TSubclassOf can be constrained ...
Frame Counter Caching Optimization Technique - Insights Part 3 - UE C++ Tutorial
Переглядів 2835 місяців тому
Video covering what to do when you've optimized your function to be as fast as possible, but still need to get some performance back. QUICK_SCOPE_CYCLE_COUNTER and the like can actually tell you a count for a given region. This allows you to identify redundant function calls. The best optimization in this scenario is to remove the extra function calls. But sometimes, that is not an option for v...
Composite Tables Pt2 - Replicated Gamestate Difficulty Property Refactor - Coop - UE C++ Tutorial
Переглядів 1686 місяців тому
In a previous video I showed how to set up a difficulty system using composite tables to layer spread sheets on top of each other. Part 1: ua-cam.com/video/3JZe7Q7cS1k/v-deo.html In this video, I refactor the difficulty property to be replicated, so that the difficulty can be changed in a co op game. This shows how one might go about refactoring properties to be replicated. First is establishin...
Using Composite tables to layer spreadsheets - building a difficulty system - UE C++ Tutorial
Переглядів 4017 місяців тому
Composite tables allow you to stack multiple tables on top of each other for a final result. Composite tables allow you to override rows from tables lower in the stack. This can be useful in many ways. But for an intuitive demonstration, I've made a quick difficulty system example. Showing how to balance a games difficult using composite tables. Composite tables save time by inheriting other so...
Unreal Balance Spreadsheets - UDataTable and FTableRowBase explained - UE C++ Tutorial
Переглядів 5208 місяців тому
Data tables are a way to integrate spread sheets into your game. Spreadsheets give a high level way of controlling a lot of data in a single place, ideal for game balancing. Unreal implements this with the UDataTable class. You create a custom FTableRowBase struct subclass, to define your data. Each member variable in your FTableRowBase struct, corresponds to a column in the spread sheet. That ...
UDataAsset - Data Assets in Unreal C++ - Data Instances and Data Classes - UE C++ Tutorial
Переглядів 1,7 тис.8 місяців тому
This video covers the information you need to know about data assets from a c perspective. The C capabilities, and how blueprints interact with code data assets. I think of things in terms of data instances and data (sub)classes. When you subclass UDataAsset, you're creating a new type of data class. Your new subclass can be used to create data instances, where designers will populate the varia...
Is QUICK_SCOPE_CYCLE_COUNTER free? The cost of measuring performance explored - UE C++ Tutorial
Переглядів 4269 місяців тому
The act of measuring requires some CPU work, so it isn't completely free. But how much does the act of measuring inflate performance measurements? I wrote some tests to attempt and answer that question, at least approximately. It is hard to accurately measure very fast things. So what I have done here is set up two different loops, that both do the same operation: Index % 3. One of the loops ha...
Introduction to using Unreal Insights Profiling with C++ - UE C++ Tutorial
Переглядів 1,6 тис.10 місяців тому
Unreal ships with a powerful profiling tool called Unreal Insights. You can quickly iterate and test ideas using scope cycle counters and unreal insights. Here I show how to define some quick scope cycle counters to measure a function or block scope. I show how to capture the profile data in the editor, and in a standalone client. I show basic usage of the insights tool to view measured duratio...
The Fast Unreal Cast versus dynamic_cast - UE C++ Tutorial
Переглядів 1,5 тис.10 місяців тому
The Fast Unreal Cast versus dynamic_cast - UE C Tutorial
Unreal C++ Gem - ON_SCOPE_EXIT is a convenient way to do RAII - UE C++ Tutorial
Переглядів 48511 місяців тому
Unreal C Gem - ON_SCOPE_EXIT is a convenient way to do RAII - UE C Tutorial
Slow Lambda Corruption; C++ Terrible Bugs. How to protect from lambda issues - UE C++ Tutorial
Переглядів 94711 місяців тому
Slow Lambda Corruption; C Terrible Bugs. How to protect from lambda issues - UE C Tutorial
Destroying Actors - Comparing Lifespan and Destroy in Unreal - UE C++ Tutorial
Переглядів 414Рік тому
Destroying Actors - Comparing Lifespan and Destroy in Unreal - UE C Tutorial
How to find and use components generically in Unreal C++ - FindComponentByClass - UE C++ Tutorial
Переглядів 523Рік тому
How to find and use components generically in Unreal C - FindComponentByClass - UE C Tutorial
Unreal Actor Iterators - How to use them, when and when maybe not to use them - UE C++ Tutorial
Переглядів 621Рік тому
Unreal Actor Iterators - How to use them, when and when maybe not to use them - UE C Tutorial
Unreal Console Variables - CVars : how create; set console, command line, or ini file - UE C++
Переглядів 1,5 тис.Рік тому
Unreal Console Variables - CVars : how create; set console, command line, or ini file - UE C
How to make a console command in Unreal Engine - UE C++ Tutorial
Переглядів 1,5 тис.Рік тому
How to make a console command in Unreal Engine - UE C Tutorial
How to correctly return values from blueprint to code - BlueprintNativeEvent Funcs - UE C++ Tutorial
Переглядів 712Рік тому
How to correctly return values from blueprint to code - BlueprintNativeEvent Funcs - UE C Tutorial
Designing C++ UFUNCTION blueprint nodes; the hidden power of UPARAM - UE C++ Tutorial
Переглядів 408Рік тому
Designing C UFUNCTION blueprint nodes; the hidden power of UPARAM - UE C Tutorial
Using TArray as other data structures (Stack or Heap) - UE C++ Tutorial
Переглядів 282Рік тому
Using TArray as other data structures (Stack or Heap) - UE C Tutorial
Advanced TArray Functions, like Placement New - UE C++ Tutorial
Переглядів 403Рік тому
Advanced TArray Functions, like Placement New - UE C Tutorial
What is TArrayView, and when to use it? - UE C++ Tutorial
Переглядів 1 тис.Рік тому
What is TArrayView, and when to use it? - UE C Tutorial
How to force TArray to be on the stack in Unreal (TInlineAllocator) - UE C++ Tutorial
Переглядів 853Рік тому
How to force TArray to be on the stack in Unreal (TInlineAllocator) - UE C Tutorial
Unreal C++ - The Algo namespace and its superpowers - UE C++ Tutorial
Переглядів 985Рік тому
Unreal C - The Algo namespace and its superpowers - UE C Tutorial
Big thanks! Rly, so easy to understand. Also, can you make a vid about the Push Model?
Hey, thanks for kind words. I have a video on push replication already :D (compared with the previous method of replication). Find it by searching for my video "How to network C++ variables in Unreal"
Andrew Joy presented at UnrealFest ANZ 2024 and talked about their RepHelpers class which is published on the 2Bit gitlab that has some other improvements to working with Replication in C++
Fantastic subject, only few cover networking side. Btw, have you explored iris networking yet ?
Thanks. I haven't learned much about Iris yet. I also haven't learned much about NetGraph either. I am mostly familiar with the default networking set up for the engine. Iris and Netgraph are topics I hope to learn more about later. :)
I notice that Iris was used in Lyra for the equipment.
@@l_t_m_f I haven't explored equipment yet but nice info.
still helping four years later. you are the GOAT
Very helpful!
thank uuuu!!!!!!!!!!!!
👏🤝💪
I learning coding cause of you thank you cause I don’t know what nothing means I watching your 11 year old videos to learn arma 3 cause I’m new
Awesome CPP content you have on your channel. How would you go baith learning UE programming if you have to do from scratch again ?
Thanks! Hm, I'm not sure how I would go about it now. If I had to do it again, I think I'd first get really comfortable with blueprint. I attempted to learn BP after learning Unreal C++. But lately I have been thinking, it probably would have been easier if I learned BP nodes first, then learned how to do that in C++. BP is very quick to write (you don't have to do things like include headers, etc.). So you can really get going fast with learning the gameplay framework. Then once you understand how things like Pawn, PlayerController, etc. work together, you can explore doing those things in C++, only having to learn syntactical things like what to include, how modules work, etc, -- but already understanding the pawn/playercontroller classes from experience in bp. Though, I'm not sure that is the best way to learn it, that's just a thought. Also, I'd study the example projects a bit more (like lyra). Learn to use "find references" "symbol search" etc in the example projects, and it can answer a lot of questions about how to set up things.
@enigma_dev I also have done CPP first and not BP, I am in deep now can't go switch to BP just yet lol but you are totally right it is better to get around visual script first. Lyra is super cool framework bit hard to her around at start. Thanks to your videos as well, I have been learning from over a year from you 🤝
This was very helpful. I was surprised to see multiple if statements in the algorithm.
thanks
So how do I loop this?
Those are tricky subjects, the IsValid() vs nullptr and the compile error that doesn't tell you it's a missing module, thanks for making these videos!
Everythings working as it should, but i the zombies wont attack me or other npcs they all end up just running away i thought if i turned everyone into a zombie by pressung delete it would fix it, but now they either stay completely still or bump into me gently and cause no damage
How did you get it to work? I can’t get it to work when I press f9 in game, nothing happens.
@huntermurphy7515 thats the thing i have no clue, i just installed a first person mod instead bc i was getting frustrated then all of a sudden it all started working for me, well kind of again the zombies wont do any actual damage just circle around me.
These dev logs are criminally underviewed. Great stuff man!
Thanks! I guess it is a fairly niche topic, so low on views.
I've been writing .Net since 2000, literally in the UK beta program for the organisation I worked for, and I'll admit that I've tried a bunch of different environments for C# dev, especially, but always found myself going back to Visual Studio, like Stockholm Syndrome or something ... but Rider took 2 days to make me switch it to my daily driver. So glad that they've now made it free for Solo and non-commercial users, JetBrains really are a cool outfit!
Super helpful, thanks!
First!!!
Checkout the description for some additions.
Hi enigma, I’m new to Unreal Engine and I'm really curious how do you come across all these useful hidden tips and tricks? I want to get a deeper understanding of Unreal, but I'm not sure where to start. Do you have any advice or recommendations on what to focus on first, or how you approached learning it? I'd really appreciate any guidance you can share.
Hey, sure. :) I feel like I sort of learned it in a backwards way. I knew C++ before blueprint, and I really liked the C++ language. So I tried to learn how to just do everything in C++, skipping blueprint. But in hindsight, I think that is the not the best way. The engine has so many features that are quickly and elegantly expressed in blueprint/editor. In my current opinion, learning those (blueprint/editor/etc.) first will be easier than learning C++ first; so learn the C++ side of it second. (you can learn it in parallel, just don't neglect learning blueprint in favor of C++) And once you have a grasp on how all the things fit together (like pawns, player controllers, gamestate, game mode, etc.). Then you can learn how it is done in C++. So you're only really having to learn the syntax of how to do it in C++, because the concepts are already pretty clear from learning the easier scripting side of things. Learning how to read engine code will help vastly too, start small with like the parts of AActor you are using. Eventually it will hopefully snowball, and you will get to the point where you can investigate things by just reading engine code (well, most of the time :D) and answer your own questions. I want to make some videos to that, at some point. The engine is large, and there's still a lot for me to learn. I think the most important thing is to get to the point where you can do investigations yourself without needing tutorials. But watching tutorials is great way to learn fast, and still useful once you reach that point too. But there isn't always a tutorial covering the exact thing needed. With my videos, my goal is to try and save people time by giving a lot of good knowledge nuggets and understanding points. So people can hit the ground running and hopefully get past the early learning phases quicker. I don't plan to cover everything in the engine, but I think it would be cool to have a set of videos that would serve as a good starting point for someone getting into programming C++ with Unreal. -- There's not really one singular place for these tips I learned. I've learned things from official tutorials, official documentation, third party tutorials, forum posts, verbally from people, projects (check out lyra), and just reading engine code to try and figure out how things work. There's a vast amount of examples of how to do things in C++, just in the engine code. So learning how to navigate that is helpful (mostly I just use find-references and raw text searches, can see my rider video on the tools I use, there is equivalents in visual studio, but I covered them in my rider IDE video). Learn to get fast at navigating code with keybinds. I have not yet made a video on the widget reflector, but check that Unreal tool out. There's multiple ways to open it iirc, I just type WidgetReflector into the console that pops up from ~. The Widget reflector lets you put your mouse on windows in the engine, which takes you to the slate code, where you can find how it is displaying and reading C++ code. Slate code can be intimidating to read at first, but if you are used to UMG, it is essentially what you see in the widget trees, just a special syntax built on top of C++. The widgetreflector gives you starting points for research in reading the engine code. You can drop breakpoints and get callstacks to inspect what calls what (if you download engine symbols from the epic games launcher, or built the engine yourself). Also I try to play around, or experiment with, new concepts to get a better grasp on them. Live coding + console-commands and actor iterators make it really easy to write bespoke tests to test how something works. (I have some videos on those topics individually). Sometimes you have to hunt for information online. Like I knew there had to be a concept to force collect garbage. With some searching I found that cvar to collect garbage every frame. But in that case, it was searching for a concept I thought surely existed. But the console window now has autocomplete in ue5, so sometimes clever combination of words can yield nice discoveries on cheats in the engine has by default. (eg summon). But you may work backwards from finding the cheat, and where it is executed in code, to see how to use it properly. Well, that turned into a wall of text. Hopefully you found some part of it useful.
Man that keyboard is annoying. It's like listening to somebody chew with their mouth open
IM ON WINDOWS 11
Thanks for the video. Didn't even know CreateWeakLambda exists and I avoided all lambda bindings in my code. One thing to note is that not all "regular" timer delegate bindings are safe. For instance the BindUFunction one also has the same memory leak problem, at least it's the case in 5.2.
Hello, thanks for this great content! I wish if you post the code (especially the C++) in GitHub in file for gist format. Its mush easier to reason about the code during/after watching the video if its in text format.
Game wont luanch with dsound.dll
Thank you
I’m binge-watching your entire playlist, and all the information you’ve shared is pure gold!
Great content, thank you very much!
I didn't know you could pass actor pointers into RPCs. Thanks for that. I believe unreal uses the FActorInstanceHandle to find which actor to point to on the receiving end of the RPC.
Your tutorials are absolutely amazing.. But I do have a problem understanding your. You seem to swallow your words sometimes and talk too fast and do things on screen WAYYY too fast without actually having a chance to see or know what you are doing.. But maybe it is the way you talk, quality of mic or something..
Hey thanks for the kind words, and thanks for the honest feedback. I've recently got a new dynamic mic to help improve the quality, but I've still got some videos I am editing using the old condenser mic -- that I need to finish before the mic makes it into new videos. I also learned a new noise-gate workflow to help improve the audio and remove breaths etc, which will hopefully cut down on editing time. Some of the this issues here is due to trying to edit out pauses between words. I've been doing a lot of these unscripted as I don't have a lot of time to spend making the video. This video in particular was a one-off video I wanted to make quickly, so it is more rough than normal. I sort of have a high level plan of the next few videos I am going to make, and this video I decided to try and fit in-between my plan and editing of other videos. I've recently been experimenting with ways of improving production quality. I found out recording a video, writing a script, and overlaying that video on top of the VO is way more work than I can do (not exact numbers, but it is way more than it seems -- something between 10-30 minutes editing for every 1 minute of video with that method). Also I tried recording the video and then recording myself talking over it playing back -- that is a lot more work than I thought too (maybe 5-10 editing minutes per minute in video, so better but not great). Not considering video prep time either. So right now I'm experimenting again with doing it "live" but perhaps some code written before-hand. Or talking over a slide presentation of code snippets. But I'm still iterating on how to best make videos quickly, but at the right quality bar. Hopefully I'll find something that works well :D
👌👌👌🧠👍👍
Can't find how to make an inherited from PDA data asset instance directly in C++ if multiple inheritance is forbidden. Using cast?
By PDA you mean primary data asset? UPrimaryDataAsset inherits from UDataAsset, so inherit from PDA instead. You shouldn't need multiple inheritance. Just inherit from UPrimaryDataAsset if you want a PDA, is that is a UDataAsset as well, just with extra features. UPrimaryDataAsset is an extension of UDataAsset (PDA is child class of DA), PrimaryDataAssets has some extra features than a raw UDataAsset like discussed here. Note this video is about the base class UDataAssets, not UPrimaryDataAssets (I wanna make a video on PDA at some point, but it will refer back to this video to get the basics of UDataAssets first, since a lot of it is the same because it inherits from UDataAsset, but I want that video to focus on the additions, if I can get around to making it)
@@enigma_dev I want a DA instance inherited from my PDA, created in C++ and available in UE Editor
I'm not sure I follow. Are you getting an error? Like what is in your inheritance hierarchy? You can make child classes of PDA in C++, you can do a multiple linear class inheritance hierarchy (note: not multiple inheritance) I think this should be possible: PDA<-PDA_CPP1<-PDA_CPP2<-BP_PDA<-BP_PDA_INSTANCE. So it would could look something like this: 1) class UPrimaryDataAsset : publuc UDataAsset //this is the engine class 2) class UMyPDA_InCPP : public UPrimaryDataAsset //this is a new c++ base class you set up 3) class UMyPDASubclass_InCpp : public UMyPDA_InCPP //this is a new c++ child class you set up 4) BP_DataInstance //this is what is defined in editor, data instance based on UMyPDASubclass_InCpp Is that what you have but are finding an error or something?
@@enigma_dev I need PDA -> MyPDA -> My DA instance. And because multiple inheritance is forbidden in UE and Interfaces don't do much, I can't have a DA instance of my custom PDA (MyDA : DA, MyPDA)
Hm, the example you gave (PDA -> MyPDA -> My DA) this part doesn't look like multiple inheritance to me, looks like a linear inheritance hierarchy. That part seems fine. I'm assuming that means MyPDA inherits from PDA, (arrows are backwards than what I would expect). I just tested what I spoke to in the last comment without issue in 5.4. I was able to make a code base class of PDA, a child code class of that, a blueprint code class of that, and finally a data instance of that bp class. I didn't get any errors/warnings from that. But that's about all I tested of it. Multiple inheritance is having multiple base classes, perhaps that is what you mean by "PDA (MyDA : DA, MyPDA)" Do you mean that as "MyDA inherits from both a DA and MyPDA"? So in cpp that'd look like "class MyDat : public DA, public MyPDA". If that is the case, then I think you're right, you can't do that because it requires multiple inheritance. I'm not sure what to advise for that situation. Perhaps a PDA/DA that has references to other DAs. IE using composition. eg sudocode: " class MyCombinedDAClassType : public UPrimaryDataAsset{ UPROPERTY(EditDefaultsOnly, ...) TObjectPtr<DAType> DA; UPROPERTY(EditDefaultsOnly, ...) TObjectPtr<DAType2> MyPDA; } " and make an data instance of that. But that may be awkward for other reasons (eg you have to make 3 DA instances since it won't have inline editing in MyCombinedDAClassType, you'd make 3 DAInstances, DA, MyPDA, and the the thing referencing DA&MyPDA.).
The part starting at 1:05 has helped me immensely, I didn't know TMap have this danger. Thank you very much.
I think the main reason people have problem with this is that not every college teaches everything, for example i didnt know there was a faster way to do cramer than the standard determinant calculation on paper. I had to use chatgpt to find out that using a dot product+cross product can give you a nice way to prepare the upper data for cramer. In a perfect world, every paper should have a "basics" section, when the paper's authors write all the essentials needed to understand the problem (copied with reference to the original author or not copied). One small lack in knowledge and you can just be stuck there and cry yourself to sleep
Will the OnRep get called if we change the TArray elements order?
I think so yeah, I think that falls under the behavior at 9:23. Simplest form of changing order would be swapping 2 elements in the middle of some array. That's like modifying 2 array elements. AFAIK there's nothing really special about a swap, other than we are overwriting existing elements with copies of the swapped elements. For push replication, you will still need to mark the array dirty, after a reorder But let me know if you seem other behavior. Pretty sure a reorder is just effectively a modify though.
Great stuff!
hello sir , there is a warning i get all the time , is saying i need to explicitly include "SlateBasic.h" where i needed and it says i included it in my editor module header , but i did not , but this always happen when i make custom tools or windows with slate , the error says something like "monolithic" include or something , i ignore it and keep working it is not breaking anything but would be nice to know how to fix the warning , thanks in advance
Hey, if you get a chance can you copy-paste the warning as a reply? I don't recall seeing that issue, but I don't do too much with slate. Anyways, I did some google searching and found a forum post: SlateBasics.h(6): warning: Monolithic headers should not be used by this module Maybe that is your issue too? I just opened up SlateBasics.h, it looks like an older header that only really just includes a bunch of files for convenience. I believe it was the IWYU effort (search unreal IWYU) that advocated for better patterns of only including the headers you use (IWYU means include what you use). But this might not be exactly the same thing as IWYU. Anways, If you open up SlateBasics.h yourself, you'll see all it does is include a bunch of headers. A whole lot. It seems like it is a single (monolithic header) full of a bunch of slate headers. Chances are you only need like 2-3 of those headers for your given cpp class. But by including SlateBasics.h, you're implicitly including all of those other files too, which slows down compile times. You don't need all ~100 headers (or whatever number is there) implicitly included in SlateBasics.h. I think you only need to include the few you are actually using (easiest way to figure this out, I think, is just hit compile, with SlateBasics.h removed, and see what types are undefined) Once you know the undefined types, then navigate to where those types are defined in a header, and include those headers; I think? I think the fix may be to remove SlateBasics.h anywhere you are using it. And see what doesn't compile (ie undefined type) and include those individual headers. It looks like that forum post above, the person only needed #include "Engine/GameViewportClient.h". But in your case, it may be a different header (and there may be multiple you need, not just 1). Again, not something I remember fixing locally for myself, but sounds like maybe that is the issue, but I am not sure.
@@enigma_dev sure , i was and away from my pc but later on will open it and build it again and come with the warning, thanks sir
@@enigma_dev Wow that's exactly my case, and also what i Found on google but to be honest didn't know what to do with the information XD , but thanks for further explaining it for me i really appreciate it
@@arrowsdev No problem :)
Amazing video with great explanation. I would like to see the current behavior (UE 5.1+) with Actors.
Hey thanks :) AFAIK this is all still true for 5.4. I think the only difference with AActors, from regular UObjects, is it seems the uworld/level implicitly(or explicitly) has a refence to all the actors spawned; so spawned actors don't seem to get GC'd if they're unreferenced by a uproperty Even if nothing in your code that has a uproperty referencing them. The level seems to keep them around, unless you mark them garbage. (btw, looks like at 8:51, I see ue5.1 symbols loading, so I think that was the version I made the video on)
This helped
I have 2 3D Elements I need to check the clash between these two elements, So Which algorithm I use is little bit confusing. Do you have any suggestions
Hey, check out SAT and GJK. I'm more familiar with SAT (separating axis theorm, aka separating axis test), less so with GJK. SAT basically cleverly looks at projections of vertices to determine if they are colliding. Think of it as casting shadows on axes (eg y axis/ x axis). I think of them like lines going through the origin. But each axis is defined based on properties of the objects. If two shadows are NOT overlapping, then the objects cannot be colliding. The trick is to find all the different axes to test. If we talk about 2 cubes, it is the face normals. But it also needs to test the edge-on-edge collisions. You can cross product each pair of edges in the cube, to get another vector, which is an axis to test. Since some of these results are the same, you can get clever and avoid testing on redundant axes. (eg the left and right faces point in same but opposite directions, so only need to test one). So basically the SAT finds if any of these axes have shadows that don't intersect, and if there is a gap between them, then the object's cannot be colliding (because if they were, their shadows would at least be touching). SAT also gives you a MTV (minimum translation vector) to get you out of collision. This is basically the axes with the smallest overlap. You get the overlap distance, and multiply that by the normalized axis vector (with some care to make sure it points away from the object that was hit during the move). I should make a video on that, I did an implementation way back in college. It is a cool algorithm.
Nice video - thank you for making this! Btw. it wasn't quite clear to me that there was a "new" and an "old" method... will need to watch again, maybe it will make sense xD (quite new to networking in UE)
Hey, ahh sorry that is good feedback. I have video dedicated to replicating properties that covers the legacy/old-way and the new push/new-way that will probably help. Also have a playlist with some other aspects of networking. But to just summarize it here, the new way is more performant ( so I infer at least). In the new way you have to explicitly mark properties dirty that have changed and need replicate down to a client. You mark a property dirty at runtime with one of the MARK_PROPERTY_DIRTY_FROM_NAME macros. Also in the GetLifetimeReplicatedProps virtual function override, it uses the struct FDoRepLifetimeParams with bIsPushBased set to true. and uses the macros with DOREPLIFETIME_WITH_PARAMS_FAST. Search for "unreal push replication" to get more info. The old way uses one of the DOREPLIFETIME macros in GetLifetimeReplicatedProps, and you don't have to explicitly mark things dirty with a MARK_DIRTY macro.
Can you tell what software you’re using to visualise the vectors
Hey, It was actually some custom C++ / OpenGL code I wrote to visualize it. It was really bespoke, but I basically had a class for "vector" "point" "plane" "line" etc, and some helper functions to draw them from mouse clicks. It was very bespoke and not general purpose, but what I needed for the video.
@@enigma_dev Thank you :)
Only wish it works on the Xbox 😔
Great job on the tutorial, best way ive seen it explained
Your unreal engine tutorial series is excellent. Thank you for taking the time to share this information publicly!
Underrated Tutorial, this is very helpful, thank you
Hello, thanks for a beautiful explanation, it's very high quality material! I have a question. My code architecture is currently based on those DataAssets .. let's say I have monstersDA, and I am sometimes updating their values like HP, status, etc - which then reflects on the UI widgets which are taking values from these Data Assets. Is this a wrong architecture? What's wrong on modifying these DataAssets - if they represents an entity (actor) within the game? What's your thought on this, or what would you recommend doing instead? Thanks a lot for the help!
Hey, great question. 6:41 is where I speak a little bit to this. But I think it depends on exactly how you mean here. The main thing I am referring to, is we have a single data asset in memory. So if you're using a data asset to represent an entities current health, if you write a new health value to the data asset, then you affecting entity that is using that data asset. IE if you have entity X and entity Y, you set a data assets current health to 5 for entity X, then Y get's their current health set to 5 as well (despite that likely being a mistake). In this case, I would use a Data asset to represent static values (like the max health, etc.) But runtime values, I would push to the actor itself (or a component on the actor to make it easy to share behavior). That way there's a clear separation between const data, and runtime data. But perhaps you mean, it is static data, but you're changing the "max health" for everyone at once. Perhaps with like a level or difficulty system? So you change difficulty, every enemies max health changes. That could work for UDataAssets I suppose, but I think at that point you need to set up delegate hooks for changes. I feel like there's probably some other subtle issues there I'm not thinking of. Personally I'd set up a UDataAsset for Easy, Medium, and Hard difficulties, and change which data asset the entity is pointing to. Or set up a UDataTable spreadsheet (see my other video on that) and have it point to a new row. Oh, one issue with using UDataAsset for shared values, is likely it won't work for replication. (though I personally have never tried this, replicating values on data assets). There might be a potential server/client desync if a server changes a value, but the client doesn't also go through the flow to change the value. I think things simplify a lot if you can push these changing values to the actors/actorcomponents themselves. edit: There's also perhaps what designers would expect a data asset file to be. They would want to open up to expecting to populate data. So changing it at runtime might violate some expectations there. Overall just isn't something I have seen used before, modifying the properties at runtime. But I haven't looked through all the sample projects, if there's some precedent for it then that would be interesting. Curious to know more of the specifics in this situation. For changing values, you could use FScaleableFloat which lets you set values per level but then you have to introduce a curve table spreadsheet. The levels are defined by columns in the table. You can get values as ints or bools too, not just floats, just have to call a different function and it will cast the float value to the type you request.
Too advance for person like me started with BP and its node understanding 🤣😂.
Hey that's okay, you can come back to this once you learn a bit more. It will make a lot more sense if you learn C++ before hand.
Thank you, very informative.
thank you for the video