Technical application

The technical method has the following form.

  1. NFT and Game Logic Contract for Database on Blockchain

  2. 2D/3D game engine based on WebGL

  3. React-based WebGL and Blockchain communication relay module

These three modules work independently, and you can combine them to make a game. Of course, developers and users will be able to change or update modules by forking or developing new ones if they don't like each module or want to develop further.

On the blockchain, the NFT contract was implemented in the form of storing data as much as possible on-chain. Metadata of each NFT is stored on-chain and can be accessed and managed through a kind of compressed DB contract module that compresses and stores data. In other words, smart contracts can be accessed through contract calls to DB contracts, and general web3 applications can be accessed as if using NFT contracts in a normal way.

These NFT contracts can be accessed and managed through logic contracts on-chain. Like Uniswap or various Yield Farmings using ERC20 token approval, you can staking NFTs using logic contracts and generate state transitions and events within the logic contract. Through this, the game is implemented using small units of logic.

A typical example of such a system can be seen in Blue Archive, a mobile game developed by Nexon. Players can acquire unique characters through the root box system, and proceed with strengthening or setting equipment for the unique characters obtained in this way (reinforcement logic), and then use these characters to battle using AP (Action Point). Participate and be rewarded according to the victory/loss of the battle (normal battle logic). In addition, there is a unique type of logic called competitive play, in which players can select characters to form a defense team. And the player can attack the defending team selected by others. Each time they attack, they select the characters of the attacking team, and 100% automatic battle will divide victory and defeat and receive rewards. The reinforcement/normal battle/competition logic is divided into sections that do not interfere with each other, and only the character and each logic interact with each other.

Think of the characters as NFTs. You will quickly notice that NFT's reinforcement logic can be implemented by changing the state of onchain metadata. In addition, the implementation of this general battle system and the semi-PvP system, competitive battle, is an automatic battle, so it is quite easy to implement on the blockchain as it is. In other words, it is easy to extend the long-term game by creating a general battle logic contract and PvP logic contract and uploading it to the blockchain, periodically creating and uploading a (new) boss battle logic contract according to the update schedule, and raising the exploration logic contract.

Also, the more interesting part here is that the combat logic contract can use any NFT contract that conforms to the NFTWAR specification. If the developer wants, they can implement other types of games of a similar genre, etc., and create a battle logic contract that fights between NFTs of other services implemented in this way, and can also operate a multiverse arena. (Let's think about the balance issue later)

Many game players are extremely strict about the beautiful graphics and interaction. So, NFTWAR was oriented towards using a technology called WebGL. This is for two reasons. First, Web3 services including many existing metaverses should finally be available anytime, anywhere. Also, in this situation, NFT often has to process 3D files and 2D files at the same time. In other words, it was necessary to create a client that can be accessed through WebGL in any mobile/web/console environment and does not cover 2D/3D. Second, games generally focus a lot on graphic quality. For this reason, it was necessary to catch fast development and graphic quality issues through Unity's WebGL Build Export. Through this, many existing game developers have opened an opportunity to create games based on NFTs and have been able to collaborate with blockchain developers.

But, how do WebGL and Blockchain connect? This is the part that many people ask, challenge, and get frustrated. We found hints in the browser communication plugin for Unity WebGL and the library that connects web browsers such as ethersjs and caverjs to the blockchain. Using an event bus in a web browser, specifically React, Unity WebGL and the blockchain communicate in real time, and if necessary, receive the user's e-wallet signature (login, item purchase, action, etc.) to synchronize the blockchain and WebGL. We have created an SDK so that you can proceed with this task.

Last updated