How Sui 8192 Uses Objects for Addictive Gameplay

Each new Sui 8192 game instance exists as an object, letting players trade or give complete or in-progress games to others.

How Sui 8192 Uses Objects for Addictive Gameplay

Ethos not only demonstrates the power of objects on Sui with its Sui 8192 game, it shows how object-based games have the power to shake up the gaming industry. Each instance of this sliding tile game that players begin mints a new object, similar to minting an NFT, giving each individually played game on-chain permanence.

Sui 8192 gameplay involves sliding tiles up, down, or to the sides, matching like tiles to double their value until the player achieves the magic number, 8192. Under the hood, each tile move initiates a transaction changing the state of the game object.

Sui 8192 game interface showing tiles
In Sui 8192, players combine similar tiles to double their values, eventually reaching a tile with a top value or 8192.

Although a simple game, Sui 8192 raises tremendous possibilities for the gaming industry. Not only are on-chain games ubiquitous, making them playable from any device connected to the Internet, the game itself is persistent, living on as part of its player's digital assets. Although trading or gifting a played game may have minimal utility, this capability sets an example for other apps, such as collaborative productivity tools.

Object Programming

Objects make up the basic unit of storage on Sui, and appear as everything from NFTs to trading platforms. They are infinitely programmable and only restricted by a developer's imagination. Programming an object requires just a few fields, such as a unique ID. However, Dynamic Fields lets developers explore a wide range of ideas.

Ethos programmed Sui 8192 as the first wholly on-chain Sui game. Each newly minted Sui 8192 object contains the game logic, while the interface was coded in javascript, CSS, and HTML. Ethos writes of this programming model, "Since there is only one layer (the blockchain) as compared to multiple layers in web2 (e.g. a server and a database) everything is more self-contained and easier to interact with and maintain."

Given the visual elements of the game, it can also be considered a dynamic NFT. In that regard, it exhibits the unique characteristics of NFTs on Sui in that it can change its appearance based on user inputs. Sui 8192 demonstrates the many interesting new use cases for NFTs, such as using an NFT for an app's interface.

The following code shows Sui 8192's basic game object:

struct Game8192 has key, store {
	id: UID,
	game: u64,
	player: address,
	active_board: GameBoard8192,
	move_count: u64,
	score: u64,
	top_tile: u64,
	game_over: bool
}

These few fields define the basic terms of the game. The player field is also the object owner. Fields such as move_count and score reflect the current state of the game, remaining fixed until the player makes a new move.

As a single-owner object on Sui, a player can give their game, whether still in play or complete, to anyone else. As one option, players could hand the game back and forth, alternating moves.

Gameplay

Exhibiting a hallmark of deceptively simple games, Sui 8192 offers addictive gameplay as players match tiles to double their values, working towards achieving a tile worth 8192. The real competition happens in creating the final tile in the least amount of moves.

Proving the Sui network's performance, each move occurs instantaneously, despite each being a transaction processed online.

0:00
/
Ethos created Sui 8192 partially as a demonstration, showing off the real-time network transactions processed with each move.

As a transaction, each game move requires a gas fee payment. Ethos integrated a pre-approval mechanism in its wallet to streamline gameplay. At the beginning of each game, the wallet launches and lets players set a specific token amount they want to pre-approve, making it unnecessary for the wallet to ask for approval at each turn.

The Future of Gaming

Sui 8192 may not be as flashy as the latest immersive world console game, but relatively simple games occasionally capture world-wide acclaim. Consider how many people played Minesweeper on their early Windows PCs in the '90s, or the incredible success of Tetris. And exploiting the power of objects on Sui can quickly give games global reach, reducing barriers to play.

Ethos created Sui 8192 to inspire other developers and show off Sui's capabilities. The company open-sourced the game and leaderboard to serve as a reference, and stands ready to offer advice through its contact email or Twitter.

We've also just begun to see how games programmed as objects on Sui can push the boundaries of the possible. Ethos put Sui 8192 into the Sui ecosystem, but each game instance is owned by a player. We'll be waiting to see what players end up doing with these digital assets.