I'm trying to build a game from scratch in Dart, similar to Minecraft.

As far as I understood, there are two main functions in a general game loop:

  • tick: a function that gets executed a fixed amount of times per second independently of the frame-rate. And I think in Minecraft those are called TPS (Tick per second).

  • render: a function that draws everything on the screen called every frame, the frequency of which depends on the device's capabilities. (FPS)

(I am referencing Minecraft, as It's a well-known game and It's quite simple)

What I'm trying to understand, is at which time should collisions be checked for? Are they checked each time the screen draws (render), or every time the tick function runs?


1 Answer 1


Collisions are part of the physics update, which is typically handled in the fixed timestep loop (what you call "tick" here).

By handling collision detection and resolution at a fixed game time interval, you help ensure that the physics play out consistently even on very different hardware.

If you do physics on a variable timestep (like in the render loop), then folks running at a low framerate can get glitchier physics — objects have to move farther in each physics step to keep up the right apparent movement rates, so they're prone to tunneling through collisions that would have been caught and handled correctly if using smaller steps.

In the Unity game engine as an example, this fixed timestep defaults to 0.02 seconds, or 50 Hz. Other games use different values, so you can tune it to get the right balance between performance and physics precision for your game.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .