project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

Bochamon

Fully on-chain turn-based game with multi-chain rewards. Bochamon is an Autonomous World that can be deployed in any OP rollup and its rewards can be bridged between all the supported chains.

Bochamon

Created At

Superhack

Project Description

This project combines Pokemon-like games and Blockchain.

While playing this game your current position on the map is stored in the blockchain and updated after every move, you can pick your Bochamons and set up your team (also registered in the blockchain) and you can fight other players (every action is also a blockchain transaction).

After winning a duel, you get rewarded in BochaCoins. These coins are deployed as an ERC20 contract in OP Mainnet and we set up a bridge to Base with the Layer-Zero. Talking with the Exchange NPC allows you to bridge the coins!

Our initial idea was to deploy it also to Base Mainnet and Zora, so you can move your BochaCoins between all the chains, but the cost of deploying to Mainnet the contracts was too high.

You can try the game at: https://superhack.bocha.io

If you login with a new user, it will automatically create you an account. To move in the map use: WASD To interact use: F To cancel use: G

NOTE: you need at least two players to duel! NOTE2: if you click the explorer button, it will link you to OP Mainnet explorer and the wallet won't exist there. The explorer button and the exchange are only working on OP Mainnet.

How it's Made

The first step to build this project was deciding what lib we were going to use to create the game contracts. We already have experience using MUD so we decided to use it for this project, it also allows us to use the open-source lib Garnet to create the backend that integrates automatically with MUD.

With the idea of building the game using MUD, we deployed a Testnet for local development, we started to look for free assets for the game and set up a Unity project to have a game client.

To connect the Blockchain with Unity we needed a backend, and we created one in GoLang. This backend provides a WebSocket connection to the Unity client. Connecting to that Websocket the clients can read the state of the game, send transactions and register new users.

One of our goals was to make the game multi-chain so we make a quick demo with Layer-Zero connecting OP Mainnet and Base to send ERC20 between both chains, it took some time but we were able to make it work. After that, we just needed to add the new message to the backend and create the same transaction programmatically there.

At this point we have everything ready to deploy to OP Mainnet, so we create a free account at Alchemy to have a rest endpoint available, and we bridge some ETH to OP Mainnet.

The last step was deploying the contracts to OP Mainnet: here we encounter a problem, MUD's deployment scripts were breaking when connecting to OP Mainnet. We found out that the issue was that the contracts were too big to estimate the gas consumption using the rest endpoints, we "hack" the node_modules folder and hardcoded the gas limit instead of using the estimation. After that change, we were able to deploy the OP Mainnet!

With everything on OP Mainnet and little time in the clock before the hackathon ends. We move a little bit on the map, we set up our Bochamons, fight a duel and use the bridge to record the video.

We realized that the costs of having that public are going to be high, so after the video was recorded we turned off the backend pointing to OP Mainnet and release a new version running on Localnet without the bridge active to have it public, so anybody can play the game.

background image mobile

Join the mailing list

Get the latest news and updates