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;
|
||||
|
||||
aggressionFactor: number;
|
||||
nextGenerationSpawnRadius: number;
|
||||
nextGenerationSpawnInterval: number;
|
||||
spawnRadius: number;
|
||||
spawnInterval: number;
|
||||
|
||||
startColorHue: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export interface BrushSettings {
|
||||
brushWidth: number;
|
||||
brushWidthRandomness: number;
|
||||
brushWidthVariation: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
struct Settings {
|
||||
brushWidth: f32,
|
||||
brushWidthRandomness: f32
|
||||
brushWidthVariation: f32
|
||||
};
|
||||
|
||||
@group(1) @binding(0) var<uniform> settings: Settings;
|
||||
|
|
@ -31,7 +31,7 @@ fn fragment(
|
|||
) -> @location(0) vec4<f32> {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue