summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rwxr-xr-xserver/bun.lockbbin1650 -> 1270 bytes
-rw-r--r--server/src/server.ts21
-rw-r--r--server/tsconfig.json14
3 files changed, 26 insertions, 9 deletions
diff --git a/server/bun.lockb b/server/bun.lockb
index 7f8b5ce..28b67ce 100755
--- a/server/bun.lockb
+++ b/server/bun.lockb
Binary files differ
diff --git a/server/src/server.ts b/server/src/server.ts
index d169f7d..18829e4 100644
--- a/server/src/server.ts
+++ b/server/src/server.ts
@@ -1,21 +1,24 @@
-import { Game } from "../../engine/Game";
-import { Floor, Player } from "../../engine/entities";
+import { Game } from "@engine/Game";
+import { Floor, Player } from "@engine/entities";
import {
WallBounds,
Physics,
Collision,
MessageQueueProvider,
MessagePublisher,
-} from "../../engine/systems";
-import { Miscellaneous } from "../../engine/config";
+} from "@engine/systems";
+import { Grid } from "@engine/structures";
+import { Miscellaneous } from "@engine/config";
const TICK_RATE = 60 / 1000;
const game = new Game();
-[new Physics(), new Collision(), new WallBounds(Miscellaneous.WIDTH)].forEach(
- (system) => game.addSystem(system),
-);
+[
+ new Physics(),
+ new Collision(new Grid()),
+ new WallBounds(Miscellaneous.WIDTH),
+].forEach((system) => game.addSystem(system));
[new Floor(160), new Player()].forEach((entity) => game.addEntity(entity));
@@ -27,7 +30,7 @@ setInterval(() => {
const server = Bun.serve({
port: 8080,
- fetch(req, server) {
+ fetch: async (req, server): Promise<string> => {
const sessionId = Math.floor(Math.random() * 1e10).toString();
server.upgrade(req, {
@@ -35,6 +38,8 @@ const server = Bun.serve({
"Set-Cookie": `SessionId=${sessionId}`,
},
});
+
+ return "200 OK";
},
websocket: {
open(ws) {},
diff --git a/server/tsconfig.json b/server/tsconfig.json
index e39b364..8cc9ad3 100644
--- a/server/tsconfig.json
+++ b/server/tsconfig.json
@@ -21,6 +21,18 @@
// best practices
"strict": true,
"forceConsistentCasingInFileNames": true,
- "skipLibCheck": true
+ "skipLibCheck": true,
+
+ // engine path
+ "paths": {
+ "@engine/*": ["../engine/*"],
+ "@engine/components": ["../engine/components"],
+ "@engine/config": ["../engine/config"],
+ "@engine/entities": ["../engine/entities"],
+ "@engine/interfaces": ["../engine/interfaces"],
+ "@engine/structures": ["../engine/structures"],
+ "@engine/systems": ["../engine/systems"],
+ "@engine/utils": ["../engine/utils"],
+ }
}
}