@inglorious/server 21.0.11 → 21.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/game-loader.js +0 -1
- package/src/game-loop.js +3 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/server",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.12",
|
|
4
4
|
"description": "A real-time, lightweight server designed to enable multiplayer experiences for games built with the Inglorious Engine.",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"pino": "^10.
|
|
43
|
-
"ws": "^8.
|
|
42
|
+
"pino": "^10.4.0",
|
|
43
|
+
"ws": "^8.23.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@inglorious/store": "^12.
|
|
47
|
-
"@inglorious/utils": "^5.
|
|
46
|
+
"@inglorious/store": "^12.9.3",
|
|
47
|
+
"@inglorious/utils": "^5.4.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@inglorious/eslint-config": "1.2.
|
|
51
|
-
"@inglorious/store": "12.
|
|
52
|
-
"@inglorious/utils": "5.
|
|
50
|
+
"@inglorious/eslint-config": "1.2.1",
|
|
51
|
+
"@inglorious/store": "12.9.3",
|
|
52
|
+
"@inglorious/utils": "5.4.3",
|
|
53
53
|
"nodemon": "^3.1.14",
|
|
54
|
-
"prettier": "^3.
|
|
54
|
+
"prettier": "^3.10.1"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
57
|
+
"node": ">= 26"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"format": "prettier --write .",
|
package/src/game-loader.js
CHANGED
|
@@ -27,7 +27,6 @@ export async function loadGame(gameFilePath, logger) {
|
|
|
27
27
|
logger.error(`Failed to load game module: ${gameFilePath}`)
|
|
28
28
|
logger.error(error)
|
|
29
29
|
|
|
30
|
-
// Fallback to a basic initial state if loading fails.
|
|
31
30
|
logger.warn("Using default game state as a fallback.")
|
|
32
31
|
gameConfig = {}
|
|
33
32
|
return gameConfig
|
package/src/game-loop.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { performance } from "node:perf_hooks"
|
|
2
2
|
|
|
3
3
|
const ONE_SECOND = 1000
|
|
4
|
-
const TICK_RATE = 60
|
|
5
|
-
const TICK_INTERVAL = ONE_SECOND / TICK_RATE
|
|
4
|
+
const TICK_RATE = 60
|
|
5
|
+
const TICK_INTERVAL = ONE_SECOND / TICK_RATE
|
|
6
6
|
let lastTime = performance.now()
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -11,14 +11,11 @@ let lastTime = performance.now()
|
|
|
11
11
|
* @param {object} api The game API with broadcast functionality.
|
|
12
12
|
*/
|
|
13
13
|
export function start(store, api) {
|
|
14
|
-
// The main server-side game loop.
|
|
15
14
|
setInterval(() => {
|
|
16
15
|
const currentTime = performance.now()
|
|
17
|
-
const dt = (currentTime - lastTime) / ONE_SECOND
|
|
16
|
+
const dt = (currentTime - lastTime) / ONE_SECOND
|
|
18
17
|
lastTime = currentTime
|
|
19
18
|
|
|
20
|
-
// The store's update function is the heart of the game loop.
|
|
21
|
-
// It processes events and advances the game state.
|
|
22
19
|
store.update(dt, api)
|
|
23
20
|
}, TICK_INTERVAL)
|
|
24
21
|
}
|