Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 115 additions & 110 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,166 +1,171 @@
# Minecraft-Style Voxel Engine Roadmap
Strictly following **SOLID principles** throughout development:
- **S**ingle Responsibility: Each module and class performs exactly one conceptual job.
- **O**pen/Closed: Systems designed to be extended (new blocks, biomes, UI components) without modification to core logic.
- **L**iskov Substitution: Interfaces and abstract types allow interchangeable implementations (renderers, world generators, block types).
- **I**nterface Segregation: Small, focused interfaces (e.g., `IMeshable`, `IUpdatable`, `IRenderable`, `IChunkSource`) instead of giant ones.
- **D**ependency Inversion: Core engine depends on abstractions, not concrete implementations (e.g., world → IChunkProvider, renderer → IGraphicsBackend).
# OpenGL Engine Roadmap

---

## High-Level Goal
A voxel engine similar to early Minecraft (2009–2010 era), built from scratch using **SDL3 + OpenGL + C++** with chunked voxel rendering, procedural worldgen, greedy meshing, player interaction, inventory, water, trees, and day/night cycle.
This roadmap is derived from The Cherno's OpenGL series and translated into **engine-level milestones**.
Use this as a checklist and progression guide while building your engine.

---

## Phase Roadmap

### **Phase 1 – Engine Foundation**
Goal: Base engine loop and camera movement.
- SDL3 window + GL context setup
- Main loop (input → update → render)
- Depth test + backface culling
- Basic math library (vec3, mat4, perspective, lookAt)
- FPS camera (WASD + mouse look)
- Render a single cube using a VAO/VBO + shader
## Phase 0 — Foundations
**Goal:** Window + context + sanity

**Done when:** You can fly around a cube smoothly in 3D space.
- [x] Window creation abstraction (GLFW / SDL)
- [x] OpenGL context creation (core profile)
- [x] Swap buffers
- [x] VSync enable / disable
- [x] OpenGL loader (GLAD / GLEW)
- [x] Runtime OpenGL version & capability checks

---

### **Phase 2 – Block & Chunk System (Naive Implementation)**
Goal: A block world stored in chunks.
- Block type enum
- Chunk structure (16×256×16 recommended)
- 3D block storage (flat array index or array)
- World grid of chunks
- Naive render: draw cube for every non-air block
## Phase 1 — Modern OpenGL Basics
**Goal:** Draw *something* correctly, the modern way

**Done when:** A visible world of blocks renders and navigation works.
- [x] Core-profile OpenGL only (no fixed pipeline)
- [x] Vertex Buffer (VBO) abstraction
- [ ] Index Buffer (EBO / IBO) abstraction
- [x] Vertex Array Object (VAO) abstraction
- [x] Vertex attribute specification
- [x] Interleaved vertex layouts
- [x] Static vs dynamic buffer usage

---

### **Phase 3 – Visible Face Culling + Chunk Meshes**
Goal: Render only visible faces, not every cube.
- For each block, emit face only if neighbor is air/transparent
- Build **one mesh per chunk**
- Rebuild chunk mesh only after modification
## Phase 2 — Shaders
**Goal:** Full control of the GPU pipeline

**Done when:** High FPS and correct geometry using visible-face logic.
- [x] Shader compilation system
- [x] Shader linking & validation
- [x] Error reporting for shaders
- [x] Shader abstraction class
- [x] Uniform upload API
- [ ] Uniform location caching
- [ ] Shader source hot-reloading
- [ ] Central shader library / registry

---

### **Phase 4 – Greedy Meshing**
Goal: Reduce vertex count by merging similar faces.
- Implement greedy sweep for each face direction
- Transparent blocks meshed separately
- Opaque draw pass + transparent draw pass
## Phase 3 — Error Handling & Debugging
**Goal:** Fail loudly, debug easily

**Done when:** Flat areas (e.g., plains) merge large surfaces into huge quads.
- [ ] OpenGL debug context
- [ ] KHR_debug callback
- [ ] GL call error macros
- [ ] Assertions around GPU calls
- [x] Engine-level logging system

---

### **Phase 5 – Procedural Terrain & World Streaming**
Goal: Infinite terrain generation.
- Perlin or simplex noise heightmap generation
- Basic materials (grass/dirt/stone)
- Chunk streaming based on player position
- Chunk load/unload radius
- Multi-threaded generation (later)
## Phase 4 — Renderer Architecture
**Goal:** Hide OpenGL behind a clean engine API

**Done when:** Terrain generates dynamically as you move.
- [x] Renderer API layer
- [ ] Render command abstraction
- [x] Draw call encapsulation
- [x] Renderer statistics (draw calls, vertices)
- [x] Render state isolation
- [x] Multiple object rendering

---

### **Phase 6 – Day/Night Cycle & Basic Lighting**
Goal: Sun movement and lighting change.
- World time variable
- Directional lighting from sun
- Ambient light curve across day
- Sky gradient or skybox
## Phase 5 — Textures & Materials
**Goal:** Real assets, not hardcoded colors

**Done when:** World visually transitions from day to night.
- [x] Texture loading system
- [x] Texture abstraction class
- [x] Texture parameter configuration
- [x] Texture unit / slot management
- [ ] Multi-texture rendering
- [x] Texture atlases
- [ ] Material system (shader + textures + params)

---

### **Phase 7 – Water Rendering**
Goal: Transparent water blocks.
- Special water block type
- Render after opaques
- Semi-transparent color + slight wave shader
## Phase 6 — Blending & Transparency
**Goal:** UI, sprites, and transparency

**Done when:** Lakes/rivers appear realistic and render correctly.
- [x] Alpha blending
- [x] Blend mode abstraction
- [ ] Premultiplied alpha support
- [ ] Transparent object ordering (basic)

---

### **Phase 8 – Trees & World Decoration**
Goal: Populate terrain.
- Simple tree generator added during chunk generation
- Logs & leaves placement
- Probability-based distribution
## Phase 7 — Math & Transforms
**Goal:** Cameras, movement, real scenes

**Done when:** World feels alive with vegetation.
- [x] Math library (vec2/3/4, mat4)
- [ ] Transform component
- [x] Projection matrices (ortho & perspective)
- [x] View matrices (camera)
- [x] Model matrices
- [x] MVP pipeline
- [x] Camera abstraction
- [x] Frustum culling

---

### **Phase 9 – Player Physics + Block Interaction**
Goal: Walk, jump, break, place blocks.
- AABB collision & physics
- Raycast block targeting
- Destroy block (set AIR & rebuild chunk)
- Place block (from inventory hotbar)
## Phase 8 — Batch Rendering (Performance)
**Goal:** Reduce draw calls, scale scenes

**Done when:** Full creative construction loop works.
- [ ] Batch renderer architecture
- [ ] Batched colored geometry
- [ ] Batched textured geometry
- [x] Texture slot management
- [ ] Dynamic geometry batching
- [x] Draw-call minimisation strategy (frustum culling)

---

### **Phase 10 – Inventory & Hotbar UI**
Goal: Store and manage items.
- Inventory structure
- Block stacks
- Hotbar selection via keys / mouse scroll
- 2D UI overlay
## Phase 9 — Uniform Optimisation
**Goal:** Stop hammering the driver

**Done when:** You can collect blocks and choose what to place.
- [ ] Uniform Buffer Objects (UBOs)
- [ ] Frame-level uniform buffers
- [ ] Per-object vs per-frame separation
- [ ] Persistent mapped buffers (optional)

---

### **Phase 11 – Saving & Loading**
Goal: World persistence.
- Serialize chunk data to disk per chunk
- Load existing chunks before generating
- Save player pos + inventory
- Store seed & metadata
## Phase 10 — Tooling & Engine UX
**Goal:** Developer-friendly engine

**Done when:** World persists across sessions.
- [ ] ImGui integration
- [ ] Debug panels
- [x] Renderer stats overlay
- [ ] Live shader reload toggle
- [x] Runtime render mode toggles (wireframe, etc.)

---

### **Phase 12 – Polish, Tools, Extensibility**
Goal: Improve developer and gameplay experience.
- Debug UI overlay (FPS, mesh stats, chunk borders)
- Config system (FOV, render distance)
- Toggle wireframe/debug visualizations
- Data-driven block definitions
## Phase 11 — Testing Framework
**Goal:** Don't break rendering accidentally

**Done when:** Engine becomes extendable and maintainable.
- [ ] Render test framework
- [ ] Isolated render tests
- [ ] Texture rendering tests
- [ ] Regression test scenes

---

## Final Expected Features
| Feature | Delivered By |
|---------|--------------|
| Chunked voxel rendering | Phase 2–4 |
| Infinite world | Phase 5 |
| Day/night cycle | Phase 6 |
| Water | Phase 7 |
| Trees / world decoration | Phase 8 |
| Block break/place | Phase 9 |
| Inventory | Phase 10 |
| Save/Load | Phase 11 |
| Debug tools & extensibility | Phase 12 |
## Engine v1 "Done" Definition
You can call this a **real engine** when you have:

- [x] Clean renderer API
- [ ] Shader + material system
- [x] Texture & asset loading
- [x] Camera & transform system
- [ ] Batch renderer
- [ ] Debug UI
- [x] Measured performance metrics

---

## Recommended Directory Structure (SOLID-Friendly)
## Optional Future Directions
- Vulkan backend
- Deferred rendering
- ECS integration
- Scene graph
- Asset pipeline
- Editor tooling

---
Loading