To make this post a little more interesting for the non-techies, I'll give 10 STEEM to whoever comes up with the funniest text to go in the text bubbles in the image above!
I know that everyone is eagerly awaiting the release of the card stats and gameplay mechanics, and I promise that is coming soon - and I mean for real soon, not SMTs soon! In the meantime, I thought I would take some time to talk about the planned protocol for the decentralized match-making and battle/tournament system. I hope everyone can contain their excitement :-P
Finding a Match
The first step to starting a 1-on-1 battle with another player is to broadcast an "sm_find_match" custom JSON transaction with the details about the type of match you're looking for and a hash of your team (more on this later). The content of the operation is as follows:
{
match_type: 'standard',
mana_cap: 20,
expiration_seconds: 120,
team_hash: 'some_hash_value'
}
The "match_type" property will indicate what format you are looking to play. Initially we will start with a single format - "standard" - but in the future we plan to create many different formats with all sorts of different rules and mechanics and to keep things interesting.
The "mana_cap" specifies the max combined mana cost for all of the cards on each team and "expiration_seconds" specifies the amount of time available to find a match before the transaction expires. Time here is actually measured in blocks so the value will be divided by 3 and rounded down to determine the number of blocks before the transaction expires.
Lastly, the "team_hash" is an MD5 hash of the cards that make up your team. We use a hash here instead of publishing the team directly so that you cannot see what cards other players looking for matches are using and cherry-pick the ones you feel you have a better chance of beating.
The hash is calculated as follows:
md5(summoner + ',' + monsters.join() + ',' + secret);
where "summoner" is the UID of the Summoner card chosen and "monsters" is an array of the UIDs of the Monster cards. "secret" can be any value and is just used so that people can't brute-force guess what a player's team is by hashing different combinations of card UIDs.
Match-Making
Whenever a new "sm_find_match" transaction is broadcast and included into a block, the protocol will search through the list of open "sm_find_match" transactions in the match queue in a deterministic fashion to see if it finds a match.
A match is found if there is another "sm_find_match" transaction that has not been matched yet and has not expired which has the same "match_type" and "mana_cap" and both players ratings are within a specified range.
We are planning to use the Elo system to assign ratings to all players based on their performance in the 1-on-1 battles. This will help ensure that matches are fair and that players get matched against players with similar card levels and similar skill levels.
If no match is found from the transactions currently in the match queue, then the new transaction is placed in the match queue until it either expires or gets matched with a new "sm_find_match" transaction that comes in.
Team Reveal
Once two players have been matched up for battle, it's time for them to reveal the cards on their teams. At this point, the match has officially started, and if any player fails to reveal their team it will count as a loss and their rating will decrease accordingly. If both players fail to reveal their teams then the match will be cancelled.
Each player will have 20 blocks (1 minute) from the block containing the second "sm_find_match" transaction to reveal their team. To do this, each player must broadcast an "sm_team_reveal" custom JSON transaction with the following content:
{
"trx_id":"84edab614797bfbd5d117f3ef387f20f3491389e",
"summoner":"C-PCPBW2W82O",
"monsters":["C-V8JFUUPV1C","C-FFNFY8RBS0","C-WCAPN7E0Q8"],
"secret":"a6MkvmV2R1"
}
The properties are as follows:
- "trx_id" is the transaction ID of the initial "sm_find_match" transaction
- "summoner" is the UID of the team's Summoner card
- "monsters" is a list of the UIDs of the Monster cards on the team
- "secret" is the secret value used to compute the hash broadcast in the "sm_find_match" transaction
At this point, the protocol will perform the following checks to validate that the team is valid:
- Check that the player actually owns all of the cards listed and that they are not currently for sale on the market.
- Calculate the MD5 hash using the summoner, monsters, and secret values to ensure that it matches the one broadcast in the "sm_find_match" transaction.
- Check that the cards used are all allowed in the specified match format and that the total mana cost is under the specified mana cap.
If one of the player's team reveal is invalid and the other player's is valid, then it will count as a loss for that player and their rating will be adjusted accordingly. If both player's team reveals are invalid, or one is invalid and the other does not submit a team reveal transaction in time, then the match will be cancelled.
It is important to note that a different account can sign and broadcast the "sm_team_reveal" transaction than the one that signed and broadcasted the original "sm_find_match" transaction. As long as the hash matches, and everything else is otherwise valid, it will be considered a valid team reveal.
This will be useful for things like tournaments where a player might enter a tournament that doesn't start for a number of days. Instead of that player having to either make sure they broadcast their team reveal at the right time, or trust another account with their keys, they can instead just share their team and their secret with a service that they trust to keep it secret (such as steemmonsters.com) which can do the reveal for them.
Enough Talk, Let's Fight Already!
This probably all sounds like a lot, but it will all be under the hood and taken care of by the user interface. From the typical player's point of view they'll just choose their team, click submit, and get matched up without knowing any of this is taking place behind the scenes on the blockchain.
So, once all the stuff I wrote above happens, and two players are matched up and have revealed valid teams, the battle will take place!
The battles will be done completely deterministically and in a provably fair manner so that anyone can calculate the battle results for themselves and verify that they match the results calculated by steemmonsters.com or any other future UI that supports battling. This is the same as how card packs are generated and how we pick our raffle prize winners!
The random number generator used for the battles will be seeded with the MD5 hash of the block id, previous block id, and transaction id of the second "sm_team_reveal" transaction, since that is the final transaction necessary to start the battle.
Tournaments
I haven't built out the protocol for running tournaments yet, but the idea is that anyone will be able to create their own tournament by broadcasting a custom JSON transaction with all of the tournament details including:
- Start Date/Time (indicated by block #)
- Min/Max Entries
- Tournament Format
- Match Format & Mana Cap
- Prizes
Then players who want to enter the tournament can submit a transaction similar to "sm_find_match" described above with a hash of their team and the ID of the tournament they want to enter.
Once we have reached the start block for the tournament, no new entries will be accepted, and all entrants will have a set period of time (in blocks) to submit their "sm_team_reveal" transactions.
Once that is done, any invalid teams will be discarded and assuming there are enough valid teams to cover the minimum required entries the tournament will take place in an automated, fully deterministic, and verifiable manner.
As for the prizes, we will likely create some type of escrow service for third-parties who want to run tournaments for blockchain-based prizes. This way they can send Steem, SBD, Cards or Card Packs, and @steemmonsters will automatically pay them out to the specified winners at the conclusion of the tournament, or refund them to the creator if the tournament does not take place for any reason.
All of this remains TBD at this point though, so please feel free to let me know if you have any other ideas, thoughts, or comments!
Tournament Prizes
As we have been saying since the beginning, the plan is to have tournaments sponsored by Steem Monsters. These tournaments will happen weekly and feature payouts of at least $1,000 worth of Steem/SBD to winners! We plan to also feature regular and gold foil variants.
Thanks For Your Support
As always, I want to sincerely thank everyone who has supported me by giving me upvotes, approving my witness, buying Steem Monsters packs, or just leaving an encouraging comment or message! We never would have built Steem Monsters, and probably wouldn't even still be using Steem, if it wasn't for the amazing community of people here!