Actions and Transactions
Last updated
Last updated
One of the key ideas in Nine Chronicles is that all game actions are essentially transactions on the blockchain. To make this understanding more concrete, we will describe transactions with respect to the game's combat.
In the game client, once you have loaded your character, you will see the main game screen. This is the familiar screen where you can see the marketplace, the workshop, combat rankings, the entrance for elemental dungeons, and the portal to enter the different worlds (also called dungeons).
The graphical interface provides a nice way to interact with the data that sits on the Nine Chronicles blockchain. All game data sits on the chain which means a copy of this data is stored by all people who run the blockchain software.
One thing that happens here, but we don’t see, is the data from the blockchain is parsed into a local database which holds the latest state of the Nine Chronicles gaming world. This is done to improve the performance of the game.
Note that a more technical understanding of blocks and transactions is provided in the Libplanet page.
From the main screen, whenever a player clicks on the portal they are led through a couple of screens that lets them choose which level they wish to fight in as well as choose their equipment. Finally, a player must press the “Start” button to proceed to combat.
The game client interprets this clicking action and turns it into a transaction ready to be sent to the blockchain. Each action has to be signed by a player’s private key. This way everyone knows who has performed which action. A private key is like a password and is unique to every account.
Transaction Broadcasting
This signed action (read: transaction) is prepared by the game client and sent to the blockchain node running on your computer, which in turn broadcasts your transaction across the Internet to all other computers who have joined the Nine Chronicles blockchain network.
This node software is managed by the game Launcher, which is the program you start when you press the Nine Chronicles icon on your computer. As all players run the Launcher before starting the game, all players are also running a blockchain node and helping to sustain the game. As mentioned above, anyone who runs the blockchain software stores the history of all transactions.
Energy Cost (“Prosperity” and “Action Power”)
Players start with 120 action power but use up this action power when entering combat.
Pressing the Start button has a cost of 5 energy (“action power”); however, this is not a financial cost to the player as energy naturally restores every 1700 blocks. Every single block, players rejuvenate 1 prosperity. After 1700 blocks, players have full prosperity and can refill their action power back to 120.
This energy mechanism is how we prevent players from spamming the network with too many actions at once. Players who send too many transactions will have their extra transactions ignored by the other players in the network.
Determining the battle result
The outcome of a battle follows a formula that depends on a player’s equipment stats plus an element of randomness. The source of this randomness is the block hash of the block where your transaction is included. As this happens in the future you won’t know the block hash that corresponds to your combat until that block is added to the chain.
As all data in a blockchain is public, then all players running the software know the stats of your player and will also see the block hash for combat too. This means that all players can calculate the result of your combat in a deterministic way once the random value is known. What’s also implied here is that all players calculate the combat results in the exact same way. This is how we prevent cheating in a decentralized game.