Tweak settings & fix bug
This commit is contained in:
parent
99d923c221
commit
d746854307
5 changed files with 15 additions and 13 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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`,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue