-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronizing properties of nodes which aren't under the root node #298
Comments
I imagine it is impossible to synchronize properties outside the root node as Godot's multiplayer is based on the scene tree reference. |
(for no misunderstanding, the root node I refer to in the OP is the |
Reparenting is probably best done by making a copy and destroying the original. Or never having that node be in somewhere that can't be permanent would be even better. SceneReplicationConfig isn't really built for moving NodePaths. There's stuff like RemoteTransform3D which might make influencing nodes that arent children easier also. |
I would like to not destroy and remake the original for 2 reasons.
That is an interesting idea actually. It doesn't fit my case unless I do some hacks, but to expand on it: I have an
How is netfox related to Having a |
Sorry I meant MultiplayerAPI object configurations. Basically because netfox is using rpcs and those rpcs are bound to SceneTree/NodePaths moving stuff is really hard. You'd need everyone to move the node at exactly the same tick which is crazy hard to synchronize. Add rollback to the mix and the complexity is just not worth it. I think you're on the right track with switching to a possession variable and items living in their own space. Much easier to rollback too :) |
Requiring rollback with reparenting is not a rare use-case, see moving platforms: #223 |
You're assuming reparenting is the solution ;) Reparenting is impractical when using the high level api. |
no high level api should completely change how I design my game. I need to reparent - a basic godot functionality - and don't want any hacks. If The solution would vaguely be some new variables to The above is only "impractical" because |
It's not a netfox thing, the high level api wasn't built with reparenting support. and fair enough. It's an anchor point for messaging, not a moving target. If you want to reparent something it can't have any rpcs in it. If they do decide to support it they'll likely just copy and kill the node behind the scenes. Also do you really want to be handling rollback reparenting scenarios? reparent, Go back 4 ticks, reparent to where it was, roll forward, reparent again. |
This single phrase destroys the design of Godot's netcoding architecture. You couldn't have highlighted the problem with high level api better. I now understand fully what you meant when you said
Yes, but in the end of the day looks like I will not be doing that at all, since items won't work with rollback 😅 |
Once you reparent one of those nodes, you break this atomic unit. So unfortunately there's no plans to support this with the current design. That does not necessarily mean that you can't do items with rollback though! Without knowing the specifics of your use case, I'd separate your item functionality based on what needs to be reparented and what doesn't. From there, you can have an item holder variable as suggested by @albertok, and whenever that changes, you can reparent the parts / nodes that need to be reparented ( I assume this includes some visuals? ). IIRC you can synchronize NodePath values as-is, so you wouldn't need to mess around with serialization. But even as a fall-back, you can write getters and setters to do the serialization, and then you can just use the backing variable in your code. This way, you can have your RPCs and rollback, with reparenting. The compromise is splitting the item logic into multiple nodes. |
Something came to mind recently during another conversation. We could add a RemoteState node, similar to RemoteTransform3D. You could configure certain properties and a target node, so that those properties are proxied to and from the target node. This way, you can sync the state of the RemoteState node, and you could reparent the target node as you'd like, as long as the RemoteState node doesn't move around the scene tree. For now this is just an idea and I'll need to check if we can properly intercept set and get calls for arbitrary properties. Regardless, how does this sound @TheYellowArchitect? |
Closing as stale. Feel free to open a feature request for the RemoteState node if needed! |
I apologize for not replying to the above earlier. Anyway, I will experiment with what is exactly required and whether |
In
RollbackSynchronizer.process_settings()
:This seems like nodes outside root cannot be synchronized.
Is it impossible to synchronize properties outside a root node? Is there some temporary workaround with
NodePath
properties?For my use-case, I want to synchronize a node which changes parents (brawler to world, and world to brawler)
The text was updated successfully, but these errors were encountered: