I am currently making a tic tac toe game for my school project, and i am planning on adding a matchmaking system in order to allow 2 devices to play the same game. however, no matter how i tried to fix my
code, it just wont work. please i need help🙏 (ignore the other screens, i am trying to do them on my own thx)
I have some ideas for you on what tag patterns to use in CloudDB, to keep things straight:
that long name for the list of names of people queued up waiting for matches (It returns a list, so the length of list block should tell you how many people are waiting after it arrives)
match names, in the form of Player1_vs_Player2, with value a list of the moves made so far in the match of Player1 vs Player2. So tag ABG_vs_poggers_real might contain the list 1,2,5,9 for the game where X (ABG) played square 1, O (poggers_real) played square 2, ABG played square 5,... (Assume Player1 will always be X)
player names, with lists of the games currently being played by that player, regardless of X or Y: ABG = tag, value = ["ABG_vs_poggers_real", "Karpov_vs_ABG", "ABG_vs_ABG1",...]
So when CloudDb returns a single value, you would check the tag first to see which pattern it matches:
that long fixed text (for the waiting for match player name list)
a match, because it contains a "_vs_" you can use in a text split block to get the player names,
an exact match against the current player name from TinyDB.
Further thoughts on managing that list of player names awaiting a match ...
That list does not need to grow to more than one item, since a player looking for a match either finds it empty, or with a player name at item 1 he can use as his opponent in setting up a match.
So the rule would be to look first, and add to the list only if it is empty.