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

[3.x] Add NetworkedMultiplayerCustom so high-level multiplayer backends can be added from GDScript #63163

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Jul 18, 2022

This is a proposed 3.x implementation for godotengine/godot-proposals#4873

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.

Really nice work 🏅 🏆 .
See my notes to clarify the method and signal.
I think this is really nice to have in 3.x and adds the functionality in a very self-contained way.
I think it should also be renamed to NetworkedMultiplayerCustom for clarity, but that's not so important given in 3.x every multiplayer peer has a different convention :)

core/io/multiplayer_peer_custom.cpp Outdated Show resolved Hide resolved
core/io/multiplayer_peer_custom.cpp Outdated Show resolved Hide resolved
doc/classes/MultiplayerPeerCustom.xml Outdated Show resolved Hide resolved
doc/classes/MultiplayerPeerCustom.xml Outdated Show resolved Hide resolved
@dsnopek dsnopek force-pushed the multiplayer-peer-custom-3.x branch from c393507 to ac05c9d Compare July 19, 2022 13:32
@dsnopek
Copy link
Contributor Author

dsnopek commented Jul 19, 2022

@Faless Thanks for the review! :-) I've updated the PR per all your notes. Please let me know if there's anything else!

@dsnopek dsnopek changed the title [3.x] Add MultiplayerPeerCustom so high-level multiplayer backends can be added from GDScript [3.x] Add NetworkedMultiplayerCustom so high-level multiplayer backends can be added from GDScript Jul 19, 2022
@dsnopek dsnopek force-pushed the multiplayer-peer-custom-3.x branch from ac05c9d to 2339707 Compare July 19, 2022 13:54
@dsnopek dsnopek requested a review from Faless July 19, 2022 14:00
@dsnopek dsnopek force-pushed the multiplayer-peer-custom-3.x branch from 2339707 to 8ad5889 Compare July 19, 2022 14:16
@dsnopek
Copy link
Contributor Author

dsnopek commented Jul 19, 2022

For some reason, changing the name from MultiplayerPeerCustom to NetworkedMultiplayerCustom led to the property defaults changing (per --doctool) for a whole bunch of child classes in the docs XML. I think it was previously using the property defaults from MultilplayerPeerGDNative for NetworkedMultiplayerPeer and it switch to using the defaults from NetworkedMultiplayerCustom - perhaps this is an alphabetical ordering thing?

Anyway, none of the defaults actually changed, it's just representing them differently in the XML, where previously some child classes were marked as "overridding" the parent's default, now match the parent, and vice versa for other child classes.

Hopefully, this is OK! Please let me know if you think it's worth putting some ADD_PROPERTY_DEFAULT() macros in NetworkedMultiplayerPeer::_bind_methods() to keep the docs XML the way it was before and I can do that.

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.

Looks really good 🥇 , thanks!

I think this could go in for 3.5 or the first point release since it's completely self contained, just pinging @akien-mga and @Calinou about the doc change but I think it's just the ordering as dsnopek mentioned.

@akien-mga akien-mga merged commit 4ef99b4 into godotengine:3.x Jul 20, 2022
@akien-mga
Copy link
Member

Thanks!

if (p_connection_status == ConnectionStatus::CONNECTION_CONNECTING && connection_status == ConnectionStatus::CONNECTION_DISCONNECTED) {
connection_status = p_connection_status;
}
// Can only go to connected, if we are connecting.

Choose a reason for hiding this comment

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

I was playing around with this today and got hung up on this bit. An error message or some actual documentation on this restriction would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've created a new PR adding those: #63628

@jarommadsen
Copy link

jarommadsen commented Jul 29, 2022

Btw, this is a very cool class and I'm very excited about it. I've got Discord's Game SDK working with it and want to try EOS with it next. I loved that I was able to take my existing code that used the NetworkedMultiplayerEnet peer and fairly easily add support for a 3rd party API. I haven't even taken out the ENet code yet so they're both working well in tandem which is just so rad!

I have some more commentary to offer on the implementation/documentation. Would you prefer I just comment on the existing PR's or create some myself?

@dsnopek
Copy link
Contributor Author

dsnopek commented Jul 29, 2022

@jarommadsen That sounds awesome! Please feel free to open your own PRs and ping me - that'd be great :-)

jarommadsen added a commit to jarommadsen/godot that referenced this pull request Jul 29, 2022
…n to guide usage

Some suggestions based on the new `NetworkedMultiplayerCustom` class introduced in godotengine#63163.

@dsnopek I've made some suggestions to the docs based on what would have helped me through my first time. This in conjunction with godotengine#63628 and your new additions in godotengine#63637 should help new users understand what's going on without having to dig through the source code.

I'd also like some help improving the `deliver_packet` method docs since I haven't gotten around to really digging through how that gets propagated. I assume the `from_peer_id` is meant to be the unique network id the sender of that packet was initialized with? And am I correct in assuming the `target_id`/`target_peer` is what it uses to deliver it the right place locally? I think some further documentation here would be helpful to know how to use `set_target_peer` in conjunction with this.
@dsnopek dsnopek deleted the multiplayer-peer-custom-3.x branch July 22, 2024 15:23
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.

5 participants