How can i setup basic server sided code for allowing players to join the map?
i have implemented the client side Matchmaking by referencing Matchmaker, but how do i do the server sided setup so that the player can join the map when the matchmaker find them a match
Hey @SnappierSoap318 keep in mind that you don’t need to write any server-side code to do matchmaking and join the resulting match.
I’d get it working without using our server-side hooks first just to become familiar with the basic flow.
Since you already have the matchmaker call, you’ll want to listen to implement onMatchmakerMatched
in the NRtClientListenerInterface
and inside the implementation call rtClient->joinMatch
using the match ID passed to the call.
If you do decide to add custom server-side logic, take a look at the server runtime hooks: Function Reference - Nakama server
so @lugehorsam, on the client side, i have written the rtClient->joinMatch
but when it recieves the matchID, what does it do next, like does the joinMatch
method automatically change the level from UI to playstate? or should we implement that on the client side?
Also how does the Matchmaker know which server to allocate in order to connect the clients which are placed in a match together?
@SnappierSoap318 you will need to implement that on the client side. You use the matchId to send match data between the clients.
In terms of which server to allocate, this isn’t something you need to worry about if you are using Heroic Cloud. If you are running the server locally, this also isn’t an issue since only one node is running.
@lugehorsam, I need to replicate data through nakama instead of the Unreal Subsystem?
@SnappierSoap318 like any server, any data you want to persist across devices needs to go through Nakama.
@lugehorsam, We have already finished replication through UE and have a headless server setup. We can connect to it through the open <ip-address>
command. So when I join through that command, I see all the other players replicated, so how will I do the same thing through namaka?
@SnappierSoap318 take a look at the Nakama console on port 7351, sign in and you’ll see an option to view all players that have authenticated with Nakama, as well as a variety of other information.
@lugehorsam, Yes, I can see that, but I don’t need that information. what i want to know is
- I have written all the client side code for joining, matchmaking, creating etc. but how does the player actually join a server(ie through ip? or auto executing a command?)
- how does the server( headless UE) know which players to accept when a match is created
- How does nakama know what server to connect to? ( How do we add the headless a server node to Nakama so that the matchmaker can assign the servers?)
- Do we need to do the replication through Nakama or through UE’s internal system?