engine: smoother main loop