UE5 Understanding Tick - Be a better game dev

Поділитися
Вставка
  • Опубліковано 18 гру 2023
  • In this episode of be a better game dev, we will be looking into the Tick event.
    Be a better game dev playlist: • Be a better game dev
    Join the Discord server here: / discord
    Support the work of LeafBranchGames on Patreon here: / leafbranchgames

КОМЕНТАРІ • 67

  • @fordston2
    @fordston2 5 місяців тому +17

    Hope that more people can discover your channel, especially beginners. There are too many tutorial channels out there that propagate misconceptions. They attract viewers with seemingly quick solutions for specific functionalities (even claiming to teach you how to create xxx system. And in fact, the video only covers the creation of a widget from start to finish. Quite ridiculous), without considering if these methods truly meet the demands of game development-such as performance, logic, and scalable architecture. It's merely a waste of time for many because such approaches will never lead to the completion of a properly functioning game.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +6

      You are spot on in your observations. It is an issue that crops up problems for people wanting to learn far down the line of their Unreal Engine journey. At that point they have learned so many bad practices and have a skewed approach that changing those patterns will almost like starting from scratch.

  • @PixelsLaboratory
    @PixelsLaboratory 5 місяців тому +6

    There are also BP nodes which allow you to control the Tick Interval for entire actors, or even individual components, which greatly allows for Tick behavior diversity!

  • @Louieeeee
    @Louieeeee 5 місяців тому +4

    As an undergrad cs student working on their capstone which is a game in ue5, you are a literal life changer. Thank u so much for putting out such high quality information about industry standard practices in UE5.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому

      Thank you, appreciate the kind words. :)

  • @macxike
    @macxike 5 місяців тому +4

    Finally found an in-depth tutorial of how to solve tick problems, thank you! It would be great if you can follow up this tutorial with a tutorial of how to make use to Tick Groups. Everyone explains how it works, but its still unclear how to actually take advantage of this in a working project. Would love to see your examples of this.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +2

      I will make a note of this on my todo list and see if I can return to it in the future. It is a fairly uncommon need to have ticks needing to execute in specific orders.

  • @kacktustoo
    @kacktustoo 5 місяців тому +2

    That was incredibly informative thank you for this. I'm just starting unreal and understanding fundamentals like this is so important to me.

  • @abdulalgharbi8784
    @abdulalgharbi8784 5 місяців тому +1

    Thank you the be a better game dev is very very useful

  • @OverJumpRally
    @OverJumpRally 5 місяців тому +1

    Great video! I'm also using a Tick Optimization Toolkit, a plugin that allows you to manage ticking elements, so they don't think if they are too further away or not visible on camera.

    • @LeafBranchGames
      @LeafBranchGames  4 місяці тому

      Thank you!
      Those kind of tools can be useful to disable ticks of actors that are too far away to be relevant. That saves some performance.
      But it is still important to make sure you don't have ticking actors if they don't need it because they will tick when near.

  • @elitetechworks
    @elitetechworks 5 місяців тому +1

    Great Tutorials :D thanks for sharing

  • @trollgasm
    @trollgasm 5 місяців тому +3

    Another good one.

  • @9243672946729
    @9243672946729 5 місяців тому +1

    Nice thanks, that's very handy performance pattern.

  • @l_t_m_f
    @l_t_m_f 5 місяців тому +10

    While the general advice is correct, and great video as usual, the example you give can easily run a tick with no problem. But I had a student recently follow a tutorial online and he put like a For loop in a For loop inside a function which was on his tick. Needless to say, when we would "stop" the game, it would freeze your PC for 5 minutes trying to finish dealing through the queued actions from that node. That single node was triggered 900 000 times a tick (there were like 20 instances running this craziness). That's an example of avoiding tick, but I find that the example you give actually doesn't matter much if it runs on a tick or not. You can also reduce the speed of an actor's tick in the details pannel if you know there's lot's of instances of it in your world. There reason is that Timeline is inflexible, it cannot change much, so its very different from moving the actor each frame.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +4

      I give three examples, so not sure which example you are referring to.
      Yes, there are of course more extreme examples of . They exponential cost of using a for loop nested in a foor loop is bad enough by itself, let alone in tick. Simply by having a thousand objects in an array looping over it in a nested loop equates a million times the inner loop executes whatever code it was aiming to execute. Less than ideal.
      So, yeah, there are worse examples. But even not very costly operations that can be handled in a different place than tick, is still a worthwhile goal to strive for. Both to avoid using Tick as a crutch and also to keep it from running code that really doesn't need it.
      The speed of tick was discussed in the end of the video.

    • @l_t_m_f
      @l_t_m_f 5 місяців тому +1

      @@LeafBranchGames Thanks i missed the last 2-3 minutes of the video actually xD

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      @@l_t_m_f No worries.
      Like I said in the video, I did oversimplify some things a bit, because there are some details that makes things fuzzy and more gray than black or white. But I tried to get it as right as I could without spending too long on the subject. Still ended up 20 minuts long though.

    • @l_t_m_f
      @l_t_m_f 5 місяців тому +2

      ​@@LeafBranchGames the video was great man! just pointing out for most programmers the danger comes from pure nodes hiding heavy stuff like loops being used unknowingsly on the tick not such much about fine tuning optimization like you did in the video, even tho they served to demonstrate the ideas.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      @@l_t_m_f Understood!

  • @franklingamedev
    @franklingamedev 12 днів тому +1

    Thank you for this information, it's great! I have a question: Should I use Tick only to move things? For example: "SetActorLocation/Rotation/Scale" or "AddMovementInput (for pawns)"? Should this be the only use? What other options do I have? Thank you.

    • @LeafBranchGames
      @LeafBranchGames  12 днів тому +1

      Thanks! No, the rule of thumb is for things you needs to update often.

  • @linezgames3893
    @linezgames3893 Місяць тому +1

    I love your work man, voice too helps a lot.
    wish people developed efficiently.
    crazy how hardware has massively improved but programmers/game designs have gotten way lazy in the past decade.
    please don't argue saying i'm wrong, I know what I'm talking about...

  • @Mohit_N.R
    @Mohit_N.R 5 місяців тому +2

    informative ✨

  • @GES1985
    @GES1985 5 місяців тому

    Should use event tick to control a platform in a floor is lava type puzzle, then give the player the frame rate controls in their settings. That would be an interesting / think outside of the box type situation

  • @gokuvinod2850
    @gokuvinod2850 5 місяців тому

    hello Sir, is using structures better than using the standard variables for eg I have a player stats such as health, stamina, manna, etc so addiing current and max health to structures should be the way to go or just adding those to variables in BP_Component itself is fine or is there anything else i need to know of? Thank you for ur help!

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      It depends, it is not a straight forward thing I can answer. They are good in different aspects.
      For example if you have structure being sent through functions, then you will be sending all the data, even if you only make use of one of the stats in the function.
      You could use structures, or you could use classes, it depends on what you are going to use them for.
      You can probably start with what is the most convenient to begin with and then refactor later on if neeeded.

    • @gokuvinod2850
      @gokuvinod2850 5 місяців тому

      @@LeafBranchGames ohh ok then I'm not much familiar with structs so i'll stay away from it as of now. Thanks!

  • @beaverundercover3479
    @beaverundercover3479 5 місяців тому +1

    Thanks for the video. What is a good example of Tick usage?

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому

      My pleasure. Anything that needs a contineous updpate would be reasonable to have. So it can be a wide variety of things depending on the game. A specific example could be some custom camera movement.

    • @Drakuba
      @Drakuba 5 місяців тому +1

      im making RTS, and for the gods of me couldnt figure out how not to use tick when updating cursor position, so i suppose that would be one. But there are ways how to make unit selection without tick, even tho with tick its much easier - that made me realize i played few RTS that had tick based unit selection since everytime i tried to select units you can see FPS dropping :P
      i also animated tank tracks using tick, but i read its possible to animate those using unit speed and not to use tick so ill be looking into that as well
      but just as Leaf said, physics and animations use tick for updating themselves and theres little to no way around it, best you can do is tick only when they actually move and not just constantly check for updates when they are not moving afaik

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      @@Drakuba Mouse cursor is a very good example. Because if a mouse cursor feels sluggish, that gives a very bad sensation to the user - so having it responsive is key for a good experience.

  • @GordonSeal
    @GordonSeal 3 місяці тому +1

    Would it be bad practise, to use a timer instead of a tick, e.g. for physics simulation on an actor like add force, with a timer rate of 0.02 or some similiar low value?

    • @LeafBranchGames
      @LeafBranchGames  3 місяці тому +1

      Probably. You would likely want your physics to be as accurate as possible, unless you are trying to do it on a large scale. But even then you probably want to look into ISM, or HISMs or similar I think.

    • @GordonSeal
      @GordonSeal 3 місяці тому

      @@LeafBranchGamesIsn't the physics simulation in Unreal always on an event tick though (in the background)? If I enable physics for a static mesh, I don't see an option to not use tick for the simulation itself.
      I guess my question was rather if using a timer on a low value like 0.02 makes sense, or if there are drawbacks to be doing this.

    • @LeafBranchGames
      @LeafBranchGames  3 місяці тому +1

      @@GordonSealThere is a cost for using a timer because you are essentially setting up delegate that triggers on completion. So if you have a timer with a very frequent update(as often as tick or near), then you probably losing more than you are gaining and should just use tick.

    • @GordonSeal
      @GordonSeal 2 місяці тому

      @@LeafBranchGamesThank you for explaining it, that is very good to know!

  • @Fudolux
    @Fudolux 5 місяців тому

    Thank You, UE/ Blueprint tutorials are very useful, UA-cam is still dominated by Unity.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      That is a reasonable since Unity has a larger marketshare.

  • @fabulamcafee
    @fabulamcafee 5 місяців тому +1

    i was only reading the title and thought "just never use this" lmao

  • @starscream2092
    @starscream2092 5 місяців тому +3

    Hello, this may sound stupid or unimportant, but I or maybe many other people learn better with practical use cases. If you would want to reach more people (many beginners) you could create an ultra small project where you show the proper implementation of these systems. Player with health getting update on projectile dmg, stamina, and flashlight. 99% tutorials put these fundamental things in games on tick and call it a day. If i am asking for too much sorry. Its just me and my friend (beginners) were discussing this video and how you are right and it makes a lot of sense. Also we tried to get the best way to show ingame FPS for the player on the hud, and that is probably impossible without a tick.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      There are things that are unavoidable or even should be on tick. Showing FPS for example is one such thing that could make sense. Now, you may not need to have it update every frame, so you could use a technique to make it less often, like a timer or a tick with interval. You have the get delta seconds node that you can use to calculate the FPS for that specific interval.
      The point is, Tick has its place, it is something that you should use for things that need frequent update, on every frame. But it is important to realize when you do not need it, and how you can work around it.

    • @TacTicMint
      @TacTicMint 5 місяців тому +2

      Projectile damage should be triggered by the collision. Periodic updates like stamina should be done with a timer (Check out set timer by event) you can set it to a specific time like 0.5 seconds instead of per frame. Per frame is every 0.0166 seconds at 60 FPS. Usually you only want to use tick for things that are physics or visual and have to match the frame like location, scale and rotation. Maybe if you're changing color or opacity but that can be done on a timer.

  • @aleca8910
    @aleca8910 5 місяців тому +2

    That thumbnail is going to enforce the wrong idea of that using Tick is a bad practice itself.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +2

      Only if they don't watch the video.

    • @aleca8910
      @aleca8910 5 місяців тому +1

      @@LeafBranchGames That must be exactly what many do, because that weird idea is popular on every dev channel.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому

      @@aleca8910 It is mostly about nuance. Using tick too frivolously comes at a cost, a cost not everyone understands. So I explain how it works so that they can better make the judgement on if tick is a good option or not, and if not - what alternatives you have.

    • @peevee5588
      @peevee5588 5 місяців тому +2

      Totally disagree. Great thumbnail and great video.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому

      @@peevee5588 Thank you. :)

  • @DEM1GOD7
    @DEM1GOD7 5 місяців тому

    15:48 "Redo this code completely" Nay Redo these nodes completely. you're not in code, you're in blueprints made up of code.

    • @LeafBranchGames
      @LeafBranchGames  5 місяців тому +1

      Blueprints is a visual scripting language that translates to bytecode which essentially calls on existing functions in C++. So even though the representation is visual it is no different than writing in text(C++) to call on those same functions. Disregarding overhead and such factors of course.