In the sixth and final video of Encode Club’s Sui series, we show how to test and deploy the role playing game (RPG) objects we created in the previous session to the Sui network.

The Sui Foundation partnered with Encode Club to offer a series of six developer-focused videos. This series will range from the basics of Sui to tutorials about building smart contracts and working with objects in Sui.

Learning Highlights

In the fifth installment of this series, we showed how to write objects and functions for an RPG, including character, item, and non-player character creation. Now we’ll explain how to make sure our code works, and how to deploy it to the Sui network so people can begin playing the game.

Testing Move Packages

Once we’ve written our code, we want to test its functionality. Two types of testing frameworks exist for Move, a general Move testing framework and a Sui-specific testing framework. As Move on Sui includes several features that are not present in core Move, we’ll focus on the latter.

Sui-specific testing can be found in the sui::test_scenario module. The test_scenario module provides an environment where builders can test their code via a series of transactions. All updates to the Sui ledger occur via transactions, and Move calls in Sui are encapsulated in transactions. Builders can create mock transactions to see the interactions between several different transactions (i.e. one transaction creating an object, another transaction transferring that object, and another transaction mutating that object).

Publishing Move Packages

Now that we’ve tested our code, we can actually publish it! Move functions can only be called once the corresponding package is published to the Sui network, where it is represented as an immutable object on the Sui ledger. To publish the package, navigate to the package directory and, from the command line interface (CLI), call sui client publish --gas-budget <gas_budget> (i.e. <gas_budget> of 2000). If successful, you will have published your package to the Sui network!

Refer to the Sui documentation on debugging and publishing packages for more detailed information.

Calling Move Code

Making calls to our code on the Sui network lets modules interact with each other, creating the action in the game. In our example in the video, we used Sui Explorer to call the code, which made it easier to visualize the lesson. We could call the same functions using the Sui CLI. When creating your own dApps, you will probably want to give users a nice frontend rather than having them use the Sui Explorer or CLI. The Sui JSON-RPC API lets you connect your smart contracts to a frontend.

Thank you!

Thank you everyone for making it to the final installment of the Sui Foundation x Encode Club Sui Educate series! We hope that by now you’ll have what it takes to create your own dapps on the Sui network. Happy hacking!

Watch the Whole Series

  1. What's Sui?
  2. Smart Contracts
  3. Creating Objects and NFTs
  4. Dynamic Fields and Collections
  5. RPG Building Basics
  6. Deploy a Game to the Blockchain
Author

Sam Blackshear

Co-Founder, CTO, Mysten Labs, Creator of Move Language

CTO of Mysten Labs and inventor of Move language. Former Principal Engineer at Meta.

Read more like this

The $100M Opportunity No One is Talking About

Main Takeaways On-chain options haven’t scaled because of architecture, not demand. Liquidity is siloed at the position level, which limits leverage,...

2min read
Aslan Tashtanov

How Sui Primitives Revolutionize Onchain Gaming

Sui's powerful primitives level up onchain gaming experiences!

3min read
Sui Foundation

Talus Integrates Sui to Power Next-Gen AI Agents, Leveraging Walrus for Onchain Storage

Talus will launch Its Nexus AI framework and Idol.fun, its AI consumer platform, on Sui.

2min read
Abhinav Garg

Wave Wallet Builds a Launchpad to Sui Apps

Along with typical crypto wallet functionality, Wave Wallet delights its many users with integrated games.

3min read
Sui Foundation

From Infrastructure to Impact: Where Sui Goes Next

How foundational work across the stack is enabling the next phase of the Sui ecosystem

5min read
Abhinav Garg

Reimagining Bitcoin’s Role in Sui DeFi

Bitcoin’s untapped potential meets a chain built to support it — discover the vision of BTCfi on Sui.

10min read
Sui Foundation