question

Juris Zebnickis avatar image
Juris Zebnickis asked

Designing a solution for one-sided asynchronous PVP

Hey guys.

I am working on a session based game where a player is supposed to be able to 'attack a random player'.

Each player has a level that they can make in the game and this is saved in the internal player data. So far so good.

Each player progresses through the game and gains levels. So players can be segmented by levels. This is fine too.

So, when an another player 'attacks', they should be able to find another player of the same level (does not matter if they are online or not), and get the level they have and load it in their game. Then when they complete it, they 'steal' currency from this player.

This starts being not so straight-forward.

I cannot use matchmaking feature because this requires the other player to be online to accept the session ticket.

I cannot use segmentation in my cloudscript query, because I cannot control how often this would happen to the server and would probably not get handled all too well if say I have 1000 players online and a 100 of them decided to roll for attack.

I cannot just roll for a random player as this does not exist and would probably be even less effective than the segment requests.

The current solution I have is a 'pool' of key value pairs containing the level and ID of the players that have created a level in the internal title data, from which I then roll and find one that corresponds with the level tier, then get the level from that player.

This has an issue that at one point the title data will just become too small to hold all players and so, the pvp will become unbalanced as not all players will be in the pool.

This can be mitigated with manual reshuffling and cleanups with automated events or some such, but still, perhaps there is a better solution?

Thank you.

Player DataTitle DataMatchmaking
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

According to your description, your game design is the player can make the level or randomly choose a level that made by others and play it to win the currency from the level owner, is it right? If so, the existed matchmaking mechanism may not suit your requirement. We would suggest you write a logic to randomly select a the level directly like the solution you currently use.

But please note, your current usage of the Title Data may cause the issues. For clarification, the Title Data is designed to store the static data such as title configurations, that doesn’t apply to store the global variable and whose update would be triggered by players. You can check the documentation - Title Data quickstart - PlayFab | Microsoft Docs for more information of Title Data. Besides, you needn’t store the K/V pairs of Player Id and the level separately. For your case, you can store the level data as the player read-only data, and set up the permission of the level data as public to allow other players to read it, then you can let the player select a random player directly, and read the level data belongs to the random player. If you need to randomly select the players whose level is close to the attacker, you can set the level as a statistic, and call the API GetLeaderboardAroundPlayer to get the players whose level around the attacker.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Juris Zebnickis avatar image Juris Zebnickis commented ·

Thank you, Sarah!

That is correct. All players can create and store a small and fixed number of levels, that each correspond with a tier of progress that they are at in the game.

This ideally should create a level pool and every player rolling for an attack would choose one other player who has a level of their progress tier.

This is perfect! Thank you. We can use the progress tier as the leaderboard statistic. I will attempt to implement this and update the answer accordingly after.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Juris Zebnickis commented ·

If you have any questions, please feel free to let us know. And if you have a dedicated leaderboard question, we more recommend you to post a new thread for that so we can specialize in different questions.

1 Like 1 ·
Juris Zebnickis avatar image Juris Zebnickis Sarah Zhang commented ·

Hi Sarah.

So, thing with this is the maximum player count that we can parse with Leaderboard calls is 100, correct?

What is the under the hood sorting process for this? Like if we have, say, a 1000 players with the same progress statistic, will the 100 players given by the result be always the same players or does the call randomize it each call?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.