#i need help getting a basic setup for unity netcode with steamworks working

1 messages · Page 1 of 1 (latest)

wind lion
#

i have gotten it working with unity transport but not steamworks ok.

also i have facepunch for unity netcode installed.

hasty sapphire
#

What error are you getting? You should only need to set the correct host steam id in the Facepunch Transport that you get from the steam lobby

wind lion
#

All socket receive requests were marked as failed, likely because socket itself has failed.

hasty sapphire
#

That is usually a firewall issue

wind lion
hasty sapphire
#

Connecting through steam hits the network. If you can't connect to the Internet then you can't connect to Steam

wind lion
hasty sapphire
#

Does steam even let you sign in to 2 accounts on the same PC? I'm not sure MPPM will work with Steamworks.

wind lion
hasty sapphire
#

I don't use Steamworks but from what I've seen, the general advice is use a separate PC(or VM) when you need to test steam transport. And just stick with Unity Transport for tesing everything else.

dreamy granite
#

"sandboxie-plus" works perfectly fine

wind lion
dreamy granite
#

just make sure both accounts are different

wind lion
dreamy granite
#

sandboxie is not a vm

#

very small software tool

wind lion
dreamy granite
wind lion
#

also is it portable like does it use an installer

dreamy granite
#

it seems to be just a installer

wind lion
#

also wow so many ads

dreamy granite
#

decline them, software itself is ad free

wind lion
dreamy granite
#

first lets use the default box it offers, in that you drag the steam either shortcut or the exe in and make sure you give it admin perms, else steam won't be able to correctly setup in that box

#

everything can be dragged inside here, it will just ask which box to use and if it should start it as an admin

wind lion
dreamy granite
hasty sapphire
dreamy granite
#

i've used it, never again

wind lion
wind lion
#

@hasty sapphire help please.

hasty sapphire
wind lion
hasty sapphire
wind lion
hasty sapphire
dreamy granite
hasty sapphire
#

You should print out lobby.Owner.Id to make sure that is the correct steam id of the host

dreamy granite
#

there's also lobby corruption you need to account, somewhat sucks to make lobbies with steamworks

wind lion
#

Thx so much.

wind lion
hasty sapphire
#

I don't use Steamworks, so I can't help there. Steamworks has their developer forums though

dreamy granite
wind lion
dreamy granite
#

i have not seen any made, i even thought about making one myself that could be used as a base to easily get started

#

https://www.youtube.com/watch?v=kBgnIJUfQak
maybe this video helps to get started

In this video I will walk you through the setup and implementation of Facepunch.steamworks for Unity. By the end of this video you will be able to start a lobby using steam and open up Netcode for Gameobjects as a host. I forgot to mention in the video that you can have friends connect at this point, however only the debug logs will indicate for...

▶ Play video
#

make sure the facepunch is up to date, do not use the runtime that comes with facepunch transport

wind lion
#

i think i watched that video and he doesn't explain much.

wind lion
hasty sapphire
#

The Facepunch website/github

dreamy granite
hasty sapphire
#

The wiki also has some helpful snippets
https://wiki.facepunch.com/steamworks/Installing_For_Unity

wind lion
hasty sapphire
wind lion
wind lion
hasty sapphire
#

Yes, create a new folder called Plugins

hasty sapphire
wind lion
hasty sapphire
#

What errors? And you'll need to remove the Runtime that came with Facepunch Transport

wind lion
brazen ore
wind lion
dreamy granite
#

https://www.youtube.com/watch?v=ZQdjyGmWD5I&list=PLLEXBFkEF1apJhUHaYpKmqNviZ7rY3iep&index=3

this one should be much better, but I still recommend reading the docs and doing it yourself

⭐️ This video will show you how to host and join your own steam lobbies where you'll be able to join and invite your friends

Note: Check our previous video to figure out which steam ID to use for your game
https://www.youtube.com/watch?v=YW_abp_vgcU

Part 1 : https://www.youtube.com/watch?v=gVJd973D7us

🎥 Arabic Channel: https://www.you...

▶ Play video
hasty sapphire
#

I think I'll try making a video tutorial this weekend so something is out there that's not a few years old

dreamy granite
hasty sapphire
#

Do you really need ticket validation with P2P lobbies? But I guess its easy enough to add

dreamy granite
#

without I don't think there's a good way to ban/kick exploiters out of lobbies, it also makes handling user data much easier, like setting payloads

hasty sapphire
#

I can understand using it for a dedicated server. I just worry about sending access tokens to other clients. CAn you even use SteamServer over a Relay?

dreamy granite
#

that i don't know, as I've only done connection approval with P2P, just without connection approval imo you cannot send that easily connection data idk like your "character's skin, xp, steamid and name"

like you can send data via RPCs, but that would be extra work, and still don't forget exploiters you kicked from the lobby, they can join, then you need some custom logic to kick them out again

#

not to mention good luck mapping steamId to client Id without it 💀

wind lion
dreamy granite
wind lion
hasty sapphire
wind lion
hasty sapphire
#

So is everyone else. There are likely thousands of lobbies out there at any time. There should be a way to limit the number of lobbies in your query

wind lion
hasty sapphire
#

Who knows. Could be not set up correctly. Dunno if names are assigned automatically or not. The lobbies could be full. Could just be folks screwing around making lobbies for one player max

#

There should also be a way to filter lobbies with open slots available

wind lion
dreamy granite
wind lion
wind lion
# dreamy granite

btw this is the line giving me errors "foreach (Lobby lobby in lobbies)"

hasty sapphire
wind lion
# hasty sapphire Post your code so we can see what's up

here's a little snippet

public async void ListLobbies()
    {
        Lobby[] lobbies = await SteamMatchmaking.LobbyList.WithSlotsAvailable(1).WithMaxResults(7).RequestAsync();

        foreach (Transform child in LobbyHolder.transform)
        {
            Destroy(child.gameObject);
        }
        
        foreach (Lobby lobby in lobbies)
        {
            GameObject button = Instantiate(LobbyButton, LobbyHolder.transform);
            // button.transform.SetParent(LobbyHolder.transform);
            button.GetComponentInChildren<TextMeshProUGUI>().text = lobby.Id.ToString();// lobby.Owner.Name + "'s Lobby";
            button.GetComponentInChildren<Button>().onClick.AddListener(delegate { JoinLobby(lobby.Id); });
        }
    }

    public async void JoinLobby(ulong LobbyID)
    {
        Lobby[] lobbies = await SteamMatchmaking.LobbyList.WithSlotsAvailable(1).RequestAsync();

        foreach (Lobby lobby in lobbies)
        {
            if (lobby.Id == LobbyID)
            {
                await lobby.Join();
                return;
            }
        }
    }
wind lion
hasty sapphire
#

That's weird. Should be a max of 7. I'll install it this evening and see what I come up with

wind lion
hasty sapphire
#

oh, 50 might be the default max if its not otherwise specified. There would be way more than 50 space war lobbies active at any given time

wind lion
wind lion
hasty sapphire
wind lion
hasty sapphire
wind lion
wind lion
hasty sapphire
wind lion
hasty sapphire
wind lion
wind lion
dreamy granite
hasty sapphire
#

If you are already connected to the host then you can use a NetworkVariable bool

wind lion
dreamy granite
#

for now just connect to the lobby using the generated lobby id which you copy paste to your clipboard

hasty sapphire
#

Lobbies do not have names by default.

wind lion
hasty sapphire
wind lion
dreamy granite
wind lion
dreamy granite
wind lion
wind lion
wind lion
dreamy granite
wind lion
dreamy granite
#

you can always use sales to get up to 50% off on most assets

hasty sapphire
#

Vivox is good for voice chat as well. But that's getting off topic

wind lion
# dreamy granite i think chatgpt can help there too with a simple guide, like 90% of the things t...

hey for some reason my code to join a lobby which i attach to a script doesn't work?

button.GetComponentInChildren<Button>().onClick.AddListener(() => { JoinLobby(lobby.Id); });

    public async void JoinLobby(ulong LobbyID)
    {
        Lobby[] lobbies = await SteamMatchmaking.LobbyList.WithSlotsAvailable(0).WithKeyValue("Uber Gamer Key", "Value Thingy").RequestAsync();

        foreach (Lobby lobby in lobbies)
        {
            if (lobby.Id == LobbyID) // LobbyID
            {
                await lobby.Join();
                return;
            }
        }
    }
hasty sapphire
wind lion
# hasty sapphire Why are you querying the lobby if you already have the lobby id?

if your asking how the lobby list works here's how

foreach (Lobby lobby in lobbies)
        {
            GameObject button = Instantiate(LobbyButton, LobbyHolder.transform);
       
            button.GetComponentInChildren<TextMeshProUGUI>().text = lobby.Owner.Name.ToString() + "'s Lobby";
            
            button.GetComponentInChildren<Button>().onClick.AddListener(() => { JoinLobby(lobby.Id); });
            
        }
hasty sapphire
#

You don't need the JoinLobby() function there at all. All it needs to do is call lobby.Join(). You are looping through the lobbies again for no reason

wind lion
wind lion
dreamy granite
wind lion
hasty sapphire
wind lion
# hasty sapphire The client will load whatever scene the host is in when it connects.

ok. i got the scene loading but with my player spawner it only spawns the host?

public override void OnNetworkSpawn()
    {
        NetworkManager.Singleton.SceneManager.OnLoadEventCompleted += SceneLoaded;
    }

    private void SceneLoaded(string sceneName, LoadSceneMode loadSceneMode, List<ulong> clientsCompleted, List<ulong> clientsTimedOut)
    {
        if (sceneName == "Gameplay") // IsHost && 
        {
            foreach (ulong id in clientsCompleted)
            {
                GameObject player = Instantiate(Player);
                player.GetComponent<NetworkObject>().SpawnAsPlayerObject(id, true);
             
                player.transform.position = SpawnPoints[(int)id];
            }
        }
    }
wind lion
hasty sapphire
#

It's probably a timing issue. If the host is loading the scene by itself, then OnLoadEventCompleted has already been called by the time OnNetworkSpawn() runs. I don't know if it gets called again after each client joins.

wind lion
wind lion
dreamy granite
#

client side prediction, also reduce the amount of traffic on the server, most things can be calculated on the client like rotation of hand using positional data etc

hasty sapphire
opal mango
#

Is anyone familiar with steam OSS in unreal Engine 5 I tried creating multiplayer logic with the steam advanced sessions plugin and I almost created it successfully but when I tried it with my friend using the steam's dev app id we can invite each other and join each other but we aren't actually going into each other's sessions if anyone knows the fix please lemme help would be appreciated

hasty sapphire
opal mango
wind lion
hasty sapphire
#

You would just need the host to call NetworkManager Shutdown() then in either OnClientDisconnectCallback or OnConnectionEvent you can call your lobby.Leave() function

wind lion
hasty sapphire
wind lion
wind lion
hasty sapphire
wind lion
# hasty sapphire This should probably be separate thread, but make sure the RPC is on a network b...

but

[ServerRpc]
public void SetOwnerServerRpc(GameObject obj)
{
    obj.GetComponent<NetworkObject>().ChangeOwnership(GetComponent<NetworkObject>().OwnerClientId);
}
``` doesn't work for me? it just says Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: error  - SetOwnerServerRpc - Don't know how to deserialize UnityEngine.GameObject. RPC parameter types must either implement INetworkSerializeByMemcpy or INetworkSerializable. If this type is external and you are sure its memory layout makes it serializable by memcpy, you can replace UnityEngine.GameObject with ForceNetworkSerializeByMemcpy`1<UnityEngine.GameObject>, or you can create extension methods for FastBufferReader.ReadValueSafe(this FastBufferReader, out UnityEngine.GameObject) and FastBufferWriter.WriteValueSafe(this FastBufferWriter, in UnityEngine.GameObject) to define serialization for this type.
hasty sapphire
wind lion
# hasty sapphire you can not send a gameobject in an RPC. It will need to be a [NetworkObjectRefe...

ok that worked but i'm trying out this video on picking up and dropping its meant for fishnet but i don't know how to alter it to work with netcode: https://www.youtube.com/watch?v=HC8BPjZDXaA

[ServerRpc(RequireOwnership = false)]
    void GrabObjServerRpc(GameObject obj, Vector3 Pos, Quaternion Rot, GameObject player)
    {
        GrabObjClientRpc(obj, Pos, Rot, player);
    }
    [ClientRpc]
    void GrabObjClientRpc(GameObject obj, Vector3 Pos, Quaternion Rot, GameObject player)
    {
        obj.transform.position = Pos;
        obj.transform.rotation = Rot;
        obj.transform.SetParent(player.transform);

        obj.GetComponent<Rigidbody>().isKinematic = true;
    }
``` also i'm sorry if im bombarding you with questions but unity netcode is really undocumented. (or i'm just bad at finding the solution)

This is an addition to the short series where I explain you how to setup a FishNet multiplayer project in Unity. In this video we are taking a closer look at how pickup, carry and drop objects in a multiplayer game setup with Unity FishNet in Unity.


Scripts used in the video:
PlayerPickup.cs: https://pastebin.com/ABAMUf0X
__________...

▶ Play video
hasty sapphire
wind lion
hasty sapphire
#

Yea. you would either have to remove the network rigidbody from the prefab or uncheck that box I mentioned

wind lion
wind lion
hasty sapphire
wind lion
hasty sapphire
wind lion
hasty sapphire
#

Sure. they are separate services that don't interact at all

#

I forgot there is also Steam Voice you can use.

wind lion
hasty sapphire