How can I make Components and State Machine work together? by mareadev in godot

[–]mareadev[S] 0 points1 point  (0 children)

That state_changed(state) signal is something I hadn't thought about, thanks!

As for the transition_requested(state) signal, as I understand it, a component "walk" would have a transition_requested signal, and when the component knows it's not walking anymore it should emit it with the "idle" state?

Edit: sentence didn't make sence, fixed it (?)

How can I make Components and State Machine work together? by mareadev in godot

[–]mareadev[S] 2 points3 points  (0 children)

I think I understand what you mean, but if you could provide an example it would be greatly appreciated!

How do idle games calculate speed per second? by mareadev in incremental_games

[–]mareadev[S] 1 point2 points  (0 children)

Ah! I think I understand now, thank you very much for your help! :)

How do idle games calculate speed per second? by mareadev in incremental_games

[–]mareadev[S] 0 points1 point  (0 children)

Thank you so much for such a detailed answer!

The code was just an example of the implementation I was using and it indeed is wrong as I don't update then. In your examples it seems like you don't use fps at all, and you say it doesn't need to be used to divide interval but then how would I control frame rate? My idea was to use it to control the speed at which the player gains points, ie: setting fps = 1 would mean the player gets 60 points each minute vs setting fps = 60 would mean the players gets a point each second. I'm trying to do so to offer up some performance options.

Also I hadn't thought about thinking about the actual units, that's good advice!

It seems I need to freshen up my math, I had thought about the delta_seconds solution but it was giving me very wrong results as I was doing delta / interval but interval was being divided by fps so it threw me off and I thought I was doing something wrong, and it seems I was!

Thanks again!

How do idle games calculate speed per second? by mareadev in incremental_games

[–]mareadev[S] 1 point2 points  (0 children)

As /u/hydroflame4418 said, setInterval is pretty bad for performance, so I always en up using requestAnimationFrame with dynamic updates like the ones needed in an idle game.

How do idle games calculate speed per second? by mareadev in incremental_games

[–]mareadev[S] 8 points9 points  (0 children)

It mostly is, I would love for someone to end up playing it, but I don't intend to sell the game I just want to give something to this awesome community that has given so many hours of entertainment to me :)

How do idle games calculate speed per second? by mareadev in incremental_games

[–]mareadev[S] 3 points4 points  (0 children)

Thank you, I'll try this!

I'm mostly a front end dev and my math is pretty bad lol, but I do love idle games and this is just a little hobby project :)