27 lines
698 B
Python
27 lines
698 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import asyncio
|
|
|
|
from engine.network.protocol import DEFAULT_PORT
|
|
from engine.network.server import GameServer
|
|
|
|
|
|
async def run(host: str, port: int) -> None:
|
|
server = GameServer(host=host, port=port)
|
|
await server.start()
|
|
print(f"Listening on {host}:{server.port}")
|
|
await server.serve_forever()
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Dedicated multiplayer server.")
|
|
parser.add_argument("--host", default="0.0.0.0")
|
|
parser.add_argument("--port", type=int, default=DEFAULT_PORT)
|
|
args = parser.parse_args()
|
|
asyncio.run(run(args.host, args.port))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|