The Future of Blockchain Games: GameBoy on Tezos L2 Deku
Last week developer Daniel Hines showed how he ran a Game Boy console emulator with Pokemon Red on Deku. All the game processes, including rendering, run on-chain!
In this post, we’ll explain how insanely cool this is for blockchain and what can run on Deku-based sidechains, at least in theory.
What Is Deku
Since these are not rollups, the sidechains created with Deku must have their own nodes and consensus algorithm. Sidechains are linked to Tezos through smart contracts in the Tezos network, in which the state of the sidechain is regularly updated.
Deku enables higher throughput (transactions per second) than any other solution. Theoretically, the speed of block creation in the sidechain can be limited only by the latency of network equipment, i.e., be under 100 ms. This feature gives way to launching any apps on the sidechain, from DeFi to games. See more details in our review.
Pokemon Red on Deku
Daniel Hines created a sidechain for the OCaml emulator of GameBoy called CAMLBOY. He wrote a VM that saved the emulator’s state and the display output in each block. The emulated console’s inner clock was linked to the speed of block creation on the sidechain. In this case, the sidechain can be called an application-specific blockchain or an appchain.
Daniel ran four nodes on the working machine with a sidechain and an emulator, which reached consensus and recorded the state of the emulator and five frames per block. The frames were rendered in a separate process, roughly speaking, in the game client.
To better visualize the value of the work done, imagine that a developer has implemented a GameBoy emulator into a smart contract on Tezos. Every cycle of the emulated processor, button press, and in-game event is recorded in this contract. If someone did this, the game would generate one frame every 15 seconds, i.e., once per block. But Deku is network-responsive, generates blocks at the request of the client, and, if the hardware is powerful enough, can render a game at 60 FPS.
How Appchains Can Change Blockchain Games and Apps
In 2014, an anonymous dev from Australia launched Pokemon Red on Twitch and transferred control to the viewers. They sent commands to the chat, and the emulator executed them. Because of input delays and the fact that everyone wrote commands ignoring all other players, the protagonist spent several days walking around in circles, saving every few seconds, and looking through Pokedex. Finally, however, the viewers cooperated and beat the game in 16 days.
This multiplayer format in a single-player game can be implemented on Deku. Players send commands, and the sidechain’s virtual machine determines the majority opinion and sends the result to the emulator input. All players get a new game state in the next block.
This is just one example. Almost any game or application that requires updating the state 1-2 times per second can be implemented on an appchain. For example, classic MMORPGs like Runescape or turn-based Rogue-like games should run as smoothly on the Deku sidechain as on centralized servers. That said, decentralized versions of the games will have advantages over centralized versions:
- Complete and verifiable history of game states. It will enable resolving disputes, including dupes or bug exploitation;
- Built-in monetization. Gamers pay transaction fees for performing actions to the sidechain node owners;
- Simplified registration and increased security. Users log in via wallets without using third-party 2FA, email confirmation, and any risks of losing access through password restoration or brute-force hacks.
Aside from games, sidechains could improve any other decentralized apps. Thus, DeFi teams could create an appchain with a built-in trading core to launch a DEX with an order book, while NFT fans could start collective graphic projects like this famous social experiment.
Subscribe and never miss updates from the world of Tezos: