본문으로 건너뛰기

Study U&I

Introduction

Study U&I is an educational game that can be fast, scalable, and transparent with mutable, fully on-chain NFTs and the Verifiable Random Function.

On this page, we provide the game and instructions. This page allows

  1. an environment for users to upgrade their game items using Sui's VRF
  • Step 1. Buying an item
  • Step 2. Upgrading an item using Verifiable Random Function
  1. an experience for users to connect a wallet and send transactions in a game that runs on Sui
  • Dynamic NFT items are updated live in the Sui Explorer

For the detailed educational tutorial on full Smart Contract code used in the game, how to deploy and run it, and what is the Verifiable Random Function and Dynamic NFTs, please go to this page.

Instructions

1. Install WELLDONE Wallet

Before you begin, you need to install WELLDONE Wallet to access the game. For installation, see the How to Install WELLDONE Wallet.

The loading screen will continue if the WELLDONE Wallet is not installed, and the error Please create SUI account will appear if the WELLDONE Wallet is installed but the Sui account is not created. study_u_and_i_1_1 study_u_and_i_1_2

2. Change to the testnet

Since the game contract is deployed on the testnet, change the network to the testnet in your wallet. study_u_and_i_7_1 study_u_and_i_7_2

3. Connect to WELLDONE Wallet

When the wallet pops up, click the Accept button to connect the wallet.

study_u_and_i_2_1

4. Faucet your account

You need to get funds to pay for gas. From your wallet, go to the Faucet tab, click the Request Faucet button, and wait for a second.

정보

Our wallet uses cURL to request test tokens, and the testnet rpc is sometimes unstable. In that case, please refer to this page. You can request test tokens through Sui Discord.

study_u_and_i_8_1

5. SHOP

If the wallet connection is successful, your Sui address will appear in the top left corner of the screen. Then, go to the SHOP.

study_u_and_i_3_1

Buy one Axe and one Enchant Scroll. Select each item in turn and click the blue button. When the wallet pops up, click the Send button to buy an item.

정보

Your test account must have funds to pay for gas.

study_u_and_i_3_2

After sending each transaction, you can look up the received Tx Hash in SUI Explorer to check the items that you bought.

study_u_and_i_3_3

6. INVENTORY

In the INVENTORY, you can view the items you have.

study_u_and_i_4_1

If you followed the previous steps, you may have one Axe and one Scroll. The number in the Axe item box indicates the current level of the item. If you just bought the item, it will probably be 0.

And the number in the Scroll item box is the number of levels an item can be upgraded by spending that scroll.

7. UPGRADE

You will now spend a Scroll to enchant your Axe. Go to the UPGRADE and select the Axe and Scroll.

study_u_and_i_5_1

After enchanting, the level of the Axe will be 1 higher than its current level plus the level of the Scroll. This is because items are enchanted using the code below:

    item_axe.level = item_axe.level + item_scroll.level + bonus;

The bonus is determined by the output value of the Verifiable Random Function (VRF). Study U&I uses Sui's VRF to enchant items.

Why is the Verifiable Random Function important?
A Verifiable Random Function (VRF) enables the holder of a private key to generate a hashed value for the message, which can be verified by anyone possessing the corresponding public key to ensure the validity of the hash. Therefore, by using VRF users have the ability to verify the random value used in games. Moreover, it also allows users can provide an input seed for the game company to use when generating a random value, and users can always verify that the game company used that seed to generate the random. It is transparent.

However this demo version doesn't have a backend server, so it uses a pre-generated fixed VRF value. Therefore, the value of the bonus is always 1.

For the full Study U&I Smart Contract code, how to deploy it, and more information about VRF, check out the Building a Game on Sui with VRF and Dynamic NFTs.

Click the enchant button. When the wallet pops up, click the Send button to enchant an item.

study_u_and_i_5_2

8. Last Step

After enchanting, you can check in your inventory or Sui Explorer that the Axe leveled up and the Scroll was burned. The image of the Axe will also change based on the specific item level.

study_u_and_i_6_1study_u_and_i_6_2

The current version focuses more on how to use VRF in the game, rather than the gameplay. For gameplay, stay tuned for our next series.