Skip to content
Demonstration of the use of Ethereum smart contracts for decentralized multiplayer games (Tic-Tac-Toe being the use case here).
JavaScript Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
abi
ipfs
public
solidity
vyper
.gitattributes
.gitignore
LICENSE
README.md
app.js
package-lock.json
package.json

README.md

DApp Tic-Tac-Toe

Simple demonstration of a decentralized game using Node.JS, Truffle, and Solidity. This is the classic strategy game that's easy to learn, but tough to win (https://en.wikipedia.org/wiki/Tic-tac-toe, hopefully you shouldn't need to look at the Wikipedia article for this one). This demo also includes options for bidding on games and placing aribitrary amounts of ETH.

Live demo

  • Use MetaMask connection to either the Ropsten testnet,
  • Open the Live Demo (http://34.197.89.246:2200/). In the event that the link does not work, you can follow the instructions below and run your own version of the demo locally.

This is a DApp version of the game

Gameplay

  1. Once the User
  2. Player 1 marks cells with crosses, player 2 marks with circles
  3. Players move one at a time and cannot place their marks in the same cells at the same time
  4. If one Player places 3 marks of theirs in a row, either vertically, horizontally, or diagonally, they are declared the Winner
  5. Winner gets bid placed by the loser
  6. Players then have option to create another new game or join an existing one

Screenshot

Pre-installation Dependencies

BONUS FOR EXPERIMENTAL FEATURES

Installing the DApp

  1. Clone repo with the following command into your directory of choice, git clone https://github.com/matthew-mcateer/decentralized_game_demo.git
  2. Install MetaMask for your browser, and set up your user account
  3. Run npm install
  4. Start rpc or ganache. (Change the network address accordingly in truffle.js)
  5. Compile and migrate contract truffle compile && truffle migrate
  6. Run npm run dev
  7. Open browser to localhost:8545 if previous command didn't automatically work

Completed

  • Stylish Front-end design for game created
  • Main responsive javascript app, app.js, created for running the game
  • Solidity contract created containing logic and rules of the game
  • Added contract execution capabilities within HTML for page
  • Game successfully tested on local testnet
  • Dependency Tracking set up with yarn

Next Steps

  • Refine Front-end additionally using Angular and/or React
  • Either Creating more permenant web app or further decentralization of back-end
  • Add Whisper Chat functionality based on this.
  • Add IPFS Functionality based on this. Some local files for the game were uploaded to the IPFS successfully, but a dedicated IPFS daemon needs to be created and maintain, or the hashed become invalid within 24-hours.
  • Reimplement contracts using the experimental Vyper Programming Language. This has been partially successful, but further testing and debugging is required
  • Increasing room for additional game rooms
  • Containerization using Docker

Known Issues

errr error in MetaMask Unknown, Ethereum test network is possibly overloaded

Unhandled rejection Error: Couldn't decode bool from ABI: 0x Contract likely wasn't deployed correctly

Submitting additional Issues

Additional new issued can be submitted to the issues page for this repo.

3rd-Party Resources & Special Thanks

This project was made possible by the existence of multiple resources for Ethereum Game Development, which served as eithr direct tutorials or indirect guides. Some of the resources that were looked at over the course of this project include but were not limited to.

The Resources of The School of AI and Siraj Raval

Useful Documentation and Articles

3rd Party JavaScript Tic Tac Toe Games

https://github.com/richleland/Tic-Tac-Toe https://github.com/rolling-scopes-school/tic-tac-toe https://github.com/jwngr/tic-tac-tic-tac-toe https://github.com/sf-wdi-gaia/tic-tac-toe

3rd Party Solidity Ethereum DApps & Smart Contracts

3rd Party IPFS Game Examples

You can’t perform that action at this time.