Baking Bad, a blockchain development company, has released a new shooter game showcasing how the Tezos Unity SDK can streamline large-scale game development. According to Tezos Spotlight, the game demonstrates the utility of Tezos (XTZ) in handling critical aspects like authentication, player inventory management, and other essential features for large-scale gaming applications.
Architecture
The game architecture is divided into several components to mimic enterprise-level applications:
- User wallets: The game leverages players’ Tezos accounts for account management, eliminating the need for developers to manage player accounts directly.
- Unity WebGL application: The frontend of the game is built using Unity, a popular platform for developing multiplatform games.
- Backend application and API: A backend application hosts a REST API for secure operations, such as distributing tokens representing in-game objects and monitoring active player sessions.
- Smart contract: Running on the Tezos blockchain, the smart contract manages the creation and transfer of tokens representing in-game items.
- Interplanetary File System (IPFS): Metadata for in-game objects, including pictures and descriptions, are stored on the decentralized IPFS system.
This modular architecture allows for efficient management of game components, enhancing scalability and security.
Ease of Use for Developers
The Tezos Unity SDK simplifies many peripheral tasks of game development:
Authentication and Account Management
Authentication is a significant challenge in game development. The sample game demonstrates how developers can set up an enterprise-level application without dealing with authentication directly. The game prompts players to connect their wallets using either Beacon or Kukai, streamlining the process without the need to store any account information.
The Unity SDK, along with Beacon and Kukai, handles all security aspects of this connection process. Once a wallet is connected, the SDK triggers the WalletConnected event, providing information about the connected wallet to the game’s handler function.
Inventory Management
In-game items are represented as Tezos FA2 tokens, which are similar to Ethereum’s ERC-20 or ERC-721 tokens. The game checks a player’s tokens via the SDK’s GetTokensForOwner() method, which accesses the smart contract and returns the account’s tokens. This approach eliminates the need to store player inventory directly, enhancing security and efficiency.
All game items are stored as tokens on Tezos, and the game’s backend API manages token distribution, ensuring security by keeping the private keys on the backend.
Player Freedom
Wallet Choice
Players can choose their preferred wallet application and account, offering flexibility and anonymity. They can even manage multiple accounts at no cost.
Control Over In-Game Items
In-game items stored as tokens in players’ wallets can be managed outside the game, allowing for additional uses and interactions. Players can transfer tokens between accounts, view them in their wallets, and utilize them in other applications, thanks to the public nature of the smart contract and metadata stored on IPFS.
Explore on Your Own
Developers interested in exploring these features can load the sample game in the Unity Editor.
Image source: Shutterstock
. . .
Tags