#Implementing network

1 messages · Page 1 of 1 (latest)

primal axle
#

the createjoin class is kinda irrelevant looking back i think

#

pls let me know if you can help and if you need more context

heady axle
#

I would suggest using Sessions. It manages the Relay and Lobby connections for you.

primal axle
heady axle
#

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.

primal axle
heady axle
primal axle
heady axle
primal axle
# heady axle 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?

heady axle
#

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

Modify lobby data and properties to reflect changes in game state or session configuration.

Integrate Relay with Netcode for GameObjects using the deprecated standalone Relay SDK.

primal axle
#

@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

heady axle
#

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.

primal axle
# heady axle I think you might have it backwards. The lobby isnt shared through the relay. th...

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.

heady axle
primal axle
heady axle
#

What version of NGO are you using? And are you using the multiplayer services package or the standalone Relay and Lobby packages?

primal axle
#

@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.

heady axle
#

make sure you are using the correct namespaces. You should be following this tutorial and not the one for Relay SDK

primal axle
#

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?

heady axle
primal axle
#

@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

heady axle
primal axle
heady axle
#

You are using MultiplayerService.Instance.JoinSessionByCodeAsync(joinCode)? Make there are not any hidden spaces when you paste it.

primal axle
heady axle
#

ok, CreateOrJoinSessionAsync just takes a session name and not a code.

primal axle
#

i am starting to think maybe this is a problem with the firewall or smth

heady axle
#

maybe.
if you call ⁨await MultiplayerService.Instance.QuerySessionsAsync(queryOptions);⁩ does it return any sessions?

primal axle
heady axle
#

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.

primal axle
#

basicly when i force quit i don t really leave the lobby

#

so it has to wait till no heartbeat hits