- ✅ 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.
- Clone the repository.
git clone https://github.com/RSginer/idle-capitalist.git
- Build images.
cd idle-capitalist
docker-compose build
- Run the containers.
docker-compose up
- Go to http://localhost:3000 🤘
- This option needs Node.js v12.16.1 installed and a MongoDB instance running on your localhost
- Install dependencies
cd idle-capitalist/server
npm install
- Start the server
npm run start
- Start the server in development mode
npm run start:dev
- Install dependencies
cd idle-capitalist/client
npm install
- Start Webapp
npm run start
- Go to http://localhost:3000 🤘
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 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 is a Node.js with Express server.
Server uses a MongoDB database.
This Model is used to store the game data.
Game: {
totalCashAmount: Number,
businesses: [Business],
lastEventDateInMs: Number
}
This Model is used to store the businesses data for each Game
Business: {
businessKey: String,
level: Number,
manager: Boolean,
lastOrderStarted: Number
}
- 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
- 👨🏻🎓📚 Bibliography: https://blog.kongregate.com/the-math-of-idle-games-part-i/