Git Product home page Git Product logo

idle-capitalist's Introduction

Idle Capitalist

alt text

Features

  • ✅ Buy Business.
  • ✅ Multiple Business to choose
  • ✅ Upgrade Business.
  • ✅ Manage orders.
  • ✅ Hire Managers.
  • ✅ Managers automatically manage orders.
  • ✅ Your businesses make money for you while you are out, even if the server is down or the websocket is disconnected.
  • ✅ Websocket reconnection.

Getting Started 🎉

  • Clone the repository.
git clone https://github.com/RSginer/idle-capitalist.git

Docker

  • Build images.
cd idle-capitalist
docker-compose build
  • Run the containers.
docker-compose up

npm

  • This option needs Node.js v12.16.1 installed and a MongoDB instance running on your localhost

Start Server

  • Install dependencies
cd idle-capitalist/server
npm install
  • Start the server
npm run start
  • Start the server in development mode
npm run start:dev

Start Client

  • Install dependencies
cd idle-capitalist/client
npm install
  • Start Webapp
npm run start

👨‍💻 Technical things

This game uses two compatible architecture patterns, a common onion architecture with a simplified version of CQRS pattern.

Workflow: Web browser -> React Component -> Dispatch Redux Action -> Redux Saga Catch -> Websocket Emmit -> Server Websocket -> Controller -> CQRS Exec Command -> Service -> Repository -> Database.

Initial game state is fetched from an REST API GET /api/v1/game/initialGameState.

Client and server communicates their commands throght a websocket.

Client

Client is a React-Redux webapp, with Redux-Saga, so is a implementation of the flux pattern. It's also ready to use with Redux-DevTools

Server

Server is a Node.js with Express server.

Database

Server uses a MongoDB database.

Game Model Schema

This Model is used to store the game data.

Game: {
  totalCashAmount: Number,
  businesses: [Business],
  lastEventDateInMs: Number
}

Business Model Schema

This Model is used to store the businesses data for each Game

Business: {
  businessKey: String,
  level: Number,
  manager: Boolean,
  lastOrderStarted: Number
}

Maths

  • Calculating expand business cost.

  • Calculating business revenue per second

  • 👨🏻‍💼 Managers price is fixed depends on the business:

    • Lemonade Stand: $1,000
    • Newspaper Delivery: $15,000
    • Car Wash: $100,000
    • Pizza Delivery: $500,000
    • Donut Shop: $1,200,000
  • Initial values

Maths of Idle capitalist table

idle-capitalist's People

Contributors

rsginer avatar troytmoneyt avatar

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.