Spaces:
Sleeping
Sleeping
Update app.js
Browse files
app.js
CHANGED
|
@@ -3,9 +3,8 @@ import express from 'express';
|
|
| 3 |
import cors from 'cors';
|
| 4 |
import { WebSocketServer, WebSocket } from 'ws';
|
| 5 |
import { v4 as uuidv4 } from 'uuid';
|
| 6 |
-
// Make sure this points to
|
| 7 |
-
|
| 8 |
-
import { resolveCombat, getDerivedStats, breedOffspring, INITIAL_STATE } from './mechanics.js';
|
| 9 |
|
| 10 |
const app = express();
|
| 11 |
// Hugging Face Spaces and other cloud PaaS use process.env.PORT (HF uses 7860)
|
|
@@ -16,6 +15,11 @@ app.use(cors({
|
|
| 16 |
origin: '*', // Set to your specific frontend URL in production for security
|
| 17 |
}));
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
const rooms = {};
|
| 20 |
const roomEmptySince = new Map();
|
| 21 |
const roomChatLogs = new Map();
|
|
@@ -74,9 +78,6 @@ function makeRoom(forceBots = false) {
|
|
| 74 |
return room;
|
| 75 |
}
|
| 76 |
|
| 77 |
-
const MIN_ROOMS = 5;
|
| 78 |
-
const ROOM_SAFETY_CAP = 200;
|
| 79 |
-
const ROOM_EMPTY_GRACE_MS = 15000;
|
| 80 |
const ARENA_SIZE = 800;
|
| 81 |
const SAFE_ZONE_START = 400;
|
| 82 |
const FOOD_COUNT = 15;
|
|
|
|
| 3 |
import cors from 'cors';
|
| 4 |
import { WebSocketServer, WebSocket } from 'ws';
|
| 5 |
import { v4 as uuidv4 } from 'uuid';
|
| 6 |
+
// Make sure this points to your JS mechanics file
|
| 7 |
+
import { resolveCombat, getDerivedStats, breedOffspring, INITIAL_STATE } from 'mechanics.js';
|
|
|
|
| 8 |
|
| 9 |
const app = express();
|
| 10 |
// Hugging Face Spaces and other cloud PaaS use process.env.PORT (HF uses 7860)
|
|
|
|
| 15 |
origin: '*', // Set to your specific frontend URL in production for security
|
| 16 |
}));
|
| 17 |
|
| 18 |
+
const MIN_ROOMS = 5;
|
| 19 |
+
const ROOM_SAFETY_CAP = 200;
|
| 20 |
+
const ROOM_EMPTY_GRACE_MS = 15000;
|
| 21 |
+
let roomCounter = 0; // RESTORED
|
| 22 |
+
|
| 23 |
const rooms = {};
|
| 24 |
const roomEmptySince = new Map();
|
| 25 |
const roomChatLogs = new Map();
|
|
|
|
| 78 |
return room;
|
| 79 |
}
|
| 80 |
|
|
|
|
|
|
|
|
|
|
| 81 |
const ARENA_SIZE = 800;
|
| 82 |
const SAFE_ZONE_START = 400;
|
| 83 |
const FOOD_COUNT = 15;
|