How andyessomba/afrocraft works
AfroCraft is a browser-based Three.js voxel game. The main runtime initializes a generated world and its chunk meshes, then runs the playable experience: movement and block interaction against that world, with interface and day/night state. Procedural terrain, rendering, and player physics form distinct internal layers. The README also describes three biomes, block placement and breaking, and day/night progression. Some visual subsystems are indexed but their runtime wiring is not visible in the excerpts, so those links are marked unverified.
Main entry points: main.js Game entry · World.js Voxel world · WorldGenerator.js World generation · Interaction.js Block interaction
Components 19
Game runtime
- Game entry
src/main.js - Day-night cycle
src/environment/DayNightCycle.js
World and terrain
- World generation
src/generation/WorldGenerator.js - Biome map
src/generation/biomes.js - Seeded noise
src/generation/noise.js - Voxel world
src/world/World.js - Chunk storage
src/world/Chunk.js - Block definitions
src/world/blocks.js
Player and interaction
- Player movement
src/player/Player.js - Collision physics
src/player/Physics.js - Block interaction
src/interaction/Interaction.js - Pointer lock
src/interaction/PointerLock.js
Rendering and ambience
- Chunk renderer
src/rendering/ChunkRenderer.js - Block materials
src/rendering/materials.js - Player model
src/rendering/PlayerModel.js - Block effects
src/effects/Effects.js - World ambience
src/environment/Ambience.js
Game interface
- Game interface
src/ui
Other components
- Player
Connections 23
- Player → Game entry: starts game
README.md - Game entry → World generation: generates world
src/main.js - World generation → Biome map: uses biome map
src/generation/WorldGenerator.js - World generation → Seeded noise: samples noise
src/generation/WorldGenerator.js - Biome map → Seeded noise: uses noise
src/generation/biomes.js - World generation → Voxel world: writes terrain
src/generation/WorldGenerator.js - Game entry → Voxel world: creates world
src/main.js - Voxel world → Chunk storage: stores blocks
src/world/World.js - Game entry → Chunk renderer: builds meshes
src/main.js - Chunk renderer → Voxel world: reads chunks
src/rendering/ChunkRenderer.js - Chunk renderer → Block materials: creates materials
src/rendering/ChunkRenderer.js - Game entry → Player movement: creates player
src/main.js - Player movement → Collision physics: resolves movement
src/player/Player.js - Collision physics → Voxel world: checks collisions
src/player/Physics.js - Game entry → Block interaction: wires interaction
src/main.js - Block interaction → Voxel world: reads and edits
src/interaction/Interaction.js - Block interaction → Player movement: checks overlap
src/interaction/Interaction.js - Game entry → Pointer lock: wires pointer lock
src/main.js - Game entry → Game interface: wires interface
src/main.js - Game entry → Day-night cycle: creates cycle
src/main.js - Game entry → Block effects: may initialize effects
src/main.js - Game entry → World ambience: may initialize ambience
src/main.js - Game entry → Player model: may initialize model
src/main.js