Migrates existing GDD and engine design notes from HacknPlan into a new Obsidian vault. This establishes a centralized, version-controlled knowledge base covering engine architecture, game constraints, design decisions, and open questions.
1.9 KiB
1.9 KiB
tags
| tags | ||
|---|---|---|
|
Scenes and ECS
Scene stack
SceneStacksupports push, pop and replace.- Each scene declares
blocksUpdateandblocksRender.- A pause menu or card-reward overlay on top of Combat blocks Combat's update but not its render.
- Scene callbacks:
OnEnter,OnExit,Update(dt),FixedUpdate(dt),Render(renderer, alpha). - Scenes receive an
EngineContext&; nothing is global.
Game-side scenes (examples, not engine code): MainMenu, RunMap, Combat, Shop, Reward.
World (ECS)
- One
World(anentt::registrywrapper) per scene. Leaving a combat throws its whole world away, which is simpler than cleaning up individual entities. - Run state is not ECS data. Deck, relics, gold and map are plain C++ owned by the game and persist across scenes.
Engine components
| Component | Purpose |
|---|---|
Transform3D |
vec3 position, quat rotation, vec3 scale (render space) |
PrevTransform |
for interpolation, see Main Loop and Time |
MeshRenderer |
model and material handles |
Animator |
rigid clip playback, see Rigid-Part Animation |
Tweened |
active tweens on this entity |
Gameplay components (Health, Tower, LaneFollower, Targeting, StatusEffects, …) live in Game/.
[!note] Sim position vs render transform Gameplay systems write a 2D ground-plane position. A sync step turns it into the
Transform3Drender transform (adding height, facing and bobbing). The simulation never readsTransform3D.
Events
- A queued bus wraps
entt::dispatcherand flushes at the end of each fixed step. - Deck-builders stack triggers ("when an enemy dies, draw 1"). Queueing gives a defined resolution order and stops handlers from mutating the world while a system is iterating it.
- The engine provides the bus; the game defines the event types and the trigger and effect resolution.
Related: Scripting (hooks fire from events)