From 22448041c4fa09920ab40e68ab4bcba4f3933c53 Mon Sep 17 00:00:00 2001 From: elioat Date: Sat, 14 Dec 2024 20:27:36 -0500 Subject: * --- html/plains/config.js | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++ html/plains/game.js | 18 +++--- 2 files changed, 172 insertions(+), 9 deletions(-) create mode 100644 html/plains/config.js (limited to 'html/plains') 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)); -- cgit 1.4.1-2-gfad0 3' href='#n133'>133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220