Dice City
January 21, 2025 ยท View on GitHub
Based on Machi Koro
Forked from this commit of robot-race.
Development
npm installnpm start- Vite- In second window run
./dev.sh- 3 docker containers and esbuilddice-city-server: handles http requestsdice-city-worker: handles game logicredis: a Redis instance
- (Optional) In a third window run
npm run logsor click on the container in Docker Desktop
Forking (on different GitHub account)
- Click the fork button
Forking (on same or different GitHub account)
- Create new empty repository on GitHub (or whatever)
git clone https://github.com/nick-ng/dice-city.git <new-repo> && cd <new-repo>- Change
dice-cityto whatever you want and change my name to your name or something. git add . && git commit -m "anything. this will get squashed in the next step"git reset $(git commit-tree HEAD^{tree} -m "forked https://github.com/nick-ng/dice-city")git remote remove origingit remote add origin <url-of-repo-you-made>git push --set-upstream origin main- Change branch permissions etc.
Deploying
./build.shordocker compose -f docker-compose.prod.yml build./serve.shorPORT=<desired-port> docker compose -f docker-compose.prod.yml up -d
Unit Tests
Create a /spec directory next to the files you want to test then create a file <name-of-file-to-test>.spec.cjs in that.
Notes:
ToDos
ToDo Comments
- src-front\utils\name-generator.ts:43: @todo(nick-ng): handle plural adjectives? put nouns in [singular, plural] arrays
- src-front\hooks\use-game-socket.ts:28: @todo(nick-ng): figure out why the screen flashes periodically
- src-front\app\game-screen\lobby.tsx:25: @todo(nick-ng): leave a game if you aren't the host
- src-front\app\game-screen\lobby.tsx:26: @todo(nick-ng): kick a player from your game if you are the host
- src-front\app\game-screen\lobby.tsx:27: @todo(nick-ng): ready check?
- src-front\app\game-screen\game.tsx:99: @todo(nick-ng): show if an opponent is deciding who to use their tv station etc. on
- src-back\worker.ts:3: @todo(nick-ng): put some of these things in a class?
- src-back\worker.ts:97: @todo(nick-ng): check if this fixes the duplicate events issue. i.e. player1 rolled the dice twice
- src-back\worker.ts:135: @todo(nick-ng): check for "orphaned" games when starting up.
- src-common\other-stuff\game-stuff.ts:5: @todo(nick-ng): time limit on turns
- src-common\actions\business-centre.ts:7: @todo(nick-ng): show cards when you hover the buttons.
- src-common\actions\roll-dice.ts:6: @todo(nick-ng): make dice rolls deterministic again?
- src-common\actions\spec\supply.spec.ts:1: @todo(nick-ng): rewrite tests so they don't use mocha