Whenever I use matchmaker for an authoritative match, the match turns out to be not authoritative. It appears the lua register_matchmaker_matched is not even running because the logs aren’t logging.
Using Nakama Docker Compose and Godot 4 SDK
Using Lua for server framework
func start_matchmaking_async(data):
if not _socket:
await connect_to_server_async()
leave()
var min_players = 2
var max_players = 4
if data.has('min_count'):
data['min_count'] = max(min_players, data['min_count'])
else:
data['min_count'] = min_players
if data.has('max_count'):
data['max_count'] = min(max_players, data['max_count'])
else:
data['max_count'] = max_players
var result = await _socket.add_matchmaker_async("*", data['min_count'], data['max_count'], {}, {})
if result.is_exception():
leave()
else:
_matchmaker_ticket = result.ticket
return result.ticket
local nk = require("nakama")
local function makematch(context, matched_users)
-- print matched users
for _, user in ipairs(matched_users) do
local presence = user.presence
nk.logger_info(("Matched user '%s' named '%s'"):format(presence.user_id, presence.username))
for k, v in pairs(user.properties) do
nk.logger_info(("Matched on '%s' value '%s'"):format(k, v))
end
end
local modulename = "Game"
local setupstate = {
invited = matched_users
}
local matchid = nk.match_create(modulename, setupstate)
return matchid
end
nk.register_matchmaker_matched(makematch)