question

element808 avatar image
element808 asked

Using Trading System for Wagering

In my game, you collect a certain type of item that can be wagered against another player who has the same types of items. For instance, to play a "For Keeps" mode of the game, each player needs 3 common, 3 uncommon, 2 rare, 1 epic and 1 legendary. As long as you have at least this amount of each type of item, you can play this game mode. Each player takes turns trying to obtain as many of the opponents items as they can, hoping they keep as many of their own wagered items as possible. The game is won by obtaining more items than your opponent; however, even if you win, your opponent could still walk away with all of the epic and legendary items that were wagered.

My initial thought was when both players entered into the match, the items would immediately be removed from their inventory via cloud script and then awarded after the match is completed. This would prevent players from gaming the system and keeping their items by exiting a match if the match doesn't go their way, before the match is over.

How can I achieve this and do you have any recommendations on a better way to solve this kind of gameplay? Thanks in advance!

Trading
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

·
Citrus Yan avatar image
Citrus Yan answered

Hi @Element808,

Based on your description, I can infer that this “For Keeps” mode contains several turns, let’s say 7 turns, the player wins or loses in each turn. When the players finished all 7 turns , the player who wins more turns wins the game and can be granted all the opponent’s wagered items, and the items are actually granted at the end of the match, is that right? If that’s the case, removing the items from their inventory and then awarding after the match is completed seems feasible to me. However, if a player disconnects from the match, does that count as leaving the match? And if the player leaves the match, does that mean all the items he possessed are gone?

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.

element808 avatar image element808 commented ·

@CitrisYan - Don't know if you're familiar with the 90's school yard craze, POGS, but basically you keep what you flip. You put in 10 caps (i.e. POGS) and your opponent puts in 10. Each player takes turns hitting the stack of POGS and depending on what you flip, you could get some rare caps your opponent has that you don't have yet. It's really a collection based game, but putting your caps on the line is where the fun is. A player has to flip the minimum of 11 caps to win the match, but they could still lose their rare caps during the match.

Which makes me expand on my initial thought of how I might have to handle it if a player disconnects. If we issue caps to players each round, if a player disconnects, they won't lose more than what they saw was flipped. How should I store the reference to the items in PlayFab for what is currently being wagered in a match? Thanks for your response

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan element808 commented ·

Hi @Element808,

I think I got it after reading your introduction and watching a youtube video:)

So, I think you should have a server session for each match, there are three basic parts in this session:

1) When the session begins, aka, the matched starts, retrieves the players' wagered items from PlayFab and stores them in it.

2) The players play the game, the session is responsible for keeping all the data of the game, for instance, modifying the players' current caps after each turn ended.

3) If the game ends properly, the server session calculates the results and updates the players' inventory accordingly. Or if a player leaves the match, the session will wait for the player first in case he disconnected, when a certain amount of time passed, it will start to calculate the results and interact with PlayFab to update their inventory accordingly.

The basic idea here is to interact with PlayFab less frequently, keeping all the temporal data in a server session, it performs games logic and interact with PlayFab at the end of the session.

0 Likes 0 ·
element808 avatar image element808 Citrus Yan commented ·

Thank you for the assistance :) Gave me great some ideas on which route to take and how to go about implementing it.

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.