Getting Started with Web3 Game Development on Sui: Building Upgradable Game Assets

Cubic Games
4 min readMay 3, 2023

This article will explore how to develop Web3 games on Sui. We will cover the following three points:

  • Why develop Web3 games on Sui, and what are the advantages of Move language and Sui.
  • The use of Move language in game smart contracts.
  • A tutorial on developing NFT game assets using Move language.

I. Why Develop Web3 Games on Sui: The Advantages of Move Language and Sui

1.1 The Advantages of Sui Network

Sui Network has several advantages that make it an ideal platform for developing Web3 games:

  • High performance: Sui Network’s design gives it high throughput and low latency, which is particularly important for game developers as they need to handle a large amount of interaction and real-time updates.
  • Security: Sui Network adopts advanced encryption technology and consensus algorithms, ensuring the security and immutability of on-chain transactions. Sui Move’s Object ownership mechanism protects the safety of user assets.

1.2 The Advantages of Move Language

Move is a new programming language designed specifically for developing smart contracts on the Sui Network. It has several notable advantages:

  • Resource safety: Move language treats on-chain assets as resources, ensuring the safety and non-replicability of assets.
  • Flexibility: Move provides a modular programming approach that allows developers to easily create and combine functionality to build complex game logic and interactions.
  • Verifiability: Move has a powerful static typing system and formal verification tools that help ensure the correctness and safety of smart contracts.

II. The Use of Move Language in Game Smart Contracts

Smart contracts play a crucial role when developing Web3 games using Move language. Here are some game features that can be processed using smart contracts:

  • Game asset management: Through smart contracts, developers can create and manage virtual items, props, and currency in the game.
  • Game logic and rules: Smart contracts can be used to implement the core logic of the game, such as character leveling, battle system, mission system, etc.
  • Transactions and markets: Smart contracts can also be used to handle in-game transactions, such as item exchanges between players, auction houses, etc.

III. A Tutorial on Developing NFT Game Assets Using Move Language

Here is a simple tutorial to guide you on how to develop an NFT game asset using Move language.

3.1 Create an NFT Contract Module

First, we need to create an NFT contract module that will contain the definition and operations related to NFTs. Here is a simple example of an NFT contract module:

3.2 Creating an NFT Game Asset

Next, we will create a specific NFT game asset, such as a game character. First, create a Hero NFT in the Hero module:

In this example, we created a Hero struct with an NFT instance and the character’s level and health.

3.3 Implementing Interactions with NFT Game Assets

Finally, we need to implement interactions with NFT game assets such as character upgrades, trades, etc. Here is an example of a simple character upgrade function:

In this example, we implemented a slay function that increases the character’s level and health.

In a real-world application, you can implement more complex interactions based on your game requirements, such as character trades, equipment upgrades, quest completions, etc. Developing Web3 games on the Sui Network has many advantages, and the features of the Move language make smart contracts more secure, flexible, and verifiable. This is why Cubic is building a game infrastructure platform on the Sui Network. This tutorial taught you the basics of developing NFT game assets using Move language. We hope this helps you in your journey to develop Web3 games on the Sui Network!

Follow Cubic:

Website | Twitter | Telegram | Medium | Discord

--

--

Cubic Games

The First Community-Driven Gaming Platform on SUI 🎮 Mint your very own Cubi on our website 💜 https://linktr.ee/cubicofficial