Improve agent agression

This commit is contained in:
Andras Schmelczer 2023-05-27 20:44:05 +01:00
parent f7d24a22b6
commit a95a5f83a3
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
8 changed files with 66 additions and 92 deletions

View file

@ -4,7 +4,6 @@ export interface GameLoopSettings {
renderSpeed: number;
simulatedDelayMs: number;
aggressionFactor: number;
spawnRadius: number;
spawnInterval: number;

View file

@ -188,15 +188,7 @@ export default class GameLoop {
].forEach((pipeline) =>
pipeline.setParameters({
time,
evenGenerationAggression:
this.gameRules.nextGenerationId % 2
? -1
: this.gameRules.nextGenerationAgression,
oddGenerationAggression:
this.gameRules.nextGenerationId % 2
? this.gameRules.nextGenerationAgression
: -1,
nextGenerationId: this.gameRules.nextGenerationId,
isNextGenerationOdd: this.gameRules.nextGenerationId % 2,
deltaTime,
canvasSize: this.canvasSize,
brushColor: GamePresentation.getGenerationColor(

View file

@ -1,6 +1,5 @@
import { GenerationCounts } from '../pipelines/agents/agent-generation/generation-counts';
import { settings } from '../settings';
import { clamp01 } from '../utils/clamp';
import { Random } from '../utils/random';
import { vec2 } from 'gl-matrix';
@ -65,17 +64,4 @@ export class GameRules {
nextGenerationCount,
};
}
public get nextGenerationAgression(): number {
if (this.generationCounts.currentGenerationCount === 0) {
return 0;
}
return clamp01(
(this.generationCounts.nextGenerationCount /
this.generationCounts.currentGenerationCount -
1) *
settings.aggressionFactor
);
}
}