Bridging the Gap: Materia Prima

A more technical view into Web3 Gaming

Materia Prima
10 min readMay 8, 2024

The Current Web2 Gaming Ecosystem

The gaming industry has predominantly operated under the Web2 model, characterized by centralized servers where game developers maintain strict control over game environments and player data. This structure has allowed for high-quality, seamless gameplay experiences, with top games like Fortnite and League of Legends attracting millions of players worldwide.

MateriaPrima, rooted in the traditions of role-playing games, began as a board game. It is inspired by the mystical and alchemical themes of ancient lore. As it evolved from a board game (Web0) towards a fully interactive digital experience (Web3), the development journey has been focused on preserving the essence of RPGs while innovating with the latest in blockchain technology. The goal has been to create a seamless bridge between the familiar world of traditional gaming and the emerging landscape of Web3 gaming.

Web2.5 is not about reinventing the wheel but rather combining Web2’s ease of use with Web3’s benefits. MateriaPrima does this by integrating blockchain technology with traditional gaming in an intuitive way.

Origin and Evolution

Materia Prima started as a board game and two successfully funded kickstarter campaigns. Until today more than 40.000 copies of the game were sold to customers in over 45 countries.

The team behind Materia Prima shares a long passion for gaming and blockchain applications.

Challenges and Opportunities in Web3 Gaming

As exciting as the transition to Web3 is, it introduces several new challenges that can create friction for users:

  1. Wallet Management: Entering the Web3 space requires players to store and manage digital wallets, a concept unfamiliar to many traditional gamers.
  2. Pay-to-Play Model: Many Web3 games adopt a pay-to-play model driven by transaction fees, which can deter players used to free or one-time purchase games.
  3. Transaction Delays: Blockchain technology, while secure and decentralized, can sometimes lead to slower transaction speeds.
  4. Asset Management: The ownership of digital assets (NFTs, tokens) is a core feature of Web3 games but managing these assets securely and effectively presents a learning curve.

The transition to Web3 is not without its challenges. The complexity of setting up and managing digital wallets, coupled with the initial costs of transaction fees (often seen in Ethereum-based games), poses significant barriers. Additionally, the latency in blockchain transactions can disrupt the real-time interaction that is crucial for modern gaming experiences. Despite these barriers, the potential for players to have a stake in the game’s economy and governance through NFTs and cryptocurrency rewards presents a compelling advantage.

Each of these areas represents a hurdle that MateriaPrima addresses through innovative solutions and user-friendly approaches to make the Web3 gaming experience as intuitive and engaging as traditional gaming.

Easy point of access for any Gamer

For new players entering the world of Web3, the first step is often the hardest: setting up a wallet. MateriaPrima simplifies this process by supporting a variety of user-friendly wallet options, ensuring that players can choose one that suits their comfort level.

  • xPortal: A highly user-friendly and secure mobile wallet that provides easy access to MateriaPrima through its Hub with just a few taps.
  • xAlias: A Web3 wallet that leverages Web2 authentication for easy onboarding.
  • Metamask: The most widely used Web3 wallet, Metamask integration will open MateriaPrima to gamers from across the Web3 ecosystem.
  • MultiversX Wallet Extension: For the users familiar with the MultiversX ecosystem

User Onboarding: Engaging Tutorials

After setting up their wallets, players are introduced to the mystical world of Alka Sowa through a step-by-step, quest-based tutorial. MateriaPrima has carefully designed this approach to mirror traditional RPG tutorials, easing players into the game’s mechanics and storyline while also seamlessly integrating lessons on managing Web3 features like transactions and asset handling.

To guide players through their journey, Lenka, the local innkeeper, serves as a trusted companion, leading them to key locations within the continent of Alka Sowa. Players will explore Expeditions, where they’ll embark on thrilling adventures; the Arena, where PvP and PvE battles await; the Peddler, a marketplace to acquire unique items; the Laboratory, the epicenter for alchemy and crafting; and many more. As players advance through the tutorial, they’ll earn valuable in-game assets, helping them understand how to navigate MateriaPrima while enabling them to play the game for free.

That free2play approach is central to the mechanics of Materia Prima. Making it possible for the player to achieve anything in game by dedication and skill.

This immersive tutorial ensures that players grasp the essential mechanics and lore of MateriaPrima, making them feel at home in their new gaming environment while empowering them to master Web3 gaming intricacies.

Bridging the Gap with Web2.5

The concept of Web2.5 is a hybrid approach, aiming to integrate the user-friendly, plug-and-play nature of Web2 games with the decentralized, ownership-driven ethos of Web3. By simplifying user interfaces, minimizing transaction costs, and reducing wait times, developers can create a more accessible entry point for traditional gamers.

This approach not only preserves the quality and ease of Web2 games but also introduces the novel benefits of blockchain technology, potentially attracting a broader audience to the Web3 gaming space. The use of scalable L1 solutions, like MultiversX, enhances this integration by providing the robustness needed for complex games without the high costs and delays often associated with other blockchain networks.

The Transition to Web3

MateriaPrima uses the eStandard Digital Token (ESDT) standard, powered by MultiversX, which offers a strong foundation by enabling more efficient and flexible management of digital assets compared to Ethereum’s traditional NFT standard. Unlike Ethereum, where NFTs are typically managed by smart contracts with varying standards, the ESDT standard stores assets directly at the account level (enhancing security and simplifying interactions).

This setup is crucial for MateriaPrima’s crafting system, where homunculi and other items are not just static tokens but dynamic assets with attributes stored directly on the blockchain. For example, when crafting a homunculus, the game reads the required attributes (like recipes and gem types) directly from the NFTs themselves, processes the crafting by burning the required items, and outputs a new, unique NFT. This direct attribute storage and manipulation streamline the crafting experience and ensure that each homunculus is truly one-of-a-kind.

The recipes, as well as the in-game resources, are represented by the same SFT collection. Under the hood, they take different forms, thanks to the customization of their attributes:

// The different types of items. This type is stored directly in the resource SFT attributes
#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, PartialEq, Debug, Clone)]
pub enum ItemType {
None,
Gem,
Recipe,
PeddlerCoin,
}


// The on-chain attributes of a MateriaPrima resource SFT
// The "attributes" field takes different form depending on the item_type.
// Encoded under a ManagedBuffer, they are later decoded in the desired format.
#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, PartialEq, Debug, Clone)]
pub struct ItemAttributes<M: ManagedTypeApi> {
pub item_type: ItemType,
pub attributes: ManagedBuffer<M>,
pub generic_attributes: GenericAttributes<M>,
}

As an example, we’ll take a look at the attributes of a recipe SFT:

// The attributes of a recipe contain the items needed for crafting, as well of the ID of the resulting Homunculi NFT
#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, PartialEq, Debug, Clone)]
pub struct RecipeAttributes<M: ManagedTypeApi> {
pub recipe_items: ManagedVec<M, RecipeItem<M>>,
pub homunculi_id: ManagedBuffer<M>,
}


// The struct RecipeItem encodes the tokenId, nonce and amount required for crafting
#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, ManagedVecItem, PartialEq, Debug, Clone,)]
pub struct RecipeItem<M: ManagedTypeApi> {
pub token: TokenIdentifier<M>,
pub nonce: u64,
pub amount: BigUint<M>,
}

When it comes to crafting a homunculi, a transaction with all the required items for crafting are sent to the Laboratory SC. The recipe items are validated, then burned, and a request is made to the Homunculi Minter SC, which mints the desired Homunculi:

#[payable("*")]
#[endpoint(transmute)]
fn transmute(&self) {
self.require_state_active();
let recipe_token_mapper = self.recipe_token_id();
require!(!recipe_token_mapper.is_empty(), "Recipe token not set");


let homunculi_address_mapper = self.homunculi_contract_address();
require!(
!homunculi_address_mapper.is_empty(),
"Homunculi contract address not set"
);


let payments = self.call_value().all_esdt_transfers();


let recipe_payment = payments.get(0);
require!(
recipe_payment.token_identifier == recipe_token_mapper.get(),
"Recipe token does not match"
);


let recipe_attributes = self
.decode_recipe_attributes(&recipe_payment.token_identifier, recipe_payment.token_nonce);
let recipe_items = recipe_attributes.recipe_items;


let gems_payments = payments.slice(1, payments.len()).unwrap_or_default();
require!(
gems_payments.len() == recipe_items.len(),
"Number of gems does not match recipe"
);


let gems_copy = &mut (gems_payments.clone());
self.require_items_match(&recipe_items, gems_copy);


for payment in payments.iter() {
self.send().esdt_local_burn(
&payment.token_identifier,
payment.token_nonce,
&payment.amount,
);
}


let payment: EsdtTokenPayment = self
.homunculi_contract_proxy(homunculi_address_mapper.get())
.mint(recipe_attributes.homunculi_id)
.execute_on_dest_context();


self.send().direct_esdt(
&self.blockchain().get_caller(),
&payment.token_identifier,
payment.token_nonce,
&payment.amount,
);
}

The decoding of the recipe attributes described above is easily achieved with just a couple lines of codes:

fn decode_recipe_attributes(
&self,
token_id: &TokenIdentifier,
token_nonce: u64,
) -> RecipeAttributes<Self::Api> {
let token_info = self.blockchain().get_esdt_token_data(
&self.blockchain().get_sc_address(),
token_id,
token_nonce,
);


let item_attributes: ItemAttributes<Self::Api> = token_info.decode_attributes();


let result = RecipeAttributes::top_decode_or_handle_err(
item_attributes.attributes,
ExitCodecErrorHandler::<Self::Api>::from(DECODE_ATTRIBUTE_ERROR_PREFIX),
);


result.unwrap()
}

The beautiful design of the MultiversX Rust SC framework and the composability of the ESDT standard, as well as additional features built directly into the protocol, are a testament to how the developer experience should be simplified in Web3. This, coupled with a smart, yet simple smart contract architecture, allowed us to create a seamless experience for the users, ensuring that a minimal number of transactions are required to complete complex on-chain interactions.

Leveling and Syncing

In MateriaPrima, homunculi gain experience through PvE and PvP battles, evolving over time. However, to minimize friction and maintain a free-to-play model, this experience is stored off-chain and synced to the blockchain only as needed by the player. This method significantly reduces the need for frequent transactions, cutting down costs and enhancing gameplay fluidity. The same principle of on-chain attributes facilitates this process, as each homunculus’s growth and achievements are efficiently managed and can be made permanent on the blockchain at the player’s discretion.

Customizable Skills System

The skills system in MateriaPrima offers an unprecedented level of customization for each homunculus. Players can develop unique traits and skill trees for their creatures, paving the way for diverse strategies and builds. This customization not only enhances player engagement by allowing for personalized gameplay styles but also fosters a competitive and dynamic environment within the game. Each homunculus can become a unique entity with its abilities, contributing to the overall strategy and success of the player in various game scenarios.

Off Chain Assets: Enabling Free to Play

By using offchain assets for its F2P components, the players can enjoy the game without incurring transaction fees for every action. The players only interact with the blockchain if they choose to. Upon completing the tutorial, each player is rewarded with “off-chain NFTs,” assets managed through the game’s backend and linked to the user’s wallet, yet not present on-chain. In the game, these off-chain NFTs behave just like actual NFTs, enabling players to explore the game and access most features without paying transaction fees.

This concept is also applied for resources like element dust and runic notes. These can be earned in-game by completing quests, expeditions, and participating in special community events. Once players have gathered a certain amount of these items they have the option to convert these resources into on-chain assets, further empowering the play-to-earn component of the game. These resources can be used to craft new homunculi or traded for more powerful items.

This approach provides multiple benefits to the user. First of all a frictionless gaming experience without waiting times is ensured. Furthermore it also supports the economical viability of the users actions. Sometimes the worth of gathered resources would be consumed by the cost of a single blockchain transaction. With storing the progress in the game’s backend the user is relieved from that burden and can transfer assets to the chain when he feels the need for it.

How can we make it better?

Advanced fighting system

The next big feature on the roadmap will be the introduction of a advanced fighting system featuring an initiative action system. Homunculi take turns based on their initiative values, with the lowest going first. Each turn costs initiative points, and the initiative bar regulates the order of actions. Also the advanced fighting system will introduce the concept of NFTs owning NFTs. Each spell a Homunculi has equipped will be represented by a NFT

NFTs Owning Other NFTs

The concept of NFTs owning other NFTs introduces a new layer of depth to digital asset management, allowing for more complex and dynamic asset hierarchies. This enables richer interactions within games, such as characters owning equipment or properties, which can themselves hold value and have utility. It enhances the gameplay by allowing for unique combinations of assets that can evolve and interact in various ways.

This concept will allow users not only to trade their Homunculi but also all the equipped spells and items.

Account Abstraction

Account abstraction simplifies user interactions with blockchain technologies by hiding the complexities of blockchain transactions behind a more intuitive interface. This innovation allows for a user experience that resembles traditional online platforms, where the intricacies of smart contracts are managed in the background, making blockchain interactions seamless and more accessible to a general audience.

Appchains

Appchains are specialized blockchain solutions tailored for specific applications, providing a more customized and efficient environment for blockchain-based systems. By embedding all functionalities directly into the protocol, appchains can offer faster transaction speeds, improved security, and reduced costs, tailored specifically to the needs of the application, ensuring optimal performance and scalability.

Secret Formula

In the case of MateriaPrima, achieving seamless integration was made possible through a unique blend of expertise and vision.The project’s inception by its visionary founders, who first conceptualized the game as a board game, and then made the bold choice of bringing it to life in Web3. Bringing this vision to the digital realm was achieved with buidly, a leading Web3 software development company, whose expertise in blockchain technology transformed MateriaPrima into a pioneering example of what Web2.5 gaming can achieve.

Conclusion

In MateriaPrima, players only interact with the blockchain if they choose to. Upon completing the tutorial, each player is rewarded with “off-chain NFTs,” assets managed through the game’s backend and linked to the user’s wallet, yet not present on-chain. In the game, these off-chain NFTs behave just like actual NFTs, enabling players to explore the game and access most features without paying transaction fees.

This system maintains the traditional gaming experience while introducing players to the unique benefits of asset ownership in Web3, striking a balance that encourages exploration and skill development without imposing unnecessary costs.

The integration of Web2.5 isn’t about changing the paradigm or reinventing the wheel. Instead, it focuses on combining the best elements of Web2 — its user-friendliness and mature ecosystems — with the benefits of Web3, all while stripping away the complexities typically associated with blockchain.

Links

Game: https://play.materiaprimanft.com/

Materia Prima Website: https://materiaprimanft.com/

Materia Prima X Profile: https://twitter.com/MateriaPrimaRPG

Buidly Website: https://buidly.com/

Buidly X Profile: https://twitter.com/buidly_

--

--

Materia Prima
Materia Prima

Written by Materia Prima

Tactical RPG on MultiversX | NFT Powered | Strategic Combat | Immersive Crafting&Trading | Homunculus Battles

No responses yet