wow just deleted 4 delay nodes out of 5 from my char and replaced them with time handler, never knew this time handler node could do soo much things, thank u soo much keep more of it coming!!!
Loving the series, theres a lot of stuff you kinda just pick up as you learn, just hoping that itll work and it often turns out that you should understand what you are using. On that note, I never actually used a timer as a timer, but for the time driven loop. Its simple stuff like that, thats making the videos really enjoyable for me.
You're right, I added a delay 0,1 sec to my event tick and was happy to finally get working code for me. :D I wonder then how to approach the topic of directional fighting style. I had previously assumed that every 0.1 seconds I would do an actual check of which direction the player moved the mouse and based on that movement, indicate which attack animation to use. This results in the need to check frequently, but only when the player has his weapon drawn. I think I need a high frequency of checking this, but certainly not as often as the event tick itself provides.
One other thing if I recall correctly is because timers (and delays) are asynchronously processed, and not necessarily on the same thread, this can create issues as well as the timers will fall out of sync.
Personally I don't like Delay nodes and always tell my student's no to use them. Unfortunately there are moments when even I use them. One of those is when I use OnTextCommitted and try to SetFocus on the end. Don't know why but without Delay of 1 tick this won't worka. Will have to dive into the C++ code of this module to understand it.
Great tutorial, as always! If we're talking about scenes that absolutely cannot be interrupted by user input (e.g. cutscenes, scripted events), would you still say that the Example #1 in this video is bad practice, or not? Of course the developer can always use a timer by event in order to stay on the safe side, but doesn't that timer reference eat up some RAM? Would a delay be preferred in such a situation, for performance reasons?
A delay would be fine in such a situation. Adding timers means creating a delegate and having a few more steps to setup. Then it is simply not worth it if you are just after a "wait for a second or two" kind of logic.
I had an issue where my player ship has a set of spikes in the front and when boosting to run through 10+ enemies it was inconsistent. Sometimes it would work perfect other times the player ship would take damage from the enemy's overlap logic. What was happening is the enemy's collision overlap would sometimes fire before the spikes logic detecting an overlapping actor. I put a small 0.01 delay on the enemy's overlap collision and it allowed the spikes overlap to run before detecting the enemy overlap every time. Other uses I've found are for slowing down how often logic will fire. My game has lots of score mechanics with multipliers that drop based on the player taking any damage and to avoid an extreme amount of multiplier drop I've used 0.2 to keep it from dropping fast. Retriggerable delays can be helpful for times where you want to keep resetting some logic. Maybe the player is using an item but if they keep spamming the button it wont start the recharge until they stop. I think the really bad examples though are the looping timers people make with them.
For initalising something there is a good alternative using a delay. Is valid? False Delay (0.05) loop back into is valid node? True, then Continue onwards. This keeps the delay short and works like a timer without the need to bind things. But yes, use in rare situations.
Thanks for the upload! How would you recommend to approach things like health/mana regeneration? I currently have a system that regenerates mana by recalling the same function once every 0.033 seconds (using delay) if a certain flag is active. Is that a good use of delay?
The examples in the tutorial would make for better regeneration in general. Delays, again, are very inflexible. What if you want to delay regeneration beceause you don't want to regenerate health in combat? Or maybe some other effect halts the regen? Well, you just pause the regen timer for that duration or during those circumstances.
@@LeafBranchGames That what the flag is for. My question is: how else how would I apply something that needs a smooth change of a value, like HP during health regeneration, without the delay node?
Thank you for the video! I didn't know how to implement dispatchers to check when a function/macro finished executing and your explanation helped me a lot... but going back to the "Delay" thing: what would be, in your opinion, they best way to set up "automatic fire": with a Gate an a Delay , or calling a Function by timer?
Thanks. I have an equip/unequip function that is integrated with theway my weapons are updated or discarded in my inventory, i tried doing delay nodes to delay and check if indeed the item is valid during swapping and this delay node behaves differently in editor which is ok but is way different upon packaging hehe thanks for this
Hi i have a question! What about connecting a delay 0.0 or 0.1sec to an IsValid node? to see if a variable is valid before doing next. Someone told me that using IsValid with a loop on delay is not a good practice. Sometime, the engine run code faster than other, and because of that, the variable could end up detected NULL while the frame after is now recognised and Set. Thanks for the tip!
Delays are bad. You should never have logic depend on delays unless you know why you need it. Most people use delays because they don't know what is going on, so a delay might fix a problem early on but whatever took 0.1 might take 0.2 seconds later on. Then the code will fail.
@@LeafBranchGames ok i see, thank you! and what about a delay at the end of an execution? exemple, when my Character leave the Vehicle, i have to wait 0.2sec before enabling the collision between the vehicle and the Player because if i do it earlier, (without delay) then there is a collision and both start to glitch and lag. So i need a delay to wait for the player to be outside the vehicle to enabling the collision. For specific things like that, that really need a delay, should we still use a delay, or there is an other technicle? Thanks for your time!
Thank you! Timer is more costly than a delay in that it forces you to have a delegate created and possibly a timer handle and such. It is also a few more steps than a delay node. But I would call all of that negligable, if responsiveness is what you are looking for.
man, i remember seeing many tutorials where they used delay rather freely i had no idea... tho i remember someone mentioning instead of delay in your third example its better to use Is Valid anyway good to know 👍
The issue with a is valid is that it will check once, and then if it is not valid, then you will not call the functionality - ever. Since the check only happens once and at one point in time. It will not actually handle a situation where it needs to load an unspecified amount of time.
pretty specific but how do you manage delays without Set Timer nodes? For examples I was doing a UI using an xbox controller, I had a custom Button BP (yeah I had no idea you can do a custom button BP) but because the button BP doesn't have a event tick I had to use a Set Timer Node as a "fake tick event" that basically constantly checks if the button is being "focus". After doing all my main menu everything was fine and cool but when I get for the paused menu it didn't work, basically all the Set Timer Nodes also stop when you use the "Pause Game Node". So I had 2 options make another custom button but parent it from a widget cuz then I can use it's event tick (yeah widgets ticks still running just need to do a small set up) or making a BPInterfaces so then I make ref to all my buttons and called them into the event tick of the widget itself (I went for the second option because having a custom button BP it was cool). What about you? what approached would you made and why? Also thanks for all the videos, I always try to watch them everytime I can!
Thanks for the support! I assume the button you talk about was inheriting from object, not an actor, so that us why you did not have tick? If tick is paused, you could try calling the "Set tickable when paused" to have it keep running even in paused mode.
@@LeafBranchGames yeah I think the "Button BP" it's inheriting from an object. Yes my solution was making a function "update button" that then its call in the widget where all my custom buttons are. That's why I asked what other solution you would have? because I liked it when I have to write less code so my custom button only need to be call at the being play because it had a "Set Timer Node", but when you paused the game all Set Timers Node get also paused
I use a delay for projectiles to die once they've travelled outside of their max range (time calculated from velocity). I could have used a timer but a delay is more simple here
@@finesseandstyle And if your character gets hit during that animation so you want him to abort what he was about to do, you will not be able to stop whatever code is after that delay.
@@LeafBranchGames It's just a shake effect for an unavailable cooldown ability. If you press it while it's on cooldown you get a feedback, the delay works pretty well without issues
Im making a day and night cicle with an event tick, but I was adding a delay of 1 second so it doesn’t check the time every tick. Now I see is a bad practice. How would be the right way?
If you only need it to happen once per second you could change your tick interval. You can check this out for details: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE--QvPxp138qQ.html
@@LeafBranchGames thanks for your answer, it seems a have a lot of optimización to make deleting delays and improving ticks. I’m using unreal insights but I don’t fully understand all the data. Waiting for task may be all the delay nodes. In a future video you May teach us to understand or how to read all that data. Thanks again for your content
So basically delay (aside from 0.0) is only good for something uncancellable? Makes sense why it's a poor fit for most game logic, when that game is always taking unpredictable player input.
Binding is pretty useful info, but about event tick part - you can't just say "don't use delays" like i added them for fucking fun and removing them won't do anything. In other parts of the vid you proposed alternatives so what's stopping you from doing the same for this part
In both videos I explained that using tick and delays is mixing two different concepts. It is like saying I need to hammer this nail, let me get an ice cream machine. They do not have synergy and work against eachother.