Voxel File Structure

Volledige gerenderde weergave van FILE_STRUCTURE.md.

Laatst gesynchroniseerd: 13 april 2026

File Structure - Voxel Cutaway World Generator

Version: 0.2.0
Date: 2026-03-08
Author: Rens Roosloot / Codex collaboration

1. Purpose

This document proposes the file and folder structure for the standalone Voxel Cutaway World Generator page.

The goal is to keep implementation isolated, static-first, and easy to evolve without mixing project-specific logic into unrelated site files.

2. Proposed Project Folder

Recommended runtime boundary:

  • site/voxel-cutaway-world/

Recommended initial structure:

  • site/voxel-cutaway-world/index.html
  • site/voxel-cutaway-world/css/voxel-cutaway-world.css
  • site/voxel-cutaway-world/js/main.js
  • site/voxel-cutaway-world/js/config.js
  • site/voxel-cutaway-world/js/seed.js
  • site/voxel-cutaway-world/js/world-generator.js
  • site/voxel-cutaway-world/js/world-rules.js
  • site/voxel-cutaway-world/js/mesh-builder.js
  • site/voxel-cutaway-world/js/materials.js
  • site/voxel-cutaway-world/js/scene.js
  • site/voxel-cutaway-world/js/camera.js
  • site/voxel-cutaway-world/js/ui.js
  • site/voxel-cutaway-world/js/theme.js
  • site/voxel-cutaway-world/assets/
  • site/voxel-cutaway-world/docs/

3. Module Responsibilities

index.html

  • page shell
  • SEO metadata
  • viewport container
  • controls markup
  • short explanatory copy

css/voxel-cutaway-world.css

  • page-specific layout
  • viewport sizing
  • control panel styling
  • theme-specific UI treatment
  • responsive adjustments

js/main.js

  • bootstraps page
  • wires modules together
  • handles initial render and regenerate flow

js/config.js

  • chunk dimensions
  • default seed behavior
  • camera limits
  • world generation constants
  • theme defaults

js/seed.js

  • seed normalization
  • deterministic random helpers

js/world-generator.js

  • creates block-grid world data
  • runs ordered generation passes

js/world-rules.js

  • terrain thresholds
  • block placement rules
  • tree rules
  • ore rules
  • cave and lava constraints

js/mesh-builder.js

  • converts voxel grid to visible geometry
  • omits hidden internal faces

js/materials.js

  • defines materials/colors for block categories
  • handles theme-dependent material adjustments if needed

js/scene.js

  • renderer setup
  • scene root
  • lights
  • chunk mount/update flow

js/camera.js

  • orbit control setup
  • zoom bounds
  • camera reset framing
  • mobile gesture support

js/ui.js

  • regenerate button
  • theme toggle
  • seed display/input handling
  • user feedback state

js/theme.js

  • day/night lighting presets
  • background changes
  • reduced-motion-safe presentation toggles where needed

4. Optional Future Files

Only add when needed:

  • js/debug.js
  • js/presets.js
  • assets/images/
  • assets/data/sample-seeds.json

5. Structure Rules

  • keep runtime-required files within site/voxel-cutaway-world/
  • keep project-specific styles out of global site/styles.css unless a shared pattern is genuinely reusable
  • keep generator logic separate from rendering logic
  • keep UI state separate from world state
  • avoid one oversized script file

6. Suggested Build Philosophy

  • no build step required for MVP if avoidable
  • plain modules preferred
  • static hosting compatibility preserved at all times
Terug naar home