Тёмный

How Delay Nodes are Ruining Your Game and What to Use Instead. Unreal Engine Tutorial. 

Mark Luttrell
Подписаться 3,9 тыс.
Просмотров 26 тыс.
50% 1

If used improperly, delay nodes will ruin your game. I show an alternative.

Игры

Опубликовано:

 

27 июл 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 80   
@wimeradus
@wimeradus 2 года назад
Wauw, man you know you can just put a delay on the 'Is Not Valid' And plug that back in to the execute of the 'Is Valid' Check. Then once the Is valid fires off you're done, and the delay loop ends. So much less code, and just way way cleaner then this whole timer stuff. (Which is the same solution literally but not unnecessarily complicated).
@jonathanantoine4962
@jonathanantoine4962 Год назад
exactly
@rpggamemaker6684
@rpggamemaker6684 3 месяца назад
Been stuck a full day on wondering why my online inventory system sometimes update and sometimes doesn't, ended up to the conclusion that delay seems to fix the problem but doesn't seems like a good idea. Needless to say I fucking love you, thank you
@TimothyBell90
@TimothyBell90 3 года назад
Once again your channel is Gold. Really appreciate you Mark. Anything we can do to support you, let me know. I'd definitely pay for the knowledge you're dropping.
@MarkLuttrell
@MarkLuttrell 3 года назад
Thanks for the support!!! I'll let everyone know if I set something up.
@_siegmeyer
@_siegmeyer 2 года назад
​@@MarkLuttrell Hello Mark, can you make a video where you setting up the crouch turn in place? (As a continuation of past TIP videos ). RU-vid has no vids about this
@FB-eq9vl
@FB-eq9vl 2 года назад
Superb material! Thank you very much for this lesson Mark!
@Romain_Derelicts
@Romain_Derelicts 2 года назад
Amazing tip, thank you Mark ! Glad I suscribed a year ago, so I can have this kind of videos in my feed ! :)
@TorQueMoD
@TorQueMoD Год назад
Awesome tutorial! Thanks so much for sharing. I literally did exactly what you said I shouldn't do, so this vid was perfect for me :)
@normalST13
@normalST13 Год назад
Very nice video, unreal community lacks videos like this! Good thing I've already doing like this in my own projects even tho they are only single player.
@shrimpson123
@shrimpson123 2 года назад
Hey Mark hope you are having fun in Unreal 5. Just want to say thank you for all the tutorials, you've pretty much taught me how to use Unreal Engine.
@vanadot
@vanadot 2 года назад
Just what I was looking for. Thanks! Another bad use of delay node is that it cannot be canceled. Using Set Timer by Event enables me to re-fire an event and reset the timer. Yay!
@singem7886
@singem7886 2 года назад
Me and a friend's project we are working on in Unreal 5 was having these same issues. Though when we made a delay node to solve the problem, all we had to do was set the duration to 0 seconds and it fixed the problem of it not being valid in begin play. I am only assuming the delay node itself didn't fully execute until everything in the level was cached.
@rabbit-istudios5444
@rabbit-istudios5444 2 года назад
Hey so i have a question, will you be continuing the Unreal Professional Series? In the showcase video you kind of showed an fps sort of game so i also want to ask what is the series going to end up making?
@mclow100
@mclow100 3 года назад
Hi Mark, would you happen to know how to use the time stretch curve in montages? . What I'm trying to do is speed up and slow down parts of my melee attack montages, and also trying to implement micro-pauses/freezes. So far ive found that the montage is only affected by the curve if the play rate is less than 1.
@MarkLuttrell
@MarkLuttrell 3 года назад
I do not. I'm not really an animation guy, but I will post something if I ever end up having to do it.
@musikalniyfanboichik
@musikalniyfanboichik 3 года назад
more practical videos like this please 🙏🏼 very useful
@momomadi2
@momomadi2 3 года назад
hey mark - what i do is putting delay after not valid -- so its loop until valid and its less code and with no extra events
@MarkLuttrell
@MarkLuttrell 3 года назад
I don’t use delays for this because they’re not available in C++, but they could work. There is a little cringe whenever a cosmetic tool gets used for something like this though, so I recommend keeping it to personal projects. Additionally, having a new event is a good way to declare that you're done with initialization and ready to start some functionality. This matters if others are building on your work.
@nightmodedevelopment
@nightmodedevelopment 2 года назад
Hi Mark, welle xplained. I just got a Quation as you said Timer are better for "initialization". So I have a Listenservergame here 1 Server 3 Clients max... One Ai... lets say.. if the player shoots the ai once... i have ow a delay which counts to 4 Seconds and if it is not hit again it plays an animation and gets angry... so here, should I use a Timer or keep using the delaynode? It is all with RPCs
@hundsy5287
@hundsy5287 8 месяцев назад
how can I see the others client health in my UI? could u do a tutorial about that HPBars appearing on everyone's HUD widget?
@nejic7809
@nejic7809 3 года назад
Hey Mark, really appreciate the video, seriously motivated me to clean up some bad code practices. Question though, if you wanted to run multiple valid checks (I have a good deal of things flying around) would best practice be to use a sequence? or any tip you could offer there?
@MarkLuttrell
@MarkLuttrell 3 года назад
Sequences are a great way to clear things up. It's well worth the extra node to keep things clean, but just making sure you're not using them instead of IsValid checks, correct?
@nejic7809
@nejic7809 3 года назад
@@MarkLuttrell I'm using them to run more than one isvalid check 😆. I've been having an issue with my client connections populating info from the player state... the HUD... generating its own inventory etc. I'm sure there's a few other code bugs I haven't tracked down, but I know my server connection works at least lol. But I finally did manage to kill that delay node on my controller thanks to you
@rremnar
@rremnar 11 месяцев назад
As a UE5 beginner, I found myself using "delay until next tick" modules to solve issues like this. Thanks for this video, now I can go back and get it done right. Edit: What happens if you need reusable code to get your blueprints, that you would put in a macro library? Macros can't use timers, because they can't use custom events. So what the solution? A blueprint component? But there is another issue that I wish was a feature for. I am using the Actor Sequence module to animate things inside a blueprint. The problem is, there is no "On Finished" part of playing those sequences. One method I used, which is finicky, is to create a event key frame at the end and bind that to a custom event. This works some of the time, but for some reason, when you play your animation, it doesn't always reach the last keyframe. There is a instance where I have to play the animation backwards; so I had to remove this method. What I did in place is take note of the length of the animation, then add a delay after the play moduule before going to the next thing. I wish there was a better way of doing this.
@Technokarate
@Technokarate 3 года назад
Completely agree on delays and how you can get yourself into trouble by setting arbitrary timers trying to accommodate everyone's replication speed. Just a note, aren't you forgetting to replicate Health variable you created in the playerstate? I thought just because the class is replicated by default, doesn't mean its variables are.
@MarkLuttrell
@MarkLuttrell 3 года назад
If you want the clients to see the correct value, then yes, you should set it to replicate.
@brendanbois1853
@brendanbois1853 Год назад
Hey, I'm so sorry this is unrelated to the video, but I've been searching everywhere for a solution and know you have a lot of experience with dedicated servers. When testing my game on my local docker there were no issues, but now that I have my server actually up and running, the movement of my character is jittery, almost like a drop of framerate but just with movement, everything else like turning and inputs are replicating just fine. I assume that this is because the server is replicating movement too slowly so the location isn't being updated fast enough, but I'm not sure where to fix this. I've been playing around with settings but can't seem to find anything that causes any type of change. Do you have any videos pertaining to this problem, or any suggestions off-hand as to how to fix it?
@maameloic7656
@maameloic7656 Год назад
yea common issue nobody talks about, I assume you have custom movements outside of the movement system unreal provided. there are 2 plugins you can take a look at , smooth sync and general movement component on the unreal marketplace. Unless you want to write something in C++ yourself. good luck.
@SolidHns
@SolidHns Год назад
Hey Mark. I usually do this with a short delay coming out of not valid and loop it back to the validation. Do you think there are any downsides of this in comparisson to your method?
@Mireneye
@Mireneye 6 месяцев назад
If for whatever reason that reference NEVER turns true, you have yourself an infinite loop. Which is something that should be avoided at all costs. It's better to understand execution order and organize your blueprints/programming according to it.
@S0paTa
@S0paTa 7 месяцев назад
Delays are just Timers under the hood. They are not bad if used properly. Delays are not here to "Ruin" your game - people just need to understand that they are not "Retriggerable" meaning they don't work in loops, etc. For that, you can use RetriggerableDelay in UE5. Your solution with Timers is essentially the same as using Delays - you are just "Delay"ing for 0.1s each time the PlayerState is not Valid
@evilpotatoman9436
@evilpotatoman9436 Год назад
what do you mean, delay is great! I even had a delay not working once so i slapped a delay on the delay and boom! it works now :)
@frozec08
@frozec08 3 года назад
Can we use delay but loop it from 'is not valid' node, and back to exec node, until it become valid
@MarkLuttrell
@MarkLuttrell 3 года назад
Yep. I replied somewhere else on why that's not the best solution, but it will still technically work and is better than putting a hard coded value in there.
@Xinixx
@Xinixx 3 года назад
Eey Mark, I checked your videos already a long time and i'm happy that your back with some videos this year i learend alot about it. But i have a general question lilbit offtopic (sorry for that). What is the reason why you don't use a dedicated server / data base to change your values and start to build from there. Maybe for better explanation what i mean is; haveing a tool/ website beside your game build, where you manage your game. You can change your game values / items, levels, names ,character locations etc., etc. Most online game builders use this and this looks very handy in my opinion. I think it is also good to start with. I have low knowledge about and want to know how you think about this. Is it worth for shooters? Will you use this later on or in a other way?
@MarkLuttrell
@MarkLuttrell 3 года назад
That's actually a more advanced feature that I plan on implementing for the first time on my newest project. I intend to store player persistent data on a different server. I see that Amazon and even Steam offer solutions for such things. For now, during development, I will simulate pulling that data from a local save file. I'm hesitant to commit to an API that I may have to re-write if I change my mind, but if you're confident on where you want to house your data, go for it!
@maameloic7656
@maameloic7656 Год назад
Enjoyed all your videos, are you still working on some projects? all the best
@Krasunya_9912
@Krasunya_9912 9 месяцев назад
Hello! Sorry if i bothering you, i would like to ask you. How much will be buy your project (Peace Restored) ?
@theoneand0nly874
@theoneand0nly874 3 года назад
What about a retriggerable delay before the actual delay so it can never be spammed because the timer would just reset every time that same action is taken
@MarkLuttrell
@MarkLuttrell 3 года назад
So you're talking about using two different types of delays back to back? I highly recommend you don't do that. The timer won't get spammed if you put a check utilizing the handle to ensure that the timer isn't already running. Timers are almost always the way to go when dealing with gameplay time events.
@guillaumemercier3536
@guillaumemercier3536 8 месяцев назад
I am not sure to understand everything. I am doing a course in Udemy, but the teacher is using delay to change the health bar of the player character and creating an invincible time of 0.3 seconds. But can't figure out how to do it without the delay, every designer and devs I talked to said to me delay are a big no no. Just want to say hey you catch some damage wait 0.3 seconds before you can get another damage. And I have a boolean that becomes true during that 0.3 seconds and becomes false again after that. But I want to use something else than the delay if it is not a good approach.
@rabbit-istudios5444
@rabbit-istudios5444 3 года назад
Hey so i have a quick suggestion, but could you make a tutorial on a team system? I tried to do it and searched multiple times for something but couldn't find anything. it'd be greatly appreciated if you could make a video on that
@MarkLuttrell
@MarkLuttrell 3 года назад
If you want teams, especially if using Ai and the perception system, it will have to be C++ . There are work arounds, but if you're wanting to change teams at runtime, we'll have to modify engine source code.
@MarkLuttrell
@MarkLuttrell 3 года назад
The reason for this is not only do we have to utilize a native interface, but we have to ensure our Ai will forget about the old team when we change teams without looping through every single Ai. It's an advanced topic, but I may start leaning into this stuff if enough interest is there. I might break us in easy though with a few starter C++ sessions to get used to the commonly used classes.
@gameformation2100
@gameformation2100 3 года назад
@@MarkLuttrell Yes if u can make those tutorials, that would be great! And also a video about that "call to parent class" that u talked about briefly in this video. I love watching ur videos to know about the professional and scalable way to do things in blueprints.
@TimothyBell90
@TimothyBell90 3 года назад
@@gameformation2100 you can set that up to test very quickly for why you need to call to parent. Make one character blueprint that's your base class. Make a widget that'll just display some text on screen. On BeginPlay of your parent class, do a Create Widget event and Add to Viewport of your created widget. Now make a child class of your parent. If you don't call to parent when you play with the child, it may not show up. Now add a Call to Parent to your begin play in your child and it should create the widget because it's referencing the parents begin play. Now
@carlosrivadulla8903
@carlosrivadulla8903 Год назад
There is a node called "Delay Until Next Tick", maybe is new to UE5. I use that instead timers.
@thomasalvarez2089
@thomasalvarez2089 2 года назад
at 16:49 is it not better to make a BPI for the player state instead of having to cast to save the reference?
@MarkLuttrell
@MarkLuttrell 2 года назад
I see a lot of people say that using an interface saves a cast, but under the hood there are equivalent checks. Maybe there's a benefit, but it makes more sense to use interfaces for their intended use. On the native side there are so many casts that you don't see when working in BP. Now, if you have something that is on the tick throughout the game, then you should pay attention to this sort of detail. Even then though, sometimes it's unavoidable and using a roundabout way could slow things down unintentionally. Unless you can benchmark, there's no way to know for sure.
@wimeradus
@wimeradus 2 года назад
BPI's are more performance heavy then casts. So a single cast defenitly wins instead of a BPI. Read the UE documentation on that for more information
@shannenmr
@shannenmr Год назад
The main issue with BP Casts is it creates a Hard Reference to the Casted class which means its now a dependency and is loaded into memory (along with all its referenced mesh(s), textures, sounds, etc) when the original object is loaded, in regards to data only objects like PlayerState or things that will always be loaded into memory like your Player Character its fine but for anything that you are not expecting to always be in your level it becomes an issue and where its certainly better to use Interfaces. You can work around the issue to some extent if you create data / code only base classes which you use for Casting to, but your world BP classes are actually a child of these data only base classes which just have the meshes, textures, sounds, etc set up and that's what you use in your levels.
@kngparadox
@kngparadox Год назад
You could say it in like 5 min
@StupidDanimations
@StupidDanimations Год назад
A useful thing to know: delays won't work in things like functions and loops, but they DO work in macros.
@StephenMinkin
@StephenMinkin 10 месяцев назад
excellent
@RC-1290
@RC-1290 Год назад
6:35 You what what the most convenient way of setting a timer for next tick is in blueprint? That's right, it's delay(0) ;).
@arisynily1882
@arisynily1882 8 месяцев назад
He's the type of guy that says you're drinking water wrong
@MarkLuttrell
@MarkLuttrell 8 месяцев назад
It's called drowning.
@GC-jm9bt
@GC-jm9bt 3 года назад
I'm definitely guilty of using delay nodes. But polling the PlayerState still feels hacky in my opinion.
@MarkLuttrell
@MarkLuttrell 3 года назад
I thought it was strange the first time I saw it, but it’s a very common and reliable way to ensure you’re valid.
@JD-tl4zs
@JD-tl4zs Год назад
This is a good tutorial but I actually went looking for the factors that influence input (to effect) latency in Unreal 5 products.
@E36_shayne
@E36_shayne Год назад
This information was much appreciated! i knew there was a much better way than delays lol
@AZ-ti7eb
@AZ-ti7eb 2 года назад
Hi Mark! I have 1 question about the building system in yours video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-4eQJMuviwvs.html Can you make some video tutorial: how you made building system, please? If it's not your own design - can you say from where did you get it please? I saw many videos about building in UE, but your video was amazing.
@MarkLuttrell
@MarkLuttrell 2 года назад
It is my system, and it's unique because it's not fixed to a grid and has the ability to function as a movable physics object. Basically my floor tiles can be made into hover vehicles that you can build on to. I could do a video on this, but man, I'm getting a headache just remembering how complicated that system was. Maybe I'll make a simplified version for a video series.
@MarkLuttrell
@MarkLuttrell 2 года назад
Oh wait, lol. That's a really old video you were talking about. Yes, I could show how to do that. I thought you were talking about my new system, and I don't know if I have shown anyone the new system, so that might be something for everyone to see as well.
@AZ-ti7eb
@AZ-ti7eb 2 года назад
Ahhh,so did you make new version of building system? Nice! That old one was amazing, so I can not imagine how perfect is the new one. If it is unique and very complicated, then you will be needed more time to refresh your memory about details etc. Mark, I saw most of your videos, but I didn't see any video about building system, so yeah - maybe you didn't show the new system how looks like. You can then i.e. do 2 videos: 1st about first building system tutorial, and 2nd about comparing new with old system but without getting into details, if you have time after work.
@AZ-ti7eb
@AZ-ti7eb 2 года назад
But Mark, you know, it is not important now, so please only remember about this subject in the future, when you will be making the content. My curiosity would be fulfilled ;) I have learnt smth new from your videos, and I appreciate your effort which you put. I know that this stuff is taking a lot of time, and mostly - require huge amount of willingness to do it - so I am leaving sub and I will be waiting patiently. Thank you Mark in advance!
@pimeine
@pimeine Год назад
Very usefull, I'd save so much time of tries if I had seen that video earlier XD
@maameloic7656
@maameloic7656 Год назад
please come back to RU-vid ✌
@MarkLuttrell
@MarkLuttrell Год назад
Started on new content last week. Might take a couple months to get rolling again, but I'm finally at the drawing board.
@gstreetgames2530
@gstreetgames2530 Год назад
@@MarkLuttrell and here I was thinking ya got indoctrinated with the genocide juice and kicked the bucket...
@alexanikiev
@alexanikiev 9 месяцев назад
Catching … fish
@LeoMKyll
@LeoMKyll 3 года назад
alright do this...alot better performance in mp
@MarkLuttrell
@MarkLuttrell 3 года назад
This is more of a safety thing. Performance will take a little bit of a hit here, but it's well worth it to prevent calling a null pointer.
@BADEYE1987
@BADEYE1987 4 месяца назад
why do they put it in the program if your not ment to use it 😂
@furkannarin2844
@furkannarin2844 Год назад
Instead of this you can create a recursive function. And implement your own delay until next tick with the "Get World Delta Seconds" node connected to a delay node instead employing a timer. Plus, as of 06.05.2023 you can use "Delay Until Next Tick" node in blueprints as well but I would still use the recursion.
@RobinDale50
@RobinDale50 Год назад
This was literally, EXACTLY, what I was looking for. Right down to needing to validate and get a state at begin play. Nice job, thank you! But its "CASH", not "CASH-AY" or "CATCH", Cache=CASH for pronunciation.
@MusicalGeniusBar
@MusicalGeniusBar 2 года назад
It’s obvious but you still got to say it👍
@Anoberia
@Anoberia 3 года назад
I had a same issue even with OnRep_PlayerState. It should valid after it's triggered but sometimes its getting null. Later on I've used timers like you did :)
@MarkLuttrell
@MarkLuttrell 3 года назад
On_Reps are powerful, but know their pitfalls. If the value doesn't change, the server will call the On_Rep function, but the clients will not. Might not be related to your issue, but this has gotten me a few times.
Далее
5 Tips to Optimize Environments in Unreal Engine 4
12:23
Копия iPhone с WildBerries
01:00
Просмотров 4,9 млн
choosing a game engine is easy, actually
15:08
Просмотров 358 тыс.
80 Year Olds Share Advice for Younger Self
12:22
Просмотров 1,4 млн
UE5 Understanding Delay - Be a better game dev
13:29
Blueprint Interfaces | Unreal Engine 5 Tutorial
14:41
I solved Unreal Engine's Package Size Problem...
14:35
Fix Network Rubberbanding Lag in Unreal Engine
9:08
Просмотров 11 тыс.