What C++ tool would I use to handle crop growth in a game with farming mechanics

Hello!

I am trying to just mess around with some small personal projects to try to put things from the course I just finished into practice and I am wondering what is the best way (ie, best for performance) to hand crop growth in a farming game.

I want to play the crop and have it slowly scale up to its full size over X amount of time (as opposed to “popping” to the next growth model after an alloted time)

My options that I can see so far are the three below but I dont know which would be the best way (or if i’m missing an option)

  • The tick component (which I currently have working) which just calls a grow() function and passes in delta time which I then interp between 0 and 1 for the Z scale.
  • Timers: I’m still unfamiliar with these and need a lot of practice but can they have this function of growing something over time? Or can they just call a function once after a set time period?
  • Timelines: Literally just learned about this in my research so far - it seems you can create a custom float curve to control the growth and pass this into a Timeline function. Would this be the best way to do this?

Thanks in advance!

Thank you Kehel18 - I carried on with this after posting and tried both timers and timelines - Timers are good if you want it to “pop” to the next growth stage after a certain amount of time - which would have an effect like minecraft where there’s X amount of growth stages. I wanted a steady growth look so I used timelines. Here is the result:v

Hi! So I also try to add some information in the order of your post

  • You can surely use Tick. However, if this will be the case dont forget to add some bool that will be checked in Tick body to define if current crop is growing or not. But mostly, you should avoid using Tick is such a way
  • As for timers - mainly their goal is to execute some logic at some moments of time and not too often (after delay, or with some period). So they are not the choice
  • Timeline is better approach then Tick, so you can implement this.

Looks nice )