Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
446 stars 164 forks source link

[Feature Request] Steam P2P through Facepunch.Steamworks #58

Closed Floris0106 closed 3 years ago

Floris0106 commented 3 years ago

I would like to have the option to use Facepunch for interfacing with steam and for networking. It should be quite easy as the only difference between this and the already existing steamp2ptransport is the backend layer. Also, Facepunch is a much more user friendly interface for steam in my experience.

LukeStampfli commented 3 years ago

Contributions for adding a Facepunch steam transport are welcome. We don't have the resources to develop this ourselves.

nico1207 commented 3 years ago

I made a Steam P2P transport using Facepunch.Steamworks for a project. It also uses Steam Networking Sockets instead of the deprecated P2P API.

https://gist.github.com/nico1207/e232f6d3e19dfcb3272fe716cd320eab

So far it has worked very well, but maybe someone should clean up the code before publishing it. (Roundtrip Time is also not implemented currently, Steam tracks it internally, there might be a way to retrieve it)

Floris0106 commented 3 years ago

I have looked at your code and tested it, and it works like a charm. I have since refactored it significantly and implemented the things that were still missing from your script, except for the rtt. May i have your permission to submit it as a pull request? You will of course be credited.

nico1207 commented 3 years ago

Of course! I would also like to use your refactored version, so go ahead! 😄

Floris0106 commented 3 years ago

I submitted a pull request for the transport. This was my first time, and the first time it didn't pass the CLA check. I fixed my mistake so the request is now valid.

WaGi-Coding commented 3 years ago

Idk it does not work well. The simple HelloWorld project with request move won't work. I tested with a build on 2 different PCs & Steam accounts. Targetsteamid is set to the steam account i use on the PC where i host from.

It does connect tho, the host can see the newly spawned player (but it's on 0,0,0 rather than the initial random spawn from the helloworld project) And the client won't see any player at all. Also when requesting a new position from the client, it does nothing on the host either. So basically it only spawns the playerprefab on the host, everything else does not work as expected. Idk if i do something wrong. Just wanted to test it with the HelloWorld project which works fine with the default network transport.

Floris0106 commented 3 years ago

I am aware that there are some issues with the transport, and I'm planning on doing a full rewrite, but i'm waiting on the next version of the netcode package. However this issue is for the transport to be added to this repository, and so you should open a new issue instead.