Tweak settings & fix bug

This commit is contained in:
schmelczerandras 2020-10-27 15:01:56 +01:00
parent 99d923c221
commit d746854307
5 changed files with 15 additions and 13 deletions

View file

@ -1,6 +1,6 @@
{
"name": "declared-server",
"version": "0.0.8",
"version": "0.0.11",
"description": "Game server for decla.red",
"keywords": [],
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",

View file

@ -4,8 +4,8 @@ export const defaultOptions: Options = {
port: 3000,
name: 'Test server',
playerLimit: 16,
npcCount: 8,
seed: 0,
npcCount: 6,
seed: Math.random(),
scoreLimit: 500,
worldSize: 8000,
};

View file

@ -12,6 +12,7 @@ import {
GameEnd,
GameStart,
Command,
last,
} from 'shared';
import { createWorld } from './map/create-world';
import { DeltaTimeCalculator } from './helper/delta-time-calculator';
@ -137,7 +138,9 @@ export class GameServer {
console.log(
`Median physics time: ${this.deltaTimes[
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(
`Memory used: ${(process.memoryUsage().rss / 1024 / 1024).toFixed(2)} MB`,

View file

@ -96,7 +96,6 @@ export class PlayerCharacterPhysical
startPosition: vec2,
) {
super(id(), name, killCount, deathCount, team, settings.playerMaxHealth);
this.head = new CirclePhysical(
vec2.add(vec2.create(), startPosition, PlayerCharacterPhysical.headOffset),
PlayerCharacterPhysical.headRadius,
@ -149,7 +148,7 @@ export class PlayerCharacterPhysical
other.destroy();
this.health -= other.strength;
this.remoteCall('setHealth', this.health);
if (this.health <= 0) {
if (this.health <= 0 && this.isAlive) {
this.kill();
other.originator.addKill();
}
@ -352,14 +351,14 @@ export class PlayerCharacterPhysical
center,
PlayerCharacterPhysical.leftFootOffset,
deltaTime,
15000,
150,
);
this.springMove(
this.rightFoot,
center,
PlayerCharacterPhysical.rightFootOffset,
deltaTime,
15000,
150,
);
this.springMove(
@ -367,7 +366,7 @@ export class PlayerCharacterPhysical
center,
PlayerCharacterPhysical.headOffset,
deltaTime,
25000,
350,
);
}
@ -387,7 +386,7 @@ export class PlayerCharacterPhysical
vec2.scale(
positionDelta,
positionDeltaDirection,
positionDeltaLength * deltaTime * strength,
positionDeltaLength ** 2 * deltaTime * strength,
);
object.applyForce(positionDelta, deltaTime);

View file

@ -25,10 +25,10 @@ export const settings = {
planetPointGenerationInterval: 1.5,
planetPointGenerationValue: 1,
maxGravityDistance: 800,
maxGravityQ: 10000,
maxGravityQ: 5000,
planetControlThreshold: 0.2,
playerMaxHealth: 100,
maxGravityStrength: 20000,
maxGravityStrength: 10000,
maxAcceleration: 60000,
playerMaxStrength: 80,
endGameDeltaScaling: 4,
@ -111,7 +111,7 @@ export const settings = {
},
palette: [declaColor, neutralColor, redColor],
paletteDim: [declaColorDim, neutralColor, redColorDim],
targetPhysicsDeltaTimeInMilliseconds: 20,
targetPhysicsDeltaTimeInMilliseconds: 15,
minPhysicsSleepTime: 4,
inViewAreaSize: 1920 * 1080 * 3,
};