Data Architecture Overview
Flowchart
| Data Source | Priority | Use Case | Persistence | |----------------|-------------|--------------|----------------| | Blockchain NFT | Primary | Authenticated characters, permanent storage | Blockchain (immutable) | | AuthContext.selectedCharacter | Runtime | Active game state, immediate updates | Memory (session) | | Local Storage | Deprecated | Migration only, being phased out | Browser (temporary) |
The system has been migrated to blockchain-first architecture:
(CharacterService.saveCharacter() rejects non-NFT characters)// NEW camelCase structure (Hive-compliant)
{
attributes: [
{ trait_type: "coreInfo", value: JSON.stringify({...}) },
{ trait_type: "combatStats", value: JSON.stringify({...}) },
{ trait_type: "gameData", value: JSON.stringify({...}) }
]
}
Data Conversion Pipeline
CharacterNFTDataService.parseNFTData()nftToCharacter() in useCharacterNFT.ts🔴 HIGH RISK CONFLICTS
// AuthContext immediately updates local state
setSelectedCharacter(updatedCharacter);
// Then syncs to blockchain in background
CharacterSyncService.syncCharacterToBlockchain(character);
CharacterNFTDataService.parseNFTData()🟡 MEDIUM RISK CONFLICTS
// Equipment can be in character.equipped AND item.equipped property
const equippedItems = character.inventory.filter(item => item.equipped);
const equippedSlots = character.equipped || {};
// Multiple XP calculation methods
const newLevel = Math.floor(newExperience / 100) + 1; // Adventure mode
const xpForLevel = (level - 1) * 100; // Character display
🟢 LOW RISK CONFLICTS
NFTInventoryService.syncNFTsWithInventory()// HIGH DEPENDENCY - Directly affects combat stats
DurabilityTracker.applyDamage() → Updates character.inventory
EquipmentService.equipItem() → Updates character.equipped
CharacterSyncService → Syncs equipment changes to blockchain NFT
// MEDIUM DEPENDENCY - Affects character progression
QuestRewardService.applyQuestRewards() → Updates character XP/level
useAdventureMode() → Tracks quest progress against character state
CharacterService.gainExperience() → Deprecated, uses AuthContext now
// LOW DEPENDENCY - Separate NFT system but uses character for access
LandManagementService.mintLandNFT() → Independent of character NFT
DungeonService → Uses character level for access requirements
DurabilityTracker → Applies damage from 'land_dungeon' activities
// HIGH DEPENDENCY - Dragons stored in character data
DragonService.addDragon() → Updates character.dragons array
NFTInventoryService.syncNFTsWithInventory() → Syncs dragon NFTs
| Mechanic | NFT Dependency | Conflict Risk | Mitigation | |-------------|-------------------|------------------|----------------| | Level Up | High - stored in NFT | Medium - XP calculation variations | AuthContext.gainExperience() with blockchain sync | | Skill Points | High - stored in NFT | Low - Simple addition | Calculated from level | | Equipment Stats | High - affects total stats | High - Multiple tracking methods | Equipment validation service | | Dragon Collection | Medium - NFT + local | Medium - Sync issues | NFTInventoryService sync |
// Character NFT Operations
- Character Minting: Requires POB tokens (amount TBD)
- Character Updates: Blockchain transaction fees
- Equipment Sync: Custom JSON broadcast fees
// Land NFT Integration
- Land Minting: 25 POB (5% burned, 95% to game)
- Dungeon Access: Character level requirements
- Equipment Durability: Damage from land_dungeon activities
// XP & Progression Rewards
- Quest XP: 10-100 XP per quest (100 XP = 1 level)
- Skill Points: 2 per level gained
- Equipment Rewards: Common to Rare items
// Token Integration
- POB: Primary game token
- SHARD: Staking token for bonuses
- BEE: Community rewards
- PART: Golem Arena requirements
// Equipment NFTs are handled through:
1. NFTInventoryService.getCharacterNFTData() - Fetches equipment NFTs
2. DurabilityTracker - Manages equipment durability (NFT metadata updates)
3. EquipmentService - Local equipment state management
4. ItemNFTService - Updates NFT metadata on blockchain
// Integration Points:
- character.inventory[] - Contains all items (NFT + local)
- character.equipped{} - Tracks equipped slot assignments
- item.isNFT & item.nftId - Identifies NFT equipment
- item.durability - Tracked locally and synced to NFT metadata
⚠️ Critical Issues to Address
✅ Well-Handled Aspects
🔧 Recommended Improvements
The current system has successfully transitioned to a blockchain-first architecture with character NFTs as the primary data source. The main conflicts arise from synchronization timing and state fragmentation rather than fundamental architectural issues. The AuthContext serves as an effective runtime state manager, while CharacterSyncService handles blockchain persistence appropriately.
Most Critical Risk: Equipment state inconsistencies that could affect combat stats and gameplay balance.
Most Well-Handled: Character NFT data parsing and adventure mode integration.
Primary Recommendation: Implement comprehensive state validation and reconciliation systems to ensure data consistency across all game modules.
The game is broken but we of the hive are determined to make this work. Enter at your own risk.