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

P2P #11

Closed
RoxDevvv opened this issue Sep 17, 2023 · 12 comments
Closed

P2P #11

RoxDevvv opened this issue Sep 17, 2023 · 12 comments

Comments

@RoxDevvv
Copy link

when do you think we will have p2p
thank you for the great work

@3ddelano
Copy link
Owner

Current project is on hold as I am occupied with other things. It would be nice if we have new contributors otherwise I will continue to work on in in 1-2months.

@RoxDevvv
Copy link
Author

Is godot have network transport layer if so could you give me link of example, i will try to write it

@Roceh
Copy link

Roceh commented Sep 17, 2023

I was looking at this myself, I think you have to inherit from PacketPeer for the transport layer and MultiplayerPeer for connection creation/management.

https://github.com/godotengine/godot/blob/4df80b0e629e25653a706f6721c13a1f9d1da368/modules/enet/enet_packet_peer.h
https://github.com/godotengine/godot/blob/4df80b0e629e25653a706f6721c13a1f9d1da368/modules/enet/enet_multiplayer_peer.h

Best guess would be to look at the enet stuff and try to rework that I think.

You then set the active multiplayer peer with multiplayer.set_multiplayer_peer in GDScript.

@3ddelano
Copy link
Owner

Oh this looks promising. What I had in mind was to not use any Godot specific network but rather directly implement the P2P interface given by EOS. Is there any pros or cons of using either method?

@Roceh
Copy link

Roceh commented Sep 17, 2023

Well i think you have to map the EOS P2P layer onto the godot PacketPeer and MultiplayerPeer classes, basically create eos_packet_peer.cpp/h & eos_multiplayer_peer.cpp/h. Then the higher level godot multiplayer stuff works normally as I understand it. If you look at PacketPeer it has virtual functions get_packet and put_packet which would need to be mapped to EOS P2P calls to receive and send packets over EOS.

@Roceh
Copy link

Roceh commented Sep 17, 2023

I was just showing the enet one as an example of how godot uses the base class internally for the default transport. Basically it would end up something being like that but using EOS instead of ENET.

@3ddelano
Copy link
Owner

Doing it this way will it support Godot's networking functions like rpc, rpc_id, etc

@Roceh
Copy link

Roceh commented Sep 17, 2023

Yes thats my understanding.

e.g. once you implemented those two classes, you would write something like this in GDScript

# Create client.
var peer = EOSMultiplayerPeer.new()
peer.create_client(EOS_REMOTE_PLAYER_ID)
multiplayer.multiplayer_peer = peer

# Create server.
var peer = EOSMultiplayerPeer.new()
peer.create_server()
multiplayer.multiplayer_peer = peer

and then all the other multiplayer stuff @rpc, etc would just "work".

Obviously you have all the EOS lobby stuff first which the clients get the host socket id from.

@RoxDevvv
Copy link
Author

Doing it this way will it support Godot's networking functions like rpc, rpc_id, etc

yes that is the purpose of the transport layer

this some examples of transport layers EOS made for unity
FIshNet : https://github.com/ETdoFresh/FishyEOS
Mirror: https://github.com/FakeByte/EpicOnlineTransport

@LowFire
Copy link
Contributor

LowFire commented Oct 22, 2023

I forked the repo and am currently working on implementing the p2p interface. My fork is here: https://github.com/LowFire/epic-online-services-godot

I've made some pretty good progress so far. Still trying to work some things out and am writing unit and integration tests for it.

@3ddelano
Copy link
Owner

Thanks for the contribution! Hoping to see great progress.

@3ddelano
Copy link
Owner

3ddelano commented Dec 5, 2023

Closing since merged #13

@3ddelano 3ddelano closed this as completed Dec 5, 2023
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

4 participants