A blockchain-powered retro fighting game on OneChain
Play-to-Earn • NFT Fighters • On-Chain Battles • Tournament Staking
- Overview
- Game Features
- How to Play
- Fighter Roster
- Game Workflow
- OneChain Integration
- Smart Contracts
- Installation
- Tech Stack
- Architecture
One Clash Fighters is a retro-style fighting game that combines classic arcade gameplay with modern blockchain technology. Built on OneChain, players mint unique Fighter NFTs, battle AI opponents, stake OCT tokens in tournaments, and earn rewards based on their performance—all recorded immutably on-chain.
- 🎨 NFT Fighters: Mint and own unique fighter characters as NFTs
- ⚔️ On-Chain Battles: Every victory is recorded on the blockchain
- 💰 Play-to-Earn: Stake tokens, win battles, claim prizes
- 🏆 Live Leaderboard: Real-time rankings from blockchain events
- 🔗 Fully Decentralized: All game logic secured by smart contracts
A clean, futuristic landing screen where players begin their journey, connect wallets, and explore game modes.

Players choose their fighters, each with unique power stats, abilities, and rarity levels.

A victory screen showing battle results, rewards earned, and XP gained.

After each match, battle stats are permanently stored on the OneChain blockchain for transparency and fairness.

The core gameplay scene where turn-based combat takes place with animations, attacks, and health tracking.

Global rankings showcasing top players based on wins, staking power, and on-chain battle history.

Users can stake tokens inside the game to boost rewards, earn yield, and unlock special characters.

The actual OneChain dashboard where staking transactions are executed and verified on-chain.

- 6 Unique Fighters with distinct stats and abilities
- Progressive Difficulty - AI gets stronger each round
- Advanced Combat System - Punch, kick, jump, duck, defense, and special moves
- Retro Pixel Art - Classic arcade aesthetics
- Responsive Controls - Smooth keyboard-based combat
- Fighter NFT Minting - Create your fighter on-chain
- Battle Recording - All victories stored on OneChain
- Tournament Staking - Stake OCT tokens to enter prize pools
- Prize Distribution - Winners claim rewards automatically
- Transparent Leaderboard - Rankings verified on blockchain
- Profile System - View your NFT fighter and battle history
- Click "Connect Wallet" on the home screen
- Connect your OneWallet (OneChain compatible wallet)
- Navigate to "Character Select"
- Choose from 6 unique fighters
- Mint your fighter NFT (small fee required)
- Select your minted fighter
- Battle against AI opponents
- Use strategic moves to win
- Visit the "Staking" page
- Stake OCT tokens to enter tournaments
- Win battles to increase your prize pool share
- Check the "Leaderboard" for rankings
- View your "Profile" to see stats and battle history
Each fighter has unique stats that affect combat performance:
graph LR
A[Fighter Stats] --> B[Power]
A --> C[Speed]
A --> D[Defense]
B --> E[Damage Output]
C --> F[Attack Speed]
D --> G[Damage Reduction]
| Fighter | Type | Power | Speed | Defense | Specialty |
|---|---|---|---|---|---|
| ⚡ Thunder Fist | Boxer | 9 | 6 | 7 | Heavy punches, high damage |
| 🥷 Shadow Strike | Ninja | 7 | 10 | 5 | Lightning fast, swift combos |
| 🤖 Cyber Warrior | Tech | 8 | 8 | 6 | Balanced, precision strikes |
| 🎭 Mystery Fighter | Enigma | 6 | 7 | 9 | Unpredictable, defensive |
| 👑 Street King | Brawler | 7 | 7 | 8 | Well-rounded, solid fundamentals |
| 🛡️ Iron Wall | Tank | 8 | 5 | 10 | Defensive powerhouse, unbreakable |
| Key | Action | Description |
|---|---|---|
| ←/→ | Move | Walk left/right |
| ↑ | Jump | Leap over attacks |
| ↓ | Duck | Avoid high kicks |
| D | Punch | Quick attack (5 damage) |
| A | Kick | Strong attack (10 damage) |
| S | Defense | Block incoming damage (1% only) |
| ↑ + A | Jump Kick | Aerial special (15 damage) |
flowchart TD
Start([Player Visits Game]) --> Connect{Wallet Connected?}
Connect -->|No| ConnectWallet[Connect OneWallet]
ConnectWallet --> Connect
Connect -->|Yes| HasNFT{Has Fighter NFT?}
HasNFT -->|No| Select[Character Select Page]
Select --> Mint[Mint Fighter NFT]
Mint --> MintTx[Transaction on OneChain]
MintTx --> HasNFT
HasNFT -->|Yes| Menu[Main Menu]
Menu --> Choice{Player Choice}
Choice -->|Fight| Fight[Enter Combat]
Fight --> Battle[Battle AI Opponent]
Battle --> Win{Victory?}
Win -->|Yes| Record[Record Battle On-Chain]
Record --> Prize[Distribute Prize]
Prize --> UpdateStats[Update Fighter Stats]
UpdateStats --> NextRound{Continue?}
NextRound -->|Yes| Difficulty[Increase Difficulty]
Difficulty --> Battle
NextRound -->|No| Menu
Win -->|No| GameOver[Game Over]
GameOver --> Menu
Choice -->|Stake| Stake[Tournament Staking]
Stake --> StakeTx[Stake OCT Tokens]
StakeTx --> Pool[Add to Prize Pool]
Pool --> Menu
Choice -->|Leaderboard| Leader[View Rankings]
Leader --> Fetch[Fetch Blockchain Events]
Fetch --> Display[Display Top Players]
Display --> Menu
Choice -->|Profile| Profile[View Profile]
Profile --> ShowNFT[Display Fighter NFT]
ShowNFT --> ShowHistory[Show Battle History]
ShowHistory --> Menu
graph TB
subgraph "Frontend (Next.js)"
UI[User Interface]
Wallet[Wallet Connection]
Hooks[React Hooks]
end
subgraph "OneChain Blockchain"
NFT[Fighter NFT Module]
Battle[Battle System Module]
Stake[Staking Pool Module]
Events[Blockchain Events]
end
subgraph "Smart Contract Functions"
Mint[mint_fighter]
Record[record_battle]
StakeFunc[stake_for_tournament]
Claim[claim_prize]
end
UI --> Wallet
Wallet --> Hooks
Hooks --> Mint
Hooks --> Record
Hooks --> StakeFunc
Hooks --> Claim
Mint --> NFT
Record --> Battle
StakeFunc --> Stake
Claim --> Stake
Battle --> Events
Events --> UI
-
Fighter NFT System
- Each fighter is a unique NFT on OneChain
- Stores stats: name, type, level, wins, losses, damage
- Minted via
fighter_nft::create_fighterfunction - Owned by player's wallet address
-
Battle Recording
- Every battle result is recorded on-chain
- Emits
BattleCompletedevent with winner, damage, prize - Updates fighter stats (wins, losses, total damage)
- Creates immutable
BattleRecordobject
-
Tournament Staking
- Players stake OCT tokens to enter tournaments
- Tokens added to shared prize pool
- Winners claim 90% of pool (10% burned for APY)
- All transactions verified on blockchain
-
Leaderboard System
- Fetches
BattleCompletedevents from blockchain - Aggregates wins, damage, and prizes per player
- Real-time rankings updated automatically
- Fully transparent and verifiable
- Fetches
The game uses three Move smart contract modules deployed on OneChain:
// Creates unique fighter NFTs with stats
public entry fun create_fighter(
name: vector<u8>,
fighter_type: u8,
power: u8,
speed: u8,
defense: u8,
ctx: &mut TxContext
)Features:
- Mint fighter NFTs with custom stats
- Track wins, losses, level, and damage
- Update stats after each battle
- Transfer ownership between wallets
// Records battle results on-chain
public entry fun record_battle(
fighter: &mut Fighter,
winner_damage: u64,
loser_damage: u64,
prize: Coin<OCT>,
round: u64,
ctx: &mut TxContext
)Features:
- Record single-player and PvP battles
- Emit
BattleCompletedevents for leaderboard - Distribute prize tokens to winners
- Create immutable battle records
// Stake tokens for tournament entry
public entry fun stake_for_tournament(
pool: &mut TournamentPool,
stake: Coin<OCT>,
ctx: &mut TxContext
)Features:
- Shared tournament prize pool
- Track total staked and prize pool
- Entry fee: 0.01 OCT (configurable)
- Winners claim 90% of pool
The contracts are deployed on OneChain Testnet. To deploy your own:
# Navigate to Move contracts
cd move
# Build contracts
one move build
# Publish to OneChain
one client publish --gas-budget 100000000After deployment, update lib/onechain-config.ts with your package and pool IDs.
- Node.js 18+ and npm
- OneWallet browser extension
- OneChain testnet OCT tokens (from faucet)
- Clone the repository
git clone https://github.com/yourusername/one-clash-fighters.git
cd one-clash-fighters- Install dependencies
npm install- Configure environment (optional)
# Create .env.local file
NEXT_PUBLIC_PACKAGE_ID=0x33339ae0dbf1d8805eb1413639455b1428484d282c0bdcbe15d1b88921e00f65
- Run development server
npm run dev- Open in browser
http://localhost:3000
npm run build
npm start- Framework: Next.js 14 (App Router)
- Language: TypeScript 5
- Styling: Tailwind CSS
- UI Components: Custom retro-styled components
- State Management: React Hooks
- Network: OneChain Testnet
- Smart Contracts: Move Language
- Wallet Integration: @mysten/dapp-kit
- SDK: @mysten/sui (OneChain compatible)
- Token: OCT (OneChain native token)
- Package Manager: npm
- Linting: ESLint
- Type Checking: TypeScript
- Version Control: Git
one-clash-fighters/
├── app/ # Next.js app directory
│ ├── page.tsx # Home/menu page
│ ├── select/ # Character selection
│ ├── fight/ # Combat gameplay
│ ├── winner/ # Battle results
│ ├── leaderboard/ # Rankings page
│ ├── staking/ # Tournament staking
│ └── profile/ # User profile
├── components/ # React components
├── hooks/ # Custom React hooks
│ ├── use-fighter-nft.ts
│ ├── use-battle-recording.ts
│ └── use-staking.ts
├── lib/ # Utilities and config
│ ├── onechain-config.ts
│ ├── fighters.ts
│ └── game-utils.ts
├── move/ # Smart contracts
│ └── sources/
│ ├── fighter_nft.move
│ ├── battle_system.move
│ └── staking_pool.move
├── providers/ # Context providers
└── public/ # Static assets
sequenceDiagram
participant User
participant Frontend
participant Wallet
participant OneChain
participant SmartContract
User->>Frontend: Connect Wallet
Frontend->>Wallet: Request Connection
Wallet->>Frontend: Wallet Connected
User->>Frontend: Mint Fighter
Frontend->>Wallet: Sign Transaction
Wallet->>OneChain: Submit Transaction
OneChain->>SmartContract: Execute mint_fighter
SmartContract->>OneChain: Create NFT
OneChain->>Frontend: Transaction Success
User->>Frontend: Win Battle
Frontend->>Wallet: Sign Battle Record
Wallet->>OneChain: Submit Transaction
OneChain->>SmartContract: Execute record_battle
SmartContract->>OneChain: Emit Event + Update Stats
OneChain->>Frontend: Battle Recorded
User->>Frontend: View Leaderboard
Frontend->>OneChain: Query Events
OneChain->>Frontend: Return Battle Events
Frontend->>User: Display Rankings
- Hit Detection: Precise collision boxes for each fighter
- Damage Calculation: Based on fighter power stat and move type
- Defense Mechanism: Blocking reduces damage to 1%
- Special Moves: Jump kicks deal 50% more damage
- AI Behavior: Adaptive difficulty with strategic decision-making
- Difficulty Scaling: Each round increases AI damage by 20%
- Fighter Leveling: Win battles to increase fighter level
- Stat Tracking: Cumulative damage dealt and taken
- Win/Loss Record: Permanent on-chain history
- Mint Fee: 0.001 OCT per fighter NFT
- Entry Fee: 0.01 OCT to stake in tournaments
- Prize Pool: 90% distributed to winners, 10% burned
- Battle Rewards: Variable based on performance
Rankings are calculated from blockchain data:
- Total Wins - Number of victories
- Total Damage - Cumulative damage dealt
- Total Prize - OCT tokens earned
- Last Battle - Timestamp of most recent fight
All data is fetched from BattleCompleted events emitted by smart contracts.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OneChain: https://onelabs.cc
- OneChain Docs: https://docs.onelabs.cc
- OneChain Faucet: Get testnet OCT tokens
- OneWallet: Browser extension for OneChain
- OneChain team for blockchain infrastructure
- Next.js team for the amazing framework
- Retro gaming community for inspiration
Built with ❤️ on OneChain
Fight. Earn. Dominate.