[Feature] Add physics backend plugin interface - #15
Closed
miogds wants to merge 1 commit into
Closed
Conversation
Plugin-facing seam for optional physics backends (PR A of the physics plugin readiness plan): PhysicsBackend protocol with value types and threading/batch-transfer contracts, single-slot PhysicsBackendRegistry with validation and runtime lock, ColliderComponent and RigidBodyComponent with cleanup handlers. Nothing invokes the new API yet, so runtime behavior is unchanged.
Member
Author
|
Superseded by upstream untoldengine#1123 (merged as 260b23f with the review-revised layout), which is now in this fork's develop via the upstream sync. |
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
PR A of the physics plugin readiness plan (upstream discussion #1116): the plugin-facing seam for optional physics backends. Nothing invokes the new API yet, so runtime behavior is unchanged by construction.
Sources/UntoldEngine/Physics/PhysicsBackend.swift—PhysicsBackendprotocol with the threading contract (step/drain on the frame thread, backends buffer worker-thread events internally) and batch-only transform transfer, plus all value types:PhysicsCapabilities,PhysicsMotionType,PhysicsColliderShape,PhysicsWorldConfiguration(gravity default(0, -9.8, 0), collision layer matrix, m/kg/s units), body/collider descriptors, write/read transform batches, contact/trigger/activation events,PhysicsEventSink, ray query types. Default no-op implementations so minimal backends only implement what they support.Sources/UntoldEngine/Physics/PhysicsBackendRegistry.swift—PhysicsBackendPlugin+ manifest + validator following the render-extension plugin conventions (namespaced IDs, exact API-version match, backend ID inside plugin namespace); single-slot registry with install/replace/reject semantics, uninstall, failure introspection, and alockForRuntime()seam for engine creation (wired in PR B).ColliderComponentandRigidBodyComponentinComponents.swift, with cleanup handlers inRegistrationSystem.swift(handler IDphysicsBody).Follow-ups per the plan: PR B (default backend wrap +
PhysicsCoordinator+runFrameseam), PR C (event sink + USCOnCollisionwiring), PR D (raycast facade).Test plan
swift test --filter PhysicsBackendRegistryTests— 15/15 passComponentRegistryTest(enforces cleanup handlers for every component inComponents.swift) andECSTestspass