Making Better User Experience for Mobile Games with NFTs

Van Cam PHAM
TomoChain
Published in
6 min readAug 8, 2019

This article will explain what is a Non-Fungible Token, why it is crucial for blockchain-based games, and how to make the user experience of NFT-based games better.

In November 2017, a DApp game named CryptoKitties brought about a storm of excitement to the world of cryptocurrency. It’s a collectible game in which people can collect digital kittens and exchange them with others. The price of some of these digital kitties even rose to USD $300,000. At its peak, CryptoKitties was contributing an average of 30% of the daily Ethereum transaction volume, congesting the entire Ethereum network. The core token used by these blockchain collectible games is NFTs, or Non-Fungible Tokens.

The majority of DApps and games featured on different DApp review websites, such as Dapp.review and Dapp.com, are NFT-driven games.

An NFT token is defined as a kind of token that is uniquely identifiable and distinguishable, hence non-fungible. Furthermore, an NFT token is not divisible like FTs (Fungible Tokens) tokens (ERC20 on Ethereum and TRC20 on TomoChain).

Due to the non-fungible feature of NFTs, they can be used to represent a large number of real-world goods, such as a ticket, a bottle of wine, a piece of jewelry and so on. NFTs enable us to tokenize anything valuable and trace the ownership of it, thus building a connection between information and value.

The key innovation of NFT is providing a method to record ownership of each individual and unique asset on the blockchain, making it transparent and tamper-resistant. NFTs don’t prevent others from accessing ownership information. They simply capture it.

NFT standards, such as ERC721, define an identifier (tokenId) for each virtual asset represented by an NFT token. It also allows the owner of a game item to prove the ownership of the in-game virtual asset, given its token ID.

The following code portion represents the functions of an ERC721 standard-driven NFT token (with an implementation referenced here). While most of the functions are similar to ERC20-like fungible tokens, the differences between an NFT and an FT are significant.

contract ERC721 {// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
// Events
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
// Optional
function name() public view returns (string name);
function symbol() public view returns (string symbol);
function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds);
function tokenMetadata(uint256 _tokenId, string _preferredTransport)public view returns (string infoUrl);
// ERC-165 Compatibility (https://github.com/ethereum/EIPs/issues/165)function supportsInterface(bytes4 _interfaceID) external view returns (bool);
}

NFTs are used in many blockchain games like the following examples:

  • Cryptofighters: A game which allows you to collect, battle and level up your fighters to win new fighters.
  • Cryptokitties: The most advanced and popular game that allows you to buy cats :) It seems like they will be doubling down on the collectible and gaming use-cases.
  • Decentraland: An open source virtual world platform with ownership of items on it being tracked as Ethereum-based collectibles that are represented as pieces of land. You can buy MANA, the native currency of the platform, and pieces of land that are ERC721..
  • Etherbots: A cool game where you can put together a robot from various (NFT) parts and have them fight against each other.
  • Ethermon: Essentially, Pokemon on the blockchain.
  • Rare Peppes: One of the early crypto collectible implementations based on Counterparty.
  • Spells of Genesis: A digital card game with some elements of trade-ability of cards, enabled through Counterparty.

Improving User Experience with Meta-transactions: A Subscription-based Game

The problem with most of NFT-based games is about on-boarding new users and improving user experience in making transactions. The first, and foremost, requirement for any user is to have the native token of the blockchain in their wallet to pay transaction fees. Unfortunately such buying requires a complicated series of steps that make it hard for the user onboarding process for blockchain games. We believe this is one of the important reasons why blockchain games and DApps in general are struggling to get significant adoption from users.

We think that this is where blockchain games need to learn from traditional games which have been providing great user experience but unfortunately lack the advantages of NFTs and blockchain as described above.

More concretely, most current games allow users to pay game providers an amount of cash for playing games using their accounts registered in the games. On-demand microtransactions and subscription packages are normally provided.

Taking this model into account on the blockchain, a similar solution could work as follows:

  1. The user buys gas in advance by using any existing payment processor, such as VISA/ MasterCard. This is similar to the way the user pays the game provider in advance to play the game, as in traditional subscription-based gaming. The game provider can offer different packages on a weekly, monthly, or yearly basis for the player.
  2. The game provider allocates the gas and sends it (in TOMO) to the game contract.
  3. For any action needed to send to the game contract, the user can make a transaction by signing the actions to be executed by the contract. The user does not need any native token (TOMO/ETH) in the wallet to make such a transaction.
  4. The transaction, signed by the user, is sent to the game provider’s server, which verifies the user signature.
  5. The game provider verifies whether the user has enough remaining gas to execute the actions.
  6. The game provider uses their own wallet to sign the transaction that contains the user signature for the action.
  7. The completed transaction, signed by the game provider, is executed by the contract. This process moves the gas consumed from the allocation to the game provider’s wallet. This is to ensure that the game provider is compensated for the gas consumed by the transaction.

The above solution has several advantages compared to the current approach most NFT games are adopting:

  • Zero friction: Users do not need to know whether they are playing blockchain games or not. The only thing they would need to know is that they are interacting with a normal game server, but the security of the system is guaranteed by blockchains.
  • Ownership protection: The ownership of user assets is protected by blockchains
  • Transparency: Game assets and game items are all transparent, and ruled by a persistent game contract.
  • Decentralization: Game assets and game items are all stored on the decentralized TomoChain blockchain. Even though the game provider acts as the centralized point for making transactions to the contract, the complete transaction can be signed by anyone having TOMO (as in Step 8), and as compensation, the signer will receive transaction fees from the gas allocated.

Get Started BUILDing Your First Game!

Are you ready to build your first game on TomoChain? We have prepared multiple tutorials to start building games on TomoChain:

For meta transactions, readers are recommended to develop their approach based on this work. This latter article provides first steps to build a more sophisticated gas offerings and gas usage subscription system.

TomoChain contact

Follow us on TomoChain Announcement Channel | Twitter | Facebook | LinkedIn | Reddit | Github | Sign up for our newsletter on Website

For General support: TomoChain Chat

For Technical support: Gitter

--

--

Van Cam PHAM
TomoChain

Lead Dev & Smart Contract Audit at The Arcadia Group, PhD in Software Engineering