Three Handed Whist

Inspiration

The inspiration for this project came from a desire to combine the traditional card game experience with modern blockchain technology and AI. By integrating Web3, Chainlink, and Gemini AI, we aimed to create a unique, secure, and engaging online card game with a royal casino vibe.

Chainlink Automation: https://github.com/Ishant-Subhash-Dahiwale/Three-Handed-Whist_Chainlink-Project/blob/main/backend/contracts/automation%20cardget.sol#L15

Chainlink Functions: https://github.com/Ishant-Subhash-Dahiwale/Three-Handed-Whist_Chainlink-Project/blob/main/backend/contracts/FunctionsConsumer.sol#L44

Chainlink VRF: https://github.com/Ishant-Subhash-Dahiwale/Three-Handed-Whist_Chainlink-Project/blob/main/backend/contracts/VRFv2DirectFundingConsumer.sol#L68

MainGame Contract: https://github.com/Ishant-Subhash-Dahiwale/Three-Handed-Whist_Chainlink-Project/blob/main/backend/contracts/main%20game.sol

What it does

Three Handed Whist is an online card game that allows players to compete in a traditional whist game with an added twist of blockchain technology and AI assistance. The game features:

  • Chainlink VRF for generating a random trump card number.
  • Chainlink Automation for swapping card indexes on-chain every 4 minutes.
  • AI assistance through Chainlink Functions and direct API calls to Gemini AI.
  • Real-time game updates using Socket.io.
  • Background music to enhance the royal casino atmosphere.

How we built it

We built Three Handed Whist using a combination of modern web development technologies and blockchain integrations:

  • Frontend: Developed with React.js, incorporating libraries like @emotion/react and @mui/material for styling, and react-p5 for graphics.
  • Backend: Built with Node.js and Express.js, utilizing libraries like body-parser and cors.
  • Blockchain: Integrated Web3.js and Chainlink Functions for on-chain AI and random number generation,Chainlink Automation for swapping card indexes on-chain every 4 minutes.
  • Real-time updates: Implemented using Socket.io for seamless communication between the server and clients.
  • AI: Utilized Gemini AI for in-game assistance, accessible via Chainlink Functions and direct API calls.
  • Music: Added background music to create a royal casino vibe.

Challenges we ran into

  • Blockchain Integration: Ensuring seamless interaction between the blockchain and the game mechanics was challenging, especially with real-time updates.
  • Randomness: Implementing Chainlink VRF for generating truly random numbers required careful handling to maintain game integrity.
  • AI Integration: Balancing the use of Chainlink Functions and direct API calls to Gemini AI for in-game assistance presented technical challenges.
  • Real-time Updates: Implementing real-time updates with Socket.io while maintaining smooth gameplay was complex.

Accomplishments that we're proud of

  • Successfully integrating blockchain technology with traditional card game mechanics.
  • Creating a secure and transparent random number generation system using Chainlink VRF.
  • Chainlink Automation for swapping card indexes on-chain every 4 minutes..
  • Implementing a reliable and efficient AI assistance system with Gemini AI.
  • Achieving real-time game updates and communication with Socket.io.
  • Designing an engaging user experience with a royal casino atmosphere and background music.

What we learned

  • Gained a deeper understanding of blockchain technology and its applications in gaming.
  • Learned to integrate AI with on-chain and off-chain systems effectively.
  • Improved skills in real-time web application development using Socket.io.
  • Enhanced our knowledge of frontend and backend web development with React.js and Node.js.

What's next for Three Handed Whist

  • Multiplayer Mode ( >3): Implement a multiplayer mode to allow more players to join and compete in real-time.
  • Enhanced AI: Improve the AI assistance by incorporating more advanced machine learning models.
  • Mobile App: Develop a mobile version of the game to reach a wider audience.
  • NFT Integration: Introduce NFT-based rewards and collectibles to enhance player engagement.
  • Community Features: Add social features like chat, leaderboards, and tournaments to build a community around the game.

Technologies Used

  • Frontend: React.js, @emotion/react, @mui/material, react-p5, react-router-dom, react-scripts, typed.js, web-vitals
  • Backend: Node.js, Express.js, body-parser, cors, twilio
  • Blockchain: Web3.js, Chainlink Functions, Chainlink VRF, Chainlink Automation
  • Real-time: Socket.io
  • AI: Gemini AI

--- Made by Ishant Dahiwale (iskdahiwale@gmail.com)

Built With

  • automation
  • chainlink
  • emotion/react
  • express.js
  • functions
  • gemini-ai
  • howler.js
  • mui/material
  • node.js
  • p5.js
  • react-p5
  • react-router-dom
  • react-scripts
  • react.js
  • socket.io
  • twilio
  • typed.js
  • typedjs
  • vrf
  • web3
Share this project:

Updates