Tech Tuesday Development Update - 2019 Week 12: Custom Blockchain Game Dev Tools

myloMarch 19, 2019

This series of posts is called the Tech Tuesday Updates. Along with Komodo's Five Bullet Fridays weekly newsletter, Tech Tuesday Updates is another weekly piece of content to look forward to.

In case you’ve missed a previous edition and want to catch up, you can find all the previous Tech Tuesday updates here.

Custom Blockchain Game Dev Tools

Komodo is an open, multi-chain platform that gives every project the ability to customize and launch an independent blockchain. When building with Komodo’s technology, your blockchain comes with a wide range of customization options:

  • 15+ parameters, such as blocktime, block rewards, staking rewards, Proof of Work or Proof of Stake or any combination of the two, the hashing algorithm, the introduction of new features through the blockchain’s lifecycle, and many more.
  • Custom consensus modules, to extend your blockchain’s functionality.
  • Tokenization, unlimited amount of in-game tokens can be launched on the custom chain
  • Access to Komodo’s Custom Consensus module library, which includes oracles, gateways, and more.
  • Atomic swaps to exchange value and ingame tokens.
  • Native bitcore integration - very fast, high performance internal block explorer functions.

The deployment or launch strategy also can include a participation-style of rewards where one global CC module address holds funds. The funds are available to anyone that satisfies the blockchain (consensus) rules which define the gameplay ,e.g. in KMDICE, half of the coins that will exist are locked up for winning against a bet. In ROGUE the amount of in-game gold can be converted to ROGUE coins, where the entire supply of coins is held, so only the gamers get the coins.

Game interactivity and hosting is quite simple in the current day. Some multiplayer games enable gamers to connect, and HTML games can be hosted for browser gameplay. Other forms of game updates are simple synchronous updates or one-time game asset downloads. With the developments of blockchain, the way to host games and interact with gameplay is set for an evolution. The operations of blockchain enabled game hosting options have two but soon three and inevitably a fourth way to deploy. Deploying blockchain games will reflect the way cryptocurrency exchange services are available.

  • Hosted Gaming: the use of Centralized databases and servers
  • P2P Full Mode: blockchain is downloaded and ran locally to access the game
  • P2P Lite Mode: mobile ready games, players might not know it’s powered by blockchain
  • 100% onchain: the zero-install trustless, secure, private HTML game in a designated wallet/app/console

What’s Ready

The following two methods are available now to the innovation seekers.

  • Centralized is totally hosted and runs through a browser or some graphical interface on a local device, sending web requests to the p2p network managed by a service provider.
  • P2P Full Mode is where the client is synced up to the game’s blockchain, much like ROGUE offers.

What to look out for

The following methods are goals of Komodo, although not on any roadmap at the moment:

  • Mid-Term: P2P Lite Mode is when the game client (like the Mobile Wallets) can sign the requests and send them through a 3rd party synced to the network, like an explorer or electrum server without needing a copy of the blockchain locally stored.
  • Long-Term: Following something like vehicle firmware loaders or skill (language) certifications are stored on-chain via oracles, the game engine and it’s rule engine could also be stored - and updated accordingly - either by real-world events or from something chain related (e.g. previous gameplay affecting future outcomes).

Features covered in previous Tech Tuesdays that offer the game devs choices to present to their teams follow in the next sections.

No Transaction Fees for Games (& dApps)

When creating an independent blockchain project with Komodo’s technology, the transaction fees are in the native coin, not KMD. If you create blockchain MARS, the MARS coins are the native currency on this independent project.

In the week 45 Tech Tuesday update, I linked to an EOS Validator that made ridicule of how Komodo could possibly be used for dApps because the transaction fees would be $1 should KMD hit a price of $100 per coin.

However, transaction fees aren’t paid in KMD so this is a non-issue. The difference between your custom game chain & the Komodo chain is that KMD is only used for fees related to delayed proof of work security (dPoW). It may be helpful to think of Komodo as the ecosystem’s security dApp. All other fees are paid in the coin native to your blockchain.

Game developers create value of a game, in the game and around the game— not on a chain, so use the chain for what it is good for and not for annoying transaction fees. You can even set the chain to make free transaction games. The system is a transactional system, use it for it’s strengths. Any shortcomings can be overcome, as will be highlighted in the next section for a zero fee transactional system. Consult with our dev team on discord for any problems, whether they are perceived or real - theoretical or implemented.

The custom game blockchain’s primary & secondary functions out-of-the-box are:

ROGUE blockchain single player gameplay utilizes both primary and secondary functions.

A game developer can come to rely on these as the layer 1 services offered by their custom chain. Where they take it, is only limited by their imagination. Game objects become chain consensus code and tokenized game objects can be traded on the Token DEX!

ROGUE provides an example of having a new user receive a nominal amount of the chain’s underlying coin (from the supply of coins locked in a CC module address). This small faucet amount enables the new user to make transactions that start and save their game. The value to the game and its ecosystem is in the tokenized game objects. This is where the in-game economy exists, through its gameplay, and the awarded tokens can be traded with other tokenized game objects and eventually converted to the chain’s coin. The chain’s coins in such small values are worthless, but a large supply results in the whole chain having value.

A $2 million dollar game chain, with a coin supply of 2 billion coins makes each coin worth one tenth of a cent ($0.001). Each transaction costs 0.0001 COIN. So each transaction to start a game costs $0.000001. Even if every person on a social media platform (including the bots) played the game in the first week of launch, that’s 3 billion people— it’s a $3,000 opportunity cost to kickstart the game economy.

I’m not an economist, so let’s wind it back to realistic numbers. You make a screamer of a title. You get 10,000 players in the first week, your COIN is now valued at $0.001, meaning your chain is valued at $2 million from your investments in time and development. The chain gave away 10,000 x $0.000001 of “free” money so people could play. I think every person on this planet (and some primates) would have designed the chain in this way for your game. Maybe there are better models to be created— it’s easy to experiment with Blockchain Technology at Komodo— our commitment to blockchain & games innovation can be found through the Blockchain Starter Kit.

P2P Blockchain Streaming

In Q4 2018, two Komodo dApp developers, with some assistance from Komodo Lead Dev jl777, created a proof of concept blockchain streaming solution. 27 minutes of streamed data were sent in 468MB between two remote nodes. Not necessarily a blockchain game innovation, as solutions like tele-medicine and training would be a natural fit in a trustless environment where sensitive information is being transferred. However, let’s also consider the context of financial data as valuable and having sensitive information.

When we say streaming, we don’t mean video alone. We stream bytes. Video is bytes. Bytes, however, are more than just video. Bytes can be streaming payments in a separate payment channel, or the bytes could be the game engine being streamed to the client. Perhaps it is an effective anti-piracy mechanism.

For the sake of simplicity, let’s stick with audio/video. Forget I mentioned streaming payments— and definitely don’t think about streaming payments through a browser— yes, this is already well scoped and defined as APIs through the w3 consortium and in several browsers. Let’s only stick to blockchain based audio/video streaming for now.

For a business simulator game dev (like Lemonade Stand, or Pizza Tycoon), this may be a live interactive real world mashup with an event. Music Promoter Tycoon may patch into some gigs that are going on with participating DJs, bands & venues.

For a football game, maybe effective use of licensable cut scenes to relevant gameplay. Cricket and other sports— new levels of interactivity, micro transaction value on a global scale and collectibles. All these not only have value in-game, they have production value. The amount of economic activity these integrations will be able to create is mind boggling.

The ability to stream and derive income from it, to make partnerships with organizations that previously were not able to, will grow the world economy in a profound way. It’s like the last stages of Civ Rev on xBox, when you build the internet wonder and your gold production increases 2x. This is what opportunities blockchain and gaming uncover, with further games innovation likely to find their way into the core of Komodo’s Blockchain Starter Kit.

Provably fair & mineable games

The KMDICE chain launched in Q4 2018 as the first provably fair and mineable dice game. The mineable property comes from it’s chain parameters (the omission of -ac_pos) at startup because a blockchain’s default behaviour is PoW.

komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=$seednode

The provably fair portion comes from the Dice Custom Consensus Module. The player and the dealer nodes both submit random numbers as a pseudo random number generator. These submitted values are combined with another random value, the entropy transaction and run through some algorithm. This is all replayed by every node, making it provable that with the submitted values and the supplied (random) entropy, the reported outcome of the game is true.

This PNRG mechanism is a demonstration of one method to achieve provably fair gameplay on a blockchain. Please consider using this method for your own games! Inspect the code and ask our dev team questions in the discord #cc-dice channel.

The KMDICE blockchain start parameters are:

  • -pubkey is the public key of an address in your local wallet
  • -ac_name is the blockchain’s name
  • -ac_supply how many KMDICE pre-mine there are, which for this chain, was locked in the dice custom consensus for users to unlock (win) by playing
  • -ac_reward is the block reward in satoshis (25 KMDICE) from PoW mining
  • -ac_halving every 210000 blocks
  • -ac_cc is the custom consensus configuration
  • -addressindex is an index for addresses and balances which makes for very fast lookups
  • -spentindex is an index for transaction data which makes for very fast lookups
  • -addnode tells the daemon which nodes are trusted to act as seed nodes

Verifiable Gameplay, Saved Player Data & Game NFT Token Trading

ROGUE burst onto the Komodo discord #cc-rogue only 6 weeks ago. It brought a slew of new features for blockchain games innovation. The game is compiled along with the blockchain and the software works together. The blockchain, the wallet, the transactions and the game produce the same byte-for-byte output on one system to the other. This is deterministic behaviour. Same result each time it is run given the same input.

Verifiable gameplay

Rogue-like games (and many other genres, like puzzles and RTS games like starcraft) use a seed to spawn the environment. For the ROGUE blockchain game, the seed of a level for a game is saved to the blockchain. The seed is used as an input to the game engine to create the level so when a transaction says “Hi, I’m representing the game play of this game. I exist because <these keystrokes> were used to play the game using <this seed>.” The keystrokes, the seed, the game engine are all software working together to reproduce the game play data of the transaction, to verify that the transaction is indeed what it claims to be. Every machine on the network computes this result to verify the game data matches the claim of the game data.

This computation happens in milliseconds. The efficiency of the game embedded into this custom consensus rule of gameplay makes it thousands of times more efficient than a virtual machine built on top of the blockchain that interprets a limited set of commands. There are no gas costs and there are no blockchain limits for native computer code running in this way.

Global Cross Platform Save Game Data

Suppose a gamer wants to bail and save their game. No problem, save it. Save it to the blockchain. Pick up another device, load up your profile, reload it - pick up where they left off. The devices do not need to be on the same game network. The devices don’t need to be of the same capabilities. One implementation of the game logic and it’s algorithms could be through a VR headset - the other, on a portable device with character animations. The gameplay, is verifiable. The artwork, the music the cut scenes...this goes back to the production value - the economic output of different professionals (or indie devs) trustlessly receiving ongoing payments through the in-game economy.

The same save game data, the same game data, the same algorithms - different implementations. It’s like a phone call on an Android device compared to an iOS device. The phone call data is agnostic - the implementation could have a bluetooth headset on one end and the other on speaker phone. The phone call is the blockchain game.

Game NFT Token Trading

Save game data is valuable. A gamer put some resources into their save game data. Maybe it’s their player profile or avatar. Maybe it’s some magic super-human power-up. Someone will likely want it. These game objects can be tokenized and in the case of player data that played a unique number of games and results - a non-fungible token. A unique token.

Komodo blockchains all feature a consensus module that enables an on-chain Token DEX. These tokens of your game data are part of the consensus (from the game consensus module).

The token DEX consensus allows trades to happen. Bids/asks/offers/fills/cancels— they’re all part of the rules— and these trading actions are confirmed in transactions that affect some exchange of value. The NFT (or the normal tokenized game objects like super human power-ups) can be exchanged on this token DEX!

To get more updates from Komodo, sign up for our weekly Five Bullet Fridays newsletter and join our active community on Discord.

Join us as we continue to develop and lead the blockchain industry into the future.