Creating a basic game on Ethereum
Another wonderful use case for a decentralized platform like Ethereum is building games. CryptoKitties is one such popular game, which is built on Ethereum blockchain. There are many options to consider while creating a decentralized game. You can either go with a fully decentralized and transparent game, or partially decentralized, feature-rich game. It depends on your requirements and target players.
In this recipe, you will learn how to create a simple game that allows the player to own heroes and battle against others.
Getting ready
You need to have a working installation of Ethereum (geth
, Parity
, ganache
, and so on) or the Remix IDE to test this recipe.
The contracts given are for illustration purposes only and cannot be used in real-world systems.
How to do it…
- Create a game contract with a target compiler version. We will use version 0.4.23 for this specific contract. This contract acts as a database to store our hero details and a battle arena where heroes...