Skip to content

Mirror remote components into the inspector's remote world - #26039

Open
jbuehler23 wants to merge 13 commits into
bevyengine:mainfrom
jbuehler23:jackdaw/inspector-remote-components
Open

jbuehler23 wants to merge 13 commits into
bevyengine:mainfrom
jbuehler23:jackdaw/inspector-remote-components

Conversation

@jbuehler23

@jbuehler23 jbuehler23 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #26014. Review the last commit only.

Objective

Part of #23013.

#26014 mirrors remote entities into a separate world but only inserts their names and parents, so selecting a remote entity shows almost nothing. This fills the remote world with real component values so the details panel works the same for a remote app as for the local one.

Solution

Following Zeophlite's idea of treating the remote app as just another world, every component the polls already receive is now inserted into the remote world, as long as inserting it can't do anything besides store the value.

  • the full poll and a fetch of the selected entity both write into the world, values are deserialized off the main thread and only written when they change
  • components that vanish remotely are removed
  • only components without hooks are inserted, since a hook could spawn an entity that takes the index of a later remote entity, or depend on state the remote world doesn't have. Hooks aren't public on ComponentHooks, so each type is probed once on a separate empty world, checking its required components too. ChildOf is the one exception, its hook only builds Children
  • relationship targets like Children are never inserted from JSON, since that detaches every child, they're built from ChildOf instead
  • components with hooks, like PointerId and PointLight, show their raw JSON read-only in the details panel instead
  • each entity records what came from the remote app, so required components that only got added locally stay hidden, components the remote app couldn't serialize get a note, and unregistered types show as raw JSON

Some bevy_ecs changes would make this simpler or more complete. A public accessor on ComponentHooks would replace the probe. A data-only insert that skips hooks and observers, or entity ranges, would let components with hooks be inserted too. And the reserve and set-generation API mentioned in #26014 would replace the allocator workaround.

A follow-up could also replace the raw JSON fallback with typed fields, by fetching the server's type schema (registry.schema) and building dynamic reflected values from it, so types the inspector doesn't know or that have hooks still get proper widgets.

AI disclosure

This builds on Zeophlite's world design from #26014. Before writing any code I had AI research what breaks when you insert arbitrary components into a bare world, which turned up the generation, allocator, PointerId and Children problems, then implement it with a test for each and check it end to end against the server example. I reviewed the design and the changes.

Comment on lines +726 to +727
/// shrinks collections. Other components are inserted. Relationship targets such as `Children`
/// are never written, since the hooks of their relationships build them.

@eugineerd eugineerd Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't read through everything properly so I'm not sure if it's an issue, but something I encountered when experimenting with remote world concept is that if you insert just RelationshipSources you lose ordering present in RelationshipTargets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! The mirror now keeps the server's Children order and sorts the mirrored Children to match after each poll, without running any hooks. It's just Children for now since there's no generic way to reorder other relationship targets

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events D-Complex Quite challenging from either a design or technical perspective. Ask for help! A-Networking Sending data between clients, servers and machines A-Dev-Tools Tools used to debug Bevy applications. S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 6, 2026
@jbuehler23
jbuehler23 force-pushed the jackdaw/inspector-remote-components branch from 70e3a81 to ba29bad Compare October 7, 2026 07:41
@jbuehler23
jbuehler23 force-pushed the jackdaw/inspector-remote-components branch from ba29bad to 270ba03 Compare October 8, 2026 10:31
@jbuehler23
jbuehler23 force-pushed the jackdaw/inspector-remote-components branch from 270ba03 to e9e836e Compare October 8, 2026 13:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Dev-Tools Tools used to debug Bevy applications. A-ECS Entities, components, systems, and events A-Networking Sending data between clients, servers and machines D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants