C++ game interacting with Sui

Hi, I wish to start experimenting on Sui from my c++ game. Please tell me if this sounds like a plan or if I am misunderstanding how Sui works.

  1. Install sui dev environment for coding smart contracts, creating assets etc using sui move usi g this tutorial. Install Sui to Build | Sui Docs
  2. Create some assets and smart contracts on testnet.
  3. Add a JSON RPC library to my C++ code. Perhaps one of these: JSON-RPC - Wikipedia
  4. Interact with my smart contracts by connecting to testnet node using the Sui JSON RPC docs JSON RPC Docs | Sui Docs

Thanks in advance for your time

9 Likes

Hello,

Yes, your plan to integrate Sui into your C++ game looks solid.

  1. You’re correct to start with installing the Sui dev environment and familiarizing yourself with coding smart contracts and creating assets, as mentioned in the Sui Docs.
  2. Experimenting with assets and contracts on testnet before the mainnet is indeed a wise move.
  3. Incorporating a JSON RPC library into your C++ codebase, as listed in the Wikipedia article, is necessary to interact with the Sui network.
  4. Finally, using the Sui JSON RPC Docs to interface with the testnet node aligns with best practices.

For inspiration on structuring your C++ library, you can take a look at other Sui SDKs and libraries like the ones in Rust, TypeScript, and Python among others and Unreal SDK for Sui: Unreal Engine uses C++, so this SDK could be particularly relevant.

Good luck!

3 Likes

Thanks for you time and info tamas. I am very new at this and didn’t want to waste weeks persuing things the wrong way. I looked into the Unreal code and have finally settled on trying this JSON for Modern C++ - JSON for Modern C++. I will attempt a basic query of a node at the weekend. I am working on a 2d game builder and adding blockchain features seems to be the hardest part.

3 Likes

I have been working on this for just a day and got my first proper response from a Sui node. The code works perfectly in a thread with the game running at the same time. I have been beating my head against a brick wall trying to do this with EVM for 2 years. I love Sui.

Many thanks!

5 Likes