In week 7 of the Codaisseur Academy we were challenged to build a multiplayer game upon a Tic-Tac-Toe logic which was provided. What we did was:
- Extending the board from 9x9 to 12x22 so there us a grid for a board
- Add two players to the board which can move from two different computers using the keyboard arrows
- Break the 'turn-based-play' mode so both players are free to move asychronously
- Adding monsters that changed either randomly or structured over the board once a player makes a step
- Adjust the login and authorization so it supportes our gameplay
- Fixing additional bugs such as the possibility to walk off the board
- Add styling with CSS
- Once setup two players on different computers can challende each other.
- One player creates a new game, the other joins it.
- A player needs to fly to the other side of the screen.
- But watch out for the flying monsters!!
To start our app:
- git clone repro
- cd to /server and run ' npm install'
- in same terminal, run 'npm run dev'. Leave open.
- a server
-
run a local Postgres DB
-
make sure the server connects to the same port as the local postgres
-
cd to /client and run 'npm install'
-
in same terminal, run 'npm run start'. Leave open
- a browser should be opened with the game
- open a incognito window and browse to the same localhost
- you're good to go!
TO PLAY ON DIFFERENT COMPUTERS
- run everything above on one computer.
- change the 'localhost' in /client/src/constant to your local IP adres
- change the 'localhost' in /server/src/DB to your local IP
- in next computer browse to the IP:{port}/games