This commit is contained in:
Matthieu Jolimaitre 2024-04-09 02:05:02 +02:00
commit 28b026a614
17 changed files with 895 additions and 0 deletions

24
server/main.ts Executable file
View file

@ -0,0 +1,24 @@
#!/bin/env -S deno run --allow-net --allow-read
import { log_from, Vec2 } from "../common/utils.ts";
import { Engine, World } from "./engine.ts";
import { Enemy } from "./entities/enemy.ts";
import { Gateway } from "./network.ts";
const log = log_from(import.meta);
async function main() {
log("Starting.");
const world = new World();
await world.spawn_structure("../data/structures/houses.txt", new Vec2(2, 2));
const engine = new Engine(world);
engine.start();
Enemy.spawn(world, new Vec2(-3, -3));
const port = 9999;
const gateway = new Gateway(port);
log("Awaiting connection.");
for await (const session of gateway.accept()) engine.add_session(session);
}
if (import.meta.main) await main();