Improve agent agression
This commit is contained in:
parent
f7d24a22b6
commit
a95a5f83a3
8 changed files with 66 additions and 92 deletions
|
|
@ -4,7 +4,6 @@ export interface GameLoopSettings {
|
|||
renderSpeed: number;
|
||||
simulatedDelayMs: number;
|
||||
|
||||
aggressionFactor: number;
|
||||
spawnRadius: number;
|
||||
spawnInterval: number;
|
||||
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue