#i need help getting a basic setup for unity netcode with steamworks working
1 messages · Page 1 of 1 (latest)
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
All socket receive requests were marked as failed, likely because socket itself has failed.
That is usually a firewall issue
no i have firewall turned off so that cant be it also why would go through firewall if i'm using unity multiplayer play mode in the editor
Connecting through steam hits the network. If you can't connect to the Internet then you can't connect to Steam
ok but it still has the same error.
Does steam even let you sign in to 2 accounts on the same PC? I'm not sure MPPM will work with Steamworks.
does this mean when ever i have to debug my game ill have to go to steam and login with two accounts there has to be another way.
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.
just use sandboxie
"sandboxie-plus" works perfectly fine
i have two steam accounts tho but i cant run them at the same time on one computer?
you can with sandboxie, just need to make sure sandboxie installs the steam in its container and then drag your game's exe there
just make sure both accounts are different
this seems like a lot of effort... to use a vm install steam on the vm and login into my second steam account?
ok i will try it out where do i download it?
idk if I can send links, https://sandboxie-plus.com/
also is it portable like does it use an installer
it seems to be just a installer
also wow so many ads
decline them, software itself is ad free
how do i use it sorry if im asking way too many questions
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
i may use sandboxie in the future but for now i'm just gonna use a friends pc.
yeah that will work too, just the sandboxie route overall will be easier to use, as long as steam doesn't make it so that it won't work there
Windows Sandbox is also an option
expensive on the system and it requires you to install steam each time so not feasible at all
i've used it, never again
i am using steamworks rn i can host but i cant join
can i have some help debugging
@hasty sapphire help please.
are you getting an error message on the client? You need to make double sure that the correct steam ID is getting set
no errors where would i check for steam id
Whereever you are setting it for the client transport.
i guess im not setting it then how should i do it
That is how the client knows what to connect to. FacepunchTransport has a public userSteamId that you need to set to the host's steam id
it looks something like this, tho it already gets somewhat complex
You should print out lobby.Owner.Id to make sure that is the correct steam id of the host
there's also lobby corruption you need to account, somewhat sucks to make lobbies with steamworks
It finally works sorry for late reply.
Thx so much.
question? is there any tutorials you would recommend to a beginner for steam lobbies for my game.
I don't use Steamworks, so I can't help there. Steamworks has their developer forums though
do you know any good tutorials
there are some tutorials on youtube, but they are kinda bad
any premade easy to use lobby systems i can modify i just need my game to have the bare bones for multiplayer rn.
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...
make sure the facepunch is up to date, do not use the runtime that comes with facepunch transport
i think i watched that video and he doesn't explain much.
also where would i check for that?
The Facepunch website/github
https://github.com/Facepunch/Facepunch.Steamworks/releases
here is the latest release
The wiki also has some helpful snippets
https://wiki.facepunch.com/steamworks/Installing_For_Unity
so do i just drag and drop the all files in that folder in my project?
Yes, just extract the Facepunch.Steamworks zip file into a folder called Plugins
I really think that would help a lot of people because I thought the hardest part would be building code around multiplayer but rn the hardest thing is just getting it setup.
should i create a folder inside asset with the name "Steamworks" and inside that "Runtime" with the Facepunch.Steamworks.2.4.1 inside
Yes, create a new folder called Plugins
If you want to. Not needed though
ok so i created a folder called plugins and extracted the Facepunch.Steamworks.2.4.1 inside and now its screaming errors
What errors? And you'll need to remove the Runtime that came with Facepunch Transport
thx. but now i have another error i cant use steam matchmaking i think error CS0433: The type 'Lobby' exists in both 'Facepunch.Steamworks.Posix, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Facepunch.Steamworks.Win32, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Codemonkey is a good start i think. If english would be my main language the tutorials are like gold mine for me. And tutorials about networking with netcode in youtube are limited. You have to watch whatever you find
i followed the video and by part 2 i realized that it doesn't actually setup a lobby system like how i wanted i was just host and join instead of seeing a list of available lobbies.
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...
I think I'll try making a video tutorial this weekend so something is out there that's not a few years old
make sure that tutorial uses connection approval, but a lot of them are without which is imo the worst thing to do
Do you really need ticket validation with P2P lobbies? But I guess its easy enough to add
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
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?
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 💀
i need some help for some reason when i try to spawn a button for every lobby it works for a couple seconds but without any data like names or anything and then itll start throwing errors like Object Refernce Not Set To Object Instance and for some reason theres like 50 lobbys?!
querying too many lobbies?
maybe how would i check?
Are you still using the space war app id?
yes! i don't have my own because my project is way to early to pay up 100$
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
well if it is a bunch of other people's lobby why are they all nameless and unjoinable?
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
what do you think?
there is, thats what the facepunch docs is for
but then why do none of them have names? or why can't i join them?
btw this is the line giving me errors "foreach (Lobby lobby in lobbies)"
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;
}
}
}
it used to only show one but now it shows like 50 i dont know what changed.
That's weird. Should be a max of 7. I'll install it this evening and see what I come up with
I’m saying how many there are without the filter.
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
i fully understand that but what i don't understand is A. why all of them have lobby.Owner.Name as null B. why before it only had 1?
btw i know destroying all the buttons and spawning them back is a bad idea so is there somewhere where it updates only when there's a new one please tell me.
I don't know how much info Steam gives you from a lobby query. You might a have to get that data from the lobby individually after you query them
It's perfectly fine to destroy and recreate those buttons as long as its not happening every frame.
it's happening every frame... it's because i want to have the lobby list update as soon as it can.
oh don't do that. I'm surprised there is not a rate limit for Queries.
weirdly when normally selecting something thats being destroyed and recreated every frame it normally has weird selection issues but not with mine for some reason? its like its not actually being destroyed every frame.
even weirder is that for the first 15 seconds it appears to have to large list of random lobbies and then they all disappear i have not yet been able to test whether it'll now only show my lobbies or not.
It has no way of knowing which lobbies are yours. That is what the app it is for. There is WithKeyValue() you could use to filter
what does key value mean like can i have all my lobbys use a certain key value and filter it like that if so how?
Looks like there is a lobby.SetData() function you can use
THX so much that fixed it!
hey can i have some help with having each player have there own bool. i need it for the lobby system.
you mean a network list of player data?
Lobby.SetMemberData()
https://wiki.facepunch.com/steamworks/Data.Lobby.SetMemberData
Sets per-user metadata (for the local user implicitly)
If you are already connected to the host then you can use a NetworkVariable bool
i still have that thing where none of the lobbies have name and i cant join them?
you're using 480 ID steam id meaning you will never find the lobby you made and those lobbies will remain without name as those lobbies use their own custom data to read and write lobby names
for now just connect to the lobby using the generated lobby id which you copy paste to your clipboard
Lobbies do not have names by default.
sorry i'm doing lobby.owner.name as the lobby name
man, steamworks is kind of a mess. Looks like you can't get much lobby info from a lobby you haven't joined
https://github.com/Facepunch/Facepunch.Steamworks/issues/238
Well I do know you can get the id without joining.
not only that, you literally need to "nuke" the lobby else players could join a corrupt lobby
i fixed joining the lobby. any tips when starting with voicechat?
i use dissonance, and I don’t think building one from ground up is a smart idea
ok... i will use dissonance in the future but for now what would be a good way to start i am trying to use this guys script
https://discussions.unity.com/t/example-voicechat-with-unet-and-steamworks/670554/49
also can you guide me through the steps of using sandboxie because setting it up with my friend every time just for me to find a new bug is painfull.
btw thx so much for your help i wouldn't be able to make this without you.
i think chatgpt can help there too with a simple guide, like 90% of the things there you do not use
sorry im anti-AI.
i was sceptical on buying a £80 asset but i found out that if a join unitys mailing list i can get 25% off any asset!
you can always use sales to get up to 50% off on most assets
Vivox is good for voice chat as well. But that's getting off topic
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;
}
}
}
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); });
}
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
could you guide me through using sandboxie? like how to load steam in it and run my game etc.
Thx so much that worked! sry for the late reply.
Nothing special than just drag and drop icons into the field, it just asks which box to use, you can use the default one and done
so when i start the game the client doesn't load the right scene?
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];
}
}
}
any idea why my players aren't spawing for the client also i checked and it doesn't even spawn the host now?!
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.
how would i fix server-authoritative player movement being laggy?
i really want my game to be server-authoritative but the lag for the clients is unbearable.
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
That is whole other topic and there is no easy fix for it. But yea, you'll want to look up client prediction. NGO has Client Anticipation but its a bit tricky to use if you also use physics to move
Client anticipation is only relevant for games using a client-server topology.
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
I'm not sure how much help you can get for Unreal on the Unity server.
Umm yeah but maybe there is some crazy developer who is good at both can help (i am living in delusional world again)
i'm trying to make a quit function that works for clients and hosts, for hosts it needs to also load every other player out.
NetworkManager.Singleton.SceneManager.LoadScene("Lobby Scene", LoadSceneMode.Single);
LobbySaver.instance.currentLobby?.Leave();
LobbySaver.instance.currentLobby = null;
NetworkManager.Singleton.Shutdown();
You would just need the host to call NetworkManager Shutdown() then in either OnClientDisconnectCallback or OnConnectionEvent you can call your lobby.Leave() function
how would i stop another networkmanager spawning when going back to the main menu?
What I do is have a empty bootstrap scene with just a network manager or other init scripts like for steam or UGS log in then automatically load the main menu.
ahh... that was in that tutorial metioned further up. ok ill do that then.
ok. i'm having trouble setting a network objects ownership and i don't know why i've tried using ServerRpc i've tried to only set the owner if it's the host etc. but i always get the error only host can set ownership?
This should probably be separate thread, but make sure the RPC is on a network behavior and the network object is spawned
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.
you can not send a gameobject in an RPC. It will need to be a NetworkObjectReference
Brief explanation on using NetworkObject and NetworkBehaviour in Network for GameObjects
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
__________...
Check out the ClientDriven bitesized sample
Learn more about Client driven movements, networked physics, spawning vs statically placed objects, object reparenting
hey i'm getting so close to it working but for some reason even tho i'm the owner of the object i cannot set it to kinematic?
If you are using the latest version of NGO, then there is a checkbox for automatically setting kinematic on the Network Rigidbody
Yea. you would either have to remove the network rigidbody from the prefab or uncheck that box I mentioned
THX SO much i turned the auto kinematic state off and that worked!
ugghh i am so bad at this multiplayer stuff i can't even set the local position of the object back to zero?!
if you changed ownership then the new owner will have to change the local position
Do you know when it’s next on sale? I would really think that it would be on sale in summer.
If you are looking for voice chat, I would give Vivox a look.
Does it work with steamworks?
Sure. they are separate services that don't interact at all
I forgot there is also Steam Voice you can use.
Here is some code for it if you are using Facepunch
https://github.com/Facepunch/Facepunch.Steamworks/issues/261
yeah i'm using facepunch.
is there a clientRPC that ignores the owner?
You can use [Rpc(SendTo.NotMe)]