# Time loop/ticking architecture

Say I build a snooker game, where balls need to jitter around.

Balls belong to a class (ball class), where all the ball functions are defined.

In the animation, time evolves by a clock ticking within a time loop.

I wonder if the clock function/time loop should be optimally defined in the main program or the class file?

If defined in the class, the advantage is that all functions regarding ball movements, collisions etc, which take time to happen, can be put in the class, without worrying about the time loop; the disadvantage is that time will tick for every ball separately, which obviously looks bad.

A typical approach is to manage your time step in your main game loop and either pass the time delta to your game entities' update methods via a dT argument, or publish it via a globally-accessible access point like Unity's static Time class