Rename settings
This commit is contained in:
parent
d83d5a8d4f
commit
3084ede26d
7 changed files with 32 additions and 34 deletions
|
|
@ -5,8 +5,8 @@ export interface GameLoopSettings {
|
||||||
simulatedDelayMs: number;
|
simulatedDelayMs: number;
|
||||||
|
|
||||||
aggressionFactor: number;
|
aggressionFactor: number;
|
||||||
nextGenerationSpawnRadius: number;
|
spawnRadius: number;
|
||||||
nextGenerationSpawnInterval: number;
|
spawnInterval: number;
|
||||||
|
|
||||||
startColorHue: number;
|
startColorHue: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,7 @@ export class GameRules {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSpawnAction(timeInSeconds: number, canvasSize: vec2): SpawnAction {
|
public getSpawnAction(timeInSeconds: number, canvasSize: vec2): SpawnAction {
|
||||||
if (
|
if (timeInSeconds - this.lastSpawnTimeInSeconds < settings.spawnInterval) {
|
||||||
timeInSeconds - this.lastSpawnTimeInSeconds <
|
|
||||||
settings.nextGenerationSpawnInterval
|
|
||||||
) {
|
|
||||||
return {
|
return {
|
||||||
generation: this.nextGenerationId,
|
generation: this.nextGenerationId,
|
||||||
position: vec2.create(),
|
position: vec2.create(),
|
||||||
|
|
@ -46,7 +43,7 @@ export class GameRules {
|
||||||
Random.randomBetween(0, canvasSize.x),
|
Random.randomBetween(0, canvasSize.x),
|
||||||
Random.randomBetween(0, canvasSize.y)
|
Random.randomBetween(0, canvasSize.y)
|
||||||
),
|
),
|
||||||
radius: settings.nextGenerationSpawnRadius,
|
radius: settings.spawnRadius,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,43 +14,44 @@ export const setUpSettingsPage = (
|
||||||
rounding: Math.round,
|
rounding: Math.round,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
new SettingsSlider(settings, 'moveSpeed', {
|
||||||
|
min: 10,
|
||||||
|
max: 500,
|
||||||
|
scaling: ValueScaling.Quadratic,
|
||||||
|
rounding: Math.round,
|
||||||
|
}),
|
||||||
|
|
||||||
new SettingsSlider(settings, 'aggressionFactor', {
|
new SettingsSlider(settings, 'aggressionFactor', {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 10,
|
max: 10,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new SettingsSlider(settings, 'nextGenerationSpawnRadius', {
|
new SettingsSlider(settings, 'spawnRadius', {
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 1000,
|
max: 1000,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new SettingsSlider(settings, 'nextGenerationSpawnInterval', {
|
new SettingsSlider(settings, 'spawnInterval', {
|
||||||
min: 0.1,
|
min: 0.1,
|
||||||
max: 600,
|
max: 600,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new SettingsSlider(settings, 'moveSpeed', {
|
new SettingsSlider(settings, 'clarity', {
|
||||||
min: 10,
|
min: 0.5,
|
||||||
max: 500,
|
max: 8,
|
||||||
|
step: 0.1,
|
||||||
}),
|
}),
|
||||||
],
|
|
||||||
[
|
|
||||||
new SettingsSlider(settings, 'brushWidth', {
|
new SettingsSlider(settings, 'brushWidth', {
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 60,
|
max: 60,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new SettingsSlider(settings, 'brushWidthRandomness', {
|
new SettingsSlider(settings, 'brushWidthVariation', {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 1,
|
max: 1,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
[
|
|
||||||
new SettingsSlider(settings, 'clarity', {
|
|
||||||
min: 0.1,
|
|
||||||
max: 8,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
sliders.forEach((sliderContainer) => {
|
sliders.forEach((sliderContainer) => {
|
||||||
|
|
|
||||||
|
|
@ -119,11 +119,11 @@ export class BrushPipeline {
|
||||||
this.linePoints.length = 0;
|
this.linePoints.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setParameters({ brushWidth, brushWidthRandomness }: BrushSettings) {
|
public setParameters({ brushWidth, brushWidthVariation }: BrushSettings) {
|
||||||
this.device.queue.writeBuffer(
|
this.device.queue.writeBuffer(
|
||||||
this.uniforms,
|
this.uniforms,
|
||||||
0,
|
0,
|
||||||
new Float32Array([brushWidth / 2, (brushWidth / 2) * brushWidthRandomness])
|
new Float32Array([brushWidth / 2, (brushWidth / 2) * brushWidthVariation])
|
||||||
);
|
);
|
||||||
|
|
||||||
this.actualPoints = this.linePoints.slice();
|
this.actualPoints = this.linePoints.slice();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export interface BrushSettings {
|
export interface BrushSettings {
|
||||||
brushWidth: number;
|
brushWidth: number;
|
||||||
brushWidthRandomness: number;
|
brushWidthVariation: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
struct Settings {
|
struct Settings {
|
||||||
brushWidth: f32,
|
brushWidth: f32,
|
||||||
brushWidthRandomness: f32
|
brushWidthVariation: f32
|
||||||
};
|
};
|
||||||
|
|
||||||
@group(1) @binding(0) var<uniform> settings: Settings;
|
@group(1) @binding(0) var<uniform> settings: Settings;
|
||||||
|
|
@ -31,7 +31,7 @@ fn fragment(
|
||||||
) -> @location(0) vec4<f32> {
|
) -> @location(0) vec4<f32> {
|
||||||
var distance = distanceFromLine(screenPosition, start, end);
|
var distance = distanceFromLine(screenPosition, start, end);
|
||||||
let noise = textureSample(noise, noiseSampler, screenPosition / state.size / 50);
|
let noise = textureSample(noise, noiseSampler, screenPosition / state.size / 50);
|
||||||
distance += noise.r * settings.brushWidthRandomness;
|
distance += noise.r * settings.brushWidthVariation;
|
||||||
|
|
||||||
if(distance > settings.brushWidth) {
|
if(distance > settings.brushWidth) {
|
||||||
discard;
|
discard;
|
||||||
|
|
|
||||||
|
|
@ -12,33 +12,33 @@ export const settings: { [key: string]: number } & GameLoopSettings &
|
||||||
RenderSettings = persist({
|
RenderSettings = persist({
|
||||||
agentCount: 1_000_000,
|
agentCount: 1_000_000,
|
||||||
|
|
||||||
brushWidth: 12,
|
|
||||||
brushWidthRandomness: 0.5,
|
|
||||||
|
|
||||||
aggressionFactor: 3,
|
aggressionFactor: 3,
|
||||||
nextGenerationSpawnRadius: 5,
|
|
||||||
nextGenerationSpawnInterval: 600,
|
|
||||||
|
|
||||||
brushTrailWeight: 5,
|
|
||||||
moveSpeed: 80,
|
moveSpeed: 80,
|
||||||
turnSpeed: 550,
|
turnSpeed: 550,
|
||||||
sensorOffsetAngle: 30,
|
sensorOffsetAngle: 30,
|
||||||
sensorOffsetDistance: 30,
|
sensorOffsetDistance: 30,
|
||||||
turnWhenGoingInTheRightDirection: 0.05,
|
turnWhenGoingInTheRightDirection: 0.05,
|
||||||
turnWhenLost: 0.2,
|
turnWhenLost: 0.2,
|
||||||
individualTrailWeight: 0.5,
|
|
||||||
deinfectionProbability: 0.001,
|
deinfectionProbability: 0.001,
|
||||||
|
|
||||||
|
brushTrailWeight: 5,
|
||||||
|
individualTrailWeight: 0.5,
|
||||||
diffusionRateTrails: 2, // inverse
|
diffusionRateTrails: 2, // inverse
|
||||||
decayRateTrails: 0.9, // inverse
|
decayRateTrails: 0.9, // inverse
|
||||||
diffusionRateBrush: 4, // inverse
|
diffusionRateBrush: 4, // inverse
|
||||||
decayRateBrush: 0.003,
|
decayRateBrush: 0.003,
|
||||||
|
|
||||||
|
spawnRadius: 5,
|
||||||
|
spawnInterval: 600,
|
||||||
|
|
||||||
clarity: 2,
|
clarity: 2,
|
||||||
|
brushWidth: 12,
|
||||||
|
brushWidthVariation: 0.5,
|
||||||
|
|
||||||
startColorHue: 200,
|
startColorHue: 200,
|
||||||
|
|
||||||
maxAgentCountUpperLimit: 64_000_000, // requires restart
|
maxAgentCountUpperLimit: Number.POSITIVE_INFINITY, // requires restart
|
||||||
|
|
||||||
// debug options
|
// debug options
|
||||||
renderSpeed: 1,
|
renderSpeed: 1,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue