Tweak settings & fix bug
This commit is contained in:
parent
99d923c221
commit
d746854307
5 changed files with 15 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "declared-server",
|
"name": "declared-server",
|
||||||
"version": "0.0.8",
|
"version": "0.0.11",
|
||||||
"description": "Game server for decla.red",
|
"description": "Game server for decla.red",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
|
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ export const defaultOptions: Options = {
|
||||||
port: 3000,
|
port: 3000,
|
||||||
name: 'Test server',
|
name: 'Test server',
|
||||||
playerLimit: 16,
|
playerLimit: 16,
|
||||||
npcCount: 8,
|
npcCount: 6,
|
||||||
seed: 0,
|
seed: Math.random(),
|
||||||
scoreLimit: 500,
|
scoreLimit: 500,
|
||||||
worldSize: 8000,
|
worldSize: 8000,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import {
|
||||||
GameEnd,
|
GameEnd,
|
||||||
GameStart,
|
GameStart,
|
||||||
Command,
|
Command,
|
||||||
|
last,
|
||||||
} from 'shared';
|
} from 'shared';
|
||||||
import { createWorld } from './map/create-world';
|
import { createWorld } from './map/create-world';
|
||||||
import { DeltaTimeCalculator } from './helper/delta-time-calculator';
|
import { DeltaTimeCalculator } from './helper/delta-time-calculator';
|
||||||
|
|
@ -137,7 +138,9 @@ export class GameServer {
|
||||||
console.log(
|
console.log(
|
||||||
`Median physics time: ${this.deltaTimes[
|
`Median physics time: ${this.deltaTimes[
|
||||||
Math.floor(framesBetweenDeltaTimeCalculation / 2)
|
Math.floor(framesBetweenDeltaTimeCalculation / 2)
|
||||||
].toFixed(2)} ms`,
|
].toFixed(2)} ms\n`,
|
||||||
|
'Tail times: ',
|
||||||
|
this.deltaTimes.slice(-20).map((v) => `${v.toFixed(2)} ms`),
|
||||||
);
|
);
|
||||||
console.log(
|
console.log(
|
||||||
`Memory used: ${(process.memoryUsage().rss / 1024 / 1024).toFixed(2)} MB`,
|
`Memory used: ${(process.memoryUsage().rss / 1024 / 1024).toFixed(2)} MB`,
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ export class PlayerCharacterPhysical
|
||||||
startPosition: vec2,
|
startPosition: vec2,
|
||||||
) {
|
) {
|
||||||
super(id(), name, killCount, deathCount, team, settings.playerMaxHealth);
|
super(id(), name, killCount, deathCount, team, settings.playerMaxHealth);
|
||||||
|
|
||||||
this.head = new CirclePhysical(
|
this.head = new CirclePhysical(
|
||||||
vec2.add(vec2.create(), startPosition, PlayerCharacterPhysical.headOffset),
|
vec2.add(vec2.create(), startPosition, PlayerCharacterPhysical.headOffset),
|
||||||
PlayerCharacterPhysical.headRadius,
|
PlayerCharacterPhysical.headRadius,
|
||||||
|
|
@ -149,7 +148,7 @@ export class PlayerCharacterPhysical
|
||||||
other.destroy();
|
other.destroy();
|
||||||
this.health -= other.strength;
|
this.health -= other.strength;
|
||||||
this.remoteCall('setHealth', this.health);
|
this.remoteCall('setHealth', this.health);
|
||||||
if (this.health <= 0) {
|
if (this.health <= 0 && this.isAlive) {
|
||||||
this.kill();
|
this.kill();
|
||||||
other.originator.addKill();
|
other.originator.addKill();
|
||||||
}
|
}
|
||||||
|
|
@ -352,14 +351,14 @@ export class PlayerCharacterPhysical
|
||||||
center,
|
center,
|
||||||
PlayerCharacterPhysical.leftFootOffset,
|
PlayerCharacterPhysical.leftFootOffset,
|
||||||
deltaTime,
|
deltaTime,
|
||||||
15000,
|
150,
|
||||||
);
|
);
|
||||||
this.springMove(
|
this.springMove(
|
||||||
this.rightFoot,
|
this.rightFoot,
|
||||||
center,
|
center,
|
||||||
PlayerCharacterPhysical.rightFootOffset,
|
PlayerCharacterPhysical.rightFootOffset,
|
||||||
deltaTime,
|
deltaTime,
|
||||||
15000,
|
150,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.springMove(
|
this.springMove(
|
||||||
|
|
@ -367,7 +366,7 @@ export class PlayerCharacterPhysical
|
||||||
center,
|
center,
|
||||||
PlayerCharacterPhysical.headOffset,
|
PlayerCharacterPhysical.headOffset,
|
||||||
deltaTime,
|
deltaTime,
|
||||||
25000,
|
350,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -387,7 +386,7 @@ export class PlayerCharacterPhysical
|
||||||
vec2.scale(
|
vec2.scale(
|
||||||
positionDelta,
|
positionDelta,
|
||||||
positionDeltaDirection,
|
positionDeltaDirection,
|
||||||
positionDeltaLength * deltaTime * strength,
|
positionDeltaLength ** 2 * deltaTime * strength,
|
||||||
);
|
);
|
||||||
|
|
||||||
object.applyForce(positionDelta, deltaTime);
|
object.applyForce(positionDelta, deltaTime);
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ export const settings = {
|
||||||
planetPointGenerationInterval: 1.5,
|
planetPointGenerationInterval: 1.5,
|
||||||
planetPointGenerationValue: 1,
|
planetPointGenerationValue: 1,
|
||||||
maxGravityDistance: 800,
|
maxGravityDistance: 800,
|
||||||
maxGravityQ: 10000,
|
maxGravityQ: 5000,
|
||||||
planetControlThreshold: 0.2,
|
planetControlThreshold: 0.2,
|
||||||
playerMaxHealth: 100,
|
playerMaxHealth: 100,
|
||||||
maxGravityStrength: 20000,
|
maxGravityStrength: 10000,
|
||||||
maxAcceleration: 60000,
|
maxAcceleration: 60000,
|
||||||
playerMaxStrength: 80,
|
playerMaxStrength: 80,
|
||||||
endGameDeltaScaling: 4,
|
endGameDeltaScaling: 4,
|
||||||
|
|
@ -111,7 +111,7 @@ export const settings = {
|
||||||
},
|
},
|
||||||
palette: [declaColor, neutralColor, redColor],
|
palette: [declaColor, neutralColor, redColor],
|
||||||
paletteDim: [declaColorDim, neutralColor, redColorDim],
|
paletteDim: [declaColorDim, neutralColor, redColorDim],
|
||||||
targetPhysicsDeltaTimeInMilliseconds: 20,
|
targetPhysicsDeltaTimeInMilliseconds: 15,
|
||||||
minPhysicsSleepTime: 4,
|
minPhysicsSleepTime: 4,
|
||||||
inViewAreaSize: 1920 * 1080 * 3,
|
inViewAreaSize: 1920 * 1080 * 3,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue