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

Add root_node as property of MultiplayerAPI #40136

Merged
merged 1 commit into from
Nov 27, 2020

Conversation

Jummit
Copy link
Contributor

@Jummit Jummit commented Jul 5, 2020

Exposes MultiplayerAPI.root_node as a property instead of only providing the setter MultiplayerAPI.set_root_node().
If this is merged, can this be cherry picked to 3.2 as well, as it's pretty important for custom multiplayer?

@Jummit Jummit requested a review from a team as a code owner July 5, 2020 14:18
@Calinou Calinou added cherrypick:3.x Considered for cherry-picking into a future 3.x release enhancement topic:network labels Jul 5, 2020
@Calinou Calinou added this to the 4.0 milestone Jul 5, 2020
@akien-mga akien-mga requested a review from Faless July 6, 2020 06:44
@Faless
Copy link
Collaborator

Faless commented Jul 13, 2020

Is this really needed? This is a very advanced feature, do we really need the property? I'm worried it might confuse beginners and don't really give any advantage to advanced user. To be clear, I'm not against it, but I don't really see much usage for it.

@Jummit
Copy link
Contributor Author

Jummit commented Jul 13, 2020

Is this really needed? This is a very advanced feature, do we really need the property? I'm worried it might confuse beginners and don't really give any advantage to advanced user. To be clear, I'm not against it, but I don't really see much usage for it.

It's necessary when working with local networking, here is an example:

remote func spawn_scene(scene : String, at_path : String):
  # this works, but not with a custom root node
  get_node(at_path).add_child(load(scene).instance())

  # this works with a custom root node
  multiplayer.root_node.get_node(at_path).add_child(load(scene).instance())

func _on_Button_pressed():
  rpc("spawn_scene", "res://Bullet.tscn", multiplayer.root_node.get_path_to(bullets_node))

... don't really give any advantage to advanced user

To make it clear: The example I showed is currently impossible, there are no workarounds.

Also, I'd find a property more intuitive than a setter, but that's just my opinion.

@Jummit
Copy link
Contributor Author

Jummit commented Oct 9, 2020

Maybe RPCs should use a path local to the root node, then custom multiplayer would be a lot easier and this problem would be solved.

@Jummit
Copy link
Contributor Author

Jummit commented Nov 27, 2020

This is still desired. I have an addon that depends on this that has 13 Stars, so there are people who would benefit from it.

@Faless
Copy link
Collaborator

Faless commented Nov 27, 2020

Maybe RPCs should use a path local to the root node, then custom multiplayer would be a lot easier and this problem would be solved.

To be clear, RPCs does send the path relative to the root node.

Copy link
Collaborator

@Faless Faless left a comment

Choose a reason for hiding this comment

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

This is fine for me, it just exposes an extra getter. So no reason to hold this.
Let's hope people don't get confused by it.

@Faless Faless merged commit 828d1ea into godotengine:master Nov 27, 2020
@Jummit
Copy link
Contributor Author

Jummit commented Nov 27, 2020

Maybe RPCs should use a path local to the root node, then custom multiplayer would be a lot easier and this problem would be solved.

To be clear, RPCs does send the path relative to the root node.

That's awesome! Should be documented somewhere.

@akien-mga
Copy link
Member

Cherry-picked for 3.2.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants