You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 383d525
Browse filesBrowse the repository at this point in the historyBrowse files
Add a remote source to the inspector entity tree (#26014)
# Objective
Part of #23013.
The inspector can only look at the world it runs in. To inspect a
running game from a separate app, it needs to read another world over
the Bevy Remote Protocol.
# Solution
Remote entities live in their own `World`, the `RemoteWorld`, spawned at
their remote ids. This is @Zeophlite design and it replaces the proxy
entities and id map from earlier revisions. The entity tree and details
panel just read whichever world `world_to_inspect` hands them, so no
local hook, observer or system ever sees remote data.
- polls read `Name`, `ChildOf` and the label defining components, and a
fuller poll with `has` runs when unseen entities show up and every 10
seconds, so internal entities like observers and systems stay hidden
- only `Name` and `ChildOf` are inserted for now, a child whose parent
isn't mirrored yet shows as a root until the parent appears
- polls run off the main thread with one in flight at a time, and the
tree only resyncs when something changed
- the remote world is rebuilt on reconnect, on source change, on a
failed connection, and when a remote id goes back a generation, which
means the remote app restarted
- selecting a remote entity shows only its name and hierarchy for now,
component values come in the follow-up PR
`World::spawn_at` only accepts an index's current generation and there's
no public way to set one, so `spawn_at_remote_id` steps the generation
up by spawning and despawning without freeing, and reserves every index
up to the remote one so the allocator never hands those out. A small
`bevy_ecs` follow-up adding a public way to move an unspawned index to a
given generation, and to reserve an index in the allocator, would let us
replace that function with a single call.
# AI disclosure
This is the first part of the remote inspection that already works in
Jackdaw. I had AI rebuild it on top of what has merged since, review it
for edge cases and run it end to end against the server example, then
went through the changes myself. The biggest change from the original is
that remote components are no longer inserted into the local world.
After review, this moved to Zeophlite's separate world design, which AI
reworked from his WIP branch, tested end to end against the server
example, and I reviewed.
# Showcase
https://github.com/user-attachments/assets/396987b0-a9b6-4bbe-b28e-e1d79d92c959
---------
Co-authored-by: Daniel Skates <zeophlite@gmail.com>
0 commit comments