Skip to content

scottm85/war

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project was bootstrapped with Create React App.

War the card game built on NodeJS, React, and Socket.IO

To Run

Clone and install dependencies: npm install.
Start the socket server: node ./src/socket.js
Start the React UI: npm start

To Play

React should automatically launch a tab to localhost in your default browser. If not, visit http://localhost:3000 (unless you specified a diffferent port during startup)

You will be prompted to enter a player name upon opening the page. If you're playing by yourself open a second tab and enter a name for that player as well. Once the game has two players, they will both need to click ready to start the game. Each player will have a "Flip" button they will need to click each turn.

More Info

The react components are state based and only update when the server sends updates via the websocket. The "ready" and "flip" buttons are the only client side event triggers. Most of the game logic is located in /src/game, where GameController.js contains the controls for the core game loop.

The other classes either act as object oriented classes(Player.js, Deck.js, Card.js), or similar to an enum to reduce repetitive string comparisons(Suit.js, PlayerType.js, GameState.js).

I wanted to do a bit more with the spectators. Potentially having the next spectator in line replace the loser as the next player, but unfortunately I was running short on time.

About

the card game war built in react

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published