Robobo is an innovative AI-Agent based robot pet battle game built on the Sui blockchain. Each robot is not just an NFT, but an independent AI-Agent that you can chat with, bond with, and take into battles for upgrades and growth.
- PVP Battle System
- On-chain Real-time Matchmaking
- Victory Rewards: Tokens, Parts, and Status Recovery
- Each Robobo is a Unique AI-Agent
- Build Bonds Through Dialogue
- AI Personality Evolution System
- Parts Management and Equipment System
- Customize Robobo Battle Styles
- Attribute Adjustment and Enhancement
- Support for Wallet and Google Login
- Web3-Friendly User Experience
- Seamless Cross-platform Experience
- Unique AI-Agent Personality System
- Deep Conversational Interaction
- Intelligent Battle Analysis
- NFT Character Evolution
- Equipment Collection and Enhancement
- Social Interaction and Quest System
.
├── server/ # Backend Service
├── contract/ # SUI Move Smart Contracts
└── web/ # Frontend & Game Engine
- Enhance Inventory System
- Implement Leaderboard and Reward System
- Improve AI-Agent Conversation Capabilities
- Introduce More AI Interactive Features
- Develop Social Ecosystem
- Build Guild and Team Systems
We're exploring the infinite possibilities of AI + Web3 gaming! If you're interested in Robobo, join us in creating the future of Web3 gaming.
Click to expand smart contract documentation
The Robobo smart contract system is implemented in Sui Move, providing core game logic including Robot NFT minting, attribute management, battle system, and equipment management.
The contract system consists of the following modules:
contract/
├── sources/ # Contract source code
│ ├── game.move # Core game logic
│ ├── element.move # Equipment system
│ ├── robot.move # Robot NFT implementation
│ ├── battle.move # Battle system
│ ├── user.move # User system
│ ├── config.move # Game configuration
│ └── trash.move # Token system
├── Move.toml # Project configuration
└── tests/ # Test cases
├── game_tests.move
├── element_tests.move
├── robot_tests.move
└── battle_tests.move
Core game state management and business logic implementation.
struct GameState has key, store {
id: UID,
passports: Table<address, ID>, // User passport records
robots: vector<ID>, // Robot records
elements: Table<ID, vector<ID>>, // Equipment records
total_battles: u64, // Total battle count
rankings: Table<ID, u64> // Leaderboard
}
struct AdminCap has key, store {
id: UID
}
struct BattleRewardEvent has copy, drop {
winner_id: ID,
loser_id: ID,
token_reward: u64,
has_element_drop: bool,
timestamp: u64
}
Robot equipment system implementation.
struct Element has key, store {
id: UID,
name: String,
description: String,
abilities: vector<u8>, // [Attack, Defense, Speed, Energy, Core]
}
- 5 Core Attributes: Attack, Defense, Speed, Energy, Core
- Attribute Threshold (ABILITY_THRESHOLD = 128):
-
128: Attribute boost
- < 128: Attribute reduction
-
- Balance Mechanism: Only one attribute per equipment can exceed threshold
create_passport
: Create user passport as identity credentialclaim_daily_token
: Daily TRASH token rewards- User permission management and state tracking
- On-chain user data storage and verification
mint_robot
: Mint Robot NFT using TRASH tokens- Robot attribute system:
- Base attributes: Attack, Defense, Speed, etc.
- Equipment slots: Different types of equipment
- Battle records: Win rate, points, etc.
- Robot attribute upgrades and evolution
- Five core attributes
- Equipment acquisition:
- Battle rewards
- Chat interaction drops
- System rewards
- Equipment mechanism:
- TRASH token consumption
- Attribute stacking
- Equipment slot restrictions
random_battle
: Random matchmaking- Battle mechanics:
- Calculation based on robot attributes and equipment
- Equipment bonus effects
- Random factors
- Reward system:
- Battle points
- TRASH token rewards
- Equipment drops
- Leaderboard updates
- Uses:
- Robot NFT minting
- Battle participation
- Equipment management
- Attribute upgrades
- Acquisition:
- Daily sign-in rewards
- Battle victory rewards
- Special event rewards
- Token economy:
- Inflation control
- Token burn mechanism
- Reward balance
- Sui Move ownership system for asset security
- Comprehensive permission checks:
- Admin privileges
- User operation verification
- Asset transfer restrictions
- Detailed error handling
- Transaction atomicity guarantee
- Modular design for easy feature expansion
- Support for future gameplay:
- Reserved interfaces
- Configurable parameters
- Low module coupling
- Reserved attribute and state expansion space
- Fair battle matching using Sui on-chain random numbers
- Unpredictable battle results
- Anti-cheating mechanism
- Sui Move Compiler
- Move Test Framework
- Sui CLI Tools
- Development IDE (VSCode + Move Plugin recommended)
# Build contract
sui move build
# Test
sui move test
# Deploy (network configuration required)
sui client publish --gas-budget 10000
# Run all tests
sui move test
# Run specific tests
sui move test game_tests
sui move test element_tests
sui move test battle_tests
// 1. Deploy contract
// 2. Initialize game state
fun init(_: GAME, ctx: &mut TxContext)
// 1. Create passport
create_passport(name, game_state, game_config, token_cap, ctx)
// 2. Claim tokens
claim_daily_token(game_config, passport, token_cap, ctx)
// 3. Mint robot
mint_robot(game_state, game_config, robot_pool, robot_name, payment, token_policy, ctx)
// 4. Battle
random_battle(game_state, game_config, robot_pool, robot, payment, token_policy, token_cap, random, clock, ctx)
const E_ALREADY_HAS_PASSPORT: u64 = 0;
const E_NO_PASSPORT: u64 = 1;
const E_ALREADY_CLAIMED_TODAY: u64 = 2;
const E_INSUFFICIENT_TRASH: u64 = 3;
const E_INVALID_ELEMENT: u64 = 4;
const E_BATTLE_IN_COOLDOWN: u64 = 5;
- Complete error checking
- Clear error messages
- Transaction rollback protection
- All transactions require TRASH tokens
- Equipment attributes must meet balance requirements
- Battle results determined by on-chain random numbers
- Regular game configuration maintenance required
- Important operations require transaction confirmation
- Test thoroughly on testnet before mainnet deployment
For more details, see contract/README.md
Click to expand frontend documentation
The Robobo Web frontend is developed using Next.js + React framework, integrating the Phaser game engine to create an NFT-enabled robot pet battle game.
The system adopts a modular design, consisting of the following core components:
-
Background System:
- Scene rendering
- Map loading
- Environmental effects
-
Animation System:
- Character animations
- Special effects
- State transition animations
-
Sound System:
- Background music
- Battle sound effects
- Environmental audio
-
State Machine System:
- Character state management
- Battle state transitions
- Game progress control
-
Connection Module:
- Wallet connection
- Network status management
- Account management
-
Minting Module:
- NFT minting
- Robot generation
- Attribute allocation
-
Home Module:
- Robot showcase
- Status overview
- Feature navigation
-
Inventory Module:
- Equipment management
- Item management
- Asset display
-
Battle Module:
- Battle matching
- Battle interface
- Reward settlement
-
Chat Module:
- AI dialogue
- Reward system
- Personalized interaction
-
Frontend Framework:
- Next.js 14
- React 18
- TypeScript
- TailwindCSS
-
Game Engine:
- Phaser 3
-
Web3 Integration:
- SUI Wallet
- Web3 API
-
State Management:
- React Context
- Custom Hooks
web/
├── app/ # Next.js application main directory
│ ├── page.tsx # Main page
│ ├── layout.tsx # Layout component
│ └── providers.tsx # Global providers
├── game/ # Game-related code
│ ├── scenes/ # Game scenes
│ ├── core/ # Core logic
│ ├── gameObject/ # Game objects
│ └── config/ # Configuration files
├── components/ # React components
├── hooks/ # Custom hooks
├── context/ # Global state
├── contracts/ # Smart contract interaction
├── utils/ # Utility functions
└── types/ # Type definitions
-
Wallet Integration:
- SUI wallet support
- Asset management
- Transaction processing
-
NFT System:
- Robot NFT minting
- Attribute system
- Equipment system
-
Battle System:
- PVP battles
- Reward mechanism
- Leaderboard
-
AI Interaction:
- Intelligent dialogue
- Personalized interaction
- Behavior learning
-
Game Scene Development:
- Create new scenes in
game/scenes
- Extend Phaser.Scene
- Implement preload/create/update methods
- Create new scenes in
-
UI Component Development:
- Use TailwindCSS styling
- Follow React component best practices
- Ensure Web3 functionality compatibility
-
Contract Interaction:
- Use utility functions in
contracts
directory - Handle transaction states and errors
- Implement event listeners
- Use utility functions in
For more details, see web/README.md
Click to expand backend documentation
The Robobo backend service is built on Next.js, implementing an AI-powered robot pet battle game server with dialogue system, personality evolution, and battle analysis capabilities.
The system adopts a layered architecture design with the following core modules:
Elizant is a flexible Agent framework that manages and coordinates various subsystems:
-
Character System:
- Robot personality definition
- Behavior pattern management
- Knowledge system integration
-
Spec Builder:
- OpenAPI specification generation
- Role definition
- Capability declaration management
-
Action System:
- Tool registration
- Capability mapping
- Permission management
-
Memory System:
- RAG engine
- Memory retrieval
- Knowledge update
-
Character Evaluator:
- Dialogue analysis
- Behavior assessment
- Personality evolution evaluation
-
Reward Evaluator:
- Behavior reward calculation
- Achievement completion
- Incentive mechanism management
-
Battle Evaluator:
- Battle analysis
- Strategy evaluation
- Element analysis
- Business Adapter: Business logic adaptation
- Chat Model Adapter: AI model integration
- Chain Adapter: Blockchain interaction
- Relational Database: Structured data storage
- Vector Database: Semantic vector storage
- SUI Blockchain: On-chain data storage
- Caching System: Performance optimization
- Relational Database [WIP]
- Vector Database Integration [TODO]
- SUI Chain Interaction [WIP]
- Caching System [TODO]
- Spec Builder [WIP]
- Character System [TODO]
- Action System [TODO]
- Memory System [TODO]
- Agent Runtime [WIP]
- Character Evaluator [TODO]
- Battle Evaluator [TODO]
- Reward Evaluator [TODO]
- Chat Model Adapter [WIP]
- Business Adapter [WIP]
- Blockchain Adapter [WIP]
[WIP] - Work In Progress [TODO] - Not Started
For more details, see server/README.md
See individual component directories for development instructions: