Hi,
To start with (I a m happy to have this policy )
we have a “no stupid questions policy” so feel free to ask the community for help.
My questions are :
//-------------------------------------------------
1. if my game require 4 player and a player is matchmaked but did not join. 3 players joined the match already. I assume they have to wait for him. but while waiting the loop_match is executing and players are able to sendMessages (I tested it )
- My current solution is to make if stalemate at the start of the match_loop
if state.game.allPlayersJoined == true then
// do stuff here
end
and state.game.allPlayersJoined will be true only if 4 players joined the match … then I will start. Is this approach is correct and the smartest one?
//-------------------------------------------------
2. According to question 1 what if the 4th player did not want to joint at all. How to bring another player to the match (make it available on matchmaking) ? How much time the 4th player have as a chance to join?
docs (matchmaker tokens)
Tokens are short-lived and must be used to join a match as soon as possible. When a token expires it can no longer be used or refreshed.
//-------------------------------------------------
3. for match_join (context, dispatcher, tick, state, presences)
I am concerned about presences, this means more than one presence (duh from the s ), also from docs …
presences —> (table) —> Presences is a list of users that have joined the match.
but I notice that when I print all the presence
for _, presence in ipairs(presences) do
print …
end
It always only print one presence at a time (I tried to join a simple game from two devices to test this)
So is it possible that you will get more than one presence and when???
//----------------------------------------------------
4. for the match_leave(context, dispatcher, tick, state, presences)
from doc is says
– Executed when one or more users have left the match for any reason including connection loss.
So In my case I want to make leave button on the game —> if player clicked it then he will lose
but I don’t want to make him leave (lose the game) if the game is closed or get a call or lost connection . Any ideas how to distinguish between scenarios?
And how the player can resume to that game?
//----------------------------------------------------