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

Create SteamMultiplayerPeer.cs #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brogan89
Copy link

@brogan89 brogan89 commented Jul 6, 2024

Solves #20

C# wrapper created to work along side of https://github.com/LauraWebdev/GodotSteam_CSharpBindings

Note: I was able to test test with Bomber Demo but only create a host. Blocked by #9 not being able to test on different machine as I only have a mac to test that with. I can't see it not working as all the wrapper does is calls the GDScript instance of the class. So if that works then this wrapper should work™️ .

@scriptsengineer
Copy link
Member

scriptsengineer commented Jul 6, 2024

I can test it, as soon as I test that it works on win/unix I approve!
Thanks for the pr 🥇

@craethke
Copy link

Related issue: #22

I tried this out, it seems the GetPacketScript and PutPacketScript should be mapped to get_packet and put_packet, respectively, as get_packet_script and put_packet_script do not exist in the underlying class.

I haven't gotten it fully working yet, as the client app crashes a few seconds after calling peer.CreateClient.

I also noticed the below methods were not mapped, which are handy to map between steam IDs and peer IDs:

    public ulong GetSteam64FromPeerId(int peerId) {
        return _classReference.Call(Methods.GetSteam64FromPeerId, peerId).AsUInt64();
    }

    public int GetPeerIdFromSteam64(ulong steamId) {
        return _classReference.Call(Methods.GetPeerIdFromSteam64, steamId).AsInt32();
    }

    // ...

    private static class Methods
    {
        public static readonly StringName GetSteam64FromPeerId = new("get_steam64_from_peer_id");
        public static readonly StringName GetPeerIdFromSteam64 = new("get_peer_id_from_steam64");
        // ...
    }

@realcoloride
Copy link

Hey there are there any news about this

@craethke
Copy link

craethke commented Oct 1, 2024

@realcoloride I believe there are still some issues with the way C# interacts with this plugin; as a workaround I threw together a C# port, which has been working for me: https://github.com/craethke/steam-multiplayer-peer-csharp

@CDVoidwalker
Copy link

Is there any work on this in progress @brogan89 ?

@brogan89
Copy link
Author

brogan89 commented Oct 9, 2024

Is there any work on this in progress @brogan89 ?

Well, it's blocked by #9. If you're not targeting MacOS then it's ready to use now.
I'm no longer working on it as I ended up making my own custom networking stack so I didn't get blocked by Godot's ENet.
But it's there for anyone to continue on with.

@brogan89
Copy link
Author

brogan89 commented Oct 9, 2024

Related issue: #22

I tried this out, it seems the GetPacketScript and PutPacketScript should be mapped to get_packet and put_packet, respectively, as get_packet_script and put_packet_script do not exist in the underlying class.

I haven't gotten it fully working yet, as the client app crashes a few seconds after calling peer.CreateClient.

I also noticed the below methods were not mapped, which are handy to map between steam IDs and peer IDs:

    public ulong GetSteam64FromPeerId(int peerId) {
        return _classReference.Call(Methods.GetSteam64FromPeerId, peerId).AsUInt64();
    }

    public int GetPeerIdFromSteam64(ulong steamId) {
        return _classReference.Call(Methods.GetPeerIdFromSteam64, steamId).AsInt32();
    }

    // ...

    private static class Methods
    {
        public static readonly StringName GetSteam64FromPeerId = new("get_steam64_from_peer_id");
        public static readonly StringName GetPeerIdFromSteam64 = new("get_peer_id_from_steam64");
        // ...
    }

Hey, that's cool. You can add those methods to this PR if you want.

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

Successfully merging this pull request may close these issues.

5 participants