In a previous article, we have argued in favor of crypto-gaming. The blockchain is ideal for hosting games for a variety of reasons, including the fact that it is easy to represent fungible and non-fungible assets in the form of tokens. These can be game characters and other digital assets, for example, 3D role-playing heroes and items, such as weapons and armor in CryptoFights. Another reason for gaming on the blockchain is the decentralized and transparent nature of the underlying platform, which has the potential to convert gaming in a fair and open process.
However, as we have also already pointed out, most crypto-games fail to meet these expectations and are nothing more than gambling or collectible trading sites. So why has crypto-gaming so far failed to take off properly? The answer is simple: It’s actually very hard to implement an exciting game on today’s blockchain technology.
There are several limiting factors that make it hard to implement the type of interactive experiences gamers would like to see:
In order for CryptoFights to be implemented on the blockchain in a practical way, the developers have adopted the following guidelines:
The above does not mean CryptoFights forgoes decentralization. On the contrary, key blockchain primitives are used, borrowed from basic algorithms, to implement fair and verifiable off-chain solutions, using the underlying smart contracts as settlement layers.
As previously published, CryptoFights consists in 3D heroes battling in an arena, modeled on traditional role-playing games. Whilst, there is an important strategic aspect to playing the game, players also roll a dice to provide a degree of randomness for the battles. Whilst, the developers have devised a clever way of generating randomness on-chain reliably, they have also designed ways to execute battles off-chain fairly and verifiably.
To illustrate this, let’s discuss two examples of how battles can be implemented off-chain.
The first solution is based on the same concept that is used in proof of stake consensus algorithms in some blockchains, namely, allowing participants to stake some of their wealth to correctly execute the battle algorithm off-chain. The result can be verified by anyone and if found fraudulent, the validator loses the staked amount. If validation is performed correctly, the validator is incentivized with a reward.
This works as follows: CryptoFights allows gamers to fight for a bounty in the arena. The bounty, paid in Ether, is paid to the winner of the battle. Therefore, in those battles in which gamers have decided to fight for a bounty, we can incentivize a third party that wishes to act as a validator with a percentage of this bounty for executing the battle contract.
The battle algorithm is implemented in a pure function, which on Ethereum means the function can be called in a gas-free local node call. The input to the battle algorithm is a random number seed, used for deciding the outcome of dice rolling. The future block method is used to provide the required seed, which is the only secure transaction-free on-chain solution for random number generation.
An outside validator executes the algorithm using the following steps:
Validator Staking
The above process greatly reduces the gas cost for battle execution and improves the interactive user experience for the players.
Another option for executing turns in battles off-chain is to use an adapted state channel approach and use the blockchain for settlement and conflict resolution. This can be achieved by the following procedure:
Using the above algorithms most battles can be resolved in only three transactions.
Validation staking and proof of turn are just two examples of how game logic can be executed off-chain, whilst conserving the key transparency properties of the blockchain.
It is essential for crypto-game developers to be creative with off-chain solutions, in order to make blockchain gaming viable with current technology.
Beta operation of some CryptoFigths functionalities has already started. Sign up at cryptofights.io. See you in the arena!