A streamlined blockchain strategy game showcasing thirdweb API capabilities. Built without any blockchain SDKs - pure API calls only!
- Simple strategic battlefield
- 3 territory types: Keep, Outpost, Stronghold
- Real-time territory claiming and battles
- 4 army types: Infantry, Archer, Cavalry, Siege
- Different movement ranges and combat strengths
- Risk-style battle mechanics
- Simple resource: Action Points (AP)
- All actions cost AP: Claim (20), Recruit (15), Move (5), Battle (10)
- Auto-regenerating - no complex economy management
- Focus on strategy, not resource micromanagement
- Quick battles and expansion
- Landing page with game overview and thirdweb CTAs
- Easy to learn, fun to master
- Easy to learn, fun to master
This is a showcase for thirdweb customers - demonstrating what's possible with pure API calls:
- ✅ No Web3 SDKs required
- ✅ No complex blockchain setup
- ✅ No backend servers needed
- ✅ No databases required
- ✅ Just HTTP requests + smart contracts
Perfect for developers exploring api.thirdweb.com capabilities!
Copy .env.example
to .env.local
and fill in:
# Get from https://thirdweb.com/dashboard
THIRDWEB_CLIENT_ID=your_client_id_here
THIRDWEB_SECRET_KEY=your_secret_key_here
# Deploy contract first, then add address
NEXT_PUBLIC_GAME_CONTRACT=0x...
# Network (Base Sepolia)
NEXT_PUBLIC_CHAIN_ID=84532
-
Install dependencies:
npm install
-
Deploy contract (use thirdweb dashboard)
- Deploy the
/contracts/Web3Warlords.sol
contract - Add contract address to
.env.local
- Deploy the
-
Run the game:
npm run dev
-
Explore:
- Landing page at
http://localhost:3000
- Game interface at
http://localhost:3000/game
- Landing page at
- Game state → Single smart contract
- Action Points → Simple counter system
- Real-time updates → Polling blockchain via API
- Persistence → Blockchain storage
Every feature is just an HTTP request:
// Get game state
const state = await fetch("/api/game/state?player=0x...");
// Claim territory
await fetch("/api/game/actions", {
method: "POST",
body: JSON.stringify({ action: "claimTerritory", territoryId: 5 }),
});
// Recruit army
await fetch("/api/game/actions", {
method: "POST",
body: JSON.stringify({ action: "recruitArmy", territoryId: 1, armyType: 0 }),
});
// Start battle
await fetch("/api/game/actions", {
method: "POST",
body: JSON.stringify({ action: "battle", fromId: 1, toId: 2 }),
});
- Clean modern UI with dark theme
- Territory grid with visual indicators
- Action Points meter showing resource status
- Intuitive controls for strategy gameplay
✅ Authentication - Wallet connection
✅ Wallets - Balance checking, transaction management
✅ Contracts - Read/write operations, event monitoring
✅ Transactions - Status tracking, gas optimization
Comprehensive Web3 integration - all via API calls!
This game shows how to build:
- Simple blockchain games
- Action-based game mechanics
- Real-time Web3 apps
- Strategy game logic
All with just API calls - no complex Web3 setup required!
This is a showcase project demonstrating thirdweb API capabilities. Feel free to:
- Fork and modify
- Add new features
- Use as learning reference
- Build your own Web3 games
Let's show the world what's possible with powerful APIs! 🚀