Very good tutorials Dan. Thank you for the info. (Subscribed) I've been in and out of UE for about 3 years now and went to Unity and Godot and nether of them scratched that itch. Most of the Tubers tell you "let's create a game" but some take so many shortcuts that you truly don't know what's right any longer. I do appreciate their reasons for not getting too technical but you can't build a game off of most tutorials, so I wanted to learn what parts do what. Your ticker brings up a ton of questions. As an old C# developer, if I were creating a garden in my game, I'd prob. want some sort of master clock that I could hang all my plant timers off of. Would I use this example or have separate timers in each plant? Also, since Casts are so expensive, in your example would i want to do the cast once and create a variable of it for the ticker, and not do the cast each and every tick?
So many questions! Brilliant. So, there are probably many ways to go about this. First, you could treat the tick event as your master timer, unless you want some serious syncronisation. But, this may be expensive, depending on how many you have. To be honest graphics tend to be the thing that slows things down most but every little helps. So yes, you could use a ticker object that talks to the game instance, and feed off that. I quite often use a variable rather than do repeated casts, but not because I think casts are expensive, but because it saves time coding, and satisfies my desire to code once, use many times. I've been known to use macros too. I don't actually know if casting is expensive. It depends on the optimisation in the compiler. Good compilers will spot when it's not being used dynamically and will find the speed-up. However, there's one simple thing you can do to streamline what you are talking about: do you need your plants to update every frame? How often is reasonable? I would work that out, and build a timer into the ticker so it only sends the tick every second, 10 seconds, whatever you want. You could also consider if you actually need to go through the GameInstance at all. Instead of a "ticker" you could have a "PlantManager" which does the same counter thing but talks directly to your plants and cuts out the middleman. Again, it depends on what you want. When things start to get more complicated I like to centralise rather than distribute, that way I don't lose track of where functionality is, which is easy to do in UE.
@@dansgamedevchannel6297 Excellent idea on the plant manager! Thank you for the reply. I assumed my plants would have 4 stages of growth as in most games, so an update event every 12 in-game hours would be normal to have something grow in 2 days, or like Stationeers it could be affected by the planet and grow quickly. As for the casting, I've always heard from forums and tubers that it was expensive, and that may have changed with the engine version too. :) Being a software engineer for so long, I've learned to think outside the box but I never considered using an Actor for just code. That was genius. Thank you.
Incredible series so far. I'm a recent convert from the Unity fiasco and your series is really helping click all of the concepts I've been learning.
Thanks :) Unity scored an own goal and no mistake. I hadn't thought about how that might push up views on my little channel.
Very good tutorials Dan. Thank you for the info. (Subscribed) I've been in and out of UE for about 3 years now and went to Unity and Godot and nether of them scratched that itch. Most of the Tubers tell you "let's create a game" but some take so many shortcuts that you truly don't know what's right any longer. I do appreciate their reasons for not getting too technical but you can't build a game off of most tutorials, so I wanted to learn what parts do what.
Your ticker brings up a ton of questions. As an old C# developer, if I were creating a garden in my game, I'd prob. want some sort of master clock that I could hang all my plant timers off of. Would I use this example or have separate timers in each plant?
Also, since Casts are so expensive, in your example would i want to do the cast once and create a variable of it for the ticker, and not do the cast each and every tick?
So many questions! Brilliant. So, there are probably many ways to go about this. First, you could treat the tick event as your master timer, unless you want some serious syncronisation. But, this may be expensive, depending on how many you have. To be honest graphics tend to be the thing that slows things down most but every little helps. So yes, you could use a ticker object that talks to the game instance, and feed off that. I quite often use a variable rather than do repeated casts, but not because I think casts are expensive, but because it saves time coding, and satisfies my desire to code once, use many times. I've been known to use macros too. I don't actually know if casting is expensive. It depends on the optimisation in the compiler. Good compilers will spot when it's not being used dynamically and will find the speed-up. However, there's one simple thing you can do to streamline what you are talking about: do you need your plants to update every frame? How often is reasonable? I would work that out, and build a timer into the ticker so it only sends the tick every second, 10 seconds, whatever you want. You could also consider if you actually need to go through the GameInstance at all. Instead of a "ticker" you could have a "PlantManager" which does the same counter thing but talks directly to your plants and cuts out the middleman. Again, it depends on what you want. When things start to get more complicated I like to centralise rather than distribute, that way I don't lose track of where functionality is, which is easy to do in UE.
@@dansgamedevchannel6297 Excellent idea on the plant manager! Thank you for the reply. I assumed my plants would have 4 stages of growth as in most games, so an update event every 12 in-game hours would be normal to have something grow in 2 days, or like Stationeers it could be affected by the planet and grow quickly.
As for the casting, I've always heard from forums and tubers that it was expensive, and that may have changed with the engine version too. :)
Being a software engineer for so long, I've learned to think outside the box but I never considered using an Actor for just code. That was genius. Thank you.