Git Product home page Git Product logo

spacenftgame's People

Contributors

jff-danno avatar lucasbitt7 avatar norswap avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

norswap

spacenftgame's Issues

"Resource Milestone" Roadmap

For discussion, I propose to aim towards getting up a few tradeable resources up, along with a few building for the purpose of farming these resources.

  • #2
  • Create Buildings contract to host at least the basic buildings. Here's a proposal for the structure
    • Have a BuildingType enum for the building types (Metal Mine, Crystal Mine, Deuterium Synthesizer)
    • Have a PlayerBuilding structure that is an (address, BuildingType) pair.
    • Have a levels map of type mapping(PlayerBuilding => uint)
    • Have a way to specify the cost of each building level, and a function to actually build them (level them up)
      • Many ways to do this. First question is whether the cost should be a hardcoded table or algorithmic (e.g. "doubles every level"). I think maybe easier to go with the table at first so we can copy the OGame values.
        If so, would require a structure LevelInfo to encode cost in the three basic resources + the resource production rate (in units per second โ€” can include decimals just like the ERC-20 balances), and a mapping of type mapping(BuildingType => LevelInfo[]).
      • The level 1 of each production building should be free.
    • In the future, we'll want building updates to take some time, but let's make it instant for now.
    • (Note for later: I think this design permits dynamically adding buildings without redeploying the contract, by basically "extending" after the end of the enum. To be checked to see if Solidity doesn't insert a range-check on enum values or some such.)
  • Implement an updateBalance(address) function in the ERC-20 contracts to update the balance based to the production of the factories.
    • This needs a mapping(address =>uint) mapping users to the timestamp where there resource balance where last updated (one mapping per resource).
      • This has to be timestamps and not blocks, Optimism currently has irregular block lengths.
    • Perform a computation on the amount of resources to add to the balance (time elapsed since last update * resource production rate obtained from the LevelInfo structure for the appropriate building).
    • The function to create a building should be updated to update the resource balances first.

How does that sound?

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.