What is the "AMM moment" of the whole chain game?

When we describe the revolutionary impact of a product, technology, or innovation in a particular industry, we like to say it’s the industry’s “iPhone moment.” Because this is based on the profound impact it had on the entire cell phone and mobile computing industry after Apple released the iPhone in 2007.

In the DeFi industry, we call it the "AMM moment". Because the AMM model has played a key role in the DeFi field, especially in improving market liquidity, it directly contributed to the arrival of the bull market in 2021. So, what is the "AMM moment" of the whole chain game? We find out in this article.

An important role of AMM in DeFi

DeFi is a combination of blockchain technology and the financial field, that is, writing financial rules into smart contracts to achieve decentralization, privacy and automation. Since it is in the financial field, what is the most critical aspect of various projects? Obviously "liquidity". For example, the three major business models, lending, trading and payment (stable currency business), if there is no liquidity, the three businesses cannot be continuously developed.

1 Lending: Liquidity is the core of the lending business. Banks and other financial institutions rely on short-term deposits and other sources of funding to provide long-term loans. If financial institutions cannot secure sufficient liquidity, they may not be able to meet the loan needs of their customers, or may face difficulties when they need to repay short-term debt. Liquidity risk is a key factor in financial crises, as banks can collapse when they cannot secure enough funds to meet their loan commitments.

2 Trading: In the capital market, liquidity is the key to trading. High liquidity means assets can be bought and sold quickly without losing value. If a market or asset is illiquid, investors may face wider bid-ask spreads or struggle to find buyers when they want to sell an asset. This can lead to wild price fluctuations and market instability.

3 Payment (stablecoin): The liquidity of the payment system (stablecoin) is crucial. When people or businesses need to move money, they depend on efficient, reliable payment systems. If the payment system (stablecoin) lacks liquidity, it may cause payment delays or failures, thereby affecting the operation of the entire economy.

In Web3, transactions are the core of financial business, because both lending and payment exist to serve transactions (adding leverage and acting as a transaction medium). So why is there an "AMM moment"? This is due to the performance limitations of the blockchain itself.

We know that the financial rules of centralized financial institutions are placed on their own high-performance servers, so the matching efficiency is extremely high, and DeFi brings decentralization by putting financial rules in smart contracts, sacrificing matching efficiency and privacy advantages.

As a simulation of the "world computer" layer, smart contracts have relatively low performance. In the initial DeFi project, whether it is a loan or an exchange, the matching method is based on the order book model of traditional finance. In this mode, DeFi has no power to fight back against CeFi until the emergence of AMM.

How to use the ultra-low-performance "world computer" to greatly improve the efficiency of liquidity matching? The solution to the AMM model is to use capital pools and algorithms to automatically match. The specific gameplay has already been introduced in many articles, so it will not be discussed here. In terms of advantages we now know:

1 No need for traditional market makers: In traditional financial markets, market makers usually need to provide quotes for buy and sell orders to ensure market liquidity. The AMM model allows liquidity providers to deposit funds into a smart contract, which automatically adjusts prices and executes transactions according to predetermined algorithms, eliminating the need for traditional market makers to intervene.

2 Liquidity pool: The liquidity pool in the AMM model provides traders with an always available counterparty. Liquidity providers can deposit funds into these pools and receive transaction fees in return, incentivizing more participation and increasing market liquidity.

3 Reduce transaction friction: Due to the automated nature of AMM, traders can trade at any time without waiting for traditional buy and sell orders to match, thereby reducing transaction friction.

4 Promoting DeFi Innovation: The AMM model has brought many new innovations to the DeFi field, such as liquidity mining, dual-currency liquidity pools, etc. These innovations have further promoted the development and popularity of DeFi.

The innovation of the AMM mechanism actually made DeFi's liquidity matching efficiency comparable to that of CeFi, and finally brought about DeFi Summer.

What is the essential contradiction between games and blockchain

Now the full-chain game has come to the same moment as DeFi: how to run a game on an extremely low-performance "world computer"? This requires an in-depth analysis of what is the essential contradiction between the game and the blockchain.

I once wrote an article "What is the difference between the full-chain game engine architecture ARC and ECS?" ", which introduced the concept of the game loop, and pointed out that traditional games are loop-based.

Traditional games are loop-based because their core operating mechanism is the game loop. A game loop is an iterative process that typically consists of processing user input, updating game state, and rendering the game world. This loop continues while the game is running, typically running tens to hundreds of times per second to keep the game world flowing. In this architecture, game systems (such as physics engines, AI systems, etc.) inspect and process the game entities and components they care about in each loop.

However, the architecture of the blockchain is push-based. Blockchain is a distributed database that shares and stores information through nodes in the network. When a node generates a new transaction (such as transfer, contract call, etc.), the transaction will be pushed to the network, and other nodes will verify it and add it to the blockchain after receiving the transaction. This is a passive process, nodes will not actively search for new transactions, but wait for other nodes in the network to send new transactions. Therefore, the architecture of the blockchain is said to be push-based.

In fact, this passage has already answered the above question. Game architecture is generally loop-based, while blockchain architecture is push-based. This is the essential contradiction between games and blockchain. So how to solve this contradiction? It can be said that as long as this contradiction is resolved, the "AMM moment" of the whole chain game will be ushered in.

For a more in-depth discussion, let's look at how the game implements the game loop.

Every game consists of a sequence of getting user input, updating game state, handling AI, playing music and sound effects, and displaying the game. This sequence is handled through the game loop. We won't discuss any of the above tasks in detail for now, but will focus on the game loop itself, so the task can be reduced to just two functions, updating and displaying the game. Here is sample code for a game loop in its simplest form:

bool game_is_running = true;

while( game_is_running ) {

update_game();

display_game();

}

First introduce three terms:

Tick

Tick is a synonym (onomatopoeia) for game loop, 1 tick = 1 game loop

FPS

FPS is the abbreviation of Frames Per Second. In the context of the above implementation, it is the number of calls to display_game() per second.

GAME SPEED

The game speed is the number of times the game state is updated per second, or in other words, the number of calls to update_game() per second.

To sum up, Tick/Game Loop is the basic cycle of the game, which determines how the game logic is updated. FPS is the number of frames rendered per second, which determines the visual fluency of the game. Game speed is how the game logic progresses, usually equal to the tick rate. Ideally, tick rate, FPS and game speed should all be equal, which means that every logic update will have a corresponding render. In practice, however, the three may differ, especially if performance is limited or there are other technical limitations.

Three core challenges of full-chain games

With the above understanding, we can now discuss the core challenges in full-chain games.

1 Mismatch between game loop and blockchain: Traditional games are based on the game loop (game loop), which means that the state of the game is updated every tick or frame. However, the blockchain is event-driven, and only when there is a new transaction or operation will the update of the state be triggered. This fundamental mismatch does complicate implementing traditional game loops in full-chain games.

2 Delay and real-time: The transaction confirmation time of the blockchain may cause a delay in the response of the game, which is a problem for games that require fast response (such as action games or competitive games). An effective ticking mechanism needs to take this delay into account and minimize its impact on the game experience.

3 Resource limitation and computing cost: Each update of the state of the blockchain requires computing resources and may incur fees. In full-chain games, frequent state updates can lead to high fees. Therefore, an efficient ticking mechanism is needed to balance the fluency and cost of the game.

If a new ticking mechanism or game loop model can be developed that adapts to the characteristics of the blockchain, this will indeed be an "AMM moment". This may require a combination of traditional game development techniques and blockchain features to create a brand new game framework.

So are all game types loop-based? While most game types are indeed loop-based, however, there are also some "push-based" games that do not require constant, real-time state updates. For example, turn-based strategy games, board games, or certain card games. In these games, the state is only updated when the player takes an action, which is more similar to the event-driven model of the blockchain. Therefore, For full-chain games, you can really consider developing games that are more in line with the "push-based" model first, so that you can more naturally adapt to the characteristics of the blockchain.

Four-tick chain is the AMM moment of the whole chain game

Scott, the founder of Argus, also expressed the same opinion:

The game operates on a loop-driven runtime. State transitions continue to occur even without user input. The fire continues to burn, the water continues to flow, the crops continue to grow, and the cycle of day and night continues.

So how can we design a ticking mechanism suitable for the blockchain? @therealbytes has the answer. I once translated his classic article "How to use OPStack to build the clock cycle of the whole chain game", which gave a very detailed explanation on how to use smart contracts and pre-compiled contracts to construct the ticking system, but unfortunately, because On a more technical level, this article has the lowest page views of all my articles. Similar to Vitalik's article "Let's run on-chain decentralized exchanges the way we run prediction markets" that introduced AMM in DEX, in that classic article, the famous constant product formula "A * B = k".

(An interesting point: At that time, there was no name for DeFi, it was just called On-chain decentralized exchange, just like now we call full-chain games On-chain games)

In this article, therealbytes should be the first to propose using the pre-compilation of the chain itself to implement ticking: Ticking-Optimism modifies the rollup node to create a "tick transaction" (tick transaction), which works in the same way as "deposit transaction ” same, but instead of setting the L1 property, call the tick() function in the contract pre-deployed to address 0x42000000000000000000000000000000000000A0. This contract can call another contract by setting its target variable.

Integrating the Ticking function into the nodes of the chain is a huge improvement in loop efficiency. This can be completely compared to the huge improvement in matching efficiency between the AMM model and the Orderbook model in the DeFi industry. Just how huge is it? For the data, you can refer to another article I translated, "Timekeeping for the "Digital God"":

In order to fully test the limits of the chain itself, he implemented the game in two ways: one as a Solidity smart contract running on the chain, and the other as a precompilation of the chain itself. The Solidity implementation is maxing out the CPU after reaching a 70x70 grid with two updates per block (1 block/sec, or about 10k cells/sec), while the custom precompiled engine's chain is using about 6% The same rate was achieved for a 256x256 grid with a higher CPU (approximately 130k cells/sec).

Five summary

If the AMM model ensures that the financial system can also have high matching efficiency and liquidity on the low-performance blockchain, then the Ticking Chain (Ticking Chain) ensures that the game system can also have high matching efficiency and liquidity on the low-performance blockchain. It can also have high loop efficiency and fluency.

The above is just a proof-of-concept of therealbytes, but in practice, there are already full-chain game engines that have started to use this tick-tick chain mode. The first open source tick chain engine is @0xcurio, they use OPStack with precompiled ticking function to build layer2, the second open source tick chain engine is @ArgusLabs_, they use Polaris to build a Precompile layer2 of the ticking function. I believe that there will be more tick chains in the future.

The above table is a comparison of blockchain applications in the financial and gaming fields. It can be seen that the two do have great similarities. The Orderbook model used by DeFi at the beginning is an active matching system (Matching). After changing to AMM, it becomes a passive automatic matching system. Similarly, the full-chain game started to use the conventional "lazy update" and "manual ticking" to carry out the active game loop. After changing to the pre-compiled ticking chain, it becomes a passive automatic game loop. AMM improves the liquidity of finance, and the tick chain improves the fluency of the game.

View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Share
Comment
0/400
No comments
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)