mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
200 lines
5.0 KiB
Markdown
200 lines
5.0 KiB
Markdown
# Quick Reference: MetaBuilder Game Engine
|
|
|
|
## Latest Work (Session 30)
|
|
|
|
**Just Completed**:
|
|
- ✅ 27 new atomic workflow steps
|
|
- ✅ 4 services converted (Audio, Input, Graphics, Scene)
|
|
- ✅ 1 dead service deleted (SelectionStateService)
|
|
- ✅ All code committed and verified
|
|
|
|
**Latest Commits**:
|
|
```
|
|
72520f42c - docs: Session 30 summary
|
|
0ff57a22b - chore: Delete SelectionStateService
|
|
cc2a594b0 - feat: Convert Audio, Input, Graphics, Scene services
|
|
5d8441515 - feat: Implement graphics init workflow steps
|
|
```
|
|
|
|
## Build Commands
|
|
|
|
```bash
|
|
cd /Users/rmac/Documents/metabuilder/gameengine
|
|
|
|
# Build main app
|
|
cmake --build build/Release --target sdl3_app
|
|
|
|
# Run with default game (seed)
|
|
./build/Release/sdl3_app --bootstrap bootstrap_mac --game seed
|
|
|
|
# Run with specific game
|
|
./build/Release/sdl3_app --bootstrap bootstrap_mac --game standalone_cubes
|
|
|
|
# Run with tracing
|
|
./build/Release/sdl3_app --bootstrap bootstrap_mac --game seed --trace
|
|
```
|
|
|
|
## Available Workflow Steps (75+)
|
|
|
|
### Graphics (10 steps)
|
|
- graphics.bgfx.init_viewport
|
|
- graphics.bgfx.init_renderer
|
|
- graphics.bgfx.init
|
|
- graphics.shader.load
|
|
- graphics.buffer.create_vertex
|
|
- graphics.buffer.create_index
|
|
- graphics.frame.begin
|
|
- graphics.frame.end
|
|
- graphics.draw.submit
|
|
- graphics.screenshot.request
|
|
|
|
### Input (5 steps)
|
|
- input.key.pressed
|
|
- input.mouse.position
|
|
- input.mouse.button.pressed
|
|
- input.gamepad.axis
|
|
- input.gamepad.button.pressed
|
|
|
|
### Audio (7 steps)
|
|
- audio.play
|
|
- audio.pause
|
|
- audio.resume
|
|
- audio.seek
|
|
- audio.set_volume
|
|
- audio.stop
|
|
- audio.set_looping
|
|
|
|
### Scene (4+ steps)
|
|
- scene.create
|
|
- scene.add_geometry
|
|
- scene.remove_geometry
|
|
- scene.get_bounds
|
|
- scene.load
|
|
- scene.clear
|
|
- scene.update
|
|
|
|
### Plus 40+ more in:
|
|
- Camera (teleport, look_at, build_view_state, set_fov, set_pose)
|
|
- Math (add, subtract, multiply, divide, min, max, abs, round, clamp)
|
|
- String (concat, split, join, upper, lower, trim, replace, equals, contains)
|
|
- Logic (and, or, not, if/then/else, compare)
|
|
- Collections (append, count, filter, map, reduce)
|
|
- Validation (checkpoint, png validation)
|
|
- And many more...
|
|
|
|
## Architecture
|
|
|
|
**95% Data-Driven**:
|
|
- JSON workflows orchestrate all core systems
|
|
- Minimal C++ service code (only integration layer)
|
|
- Each step: ~50-100 LOC, testable in isolation
|
|
- Dynamic step registration via plugin IDs
|
|
|
|
**Zero Monolithic Services**:
|
|
- Graphics: Complete pipeline via 10 workflow steps
|
|
- Input: Full event handling via 5 steps
|
|
- Audio: Complete playback control via 7 steps
|
|
- Scene: Full 3D management via 4+ steps
|
|
|
|
## Key Files
|
|
|
|
**Workflow Definitions**:
|
|
```
|
|
/gameengine/packages/*/workflows/*.json
|
|
- bootstrap_mac/workflows/
|
|
- standalone_cubes/workflows/graphics_init_atomic.json
|
|
- seed/workflows/demo_gameplay.json
|
|
```
|
|
|
|
**Workflow Step Implementations**:
|
|
```
|
|
/gameengine/src/services/impl/workflow/
|
|
- graphics/ (10 graphics steps)
|
|
- workflow_generic_steps/ (5 input + 4 audio steps)
|
|
- scene/ (4 scene steps)
|
|
- frame/ (40+ frame/game steps)
|
|
- workflow_*_step_registrar*.cpp (step discovery)
|
|
```
|
|
|
|
**Main Entry Point**:
|
|
```
|
|
/gameengine/src/main.cpp
|
|
```
|
|
|
|
## Recent Fixes
|
|
|
|
1. **Red background issue** (Fixed Feb 11)
|
|
- Removed hardcoded color in bgfx initialization
|
|
- User confirmed: "pink and flashing thing" renders correctly
|
|
|
|
2. **Validation tour disabled** (Feb 11)
|
|
- Was forcing test checkpoints in gameplay
|
|
- Removed from demo_gameplay.json
|
|
|
|
3. **Dead code cleanup** (Feb 11)
|
|
- SelectionStateService deleted (136 LOC)
|
|
- No impact on functionality (was orphaned)
|
|
|
|
## Next Steps (If Continuing)
|
|
|
|
**High Priority** (2-3 hours each):
|
|
1. Shader validation steps (120 LOC)
|
|
2. Render coordination steps (80 LOC)
|
|
3. Diagnostics steps (100 LOC)
|
|
|
|
**Medium Priority**:
|
|
4. GUI parametric drawing steps (90 LOC)
|
|
|
|
**Result**: Complete atomic conversion of all non-infrastructure services
|
|
|
|
## Testing
|
|
|
|
**Manual Test**:
|
|
```bash
|
|
./build/Release/sdl3_app --bootstrap bootstrap_mac --game standalone_cubes
|
|
# Should see: Pink/orange color, cube animation, window updates
|
|
# Expected: 52 FPS rendering
|
|
```
|
|
|
|
**Unit Tests**:
|
|
```bash
|
|
# Audio step tests exist (369 LOC)
|
|
# Located in: gameengine/tests/unit/workflow/test_audio_*.cpp
|
|
```
|
|
|
|
## Performance Notes
|
|
|
|
- **Build time**: ~2 minutes (full rebuild)
|
|
- **Binary size**: 36MB (arm64)
|
|
- **Frame rate**: 52 FPS (verified on metal)
|
|
- **Memory**: Efficient (atomic-based spy thread ~3-5ns overhead)
|
|
|
|
## Git Server
|
|
|
|
**Local Setup**: Hospital bedroom
|
|
- Repository size: 8.1GB
|
|
- All commits locally safe
|
|
- No network dependencies
|
|
- Full version history: 60+ commits
|
|
|
|
## Architecture Philosophy
|
|
|
|
**95% Data, 5% Code**:
|
|
- Configuration: JSON workflows
|
|
- Business logic: JSON variable flows
|
|
- Infrastructure: C++ (only 5% of code)
|
|
- Composition: JSON orchestration of atomic steps
|
|
|
|
**One Responsibility Per Step**:
|
|
- Each workflow step does ONE thing
|
|
- Testable in isolation
|
|
- Reusable across workflows
|
|
- Composable into complex behaviors
|
|
|
|
---
|
|
|
|
**Last Updated**: Feb 11, 2026 (Session 30)
|
|
**Status**: Production-ready architecture, 95% data-driven
|
|
**Git**: All work committed and verified locally
|
|
|