VIVIA โ Architecture
Source Layout (as built โ matches Core/Src/ 1:1)โ
Core/Src/
โโโ main.rs # App loop, input, world/actor orchestration
โโโ gameplay.rs # GameClock, PlayerStats, animals, enemies, achievements
โโโ inventory.rs # Hotbar, inventory slots, stacking
โโโ crafting.rs # RecipeRegistry โ shaped & shapeless recipes (NVCrafter)
โโโ commands.rs # Chat commands (/tp, /give, /help, /ai_*)
โโโ settings.rs # SharedSettings (render radius, low_end_pc, perf profiles)
โโโ assets.rs # Asset loading
โโโ input.rs # Keyboard/mouse state
โโโ interaction.rs # Block place/break interactions
โโโ egs.rs # Epic Online Services bridge (runtime-loaded, keyless)
โโโ renderer/
โ โโโ mod.rs # GPU pipeline, draw calls, world mesh cache
โ โโโ camera.rs # First-person camera
โ โโโ mesh.rs # Chunk meshing
โ โโโ instance.rs # Instance buffer management
โ โโโ texture_atlas.rs # Block texture atlas
โ โโโ texture_registry.rs # blockname.png / *_side.png conventions
โ โโโ dynamic_atlas.rs # Runtime atlas updates (AI textures)
โ โโโ text.rs # Text rendering
โ โโโ menu.rs # Main menu
โ โโโ *.wgsl # Shaders: terrain, sky, weather, animals, text, UI
โโโ world/
โโโ mod.rs # World state, block access, spawn logic
โโโ block.rs # BlockType registry (~124 types: hardness, tool tiers)
โโโ chunk.rs # 16ร512ร16 chunk storage (CHUNK_H = 512)
โโโ generator.rs # OpenSimplex2 terrain generation
โโโ worldgen.rs # World generation orchestration
โโโ biomes.rs # 9 climate-driven biomes (BiomeId)
โโโ vegetation.rs # Tree/plant placement per biome
โโโ decorations.rs # Decorative elements
โโโ decoration_ai.rs # AI-driven decoration placement
โโโ ai_generator.rs # MeMLP application to world generation
โโโ ai_feedback.rs # Player preference learning
โโโ memplp.rs # Modular MLP (VEGETATION/BIOME/TEXTURE archs)
โโโ online_trainer.rs # Open-Meteo API training loop (8 cities)
โโโ meteo.rs # Embedded NASA POWER climate grid + seasons
โโโ liquid.rs # Water/lava simulation
โโโ palette.rs # Block color palettes
โโโ storage.rs # Block storage optimization
โโโ raycast.rs # Block raycasting
Data Flowโ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ Seed โ coord โโโโโบโ NASA POWER โโโโโบโ Biome table โ
โ (Earth map) โ โ climatologyโ โ + weather โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโ
โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโผโโโโโโโ
โ GPU upload โโโโโโ Chunk โโโโโโ OpenSimplex2โ
โ (wgpu) โ โ meshing โ โ + MeMLP veg โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
Chunk Lifecycleโ
- Request โ player position triggers chunk generation requests
- Generate โ OpenSimplex2 heightmap + cave/ore placement (rayon-parallel)
- Decorate โ climate-driven vegetation, AI decoration placement
- Mesh + Upload โ chunk meshing, vertex/index buffers to GPU
- Render โ instanced draw calls per chunk
- Unload โ chunks beyond
cleanup_radiusare evicted
Block Registryโ
~124 block types (BlockType), each with:
- Hardness (
hardness()) โ mining time - Tool tier (
required_tool_tier()) โ wood โ stone โ iron โ diamond - Display name โ inventory tooltip
- Special interactions (Chest, NVCrafter, Cactus break-speed rules)
What is intentionally NOT here yetโ
Multiplayer networking, quest system, spatial audio, GLB model pipeline and pathfinding are designed but not implemented โ see the roadmap on the index and the multiplayer protocol design page. This document describes only code that exists in the repository.