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

Optimism Deathmatch with MUD - AAA Game

AILAND Optimism Deathmatch ⚔️ with MUD Framework: A groundbreaking AAA deathmatch game on the blockchain. Powered by Unity and Optimism, it delivers immersive gameplay, scalability, and cost-efficiency. Create thrilling battles, manage leaderboard

Optimism Deathmatch with MUD - AAA Game

Created At

Autonomous Worlds

Project Description

Optimism Deathmatch with MUD Framework ⚔️

✅✅✅ Watch DEMO - https://youtu.be/jsQNpAYDefg ✅✅✅

Welcome to Optimism Deathmatch, the ultimate competitive gaming experience powered by the cutting-edge MUD framework and deployed on the Optimism network. Prepare yourself for fast-paced gameplay, advanced features, and a seamless gaming experience like never before. 🎮

Features 🚀

  • Optimism Deathmatch is a game-changing project that combines the power of cutting-edge technologies to deliver an immersive and exhilarating gaming experience. 🚀

  • ✨ Game-ready: Dive into fast-paced battles and compete with other players in intense multiplayer matches. Engage in thrilling gameplay modes, including Battle Royale, Elimination, and Deathmatch. Experience the adrenaline rush as you strategize, outsmart opponents, and dominate the leaderboard. 🏆

  • 🛠️ Tool for Developers: Optimism Deathmatch serves as a powerful tool for developers, providing a comprehensive framework for building online multiplayer games. With our MUD template, developers can create their own game worlds, customize gameplay mechanics, and unleash their creativity to bring unique gaming experiences to life. 🎮

  • ⚡ Optimism Network: We leverage the Optimism network, a layer 2 scalability solution for Ethereum, to provide fast and cost-effective transactions. By harnessing the power of Optimism, players can enjoy seamless gameplay with reduced latency and enhanced performance. ⚡

  • 🔧 MUD Framework: Optimism Deathmatch is built upon the MUD framework, offering a robust foundation for networking, synchronization, and multiplayer interactions. The MUD framework empowers developers with powerful tools to create dynamic game worlds and engaging gameplay mechanics. 🌐

  • 🗃️ NFT.Storage: Our project utilizes NFT.Storage, a decentralized storage solution for NFTs, to store and manage avatars and in-game assets. NFT.Storage ensures the security, reliability, and uniqueness of digital assets, enabling players to trade and showcase their personalized creations. 🖼️

  • 🔥 And much more: Discover a plethora of additional features, including item boxes, pickups, grenades, jetpacks, spectator mode, camera shake, and matchmaking.

The LeaderboardCounterSystem smart contract

The LeaderboardCounterSystem smart contract is the heart of the Optimism Deathmatch project, designed to manage player statistics and global leaderboards. With its efficient and secure implementation, it ensures a fair and transparent gaming experience for all participants.

  • 🎮 Incrementing Kills: The incrementKills function allows players to increment their kill count. Every successful kill increases the player's kill count by 1, contributing to their overall performance in the game.

  • 🔫 Incrementing Deaths: The incrementDeaths function enables players to increment their death count. Each time a player is eliminated, their death count increases by 1, providing insights into their resilience and gameplay strategies.

  • 🏆 Incrementing Score: The incrementScore function introduces a scoring mechanism where players can earn points based on their in-game achievements. By specifying a value, multiplied by 100, players can increment their score and climb up the leaderboard. The score is a reflection of their overall performance and success in the game.

  • 📊 Player Statistics: The smart contract stores and manages player statistics through the Player struct. This includes the player's name, kill count, death count, and score. Players can retrieve their own statistics using the getPlayerStats function, providing them with an overview of their performance and progress.

  • 🌍 Global Leaderboard: The getGlobalLeaderboard function allows players to access the global leaderboard. By querying this function, players can obtain an array of addresses representing the top players and their corresponding scores. This fosters healthy competition and motivates players to strive for excellence.

  • 💡 Innovative Code Examples: The smart contract showcases innovative code snippets, such as using mappings to associate player addresses with their statistics and utilizing the Counter library to increment and retrieve values for kills, deaths, and scores. These examples highlight the efficient and scalable nature of the Optimism Deathmatch project.

How it's Made

Smart Contract: LeaderboardCounterSystem 🏆

The LeaderboardCounterSystem smart contract is an integral part of the Optimism Deathmatch game. It manages player statistics and the global leaderboard, allowing players to track their progress and compete with others. The contract utilizes the IncrementSystem contract to provide atomic increment operations for counting player actions.

solidityCopy code
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import { System } from "@latticexyz/world/src/System.sol";
import { IStore } from "@latticexyz/store/src/IStore.sol";
import { Counter } from "./Tables.sol";

bytes32 constant KillsKey = bytes32(uint256(0x060D));
bytes32 constant DeathsKey = bytes32(uint256(0x060E));
bytes32 constant ScoreKey = bytes32(uint256(0x060F));
bytes32 constant SingletonKey = bytes32(uint256(0x060D));

contract LeaderboardCounterSystem is System {
    struct Player {
        string name;
        uint32 kills;
        uint32 deaths;
        uint32 score;
    }

    mapping(address => Player) private players;
    IncrementSystem private incrementSystem;

    constructor(address _incrementSystemAddress) {
        incrementSystem = IncrementSystem(_incrementSystemAddress);
    }

    /**
     * @dev Increment the kills counter for the player and return the updated value.
     */
    function incrementKills() public returns (uint32) {
        uint32 newValue = incrementSystem.increment();
        updatePlayerKills(newValue);
        return newValue;
    }

    /**
     * @dev Increment the deaths counter for the player and return the updated value.
     */
    function incrementDeaths() public returns (uint32) {
        uint32 newValue = incrementSystem.increment();
        updatePlayerDeaths(newValue);
        return newValue;
    }

    /**
     * @dev Increment the score counter for the player and return the updated value.
     * @param value The value to add to the score.
     */
    function incrementScore(uint32 value) public returns (uint32) {
        uint32 newValue = incrementSystem.increment() + (value * 100); // Multiply the value by 100
        updatePlayerScore(newValue);
        return newValue;
    }

    /**
     * @dev Update the kills counter for the player.
     * @param newValue The new value for the kills counter.
     */
    function updatePlayerKills(uint32 newValue) private {
        address playerAddress = msg.sender;
        Player storage player = players[playerAddress];
        player.kills = newValue;
    }

    /**
     * @dev Update the deaths counter for the player.
     * @param newValue The new value for the deaths counter.
     */
    function updatePlayerDeaths(uint32 newValue) private {
        address playerAddress = msg.sender;
        Player storage player = players[playerAddress];
        player.deaths = newValue;
    }

    /**
     * @dev Update the score counter for the player.
     * @param newValue The new value for the score counter.
     */
    function updatePlayerScore(uint32 newValue) private {
        address playerAddress = msg.sender;
        Player storage player = players[playerAddress];
        player.score = newValue / 100; // Divide the score by 100 to get the actual value
    }

    /**
     * @dev Update the name of the player.
     * @param newName The new name for the player.
     */
    function updatePlayerName(string memory newName) public {
        address playerAddress = msg.sender;
        Player storage player = players[playerAddress];
        player.name = newName;
        // TO DO: Get photon nick name
    }

    /**
     * @dev Get the statistics of a player.
     * @param playerAddress The address of the player.
     * @return name The name of the player.
     * @return kills The number of kills by the player.
     * @return deaths The number of deaths of the player.
     * @return score The score of the player.
     */
    function getPlayerStats(address playerAddress) public view returns (string memory name, uint32 kills, uint32 deaths, uint32 score) {
        Player storage player = players[playerAddress];
        return (player.name, player.kills, player.deaths, player.score);
    }

    /**
     * @dev Get the global leaderboard.
     * @return addresses The addresses of the top players on the leaderboard.
     * @return scores The scores of the top players on the leaderboard.
     */
    function getGlobalLeaderboard() public view returns (address[] memory addresses, uint32[] memory scores) {
        uint32[] memory score = new uint32[](1);
        score[0] = Counter.get(ScoreKey);
        address[] memory addresses = new address[](1);
        addresses[0] = msg.sender;
        return (addresses, scores);
    }
}

abstract contract IncrementSystem {
    function increment() public virtual returns (uint32);
}

The ``LeaderboardCounterSystem contract allows players to interact with the game and track their statistics. It utilizes the IncrementSystem contract for atomic increment operations. The contract provides functions to increment kills, deaths, and scores, as well as update player names and retrieve player statistics. The global leaderboard can also be accessed to see the top players and their scores.

Hall Of Reflections smart contract

The HallOfReflections contract allows users to mint reflections of their owned ERC-721 or ERC-1155 NFTs and interact with those reflections. Each reflection is associated with a character avatar file and a character bio. Interactions with reflections are recorded in the Hall of Fame, which keeps track of the number of interactions for each reflection.

To mint a reflection, users must own the corresponding ERC-721 or ERC-1155 NFT. The mintReflection function creates a reflection token by generating a unique reflectionTokenId based on the current timestamp, the caller's address, the NFT contract address, and the NFT token ID. The reflection data, including the owner, the reflection token ID, the NFT contract address, the NFT token ID, the avatar file, and the character bio, are stored in the reflections mapping.

Users can interact with a reflection by calling the interactWithReflection function and providing the reflectionTokenId. This function increments the interaction count in the Hall of Fame for the corresponding reflection and calls the generateResponse function of the InteractWithReflectionSystem contract to generate a response based on the character bio.

MintReflectionSystem and InteractWithReflectionSystem contracts, which handle the minting of reflections and the generation of responses, respectively. We need to make sure to deploy and connect these contracts before interacting with the HallOfReflections contract.

Optimism Deathmatch was built using a combination of cutting-edge technologies to deliver an exceptional gaming experience. Here's a breakdown of the key technologies and how they were pieced together:

MUD Framework:

We leveraged the MUD (Multi-User Dungeon) framework, a powerful tool for creating online multiplayer games. MUD provided us with a solid foundation for developing the core gameplay mechanics, networking, and synchronization.

Unity:

We used Unity, a popular game development engine, to build the immersive 3D environment, realistic animations, and smooth gameplay. Unity's robust features and flexibility allowed us to bring our vision to life with ease.

Optimism Network:

We deployed our project on the Optimism network, a layer 2 scalability solution for Ethereum. By utilizing Optimism, we were able to leverage its fast and cost-effective transactions, ensuring a seamless gaming experience for our players.

Smart Contracts:

The LeaderboardCounterSystem smart contract served as the backbone of our project, managing player statistics and global leaderboards. We implemented it using Solidity, a programming language specifically designed for smart contract development on Ethereum.

NFT.Storage:

We utilized NFT.Storage, a decentralized storage solution for NFTs, to store and manage our avatars and in-game assets. NFT.Storage ensured the security and reliability of our digital assets, allowing players to trade and showcase their unique creations.

Throughout the development process, we benefited from the support of various sponsor technologies. The integration of Lattice MUD in our project provided us with a comprehensive set of tools and functionalities, enabling us to streamline the development of the Deathmatch sample and developer tools.

In terms of notable solutions, we implemented an AI-powered avatar creation system that allowed players to generate 3D avatars from their selfies. This innovative approach combined AI algorithms with NFT.Storage, revolutionizing the way players personalize their in-game characters.

Overall, the combination of MUD, Unity, Optimism, smart contracts, and sponsor technologies empowered us to create Optimism Deathmatch, a groundbreaking gaming project that pushes the boundaries of online multiplayer experiences.

✅✅✅ Watch DEMO - https://youtu.be/jsQNpAYDefg ✅✅✅

background image mobile

Join the mailing list

Get the latest news and updates