Translator's preface: "This article is compiled from a long Twitter post by the two founders of Primodium. It systematically introduces how the Primodium team reduces gas consumption and storage during game development. Players’ resources in the game. And why financialization is also indispensable for the entire chain of games.”
01. How Primodium works Lazy Update
Author: Emerson Hsieh
Original link: https: //twitter.com/intemerson/status/1740787479203004559
A game on the entire chain will inevitably consume a lot of gas, so we must find ways to reduce player signatures The number of transactions. After introducing lazy update, we only calculate the required game resources when the player performs an action.
In the first version of Primodium, players had to place miners next to nodes before they could place conveyor belts to transport resources to the main base.
When players claim resources from their home base, we have to figure out the following:
How to track the mining rigs owned by each player;
Let these mining rigs connect to The right processing plant;
Our first solution is to perform depth priority from the player's main base when extracting resources search. Players can place up to four miners next to each block.
When we introduced factories that harvested resources from miners, players began to build more complex structures to optimize resource output. For example, player @CincauHangus created the following factory design:
After @AlirezaN95 joined our team, he redesigned the resource components we developed based on MUD. In v0.6.0, we gave each player a global resource production rate that increases every time a miner is built on the resource.
This makes updates atomic, and every time a player performs an action, we can quickly calculate the total amount of resources through their productivity. And when they build factories and consume resources to produce items, the resources consumed are simply deducted from the global productivity.
In subsequent versions, we found that player participation declined after building the mining machine. This may be because the construction mechanism of the mineral conveyor belt made some players Confused.
By setting global resource production rates, we can completely remove mineral conveyors and teleport nodes, allowing for more complex gameplay in Primodium today.
In our latest release, we’ve redesigned how resource productivity is stored and calculated in smart contracts, laying the foundation for exciting new features to come.
02. How Primodium stores player resources
Author: Emerson Hsieh
Original link: https://twitter.com/intemerson/status/1742214023809306953
In Primodium, you will be born on a resource-rich asteroid. Collect resources by building mining machines and use these resources to strengthen buildings, train armies, and attack other players.
Miner and mineable resources can be seen in the above picture
Using Lattice's MUD In the initial version of Primodium built on the V1 engine, all smart contracts were developed around the Entity Component System (ECS) architecture.
Initially, I designed a separate new contract for each resource. This approach allowed the client to track the amount of each resource individually, but as the complexity of the game increased, it created an overhead that was difficult to handle.
For example, in Primodium v0.0 (eleven versions ago!), 63 contracts were needed just to store player items. @l_udens proposed a working solution: use a hash of the resource name and player address as a unified component key to simplify everything into a single component.
Over the coming months we will continue to increase the content and complexity of the game. More resource items enrich the player experience, thereby increasing player retention rate.
The picture below shows a complex base built by an enthusiastic player in the current beta version of Primodium!
We also upgraded the game engine to the MUD V2 version, which means we have to reconstruct the contract structure of our resources.
@0xhank redesigned the contract, using a table with entities and resources as key schema, avoiding additional hash calculation steps .
When players build factories or mining machines, the productivity of related resources will increase. For example, building an iron mine increases iron production rate. Likewise, building factories that use iron (such as iron plate factories) will increase the rate of iron consumption.
Through the store hooks system built by @AlirezaN95, the game can update the production rate and consumption rate in real time, thereby changing the player's resource amount. Every time the player takes an action, the resource count is updated.
Before the player executes the transaction, the client will display the predicted resource value in advance on the panel designed by @0xNAB5. In future versions of Primodium, we plan to conduct deeper technical exploration and open our contracts to facilitate the community to explore new gameplay.
03. Why financialization is also indispensable for full-chain games
Author: Tax cuts
Original link: https://twitter.com/tax_cuts/status/1740453166875877768
Because the Play to Earn game has brought too many disastrous consequences in the past, developers have turned to full-chain games and sought different ways to integrate Crypto into the game. The main point of view on full-chain games is that it increases the composability and permanence of the game, while the financial part is often strongly resisted.
But I think financialization is still very important:
Financialization is the fundamental reason why cryptocurrency exists as the underlying architecture. Imagine if I run the Bitcoin protocol on my PC and he can show you have 1 BTC and I have 5 BTC, no one will give a real value to Bitcoin which lacks decentralized consensus. Because I can tamper with the background data at will and say that I actually have 50 BTC.
It can be seen that running the Bitcoin protocol on a centralized server relies on trust in the centralized server. In the crypto world, the decentralized consensus on who holds 1 BTC needs to be verified by a certain number of nodes. From a certain perspective, decentralization forms the basis for giving cryptocurrency real value. Under the umbrella of decentralized consensus, people are willing to assign value to cryptocurrencies.
As for whether this value is 1 US dollar or 40,000 US dollars, this is not the focus of our discussion today. The key is that the limitation of block space and decentralized consensus make things recorded on the chain have scarcity, and this scarcity gives them real value. This is unheard of in other industries, they can’t create something of real value out of thin air.
You could argue that gaming companies could create billion-dollar items in games without cryptocurrencies. Yes, but these companies have a consensus built on years of trust from players. For startups, achieving this will be even more difficult. This is similar to how U.S. dollar fiat currencies and cryptocurrencies gain value.
For games on the entire chain, imagine if not just some assets, but the entire game were placed on the chain - then every Every item, unit, decision, and building will gain real value because they are all scarce resources guarded by decentralized consensus.
Providing such scarce resources is one of primodium's many goals. It's exciting that you can build real economies based on this value-giving process (I'll explain in another thread why web 2.5 games don't work, the main reason is that they need to be face-to-face There are so many regulatory and compliance issues.)
You might argue: But Mr. tax cuts, financialization means everyone is trying to extract from the system interests and make money, so the system will eventually collapse!
But my point is that in the process of BTC mining, every participant is also trying to make money. As long as the system has external value, he will can last. And obviously, the key to staying afloat is balance, so the game will provide enough fun to ensure that it meets expectations for most people.
The in-game resource trading market launched in Primodium V0.9 is a step in this direction, but we still have a lot of work to do in the future a lot of.