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

Arena Mayhem

A one-on-one auto-battler game on-chain where users can bet on the outcome of the battle.

Arena Mayhem

Created At

ETHOnline 2023

Project Description

Arena Mayhem is an exciting fighting game that lets users craft their own gladiators and join many epic battles by inviting their friends. To enter the arena, participants stake a chosen amount of tokens, those should be ERC 20 tokens like ETH, APE, or any other that follows the protocol.

Once the bets are set in place, the battle issuer and the challenger can enter the battle, and the Cartesi machine starts executing a complex algorithm to generate a battle log in a JSON format based on each fighter's statistics. This battle log represents the actions taken by each gladiator in each round. The winning player can claim the prize.

The choice of Cartesi to run the battle logic happens because the algorithm can be as complicated as the devs want it to be, which could overwhelm the Solidity language.

After the algorithm finishes the calculations and log generation, players can watch their gladiators in action through an animation made with the react frontend, displaying each step of the fighters' attacks and the decay of their health throughout the battle.

Once the battle ends, tokens are distributed within the application and can be withdrawn by the winner. Arena Mayhem is your ticket to a world of exciting battles, strategy, and the thrill of victory!

How it's Made

Back-end: We use Cartesi Rollups framework to run the battle algorithm and interact with generic contracts deployed by the framework. It allowed us to abstract Solidity smart contracts. Our battle algorithm is written in Python. The complexity of the algorithm makes it challenging to execute such games in EVM environment, hence we use Cartesi Machine to run our backend logic.

Front-end: We use ReactJS framework for front-end to interact with the backend. The project comprises 4 main components: Connecting your wallet to the dapp, generating the character, reading the outputs generated and running the simulation to watch. Additionally, we've added the tokens integration where a user is able to deposit standard ERC20 tokens to the dapp such as ApeCoin.

We use GraphQL to query the output generated by the Cartesi rollups node. Apollo client is used in the React app to connect to graphQL service and fetch notices.

background image mobile

Join the mailing list

Get the latest news and updates