diff --git a/src/game-loop/game-loop-settings.ts b/src/game-loop/game-loop-settings.ts index 85b2f90..bebdae1 100644 --- a/src/game-loop/game-loop-settings.ts +++ b/src/game-loop/game-loop-settings.ts @@ -5,8 +5,8 @@ export interface GameLoopSettings { simulatedDelayMs: number; aggressionFactor: number; - nextGenerationSpawnRadius: number; - nextGenerationSpawnInterval: number; + spawnRadius: number; + spawnInterval: number; startColorHue: number; } diff --git a/src/game-loop/game-rules.ts b/src/game-loop/game-rules.ts index bf2d045..2117cad 100644 --- a/src/game-loop/game-rules.ts +++ b/src/game-loop/game-rules.ts @@ -27,10 +27,7 @@ export class GameRules { } public getSpawnAction(timeInSeconds: number, canvasSize: vec2): SpawnAction { - if ( - timeInSeconds - this.lastSpawnTimeInSeconds < - settings.nextGenerationSpawnInterval - ) { + if (timeInSeconds - this.lastSpawnTimeInSeconds < settings.spawnInterval) { return { generation: this.nextGenerationId, position: vec2.create(), @@ -46,7 +43,7 @@ export class GameRules { Random.randomBetween(0, canvasSize.x), Random.randomBetween(0, canvasSize.y) ), - radius: settings.nextGenerationSpawnRadius, + radius: settings.spawnRadius, }; } diff --git a/src/page/set-up-settings-page.ts b/src/page/set-up-settings-page.ts index 9769dcf..847db07 100644 --- a/src/page/set-up-settings-page.ts +++ b/src/page/set-up-settings-page.ts @@ -14,43 +14,44 @@ export const setUpSettingsPage = ( rounding: Math.round, }), + new SettingsSlider(settings, 'moveSpeed', { + min: 10, + max: 500, + scaling: ValueScaling.Quadratic, + rounding: Math.round, + }), + new SettingsSlider(settings, 'aggressionFactor', { min: 0, max: 10, }), - new SettingsSlider(settings, 'nextGenerationSpawnRadius', { + new SettingsSlider(settings, 'spawnRadius', { min: 1, max: 1000, }), - new SettingsSlider(settings, 'nextGenerationSpawnInterval', { + new SettingsSlider(settings, 'spawnInterval', { min: 0.1, max: 600, }), - new SettingsSlider(settings, 'moveSpeed', { - min: 10, - max: 500, + new SettingsSlider(settings, 'clarity', { + min: 0.5, + max: 8, + step: 0.1, }), - ], - [ + new SettingsSlider(settings, 'brushWidth', { min: 1, max: 60, }), - new SettingsSlider(settings, 'brushWidthRandomness', { + new SettingsSlider(settings, 'brushWidthVariation', { min: 0, max: 1, }), ], - [ - new SettingsSlider(settings, 'clarity', { - min: 0.1, - max: 8, - }), - ], ]; sliders.forEach((sliderContainer) => { diff --git a/src/pipelines/brush/brush-pipeline.ts b/src/pipelines/brush/brush-pipeline.ts index ca97efd..0936915 100644 --- a/src/pipelines/brush/brush-pipeline.ts +++ b/src/pipelines/brush/brush-pipeline.ts @@ -119,11 +119,11 @@ export class BrushPipeline { this.linePoints.length = 0; } - public setParameters({ brushWidth, brushWidthRandomness }: BrushSettings) { + public setParameters({ brushWidth, brushWidthVariation }: BrushSettings) { this.device.queue.writeBuffer( this.uniforms, 0, - new Float32Array([brushWidth / 2, (brushWidth / 2) * brushWidthRandomness]) + new Float32Array([brushWidth / 2, (brushWidth / 2) * brushWidthVariation]) ); this.actualPoints = this.linePoints.slice(); diff --git a/src/pipelines/brush/brush-settings.ts b/src/pipelines/brush/brush-settings.ts index cffc73a..61f0008 100644 --- a/src/pipelines/brush/brush-settings.ts +++ b/src/pipelines/brush/brush-settings.ts @@ -1,4 +1,4 @@ export interface BrushSettings { brushWidth: number; - brushWidthRandomness: number; + brushWidthVariation: number; } diff --git a/src/pipelines/brush/brush.wgsl b/src/pipelines/brush/brush.wgsl index 8b2b07a..819e315 100644 --- a/src/pipelines/brush/brush.wgsl +++ b/src/pipelines/brush/brush.wgsl @@ -1,6 +1,6 @@ struct Settings { brushWidth: f32, - brushWidthRandomness: f32 + brushWidthVariation: f32 }; @group(1) @binding(0) var settings: Settings; @@ -31,7 +31,7 @@ fn fragment( ) -> @location(0) vec4 { var distance = distanceFromLine(screenPosition, start, end); let noise = textureSample(noise, noiseSampler, screenPosition / state.size / 50); - distance += noise.r * settings.brushWidthRandomness; + distance += noise.r * settings.brushWidthVariation; if(distance > settings.brushWidth) { discard; diff --git a/src/settings.ts b/src/settings.ts index 16dfe93..0c8adc0 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -12,33 +12,33 @@ export const settings: { [key: string]: number } & GameLoopSettings & RenderSettings = persist({ agentCount: 1_000_000, - brushWidth: 12, - brushWidthRandomness: 0.5, - aggressionFactor: 3, - nextGenerationSpawnRadius: 5, - nextGenerationSpawnInterval: 600, - brushTrailWeight: 5, moveSpeed: 80, turnSpeed: 550, sensorOffsetAngle: 30, sensorOffsetDistance: 30, turnWhenGoingInTheRightDirection: 0.05, turnWhenLost: 0.2, - individualTrailWeight: 0.5, deinfectionProbability: 0.001, + brushTrailWeight: 5, + individualTrailWeight: 0.5, diffusionRateTrails: 2, // inverse decayRateTrails: 0.9, // inverse diffusionRateBrush: 4, // inverse decayRateBrush: 0.003, + spawnRadius: 5, + spawnInterval: 600, + clarity: 2, + brushWidth: 12, + brushWidthVariation: 0.5, startColorHue: 200, - maxAgentCountUpperLimit: 64_000_000, // requires restart + maxAgentCountUpperLimit: Number.POSITIVE_INFINITY, // requires restart // debug options renderSpeed: 1,