Turning the impossible into possible Making full-chain game development on the Lightning Network a reality

Transforming the Unattainable into Achievable Actualizing Full-Chain Game Development on the Lightning Network

Author: Infinitas

Introduction

“Whole-chain games refer to games and NFT ecosystems that run entirely on the blockchain, attracting various game giants and investment institutions to layout and attempt.” Currently, whole-chain games have not found the optimal scalability solution while ensuring security, privacy, and decentralization. For example, the most popular whole-chain game engines Mud and Dojo are dedicated to helping whole-chain games achieve higher TPS, but players still need a buffer of more than 2 seconds for each operation. In fact, the current highest TPS of whole-chain games on the blockchain can achieve a peak of around a few thousand TPS, which is a huge gap compared to traditional Web2 3A games with TPS in the hundreds of thousands. In pursuit of not losing the advantages of the blockchain, whole-chain games need to overcome scalability.

So, can the “spring of whole-chain games” be achieved in the end? Maybe not. This article, co-authored by the blockchain underlying infrastructure project Infinitas and the game platform CrystalFun, takes their Outerverse native four games as an example to explore how the Bitcoin ecosystem can make the landing and large-scale popularization of whole-chain games possible.

How can Lightning Network and RGB Protocol help solve the dilemma of whole-chain games?

In whole-chain games, the core logic, rules, and in-game interactions are fully on-chain, realized and verified through smart contracts. Game assets and virtual items also exist in the form of blockchain, allowing players to directly own, trade, and transfer these assets without relying on centralized servers of traditional game companies. The complete decentralization of core game logic and in-game assets empowers players with higher autonomy and security.

As a second-layer scalability solution built on the Bitcoin blockchain, the Lightning Network extends the design space of on-chain games by moving transactions off-chain while retaining the underlying security and transparency of the blockchain, thus enabling fast and cheap transactions.

The Lightning Network helps to expand games to more users and usage scenarios while balancing the decentralization and scalability of the blockchain. Developing whole-chain games using the Lightning Network can better improve the speed of in-game transactions and enhance the user experience.

However, even if the Lightning Network solves the scalability issue, some core game logic still needs to be on-chain, such as writing the final results of immutable records or state changes to smart contracts. The Lightning Network has not yet solved the problem of smart contracts, so it is only a supplement to on-chain interactions, not a complete replacement.

7lsw9nTEPDqI6tTl0WYmyO3THTGnC6r39uWB1CAg.png

RGB is a client-validating state and smart contract system that runs on the second and third layers of the Bitcoin ecosystem. In abstract terms, RGB establishes a self-managed contract management system on the Bitcoin blockchain, where users verify and execute state changes, including assets and contracts. When users initiate transactions and invoke a contract logic, the execution of the contract and the change in asset state do not require consensus across the entire network but only need verification and consensus between the two transaction parties.

By using the Lightning Network, the RGB protocol operates on top of the Bitcoin transaction chain, but without the problem of Bitcoin time chain congestion: transactions only retain the same state commitments, without the need for additional on-chain storage. Whether it comes from the Bitcoin blockchain or the Lightning channel (or any other type of state channel), RGB can work as a second-layer solution on top of Bitcoin, or as a third-layer solution on top of the Lightning Network.

Powering Full-Chain Gaming Support Tools

The blockchain itself, as a valuable on-chain resource state machine, is difficult to handle the redundant call demands in high-frequency interactive scenarios like gaming. Therefore, in addition to integrating with the Bitcoin second-layer Lightning Network, to truly run games, it is also necessary to write game logic and assets in Bitcoin ecosystem smart contracts. Hence, some supplementary technical stacks and tools for on-chain interaction are indispensable.

Ephemeral Chain

An ephemeral blockchain can be defined as a blockchain that will not exist forever. Once the purpose of the blockchain is achieved (such as recording transactions) or once its state is permanently stored elsewhere, it is destroyed. The termination state stored in the ephemeral chain consists only of data related to the termination facts of the ephemeral chain, compressing all the content to a considerable extent. Ephemeral chains are mainly constrained by transaction latency and throughput on the blockchain.

Ephemeral Chain vs. State Channels

Regarding the ephemeral chain, due to the presence of state on the public chain, we will ultimately have a large number of users. The states that need to be inserted into the public chain will be reduced in size through pruning/compression/differential extraction and then regularly, instead of irregularly, saved on the public chain. RGB state channels have the potential to bypass the performance constraints of the ephemeral chain and achieve the same functionality.

State channels have so far been designed for a small number of users. The most noteworthy aspect is that state channels are primarily designed for a large number of off-chain transactions between two users conducted simultaneously. Each RGB smart contract is created by the smart contract issuer (or simply the issuer) and stored as data saved in the form of “genesis state” on the blockchain or in Lightning Network transactions/channels, commonly referred to as Unspent Bitcoin Transaction Outputs (UTXOs) and the process is known as “one-time sealing.” The RGB protocol state transition process allocates states to a defined set of one-time seals. Each smart contract can maintain different forms of state and define different types of one-time seals with different validation rules. In addition, state transitions may involve different metadata and scripts, which are also part of the business logic.

App-Specific Blockchains

App-specific blockchains are blockchains created specifically to run a single decentralized application (dApp). Developers do not build on existing blockchains but instead build new blockchains from scratch using a custom virtual machine (VM) that executes transactions involving user-app interactions. Developers can also customize different elements of the blockchain network stack – consensus, network, and execution – to meet specific design requirements. Enhancing smart contract execution speed and solving computational resource constraints can help make app-specific blockchains a reality. Allowing developers to customize infrastructure for different use cases makes development easier. It also enables Web3 developers to build powerful value models and scale their dApps to meet exponential growth demands, inspiring more innovation.

Specific Application Blockchain vs. Bitcoin Layer 2 Mold “schema”

In RGB, there is something called RGB Schema. It is a set of rules that define how contract states evolve over time. However, unlike Ethereum or any other blockchain-based smart contract platform, Schema requires programming of the operational algorithm.

The “schema” defines which types of states, sealing, metadata, and script extensions are allowed in state transitions. Schema can be considered as validation rules for client verification; the schema is always defined by the issuer in the state origin, containing Turing complete scripts that define part of the business logic for client verification.

Mod2S3kJYZkMP1cHMYyNv9AjdCL0rnynK9oH9Jik.png

Source: Infinitas Architecture

As shown in the diagram, the left arrow represents a few users who can directly access smart contracts by building their own nodes. The right arrow represents commercial nodes that use cloud computing technology to ensure secure and reliable operation, helping users manage a large amount of off-chain smart contract computing data and contract computation verification.

All contract logic and code are stored in the “schema”. Contract deployment or project owners do not need to write code; they only need to use the appropriate “schema” for parameter configuration to deploy contracts. Developers use suitable molds to customize infrastructure for different use cases, making development easier and achieving the same functionality as specific application blockchains.

Battle Rollup

Battle Rollup is a technical mechanism primarily used to simplify the battle process in blockchain games. By batching and summarizing the battle actions between players into one block, Battle Rollup can reduce the number and cost of transactions, improving the performance and playability of blockchain games. Instead of recording every step, we can package and summarize the overall results of several moves after a player’s multiple actions.

Battle Rollup is mainly limited by transaction costs on the blockchain and blockchain processing speed.

Lightning Network helps complete Battle Rollup “packaging”

  • Scalability: The Lightning Network can process millions to billions of transactions per second. Its capacity exceeds traditional on-chain payment methods by multiple orders of magnitude. It is now possible to attach payments to each operation/click without intermediaries.

  • Low cost: Through off-chain transactions and settlements, the Lightning Network can charge extremely low fees, enabling new use cases like instant micro-payments.

Engine for On-Chain Games

The Engine for On-Chain Games is a specialized engine tool for developing blockchain games. It provides a development framework and tools to help developers build game logic and interactive features on the blockchain. More versatile smart contract programming languages and development tools assist developers in on-chain game engine development.

The first engine to support the ETH ecosystem is the MUD engine developed by Lattice. Gradually, game engines that support different ecosystems and use different programming languages ​​have emerged, such as DojoEngine used by starkware. Game engines like MUD and Dojo simplify the development process, provide rich libraries and tools, and enable developers to create blockchain games more efficiently.

RGB “Contract Schema” reduces the barrier for developers

In the current world of smart contracts, it is common for smart contract creators (companies issuing assets, DAOs, DeFi engineering teams) to organize or execute smart contract code development.

The biggest drawback of this development organization method is that it leads to higher contract code vulnerabilities and multiple hacking attacks. Since the contract publisher may not be an experienced developer and cannot require the outsourcing company to write smart contract code from scratch and audit its results for each contract published. Therefore, the roles of contract programmers and contract issuers must be separated. RGB introduces the concept of “Contract Schema” contract pattern. Contract patterns are the actual code of smart contracts that issuers can use as “contract templates” without having to code or review customized code written by a random outsourcing company for them. This design greatly simplifies the barrier for developers to develop and maintain smart contracts.

Synchronization Mechanism

Another concern is synchronizing on-chain state with game state. This is crucial for ensuring the integrity of the game and transactions. Improper operations can lead to user asset data leakage, duplicate items, or various other issues. Therefore, the confirmation of each step’s transaction order and transaction time is crucial.

For example, let’s imagine a scenario with two players, Player A and Player B. Player A wants to trade 20x DNA (an in-game token) for Player B’s sword (represented as an NFT). Here is an example of synchronizing on-chain and off-chain:

  1. Player A and Player B agree to trade 20x DNA for the in-game sword.

  2. The trade begins on-chain, and the digital assets are published to an on-chain escrow contract.

  3. The game queries on-chain data to understand the activity.

  4. The game state changes according to on-chain activity.

  5. Manage game activity, update items in the off-chain database, and the transaction appears in each player’s game account.

  6. The escrow contract releases the on-chain digital assets to the wallets of Player A and Player B.

Lightning Network achieves transaction synchronicity

The synchronicity of the Lightning Network is achieved through the use of transaction locking. When two nodes establish an off-chain payment channel, they can conduct multiple transactions within the channel without submitting each transaction to the blockchain. These transactions are locked in the channel until the channel is closed and the transaction results are uploaded to the chain. This locking mechanism ensures transaction synchronicity, without worrying about block confirmation time, with payment speeds in milliseconds to seconds.

Through the above in-depth discussion from different perspectives on the tools for the whole-chain game auxiliary: temporary chain, specific application blockchain, battle rollup, whole-chain game engine, and synchronization mechanism, in order to facilitate better imagination and understanding, we will continue to share various application scenarios in the underlying construction and architecture of Outerverse in Infinitas.

Outerverse

OUTERVERSE is a combination of games launched by Crystal Labs, with the open-world star wars theme as the core of a series of large-scale multiplayer online role-playing games (MMORPGs). It includes a total of four different game categories: the main game “OUTER”, the spin-off game “OUTER: StarFall 2312”, and the derivative games “OUTER: Survivor” and “OUTER: Endless War”.

The background settings of these four games will take place in the same world view system, and the economic ecosystems between the games will also be interconnected. The developers hope to attract gamers with different preferences through games of different categories. Let’s take a look at the future solutions of whole-chain games in the Bitcoin ecosystem from these four different types of blockchain games.

OUTER

OUTER is an MMORPG with a space-themed star war. In MMORPGs, there are a lot of combat processes that require real-time calculation. For example, if A attacks B, B needs to provide feedback on the damage received in an instant. These calculation processes are extremely complex and require reading a large number of parameters from the game characters to obtain real-time combat results.

In traditional web2 games, in order to improve computing efficiency, the overall computation is performed in centralized servers. This solution does improve computing efficiency, but does not guarantee the security and transparency of the computation. Players can only assume that the official servers will not make mistakes or act maliciously.

For example, in OUTER, when player A and player B’s spaceships encounter each other in battle, they need to obtain more than a dozen combat attributes of both spaceships, such as their health, firepower, armor, and penetration. These attributes are calculated to determine the damage caused in the battle and the losses of each spaceship. Finally, the status of the spaceships after the losses is recorded in a centralized database.

Let’s simplify the combat model in the game: “A and B engage in a battle, A can cause x points of damage to B, and B will have y points of health left after taking the damage.” We can see that x is an intermediate value that needs to be generated through real-time calculation, and y is the resulting value that needs to be written back to the game data. In traditional web2 games, the calculation process of x value is performed in the memory of the centralized server, and after the calculation is completed, the y value is generated and then written back to the server’s database.

And if the real-time computation in OUTER is applied using the Lightning Network, then the real-time computation needed in the game can be done through the Lightning Network to generate the value x, which is the damage value A inflicts on B. The final result, value y, is then written onto the blockchain. By combining “off-chain computation + on-chain ledger” in a similar way, it is possible to implement game mechanisms that are too slow or costly on-chain. This way, the security and transparency of the underlying blockchain are maintained, while the game is expanded to more users and use cases without sacrificing decentralization.

In addition, for large multiplayer online games like OUTER, due to the complexity of the game ecosystem and the variety of items, the transactions between players will also be very frequent (such as the existence of nearly a thousand different items in OUTER). The settlement performance of the Bitcoin Lightning Network may be a good solution for payment settlement between MMO blockchain game players.

STARFALL 2312

Let’s take a look at STARFALL 2312, the second game under the OUTERVERSE umbrella. This is a card-based RTS blockchain game. Unlike large multiplayer online games like OUTER, STARFALL is a game with a single-match competitive gameplay. Whether it’s 1v1 or 2v2, players enter a single match after being matched and engage in battle, similar to “StarCraft”. Single-match competitive games do not require high real-time calculations and multiplayer online loads, but they do have strong requirements for anti-cheating measures.

From LAN matchmaking in the early days to Battle.net matchmaking today, cheating in competitive games has always been a long-standing issue. Imagine you’re still mining and developing technology to build riflemen in your home base, while your opponent has already formed a fleet and is bombarding you with cannon fire, leaving you defenseless. And what you most want to know at this point is whether your opponent is using cheats. Many players have the habit of watching replay recordings after playing competitive games, and the principle of replays is to record all the player’s actions in the gameplay and then restore them through the client. However, many replays are local files, which can hardly guarantee transparency and tamper resistance.

Synchronization is an important mechanism for ensuring consistency between players’ actions and states. The synchronization mechanism can use blockchain and smart contracts to ensure synchronization of players’ actions and states, and guarantee the fairness and credibility of the game. If every action the player takes in the game can be written onto the blockchain, it ensures that all players’ actions are public, transparent, and traceable. This may be a solution to the anti-cheating problem in competitive games.

Survivor

Survivor is a blockchain game of the starship Roguelike genre under OUTERVERSE. It is a light single-player casual game that can be picked up in just 10 seconds. The biggest appeal of this type of game for players is simplicity and responsiveness of controls. When the player starts the adventure, their ship will be loaded into a predefined level for them to explore. If this part of the game can be decentralized and put on-chain, the precompiler in the smart contract might be a good choice.

The precompiler is similar to the “preloading” principle in traditional games, which means preparing resources in advance and reading them when needed. The smart contract precompiler, designed for specific application scenarios, provides specific functionality and computing capabilities in full-chain games. By designing level resources in advance and reading them during real-time gameplay, the execution speed of game logic is accelerated, transaction costs are reduced, and full-chain games can achieve higher scalability and efficiency.

Endless War

Endless War is a full-chain game developed by OUTERVERSE. Players start from a certain planet and use existing resources to develop their economy and technology, build their own fleet, and colonize foreign star systems for profit. The player’s battles in the game involve assembling their own fleets and all battles take place on the blockchain. Battle rollup technology can be used to simplify the battle process in the game: by batch processing and summarizing the battle actions between players into one block, battle rollup reduces the number and cost of transactions, and improves game performance and playability.

Other Challenges of Full-Chain Games in the BTC Ecosystem

User Onboarding

Since the game is fully on-chain, players may have to sign every popup window for actions in the game, which would result in a poor user experience. The simplest solution to this problem is more secure wallets, but there are potential security risks. Currently, game developers do not want players to hold high-value items in their wallets. However, as more and more players join, the wallet problem of full-chain games will eventually be resolved.

In the future, full-chain games may be combined with technologies such as account abstraction, batch transaction processing, signing, and delegated signing. This means that some routine operations in the game, such as the next 20 steps, do not require signing or can be simplified using delegated signing. This integration will bring more efficient interaction and gameplay experience to the game.

Another aspect is the onboarding of developers to encourage and attract game modders to contribute and extend the game, which will increase the value of the game’s autonomous world. This is mainly achieved by providing developers with appropriate tools and giving them proper incentives.

Economic Monetization

The social consensus on the client-side verification rules of RGB also ensures that every other owner of an asset will apply the same verification rules. Each asset/state verification rule is defined by the Schema at the genesis level, which means that every subsequent owner of the asset still uses the same Schema to verify the history. Therefore, the Schema here actually guarantees consensus on verification and serves as a means of distributing incentives.

With the promotion of RGB economic incentives, economic incentives within full-chain games will become clearer. By adopting social consensus and electing the best schema through token voting, project parties can make payments, authorize usage, and Schema project parties can receive dividends. A clearer incentive mechanism will also contribute to the quality of full-chain game development, ensuring that players have fun in the game.

Conclusion

The design of the RGB architecture profoundly redefines consensus rules, injecting powerful momentum into the blockchain ecosystem of the new era. Under this innovative consensus framework, RGB achieves excellent execution efficiency and remarkable privacy, successfully overcoming the traditional impossible trilemma. This breakthrough design not only brings a qualitative leap to blockchain technology but also creates ideal conditions for the widespread adoption of fully chain games. What’s even more remarkable is that the launch of the RGB extension scheme not only integrates the RGB architecture with the Lightning Network but also provides developers with more convenient tools, lightweight clients, and a brand-new BTC ecosystem economic model. This comprehensive extension scheme makes RGB not only a technological innovation but also an upgrade to a comprehensive decentralized infrastructure. Under this optimization, fully chain games that have been hindered by Ethereum are expected to find new opportunities for vigorous development within the Bitcoin ecosystem.

This integration will open up a new chapter for the future development of fully chain games, bringing more possibilities for application forms and business models. Therefore, we have full confidence in the RGB architecture and its extension scheme, believing that it will have a profound impact on the blockchain industry and drive fully chain games towards a more prosperous future.

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Tens of millions of investments are frequent, policy blessing: blockchain will prove value in 2020

Every reporter Panting Source: Daily Economic News In 2019, blockchain technology was mentioned several times in offi...

Blockchain

Interpretation | Internet of Things + Blockchain Series: Where are the current limitations?

Relying on blockchain technology, IoT devices can have more autonomy to complete independent decisions, coordinate wo...

News

At the 5G Chain Network Industry Innovation Summit, consider the impact of super-smart rise on 5G, artificial intelligence and blockchain

“When human springs of artificial excitement and artificial intelligence come, panic and artificial intelligen...

News

Gong Ming: Crypto War, Blockchain Technology Road

On October 31, the Wanxiang Blockchain Hive Academy Open Class organized by Wanxiang Blockchain Lab and Xinchain Spac...

Blockchain

Featured | Ten disasters in the history of Ethereum; how DeFi cannibalize PoS security

Today's content includes: 1. The top ten disasters in the history of Ethereum. 2. Network effects in a decentral...

Blockchain

Opinion: Excessive speculation that privacy coins will die

Author: Jarosław Adamowski Translator: Summer Source: Unitimes The ambitions, patents, and inevitable risks of ...