OnchainSweeper

OnchainSweeper

Free2Play Minesweeper on the Blockchain

Created on 18th August 2024

OnchainSweeper

OnchainSweeper

Free2Play Minesweeper on the Blockchain

The problem OnchainSweeper solves

Enjoy a Classic Game with a Modern Twist
Play OnchainSweeper: Engage in a decentralized version of the classic Minesweeper game. Enjoy a nostalgic experience with the added benefits of blockchain technology.
Challenge Yourself:The grid size adjusts to match your skill level & create new challenges as you progress in the game.

Transparent and Fair Gaming
Trustless Experience: All game mechanics are governed by a smart contract on the Ethereum blockchain, ensuring that the game is fair and tamper-proof.
Immutable Records: Every move and game outcome is recorded onchain, providing an immutable record of your gameplay.

Onchain Game on the Ethereum blockchain:
It supports dynamic grid sizes and includes essential game mechanics such as starting a game, placing mines, and revealing cells. Players can only reveal cells if their game is in progress, and the game ends either when a mine is triggered or all non-mine cells are revealed. Winning or losing a game is reflected by emitting events, and players' game states are updated accordingly. The contract also includes functionality to increase the grid size upon winning and handle game state transitions efficiently. With each Size increase one new mine is beeing added to the board. It starts at 3x3 and 1 Mine, next level: 4x4 and 2 mines and so on

Challenges I ran into

Challenges and Solutions

  1. Canvas Overlap
    Issue: Misalignment between interaction and display canvases, especially as the canvas increases in Size.
    Solution: Adjusted CSS styling for proper layering and refined JavaScript event handling for edge-cases when no user is connected f.e.

  2. Multiplayer Transition
    Issue: Managing multiple game states and player interactions.
    Solution: Implemented basic multiplayer support and adjusted UI for player-specific feedback.

  3. Smart Contract Performance
    Issue: Performance inefficiencies and high gas costs.
    Solution: Optimized contract code for efficiency and conducted rapid performance testing.

  4. Security Concerns
    Issue: Ensuring game logic security in a short timeframe.
    Solution: Applied essential security practices and performed quick debugging.

Tracks Applied (1)

Multi-Feature

Smart Wallets with Paymaster and Batch Transactions: All transactions/interactions get sponsored by us and we leverages ...Read More
WalletConnect

WalletConnect

Discussion

Builders also viewed

See more projects on Devfolio