Skip to content
Public template

About

A simple multiplayer web3 game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NeonStrike

A real-time multiplayer arena shooter with Web3 integration on Base chain. Compete in free matches or stake ETH for winner-takes-all battles. Clone it and try it yourself

Base Chain Solidity Node.js Socket.IO

Gameplay

  • Move: WASD keys
  • Shoot: Click to fire projectiles (200ms cooldown)
  • Health: 3 HP per life, 3 lives total
  • Respawn: Automatic respawn with 2s invincibility
  • Objective: Eliminate other players, climb the leaderboard

Features

Core Game

  • Real-time multiplayer with Socket.IO
  • Smooth player interpolation
  • Live leaderboard
  • Neon-glow visual effects
  • Health bars and lives system
  • Kill feed notifications
  • Procedural sound effects (Web Audio API)
  • Screen shake on hit

Web3 Integration (Base Chain)

  • Free Play: Play without wallet, stats recorded on-chain
  • Staked Matches: Stake ETH, winner takes 97.5% of the pot
  • On-chain Leaderboard: Persistent stats across sessions
  • Achievements: Unlock NFT-style achievements
  • ARENA Token: Earn tokens for kills and wins

Quick Start

Prerequisites

  • Node.js 18+
  • MetaMask wallet (for Web3 features)
  • Base Sepolia ETH (for staked matches)

Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/neonstrike.git
cd neonstrike

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Start the server
npm start

Open http://localhost:3000 in your browser.

Environment Variables

# Server
PORT=3000

# Blockchain (Base Sepolia)
CHAIN_ID=84532
SERVER_PRIVATE_KEY=your_private_key

# Contract Addresses
GAME_MANAGER_ADDRESS=0x...
LEADERBOARD_ADDRESS=0x...
GAME_TOKEN_ADDRESS=0x...

Smart Contracts

Deployed on Base Sepolia:

Contract Address
GameManager 0xC07DbdcC57C3420d6B21031F7E00DCE1a627E859
LeaderboardRegistry 0x55b4D19Df4BD408eAcCb546e92207DC7F88Ca0EC
GameToken 0xb9056Fff904D6Fb7BcD6e944e7b480A3706B4434

Contract Features

GameManager.sol

  • Create/join staked matches (0.001 - 10 ETH)
  • Escrow funds during gameplay
  • Server-signed result verification
  • 2.5% platform fee on winnings

LeaderboardRegistry.sol

  • Track kills, deaths, wins, losses
  • Season-based rankings
  • Achievement system (First Win, 10 Streak, etc.)

GameToken.sol (ARENA)

  • ERC-20 reward token
  • 1 token per kill, 10 per win
  • Daily mint cap to prevent abuse

Project Structure

neonstrike/
├── backend.js              # Express + Socket.IO server
├── public/
│   ├── index.html          # Game UI with HUD
│   └── js/
│       ├── frontend.js     # Game client + wallet state
│       ├── wallet.js       # MetaMask integration
│       ├── gameUI.js       # UI modals and controls
│       ├── sound.js        # Web Audio API sound effects
│       ├── eventListeners.js
│       ├── contracts/
│       │   └── abis.js     # Contract ABIs
│       └── classes/
│           ├── Player.js   # Player with health bar
│           ├── Projectile.js
│           └── Particle.js
├── contracts/
│   ├── contracts/
│   │   ├── GameManager.sol
│   │   ├── LeaderboardRegistry.sol
│   │   └── GameToken.sol
│   ├── scripts/deploy.js
│   └── hardhat.config.js
└── .env

Deploying Contracts

cd contracts
npm install

# Deploy to Base Sepolia testnet
npm run deploy:sepolia

# Deploy to Base Mainnet (production)
npm run deploy:mainnet

Game Modes

Free Play

  • No wallet required
  • Join instantly with username
  • Stats recorded on-chain (if wallet connected)
  • Earn ARENA tokens for performance

Staked Match

  1. Connect MetaMask wallet
  2. Switch to Base Sepolia network
  3. Create match with ETH stake (0.001 - 10 ETH)
  4. Share Match ID or wait for opponent
  5. Winner claims 97.5% of total pot

Roadmap

v1.1 - Core Improvements ✅

  • Respawn system with lives (3 lives, auto-respawn)
  • Health bars (3 HP per life)
  • Shooting cooldown (200ms)
  • Sound effects (Web Audio API procedural sounds)
  • Kill feed notifications
  • Screen shake on damage
  • Invincibility on respawn (2 seconds)

v1.2 - Enhanced Gameplay

  • Mobile touch controls
  • Death particles/animations
  • Match timer display
  • Power-ups (speed boost, shield, rapid fire)
  • Map obstacles

v1.3 - Social Features

  • In-game chat
  • Player profiles
  • Friends list
  • Private matches
  • Spectator mode

v2.0 - Base Mainnet Launch

  • Security audit
  • Mainnet deployment
  • Tournament system
  • Seasonal rewards
  • DAO governance with ARENA token

Tech Stack

  • Frontend: HTML5 Canvas, Vanilla JS, GSAP
  • Backend: Node.js, Express, Socket.IO
  • Blockchain: Solidity, Hardhat, ethers.js
  • Network: Base (Ethereum L2)

Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE for details.

Links


Built with Base

About

A simple multiplayer web3 game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages