Solidity W3Maze Game Full Stack
Purpose
Implement a decentralized game with verification of successful completion of game
Summary
A dApp based on scaffold-eth-svelte that implements a decentralized maze game.
It consists of 3 smart contracts: W3Maze, MazeStorage, and MazeOracle.
W3Maze -- main contract
MazeStorage -- stores a compressed representation of a 2D Maze for game history
MazeOracle -- decentralized verification that a player has successfully completed the maze,
currently this is an area that future work can expand on as right now it always returns success
It also contains a frontend that allows deployer/owner to
- Width and Height can be selected while a preview shows the resulting maze
- There is an option to solve the maze to see a path to the goal
- Each new maze has their own unique id
Smart contract transactions
Start new game
- Select a maze and start a new game (smart contract)
- Players must wait for a count down before joining the game
- After countdown player can join the game (smart contract)
Game play
- Players can move around the maze using keyboard arrows wherever a move is possible
- Upon reaching the goal players must submit a proof of completion (smart contract) before the game countdown ends
- Upon submission player proof is verified by smart contract using maze oracle to verify player completed the maze
- sucess message is indicated if player proof passess verification consequently player turn ends for current while game count down continues
- failure message is shown if player proof fails verification
and player can try again before game count down ends
- When game countdown ends for current game a close game button is available that only the owner can click to close the current game
- On close start screen is shown again
- on start screen if player is owner, option to start new game is shown
- otherwise a message is displayed to player to come back later
Getting Started
- Clone this repo
git clone https://github.com/rodoard/solidity-w3maze.git
cd solidity-w3maze
yarn
- Run tests
yarn test
- Run a local chain
yarn chain
- On a second terminal, deploy the example contract
yarn deploy
- Start the frontend
yarn start
Your app should now be running on http://localhost:3000
.
Documentation
Deployer/OWner View