Byterockers' Games
started a topic on Mon, 21 September 2015 at 7:50 AM
In our game, players create their own maps, which then will be played by other players (on player breaks into the base of another player). For that we need the possibility to find other players depending on their stats.
On our test server (simple PHP server with a mySQL database) we used the following approach:
1) Find another player which did not get selected for the longest time (smallest last_target_fetch time):
$query = "SELECT `id`, `name`, `map`, `cash` FROM data WHERE `hash` != '$id' AND `map` IS NOT NULL ORDER BY `last_target_fetch` LIMIT 1";
2) Set this time value to the current time, so when the query before is called again, another player will be found:
$query = "UPDATE data SET `last_target_fetch` = NOW() WHERE `id` = '$row->id';";
Is there a way to make queries similar like that with PlayFab?
The only approach I found in the PlayFab documentary would be with the help of leader boards. So I would create a leader board for a value like "last broke in time", the leader board will do the ordering so that I can get the first (or last) player, resets its time value and then present its data to the current player.
Is this a proper approach? How fast these leader boards got updated? Is there a more direct way to access, search and filter the data in PlayFab?
In future, we also need to be able to group users, i.e. only find maps of other users which have the same level like the current player. My approach for that would be to create a leader board for the "last broke in time" for each level (i.e. by using a prefix). Therefor it would nice to also delete user stats, so that they do not show up in every leader board.