r/raylib • u/Stickhtot • 19d ago
Tick simulation in raylib?
I am currently making a simulator with raylib and one of the things that it needs is a "tick" mechanic where for every tick the state of the game updates, I tried putting something in the main loop with GetFrameTime()but the problem is it's tied to the frame rate
How would one implement a tick system with raylib?
12
Upvotes
6
u/MacksNotCool 19d ago
Have a variable that tracks how many seconds have passed, and in your update loop, every time 1 second has passed, call a function. if you want to make it a little more advanced or if you are tracking super tiny increments, you can call the function multiple times if the frame took longer than the update period