--- description: Standards for map generation, seeding, and textures. globs: src/generation/*.js** --- # **Procedural Generation Standards** ## **Core Principles** 1. **Determinism:** All generators must accept a seed. Using the same seed must produce the exact same map and textures. Use src/utils/SeededRandom.js. 2. **Additive vs Subtractive:** - **Ruins:** Use Additive (Fill 0, Build Rooms). - **Caves:** Use Subtractive/Cellular (Fill 1, Carve Caves). 3. **Playability:** - Always run PostProcessor.ensureConnectivity() to prevent soft-locks. - Always ensure valid "Floor" tiles exist for spawning. ## **Texture Generation** - Use OffscreenCanvas for texture generation to support Web Workers. - Return a composite object (diffuse, normal, roughness) for PBR materials. - Output textures to generatedAssets object, do not apply directly to Three.js materials inside the generator.