Study U&I
- network: testnet
- package: 0x243923d9bd6a8d341c2b94c0ef1f1ec42faf353291a46a64d85224ff86c62c79
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
- 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
- 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.
2. Change to the testnet
Since the game contract is deployed on the testnet, change the network to the testnet in your wallet.
3. Connect to WELLDONE Wallet
When the wallet pops up, click the Accept
button to connect the wallet.
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.
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.
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.
After sending each transaction, you can look up the received Tx Hash in SUI Explorer to check the items that you bought.
6. INVENTORY
In the INVENTORY, you can view the items you have.
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.
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?
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.
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.
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.