i have been trying to implement it but i can t get connection to work. like i might join from a client into the host and no updates in between them. after a while they get these errors which are in this text doc. here are the main scripts i use please help 😄
#Implementing network
1 messages · Page 1 of 1 (latest)
the createjoin class is kinda irrelevant looking back i think
pls let me know if you can help and if you need more context
i considered it but it doesn t really fit what i am going for. like the pros of it don t effect anything i want here. idk maybe i add it later but right now i can t even get the basic hosting to work which is breaking my head
What you need to do is have the host create a Lobby then create a Relay. Save the Relay Join Code in the Lobby Data. Clients can then see the Lobby and Relay code when they join the Lobby.
Sessions do exactly that for you.
well can t i not do it without sessions? i wanna learn the workflow more in depth a bit. it might be a weird aproach but i think i learn better that way.
sure. What I posted there is the workflow.
well thats the exact workflow i have followed but still it doesn t work
Where are you saving the Relay join code to the Lobby Data?
i made this code like 4 days ago i am not sure. maybe i don t but watching a tutorial with a similar setup he had the lobby correctly placed. i don t really wanna have to return to the old git commit and reemplement this from the start i am really drained from the implementation. can you see if the code is beyond repair or something?
all code can be repaired. First, you need to make sure that the relay is getting created and the host is properly started. Second, the host has to add the relay join code to the lobby that it created.
The clients will need to search for a lobby to join then they can get the relay code from the lobby data and join the relay
@heady axle it seems now that the lobby isn t shared . like it seems to be a relay issue where the lobby just doesn t exist for the client to find even with the correct code being given
I think you might have it backwards. The lobby isnt shared through the relay. the Relay code is shared through the lobby. Before the client can connect to the relay, it needs to search for the lobby to join.
the client finds the lobby and joins but the host doesn t seem to communicate with it. here is a good diagnosis copilot made for me.
The client is connecting to Relay and starting as a Netcode client, but the host never receives a connection event for the client.
The client’s UI is updating based on its own local state, not from a synchronized NetworkVariable or host event.
The host’s connectedPlayerCount remains 1 (itself), and never increments.
Copilot don't know squat about Netcode. If the client is connecting to the relay then the host will receive the connection event. You'll need to make sure that the host has created the relay properly. If the host is not in the relay then clients won't be able to join
as werird as it sounds that is what happening. the code gets flaged as real. like i get joined on the client. like the code gets accepted. but the host doesn t see it.
Is it just the event that the host isn't seeing? Are you seeing the client spawn a player object?
What version of NGO are you using? And are you using the multiplayer services package or the standalone Relay and Lobby packages?
@heady axle theses packages. when i host it in the hosts scene there is a spawn of the default network object but when you join there isn t.
make sure you are using the correct namespaces. You should be following this tutorial and not the one for Relay SDK
pretty sure thats the one i am using
i don t know if i am asking for too much but can you take a look at the code if i send it to you?
No time for code review. I'm running a global game jam site in about 2 hours. I still suggest you reconsider using Sessions, it is literally 2 lines of code to get this working
@heady axle changed to sessions but now i can t really join. like it doesn t find the lobby with the code. its like no connection is happening
You don't have to find the lobby anymore. The session code is what you use. Or you can use MultiplayerService.Instance.CreateOrJoinSessionAsync() with the same session id on both client and host
there is the code made by sessions which i paste on the client side. pasting it and using it to join doesn t work tho.
You are using MultiplayerService.Instance.JoinSessionByCodeAsync(joinCode)? Make there are not any hidden spaces when you paste it.
CreateOrJoinSessionAsync which is the same thing basicly. and yeea i check for white spaces.
ok, CreateOrJoinSessionAsync just takes a session name and not a code.
i changed it back to JoinSessionByCodeAsync and still the exact same issue. it doesn t find the lobby
i am starting to think maybe this is a problem with the firewall or smth
maybe.
if you call await MultiplayerService.Instance.QuerySessionsAsync(queryOptions); does it return any sessions?
i figured it out. i was using parrelSync and it had the same auth id. pretty stupid bug. anyway now i have another issue. if i am in a lobby and force quit the game and then reopen it and try to create a lobby because i never left the other one i get rate limited. is there a way to destroy the other one in this example? maybe when reopen search if my id has an open session?
You should also try using Multiplayer Play Mode.
You'll need to make sure you are changing the authentication profile when you first initialize Unity Services. It shouldn't rate limit then.
The session should close automatically when no players are left in it. There might be like a 10 sec timeout period for reconnections.
well the period is a bit more which means that if i create lobby force quit and then run again and go to create i get rate limited.
basicly when i force quit i don t really leave the lobby
so it has to wait till no heartbeat hits