Games have different mechanics off-chain but due to web3 gaming being relatively new, existing on-chain mechanics in gaming are pretty universal. Apart from innovative technology that pops up every now and then, blockchain integration 101 can be summed up in a guide or a blog post.
So you are developing a game off-chain on a game server. And now you want to add blockchain integration. The obvious first steps would be to think of player onboarding, wallet integration, and easy to use UI/UX.
You also need to think about what you’re using web3 for in your game. Do you want to build a web3 economy? Do you care about tokenomics? Do you want to gamify web3 integrations rather than making it all about play-to-EARN?
To help you with the overwhelming amount of questions, there exists a lot of tools to add web3 to your game. Some of them are stand-alone tools for specific needs. But then there are infrastructure tools that have ready-to-use solutions – an infrastructure – to build upon.
The advantage of using infrastructure tools is that you can find a working system that’s already been tested in other games and modify it. As opposed to picking and choosing different tools from different sources that don’t necessarily lead to an engaging player experience. You can still do that as well but now you have a solid foundation.
Moonstream provides open source economic infrastructure for web3 games. Here are some essential tools that we made for you to deploy in your game and why:
Terminus is a smart contract standard and a modification to the EIP-1155 Multi-Token Standard. It lets game designers and game developers define transferability, burnability, and even supply limits at the level of token IDs.
What for? To be able to create different types of game tokens. It also allows for delegation of minting and burning capabilities on individual token IDs to other accounts or to other smart contracts.
The following types of assets can be represented using Terminus:
- Badges: Non-transferable tokens which can be minted by a game server or other game contract
- Items: Transferable tokens with a high maximum supply
- Consumable tokens: Transferable tokens which are burned by the game contract on use
- Artifacts: Transferable tokens with a low maximum supply
You can use badges for access control in reputation systems or to gate administrative access, for example. If a person has a badge in their wallet they get access to perks other people don’t have. And since badges are not transferable – this system is not easily exploited.
The advantage that Terminus-based access control has over address whitelists is that it makes it easy to rotate accounts. Instead of submitting whitelist and blacklist transactions against multiple contracts, administrators can simply burn and mint batches of Terminus tokens against the same Terminus contract.
Items, consumables, and artifacts can all represent different in-game items on the blockchain. You can also create Terminus Lootboxes that contain several different tokens inside for randomized rewards. The randomness is customizable.
Terminus is compatible with any marketplace that supports the EIP-1155 Multi-Token Standard, like OpenSea. The largest Terminus marketplace on Open Sea is currently Crypto Unicorns: Item Marketplace, with over 2000 ETH in transaction volume.
Moonstream Leaderboards allow you to create player rankings based on both on-chain and off-chain activity. That’s right, that includes activity on your game server.
With leaderboards you can display the rankings along with the rewards players get.
What’s great about using leaderboards is that besides adding competitiveness to your game, they also serve as a game design tool. By attaching a leaderboard to a game mechanic you spike engagement with that game mechanic.
Now that you have your game items represented on-chain with Terminus and you give players an opportunity to win those items by competing for a leaderboard ranking, a question arises of distributing those items as rewards.
It used to be a common practice to have airdrops where you distribute rewards to each individual player wallet yourself. When you have hundreds and thousands of players, that can lead to tricky errors and cost a lot of money.
That’s why we made Dropper. You can use Dropper to distribute ERC20 tokens, NFTs, items, or achievements to your community. All you have to do is upload a spreadsheet listing the amount that each community member should receive. Dropper creates a “claim your reward” flow, where players go to a website to check and claim their rewards themselves.
Our smart contracts and APIs handle the rest. Integrate your frontends or game clients with our APIs for full control over the claim experience. Use Moonstream-backed leaderboards to automatically reward players for their on-chain activity.
Gaming projects have used Moonstream to drop over $80,000,000 worth of tokens and items to date.
On-chain game mechanics
Now for the fun part. We made several game mechanics that can be arranged into on-chain minigames. Those include:
- Staking or Exploration mechanic. NFT characters receive a reward for “exploring” an area for a certain amount of time. The reward can be ERC20 tokens, achievements, experience points, on-chain lootboxes, etc.
- Sacrifice mechanic. Players can sacrifice an ERC20 token to get a chance at winning a prize. Prizes can be any ERC20 or ERC1155 token (e.g. badges, lootboxes, etc.)
- The Garden of Forking Paths – a multiplayer choose your own adventure mechanic where players choose a path to follow that can lead to failure or XP gain.
Our mechanics are implemented to be mounted as facets on EIP-2535 Diamond proxy contracts.
Traditional gaming mechanics on chain
Moonstream also built two mechanics that are like what web2 games have but work on the blockchain:
- NFT Inventory
Crafting is pretty self-explanatory and works similar to Minecraft crafting. As a game developer you can create crafting recipes to let players create new items in your game. As a player, you can use crafting to upgrade your items or make new ones from what you already have.
This can be used for badge upgrading for example. Get on-chain XP (Terminus) by completing tasks > exchange it for a badge (Terminus) > get more XP by completing more tasks > combine XP with your badge to level it up (crafting).
NFT Inventory is something we are building with Game7 DAO. It lets NFTs own things. Game developers can define inventory slots for NFTs so that players can equip items not to their wallets but to their characters. You can read more about it here.
The point of all of that technology is to make web3 game development easier. All of this is open source. You can find more details about implementation on our GitHub but if you still have questions – feel free to reach out.
For a more in-depth technical guide about making a web3 game I highly recommend checking out this free Web3 Games Guide by Polygon Labs – Blueprint.
Now the next task on our agenda is seamless blockchain integration.. but that’s a topic for another post!