The Future Is Now: Open Portal Studios Solves the Problem of Integrating Solana NFTs into a Downloadable Game

MetaOps
4 min readMay 6, 2022

Open Portal Studios is a technology firm focused on developing blockchain gaming and proprietary blockchain applications. As of now, there are no official Unity plug-ins allowing developers to create applications that interact with the blockchain directly from a Standalone Unity Application. However, Open Portal Studios has curated a solution and implemented it into their NFT-based first-person shooter, MetaOps.

Blockchains usually make APIs publicly available; however, most APIs use web languages like Rust, React, and JavaScript. These options are adequate for web development but not for applications developed in Unity because Unity uses C# as its primary programming language. In layman’s terms, it is pretty simple to integrate NFTs within a browser-based game because that technology has been available for some time. As far as getting NFTs integrated with a downloadable Unity game without prompting players outside of the game and to a browser, it has yet to be done on Solana.

Figure 1. Using a public Solana API to get an Account’s Balance
Figure 1. Using a public Solana API to get an Account’s Balance

To enable players’ use of MetaOps and partners’ NFTs (tokens) in-game, the MetaOps team had to get creative and develop the code themselves.

First, the player’s public Solana wallet address must be obtained to read wallet contents and identify what kind of “tokens’’ the player holds. This information is obtained during the new player registration process — players cannot create a new profile without first connecting their Phantom Wallet using the MetaOps’ WebGL Dapp.

Figure 2. MetaOps Dapp connecting to the player Phantom Wallet
Figure 2. MetaOps Dapp connecting to the player Phantom Wallet

Behind this process is the JavaScript code interacting with the player’s Phantom Wallet browser extension. Since Unity no longer supports JavaScript, the MetaOps team coded a plugin. The plugin loads external .NET DLLs to interact with the browser, then uses Phantom Wallet API to prompt the player to connect to MetaOps Dapp. With this information in hand, wallet contents are read using Solscan Public API to identify all the MetaOps and Collabs “tokens” owned.

Figure 3. Unity log displaying the player MetaOps tokens
Figure 3. Unity log displaying the player MetaOps tokens

The next step is to read the player’s token metadata for validation and detect where the token media file is stored in the cloud. This step is by far the most time-consuming part of developing a plugin. Neither Solana nor Solscan provides a straightforward method to read a token’s Metaplex metadata. Therefore, the Open Portal Studios team had to dig even deeper to determine how to use Metaplex Rust API to retrieve the metadata. With thorough knowledge of the tokens’ media address, the metadata can be downloaded to create Unity assets used in-game programmatically.

Figure 4. Players can use their PFP NFTs in-game

The tokens’ media files are not stored in the player’s hard disk at any time. This is important when it comes to players hacking items in-game to use assets they do not own. Even if a player manages to hack outcoming/incoming web messages to use a unique PFP or any other image, other players will only see the player’s owned asset.

Figure 5. Players’ PFP NFTs are being displayed to other players on the scoreboard

This Unity Plugin named, BINKS, was developed in-house at Open Portal Studios led by our Head of Development, Gabe Rocha, and, for the first time, will be implemented and available in MetaOps. This technology propels the use of NFTs in not only MetaOps but possibly other downloadable Unity games as well. BINKS holds endless opportunities for utilities, including displaying ANY NFT collection within MetaOps as a spray, weapon decal, weapon charm, etc. All of this player data is stored on the Solana blockchain using cloud storage. Now each player can have thousands of assets without exhausting an absorbent amount of Hard Disk space. With that being said, the goal at Open Portal Studios has been, and always will be, to create a seamless user experience. With this proof, if the technology needed to improve their systems is not readily available, their team creates these seamless solutions themselves. The future is now…

Follow and connect with MetaOps:

| Website |: https://metaopsgaming.com/

| Discord |: https://discord.gg/metaops

| Twitter |: https://twitter.com/metaopsgaming

| Instagram|: https://instagram.com/metaopsgaming

--

--

MetaOps

Play, Earn & Own with a tactical 6v6 first-person shooter built on Unity.