ADR-011: GameObject attachment hierarchy (parent/child transforms) - #24
Merged
Merged
Conversation
Proposes a runtime attach/detach capability (e.g. a sword following the player's hand) that ADR-001 explicitly scoped away from gameplay, deferring it until there was a concrete need. Compares four approaches (per-script copying, reviving ADR-001's rejected unified SceneNode, an optional Parent+LocalOffset on GameObject resolved by a small system, and Box2D joints) against Game Coding Complete's 3D scene-graph pattern adapted to 2D, and recommends the Parent+LocalOffset approach as additive and backward compatible with the existing flat Transform.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proposes
docs/adr/ADR_011_gameobject_attachment_hierarchy.md: a runtime attach/detachcapability for GameObjects — e.g. a sword
GameObjectattached to (and later detached from) theplayer, following its position/rotation automatically. This is the "scene graph" capability
raised in conversation: does the engine support parent/child transform hierarchies for gameplay
objects, and how does that compare to Game Coding Complete's treatment of the same idea.
What it found and proposes
object.Transformis flat/world-space only(no parent field), and
object.Managerholds a flat slice. This was actually already decidedonce — ADR-001 explicitly scoped parent/child to UI only, not gameplay, deferring it
"until there is a concrete need." (Notably, even UI's optional hierarchy was never built —
view/ui.Containeris still a flat list.)SceneNodetree is the sameidea — a child's world transform is derived from its parent's every frame, which is exactly
how the book attaches a weapon to a character's hand/bone node with zero code in the weapon.
The book's 4×4 matrix stack is 3D/DirectX-specific; the ADR shows the 2D equivalent needs only
what
vec2.Vector.Rotatealready provides — no new math type required.rejected unified SceneNode to cover gameplay too (Approach 2), an optional
ParentID+LocalOffsetonGameObjectresolved by a small system each frame (Approach 3,recommended), and Box2D joints for physically-simulated attachment (Approach 4, additive
for later).
majority, are entirely unaffected), reuses the existing
vec2package, composes with thePrototype/
spawnEntityspawning pattern already established (ADR-007/PR Propose game-architecture skill (Game Coding Complete patterns) #23'sgame-architectureskill), and mirrors the existingPhysicsSystem.SyncToWorldprecedent ofan external system overwriting
Transformafter another system runs.event API,
Clone()semantics for a parent with attached children, cycle/depth guarding)rather than pre-deciding them.
No engine or game code changes — this PR only adds the ADR document, per this project's own
convention: "When making a significant architectural decision, create a new ADR" (
CLAUDE.md).Generated by Claude Code