written game loop