sets up game loop