A game loop that doesn't crash the browser