Cronos Play : exciting updates for Unreal Engine and C++ game developers
Game Developers Conference, new demo project, dynamic contract support, secure storage of mnemonics and private keys, iOS support, WalletConnect support
As we prepare to open the Cronos ecosystem booth at the Game Developers Conference (GDC) 2023 in San Francisco, and get ready for the GDC panel discussion and the networking event co-hosted with the Blockchain Game Alliance, we have some exciting news to share with game lovers.
We are pleased to announce major upgrades of two open-source projects: Cronos Play for Unreal Engine Plugin and Cronos Play for C++ SDK (Software Development Kit).
The Unreal Engine is a powerful tool for game creators working on Cronos-powered games. The Cronos Play plugin for Unreal Engine was listed on the Unreal Engine Marketplace on October 12, 2022. An open-source project, the plugin is maintained by Cronos Labs in collaboration with Crypto.com, the world’s fastest-growing crypto exchange and a technical partner of the Cronos chain.
The latest version of the Unreal Engine plugin is v0.0.11-ue5.1-alpha. It brings exciting new features and improvements that will enhance the user experience and make game development even more accessible. This release is available for free on the Unreal Engine Marketplace.
Demo Project - Metaverse for Unreal Engine 5.1
Game developers can find the demo project pack for Unreal Engine 5.1 here on GitHub. After you unzip the file, you can find Metaverse.uproject
and launch the demo project. For more details about how to install and enable the plugin and interact with the Cronos blockchain in a game, you can refer to this post.
Connecting with Crypto.com DeFi Wallet
With the demo project ready, connecting to a wallet within the project is a straightforward process. The user must simply scan the QR code, which will effortlessly link the interface to the DeFi Wallet. Users can immediately view their wallet address and balance within the demo.
Connecting with MetaMask
The user experience is similar in this case. The user can connect their wallet by scanning a QR code. The interface will then show the wallet address, and after that, the user will be able to sign a message HELLO WORLD
in MetaMask.
Dynamic Contract support
Dynamic Contract support allows developers to interact with smart contracts on the fly, as opposed to hardcoding them in the game.
With Dynamic Contract, the game can invoke any smart contract through its ABI JSON file. This assumes that the smart contract has already been deployed to the Cronos chain, and that you have the ABI file (JSON).
Dynamic Contract supports three functions: Call, Send, and Encode.
Call is used for querying a contract without signing;
Send is used for modifying a contract and requires signing;
Encode is used for contract calls that require 3rd party signing, such as with a Ledger hardware wallet.
The diagrams below should give you a better understanding of how these three functions work:
Call
Send
Encode
When working with a dynamic contract, it's essential to ensure that the argument type matches the function signature. The argument comprises a key and its corresponding value. The key can have one of the following types: Address, FixedBytes, Bytes, Int, Uint, Bool, String, FixedArray, Array, or Tuple.
To obtain a comprehensive understanding of each key type, kindly refer to the table provided below.
For example:
Function name: safeMint
Function signature: safeMint(address, string)
Function arguments: [{ "Address": { "data": "0x00" } }, { "Str": { "data": "my" } }]
The safeMint
function takes two arguments: an address and a string. The function signature specifies the types of these arguments. In this example, the address argument has a value of 0x00
, and the string argument has a value of "my
". These arguments are passed in as an array of objects with key-value pairs.
Secure Storage of Mnemonics and Private Keys
The plugin enables self-custody of game player’s assets, by allowing game developers to securely store user mnemonics and private keys in the player’s device. This feature is supported on Windows, Mac, Linux, as well as mobile platforms iOS and Android. Secure Storage uses the security APIs of the relevant operating system.
There are two APIs available for secure storage:
RestoreWalletSaveToSecureStorage
This API restores a wallet using a provided mnemonic and password, and saves it to Secure Storage. To use this API, simply call it with the mnemonic and password to restore the wallet, as well as the service and username for Secure Storage. The wallet data will be written in JSON format to the Secure Storage, which can only be accessed by the end-user.
RestoreWalletLoadFromSecureStorage
This API facilitates wallet restoration from secure storage. To use this API, the user does not need to re-input the mnemonic, instead, only the service name and username are required to restore the wallet from Secure Storage. By utilizing this API, the game can effortlessly restore the player’s wallet without the need for mnemonic inputs.
To build for Android using Unreal Engine, you can use the following settings in your project:
JDK: 1.8.x
NDK: 25.1.8937393
SDK API Level: Latest
NDK API Level: 25
By configuring these options in your project settings, you should be able to successfully build your Android application with Unreal Engine.
iOS Support
The Cronos Play plugin for Unreal Engine now supports iOS, adding to the existing development platforms of Mac, Win64, Linux, and Android. This feature will allow game developers to reach a wider audience and make their games available to iOS users.
WalletConnect v1.0 Session Management Support
The Cronos Play plugin for Unreal Engine now supports WalletConnect v1.0 Session Management, facilitating the handling of multiple secure requests to an application or service from a single user. Session information is cached locally so that the session can be restored or destroyed easily, and games can retrieve the connection session information even after restarting.
Future Support of WalletConnect v2.0
WalletConnect v2.0 will be supported in the future versions. Compared with WalletConnect v1.0, WalletConnect v2.0 protocol includes several new features, such as multi-chain support (enhancing the support for an application to connect to multiple chains simultaneously), pairing and session separation enhancement (allowing cache previously paired wallets which it can use to send new session proposals to avoid pairing all over again), and other new features (details here).
* * *
Cronos Play is a suite of integrations and development tools that aim to streamline the creation of Web3 games. We look forward to seeing even more innovative games being launched on Cronos chain!
If you are ready to build your game with Cronos Play, you can find more details in the Cronos Play Plugin for Unreal Engine Docs. You can also visit the Cronos Play website. Please use this contact form if are looking for a business/marketing partnership with Cronos Play.
Please note that the plugin is shared as an open source project without any warranties. You need to conduct extensive testing to ensure that your game produces the desired results.
Subscribe for free to receive new posts.