about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2024-12-14 20:27:36 -0500
committerelioat <elioat@tilde.institute>2024-12-14 20:27:36 -0500
commit22448041c4fa09920ab40e68ab4bcba4f3933c53 (patch)
tree83650dad9508171090b5b6ace8ad5002c1be8457
parent8730c864825d78221d9f5dbdd5ff45b71447f175 (diff)
downloadtour-22448041c4fa09920ab40e68ab4bcba4f3933c53.tar.gz
*
-rw-r--r--html/plains/config.js163
-rw-r--r--html/plains/game.js18
2 files changed, 172 insertions, 9 deletions
diff --git a/html/plains/config.js b/html/plains/config.js
new file mode 100644
index 0000000..2f5e227
--- /dev/null
+++ b/html/plains/config.js
@@ -0,0 +1,163 @@
+export const CONFIG = {
+    display: {
+        fps: 60,
+        grid: {
+            size: 100,
+            color: 'rgba(221, 221, 221, 0.5)',
+            worldSize: 100,
+            voidColor: '#e6f3ff'
+        },
+        camera: {
+            deadzoneMultiplierX: 0.6,
+            deadzoneMultiplierY: 0.6,
+            ease: 0.08
+        }
+    },
+    effects: {
+        colors: {
+            primary: '#4169E1',
+            secondary: '#1E90FF',
+            tertiary: '#0000CD',
+            glow: 'rgba(0, 128, 255, 0.5)',
+            inner: '#0000CD'
+        }
+    },
+    player: {
+        size: 30,
+        speed: 5,
+        sprintMultiplier: 2,
+        color: '#111',
+        strafeKey: ' ',
+        directionIndicator: {
+            size: 10,
+            color: 'rgba(32, 178, 170, 1)'
+        },
+        dash: {
+            duration: 3000,    // 3 seconds of use
+            cooldown: 1000,    // 1 second cooldown
+            exhaustedAt: 0     // Track when dash was exhausted
+        },
+        idle: {
+            startDelay: 1500,    // Start idle animation after 1.5 seconds
+            lookSpeed: 0.001,    // Speed of the looking animation
+            lookRadius: 0.4      // How far to look around (in radians)
+        }
+    },
+    sword: {
+        length: 60,
+        swingSpeed: 0.6,
+        colors: null
+    },
+    bubble: {
+        size: 20,
+        speed: 8,
+        lifetime: 800,
+        cooldown: 1000,
+        arcWidth: Math.PI / 3,
+        colors: null,
+        particleEmitRate: 0.3,
+        fadeExponent: 2.5
+    },
+    bubbleParticle: {
+        lifetime: 700,
+        speedMultiplier: 0.3,
+        size: 3
+    },
+    defense: {
+        numLayers: 6,
+        maxRadiusMultiplier: 2,
+        baseAlpha: 0.15,
+        particleCount: 12,
+        orbitRadiusMultiplier: 0.8,
+        rotationSpeed: 1.5
+    },
+    footprints: {
+        lifetime: 1000,
+        spacing: 300,
+        size: 5
+    },
+    world: {
+        village: {
+            size: 2,
+            groundColor: '#f2f2f2'
+        },
+        wilderness: {
+            groundColor: '#e6ffe6',
+            vegetation: {
+                tree: {
+                    frequency: 0.1,  // Chance per grid cell
+                    colors: [
+                        'rgba(100, 144, 79, 1)',
+                        'rgba(85, 128, 64, 1)',
+                        'rgba(128, 164, 98, 1)',
+                        'rgba(110, 139, 61, 1)',
+                        'rgba(95, 133, 73, 1)',
+                        'rgba(248, 239, 58, 1)'
+                    ],
+                    size: { min: 20, max: 30 }
+                },
+                mushroom: {
+                    frequency: 0.03,
+                    colors: [
+                        'rgba(242, 63, 63, 0.25)',
+                        'rgba(245, 131, 148, 0.25)',
+                        'rgba(255, 119, 65, 0.25)',
+                        'rgba(193, 97, 1, 0.5)'
+                    ],
+                    pattern: {
+                        size: 3,
+                        spacing: 10,
+                        margin: 10,
+                        variation: 0.5,
+                        offset: 0.5,
+                        singleColor: 0.7  // % chance that all dots in a cell will be the same color
+                    }
+                },
+                flower: {
+                    frequency: 0.05,
+                    colors: [
+                        'rgba(255, 105, 180, 0.3)',
+                        'rgba(221, 160, 221, 0.3)',
+                        'rgba(147, 112, 219, 0.3)'
+                    ],
+                    pattern: {
+                        size: 12,
+                        spacing: 16,
+                        rotation: Math.PI / 6,  // Base rotation of pattern
+                        margin: 10,
+                        variation: 0.2
+                    }
+                },
+                grass: {
+                    frequency: 0.12,
+                    colors: ['rgba(28, 48, 32, 0.25)'],
+                    hatch: {
+                        spacing: 8,
+                        length: 6,
+                        angle: Math.PI / 4,
+                        variation: 0.4,   // Slight randomness in angle
+                        margin: 4
+                    },
+                    spreadFactor: 0.6  // Add this for grass spreading
+                },
+                villagers: {
+                    count: 100, // Number of villagers to place
+                    color: '#424242',
+                    size: 30
+                }
+            }
+        }
+    },
+    collision: {
+        enabled: true,
+        vegetation: {
+            tree: {
+                enabled: true,
+                sizeMultiplier: 1.0
+            }
+        }
+    }
+};
+
+CONFIG.sword.colors = CONFIG.effects.colors;
+CONFIG.bubble.colors = CONFIG.effects.colors; 
\ No newline at end of file
diff --git a/html/plains/game.js b/html/plains/game.js
index 6b03353..57143cd 100644
--- a/html/plains/game.js
+++ b/html/plains/game.js
@@ -1426,16 +1426,16 @@ const getCellInfo = (x, y) => {
     }
     
     // Check for vegetation only if in wilderness
-    const hasTree = random < CONFIG.world.wilderness.vegetation.tree.frequency;
+    const hasTree =      random <  CONFIG.world.wilderness.vegetation.tree.frequency;
     const hasMushrooms = random < (CONFIG.world.wilderness.vegetation.tree.frequency + 
-                                 CONFIG.world.wilderness.vegetation.mushroom.frequency);
-    const hasFlowers = random < (CONFIG.world.wilderness.vegetation.tree.frequency + 
-                                CONFIG.world.wilderness.vegetation.mushroom.frequency +
-                                CONFIG.world.wilderness.vegetation.flower.frequency);
-    const hasGrass = random < (CONFIG.world.wilderness.vegetation.tree.frequency + 
-                              CONFIG.world.wilderness.vegetation.mushroom.frequency +
-                              CONFIG.world.wilderness.vegetation.flower.frequency +
-                              CONFIG.world.wilderness.vegetation.grass.frequency) ||
+                                   CONFIG.world.wilderness.vegetation.mushroom.frequency);
+    const hasFlowers =   random < (CONFIG.world.wilderness.vegetation.tree.frequency + 
+                                   CONFIG.world.wilderness.vegetation.mushroom.frequency +
+                                   CONFIG.world.wilderness.vegetation.flower.frequency);
+    const hasGrass =     random < (CONFIG.world.wilderness.vegetation.tree.frequency + 
+                                   CONFIG.world.wilderness.vegetation.mushroom.frequency +
+                                   CONFIG.world.wilderness.vegetation.flower.frequency +
+                                   CONFIG.world.wilderness.vegetation.grass.frequency) ||
                      (seededRandom(cellX * 50, cellY * 50) < 
                       CONFIG.world.wilderness.vegetation.grass.spreadFactor && 
                       hasAdjacentGrass(cellX, cellY));