Skip to content

About

A match-3 styled P2E game integrated with Linera microchains.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

Chain Crush ⛓️⛓️⛓️

A blockchain-powered Candy Crush-style game built with React and Linera Protocol.

Features

  • 🎮 Classic Match-3 Gameplay: Drag and drop to create matches
  • ⛓️ Blockchain Integration: Scores are converted to test-tokens on Linera Microchains
  • 🏆 Real-time Leaderboard: Compete with other players
  • 👤 User Authentication: Simple login system with persistent sessions
  • 📱 Responsive Design: Works on desktop and mobile devices
  • 📱 Mobile Touch Support: Full touch/swipe controls for mobile gameplay
  • 💾 Offline Mode: Play even when blockchain is unavailable
  • 🔧 Admin Panel: Administrative controls for game management

Blockchain Integration

This game integrates with the Linera protocol to:

  • Convert game scores to testnet tokens
  • Provide verifiable game sessions

Game Rules

  • Match 3 or more chains in a row or column
  • Score points for each match (3 chains = 3 points, 4 chains = 4 points)
  • 60-second time limit
  • Scores are converted to test-tokens when connected

Mobile Support

The game now includes full mobile touch support:

  • Touch Controls: Tap and swipe to move pieces
  • Swipe Gestures: Swipe in any direction to move adjacent pieces
  • Touch Feedback: Visual feedback for touch interactions
  • Mobile Optimized: Prevents scrolling and zooming during gameplay
  • Responsive Design: Adapts to different screen sizes

How to Play on Mobile

  1. Start the Game: Tap the "Start Game" button
  2. Move Pieces: Tap and swipe on a candy piece in the direction you want to move it
  3. Valid Moves: Only adjacent pieces can be swapped
  4. Match Detection: The game automatically detects and removes matches
  5. Score Tracking: Your score is displayed and tracked in real-time

The mobile version maintains all the same features as the desktop version, including blockchain integration and leaderboard functionality.

TO DO

🔐 Authentication & User Management

  • User Authentication System
    • Login with username
    • Discord OAuth integration
    • User preferences and settings
    • Secure password hashing
    • Session management with 24-hour timeout
    • Persistent login state

🎨 UI/UX Improvements

  • Smooth Animations
    • Falling animations
    • Match explosion effects
    • Score popup animations
    • Smooth transitions between game states
    • Particle effects for special matches

🏆 Leaderboard & Competition

  • Advanced Leaderboard System
    • Separate smart contract for leaderboard management
    • Multiple leaderboard categories (daily, weekly, all-time)
    • Player ranking system with tiers
    • Historical performance tracking
    • Seasonal competitions with rewards
    • Tournament system with admin controls
    • Tournament timers and countdowns
    • Tournament leaderboards (top 25 results)
    • Tournament status management with grace periods

⛓️ Special Game Mechanics

  • Special Chains & Power-ups
    • Lightning chains (clear entire row/column)
    • Bomb chains (clear surrounding area)
    • Rainbow chains (match any color)
    • Multiplier chains (2x, 3x score bonuses)
    • Time freeze power-ups
    • Chain shuffle abilities

🎮 Game Modes

  • Multiple Game Modes
    • Free Mode: Unlimited time, practice mode
    • Fast Mode: 30-second quick games
    • Endurance Mode: Progressively harder levels
    • Puzzle Mode: Specific objectives to complete
    • Daily Challenge: Special objectives with bonus rewards

👥 Multiplayer Features

  • Multiplayer Modes
    • Turn-based Mode: Players take turns, highest score wins
    • Parallel Playing: Real-time simultaneous gameplay
    • Tournament Mode: Bracket-style competitions

🏅 Achievement System

  • On-chain Achievements
    • Smart contract for achievement tracking
    • NFT badges for major milestones
    • Achievement categories:
      • Score-based achievements (reach X points)
      • Combo achievements (X matches in a row)
      • Speed achievements (complete game in X seconds)
      • Consistency achievements (play X days in a row)
      • Special move achievements (use power-ups X times)
      • Social achievements (invite friends, win tournaments)

🔧 Technical Improvements

  • Performance & Scalability
    • Game state optimization
    • Blockchain transaction batching
    • Offline game state synchronization
    • Progressive Web App (PWA) features

🎵 Audio & Visual Enhancements

  • Sound Design
    • Match sound effects
    • Background music (Jay Someday - Strawberry.mp3)
    • Power-up activation sounds
    • Victory/defeat audio feedback
    • Music controls with mute button
    • Audio autoplay handling for browser compatibility

📊 Analytics & Insights

  • Player Analytics
    • Game performance metrics
    • Player behavior tracking
    • Blockchain transaction analytics
    • Leaderboard statistics dashboard

Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Linera CLI (for blockchain features)

Installation

  1. Clone the repository:
git clone https://github.com/liolikus/chain-crush.git
cd chain-crush
  1. Install dependencies:
npm install
  1. Start the development server:
npm start
  1. Open http://localhost:3000 to view it in the browser.

Environment Variables

Create a .env file in the root directory:

REACT_APP_LINERA_FAUCET=https://faucet.testnet-babbage.linera.net
REACT_APP_APPLICATION_ID=your_application_id_here

Technology Stack

  • Frontend: React 17, JavaScript ES6+
  • Blockchain: Linera Protocol
  • Smart Contract: Rust (Fungible Token)
  • Styling: CSS3 with animations
  • Build Tool: Create React App

Project Structure

chain-crush/
├── src/
│   ├── components/          # React components
│   │   ├── GameBoard.js     # Game board component
│   │   ├── GameControls.js  # Game control buttons
│   │   ├── LoginModal.js    # User authentication
│   │   ├── UserBar.js       # User information display
│   │   ├── Leaderboard.js   # Score leaderboard
│   │   ├── BlockchainInfo.js # Blockchain status
│   │   └── LoadingScreen.js # Loading screen
│   ├── hooks/               # Custom React hooks
│   │   ├── useLinera.js     # Blockchain integration
│   │   ├── useAuth.js       # Authentication logic
│   │   ├── useGameLogic.js  # Game mechanics
│   │   └── useGameTimer.js  # Timer functionality
│   ├── utils/               # Utility functions
│   │   ├── authUtils.js     # Authentication helpers
│   │   ├── adminUtils.js    # Admin functionality
│   │   └── leaderboardUtils.js # Leaderboard management
│   ├── services/            # External services
│   │   └── lineraService.js # Linera blockchain service
│   ├── constants/           # Game configuration
│   │   └── gameConstants.js # Game settings and constants
│   ├── images/              # Game assets
│   └── App.js               # Main application
├── contract/                # Linera smart contract (Rust)
│   ├── src/                 # Contract source code
│   └── Cargo.toml           # Rust dependencies
└── public/                  # Static assets

Acknowledgments

  • Original Candy Crush concept
  • Linera Protocol team
  • @kubowania

🎮 Start playing Chain Crush and earn test-tokens while having fun! 🎉

Built with ❤️ using React and Linera Protocol

About

A match-3 styled P2E game integrated with Linera microchains.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages