Making Unity NFT games faster, more scalable, and more dependable
In keeping with our values, we're taking the first steps toward a more decentralized and open-source SDK with the launch of web3.unity v2.0. This is a new chapter for ChainSafe Gaming, and we're excited to share all the details with our community! Here's what you need to know.
The current state of web3.unity
Up to now, when a player took an action in a game made with web3.unity, a call was made to the API server, which then either performed a read query on the user's behalf and returned the result or formed a write transaction sent back to the game for the player to sign with their wallet and broadcast.
The SDK could not function without this API intermediary. If the API went down, so too did the games relying on this service. While some of our initial decision-making was designed to get the library up and running quickly, with time, it's become clear that a more resilient solution was needed.
Future decentralized state 🌌
Our goal has always been to make web3.unity as decentralized, flexible, and scalable as possible. In keeping with that, the launch of v2 enables client-side reads and writes directly from Unity and the RPC provider of your choice, minimizing the need for ChainSafe's intermediary APIs.
By reducing the need for interactions with the API server, the limitation on reads and writes in any one direction gets mitigated. Instead, users can directly query the blockchain using their own local node, whether that's through Infura via MetaMask or through a custom RPC endpoint.
This way, actions get taken as close as possible to where they're needed, with no servers slowing things down between the wallet and the blockchain. This puts more control in the hands of the developer by reducing dependence on an API service and allowing devs to choose their own RPC providers for broadcasting transactions.
What are the benefits of v2?
Decentralizing the SDK will make blockchain games built with web3.unity faster, more scalable, and more dependable while also giving the community a greater ability to shape the future of the project 🌱
Improves reliability - v2 gives developers the flexibility to choose the best infrastructure for their use case and avoid possible downtime while also choosing fallback options if any infra provider fails.
Improves scalability - Game studios will be able to pick and choose the infrastructure that serves their uptime requirements.
Improves SDK speed - Removing the API server speeds up the blockchain gaming UX since reads and writes can happen either player-side or on dedicated infrastructure.
Improves transaction handling - Improved event listening (getting a notification immediately when a transaction goes through, rather than pinging the API server repeatedly for a status update) is one of the most consistently requested features. Decentralizing provides more responsive event handling by allowing devs and players to check transactions directly.
Improves collaboration - Open sourcing v2 invites the gaming community to contribute meaningfully to the codebase - helping to debug, optimize, and ultimately, determine for themselves where it may be undesirable or infeasible for service providers to run infrastructure.
What does this mean for developers?
⚠️❗ This update will require code changes in projects using legacy versions of web3.unity (v1.6.x and below). In addition, projects will need to define an RPC provider as we look at sunsetting the current version of the SDK and the API server by May 2023 __ ❗⚠️
For existing users who need to switch, games will need to:
Register for a project ID (including filling out profile and project info). This is one lasting aspect of centralization, and we aim to reduce it with future updates. See this video for a tutorial on how project registration works.
Sign up for a node provider and get an RPC endpoint (if you aren't already using one).
Update any code in your game that uses modified versions of our prefabs.
Test your game to ensure all functions work the same way as before.
New users will follow the same steps, with the exception of having to update any existing code.
Without these changes, people will soon be unable to make transactions within existing games. This will require some effort to refactor your code but it will also lead to payoffs in the longer term, and we're here to help make the transition as smooth as possible.
We will provide documentation, tutorial videos, FAQs, and support via GitHub and Discord. In addition, we'll be hosting a Discord community call on Tuesday, February 14th, 2023, to further introduce v2 and address any questions or concerns. Sign up here!
Community contribution wishlist 👥
The new version of web3.unity will be open-source, giving developers and players the opportunity to contribute to building the most flexible blockchain gaming tool to date. Want to make the SDK even better?
We invite you to tweak parameters, audit the code, and make contributions where you see fit. In particular, here are a few areas of active development:
Writing new queries and deploying new subgraphs on The Graph for each new chain that needs to be indexed
Creating new prefabs and features to expand the SDK's potential
Designing a flexible framework for supporting non-EVM chains
Creating a new version of the SDK that supports Unreal Engine
Improving signing UX across platforms
The bottom line in all this is that we wouldn't be where we are today without our community. To fulfill our vision for web3.unity, we need your contributions!
A heartfelt thank you for your continued support. Let's explore the future together.
— The ChainSafe Gaming Team
Web3.unity is an open-source gaming SDK developed by ChainSafe Gaming that connects games built with Unity to the blockchain. The library currently supports builds for web browsers (WebGL), iOS/Android mobile (WebWallet), and desktop (WebWallet). web3.unity is compatible with most EVM-based chains, letting developers easily choose and switch between them to create the best in-game experience.
ChainSafe is a leading blockchain research and development firm specializing in infrastructure solutions for web3. Alongside its contributions to major ecosystems such as Ethereum, Polkadot, Filecoin, and more, ChainSafe creates solutions for developers and teams across the web3 space utilizing our expertise in gaming, bridging, NFTs, and decentralized storage. As part of its mission to build innovative products for users and improved tooling for developers, ChainSafe embodies an open source and community-oriented ethos to advance the future of the internet. To learn more, click here.