Coder Social home page Coder Social logo

strategy-game's Introduction

Aurbit is a map based strategy game built with Ethereum Contracts. The objective of the game is to hold pixels, or tiles of land coordinates on a planet for as many blocks as possible. Each new block will mint you new AUR tokens according to how many land pixels you hold. Aurbit is an Interplanetary Strategy game built for HackFS, an ETHGlobal hackathon in 2020.

https://www.aurbit.io

Overview

Project Aurbit is an entry to the HackFS ETHGlobal Hackathon sponsored by Protocol Labs, among others. Aurbit is a game that uses Fungible and Non-Fungible tokens on Planet Contracts. Assets are Stored on IPFS and the client applicaiton is hosted and deployed with Fleek Hosting.

Developers: Documentation

How it's Made

Aurbit is a mono repo with two packages, Client and Truffle.

Client The client was created with Create-React-App and uses Redux Saga State management. Important libraries in use are React-Bootstrap, Metamask-Provider, WalletConect, and Redux-Sata. The deployment and hosting for production assets are hosted with Fleek Hosting with continuous deployments happening on merges to master branch. The client features a decentralized chat built with Textile services that's available within the Planet game maps. We are also using Infura as our core proider, with the exception of signed transactions with Metamask. All requests to the networks happen with Infura, including those signed with WalletConnect.

Aurbit is a strategy game the following pages:

  • /auth: The Auth page is a basic landing container to get the wallets setup.
  • /avatar: The Avatar Page allows the user to create a new Avatar.
  • /planet: The Planet Page has the game map, contol panel and chat components.

All state management happens with Redux Sagas and we use generator functions to handle state transition logic.

Truffle It was our hope to use Buidler for this project, but we found Truffle to be a more mature and easy-to-use library to quickly get working with contract deployements. We are using Ganache-Cli and and Truffle to compile, deloy and migrate for development and mainnent/testnet builds.

Game Play

The game rules are a combination of the map based strategy game Risk, and the ancient game Go. It is designed to never end, and as a result is impossible to win conclusively. The player is designated by a ERC721 token called the Avatar. Any wallet containing the corresponding avatar token inherits control of the resources belonging to that avatar.

There are two types of tiles, land and water. In gameplay their only difference is the ability to mine. There is also a fungible token used in gameplay called AUR. This token is an abstraction of resources and can be mined at a designated rate per block passed, per tile of land. AUR can be held in a map/planet contract, on a tile, or in a wallet. A transaction must be sent to mine your AUR. The resulting AUR will be minted and added to the balance of the avatar in the given map. Read More

Governance

Aurbit.eth [ENS]

The Aurbit Contracts and AUR Tokens are controlled via the AURGov contract which seeks to preserve transparency, fairness and community engagement. The AURGov contract of Aurbit should fullfill the vision of building safe and high-quality Ethereum dAPPS.

Aurbit seeks to be an open and positive community. Read More

Planets

In the Spirit of IPFS and the ETHGlobal community, Aurbit is an Interplanetary strategy game. Planets are maps of land and water 112 X 63 pixels. Ownership of land tiles rewards your Avatar with new AUR tokens every block. The tokens can be claimed at anytime and withdrawn to a wallet or used by the Avatar during game play.

AUR Tokens can be allocated to a tile which bolsters defences against attack from another player. An attack will burn tokens for both players, but having more AUR allocated to a tile will greatly improve the chances of defending an attack.

The above rules apply to the first Planet contract, Earth. Aurbit is designe to be Interplanetary, and more Planet games are being considered with different game rules. Read More

Avatar AUR

The Avatar AUR contract is an ERC 721 collectible token that holds AUR tokens. It's also an in game avatar that has unique DNA. The DNA is pseudo-random generated to create Strength, Intelligence and Vitality. The user selected various cosmetic attritubtes and the DNA is stored on Ethereum. Read More

AUR Token

The AUR Token is the in-game resource that is minted to avatars that hold tiles of land on Planet maps and burned during attacks. The Token is based on ERC777 and is ERC20 compatible. 100 Million AUR tokens were minted on Mainnet and new tokens are minted or burned during game play. Read More

Developers

Standard Js

  • yarn client:dev: This will run the react application development server
  • yarn eth:chain: This will run a local EVM node
  • yarn eth:console: Compile contracts and attach to an EVM node
  • yarn eth:compile: Compile the solidity contracts.
  • yarn eth:deploy: Compile the solidity contracts.
  • yarn eth:migrate: This will publish the contracts to the ethereum network.

Monorepo Methodology

  1. To add your own package, create a folder inside the packages folder and treat it as its own project by running yarn init--yes to create a basic package.json file
  2. Take note of the name of your project ensure the name of the folder and the name inside the package.json file match
  3. Add your scripts to run your project as you would any normal project in your package.json
  4. In the root package.json add your script named after the script you made in your project to run what ever you need inside the project I.E
  5. Install project dependant npm packages within the projects package.json its self
  6. In the event you need global packages (I.E If we were going to use jest to test in many projects - instead of installing it at each project package level - you could install it at the root project level)

strategy-game's People

Contributors

xhad avatar xxvalhallacoderxx avatar

Stargazers

Chris Fusillo avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

cmark0v

strategy-game's Issues

AvatarAUR - Need event for Mint

We need an event in the Avatar contract for Mint so the client knows if the user has minted a new Avatar.

    event Minted(address _userAddress, uint256 dna, uint256 aid);
    ...


    function _birthAvatar(
        string memory _name,
        uint256 _id,
        uint256 _userDNA
    ) private {
        uint256 dna = _mkDNA(_name, _userDNA);
        uint256 aid = storeAvatar(_name, dna);
        TokenIDtoAvID[_id] = aid;
        //return dna; could return DNA to put in description, but parsing numbers to string is a little dumb i think


       // please emit the event within the birthing method as to pass the DNA and Aid
        emit Minted(msg.sender, dna, aid);
    }

AURToken - Method to add new planets

We should have a function that can add new Planet contract addresses to the minters array.

I believe this could be something that AURGov could handle, but I'm not sure how that would be structured. At a minimum, the AURToken contract should have a method to add new Planets.

AURToken - Owner can Mint Tokens

I was just looking over the AURToken contract and the deployment owner address is able to mint or burn tokens. This seems to be problematic.

Source
mintInternal

Perhaps minting and burning can only happen via AURGov according to vote, or only Planets can mint new tokens during gameplay. [owners must not be able to call the mint function from the planet contracts, too]

AURGov / Planet - Planets do not have a name

There is no way to determine which Planets are wich with a simple array of addresses and there is no planetName on the planet contract.

Calling the getPlanets method does not provide the planet name which makes it very difficult if not impossible to use because you cannot know the name of the planet address you received.

  1. required in Planet.sol:
    Allow the Planet to have a name.

string planetName;
constructor(string _planetName ...)

  1. Required in AURGov.sol
    Need to map the Planet name to planet Contract address.
    mapping(string => address ) Planets

{ 'VENUS': '0xad0d3bea877d25d766ADdB1cE2da3256A3D3fD65' }
setPlanet(string _planetName, address contractAddress) returns (Planet)
getPlanet(string _planetName) returns (Planet)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.