implement game loop timing mechanism