Skip to content
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

Open
TheYellowArchitect opened this issue Oct 9, 2024 · 4 comments

Comments

@TheYellowArchitect
Copy link
Contributor

In RollbackSynchronizer.process_settings():

# Gather all rollback-aware nodes to simulate during rollbacks
	_nodes = root.find_children("*")
	_nodes.push_front(root)
	_nodes = _nodes.filter(func(it): return NetworkRollback.is_rollback_aware(it))
	_nodes.erase(self)

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)

@albertok
Copy link
Contributor

I imagine it is impossible to synchronize properties outside the root node as Godot's multiplayer is based on the scene tree reference.

@TheYellowArchitect
Copy link
Contributor Author

(for no misunderstanding, the root node I refer to in the OP is the var root: Node inside RollbackSynchronizer.gd, not the root of the scene tree)

@albertok
Copy link
Contributor

@TheYellowArchitect

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.

@TheYellowArchitect
Copy link
Contributor Author

TheYellowArchitect commented Oct 16, 2024

I would like to not destroy and remake the original for 2 reasons.

  1. The node I want to synchronize has a unique ID
  2. Because creating that type of node is expensive for no reason

Or never having that node be in somewhere that can't be permanent would be even better.

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 Item node. To implement this suggestion would be to put an entity ID for who holds it at any moment, and it stays under a permanent WorldItems node, regardless who picks it. Anyway, it causes a lot of code complexity, and is incompatible with my item system which requires the holder to also be its parent. But even such food for thought is helpful for me to think of a problem in more angles, so thanks for the suggestion

SceneReplicationConfig isn't really built for moving NodePaths.

How is netfox related to SceneReplicationConfig?


Having a NodePath property "holder" at the Item would kinda work, but I would have to somehow hook up to its setter and reparent. Its the closest solution I can think of without any changes to netfox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants