Critter‐Craft Universe Wiki: Core PetNFT Structure - BigBossBoolingB/CritterCraftUniverse GitHub Wiki
Wiki: Core PetNFT Structure Document ID: F-NFT-001 Status: Finalized Architect: Josephis K. Wade
-
Overview The PetNft is the atomic unit of the CritterCraft Universe. It is a non-fungible token representing a unique, evolving AI companion. This document specifies the data structure that defines every Pet.
-
Data Structure Definition The PetNft will be implemented as a Rust struct within the pallet-nft module.
// A simplified Rust-like struct for conceptual clarity.
#[derive(Encode, Decode, Clone, PartialEq, Eq, Default, TypeInfo)] pub struct PetNft<AccountId, BlockNumber> { // --- Immutable Charter Attributes (The "DNA") --- // These are set at minting and never change.
/// Unique identifier for the PetNFT.
pub id: u128,
/// The species of the Pet (e.g., "Cyber-Wolf", "Gryphon").
pub species: Vec<u8>,
/// The elemental affinity of the Pet (e.g., "Fire", "Data", "Aether").
pub element: ElementType,
/// The base genetic potential, influencing stat growth. (e.g., 1-100).
pub potential: u8,
// --- Dynamic Attributes (The "Experience") ---
// These evolve through gameplay and interaction.
/// The current owner of the PetNFT.
pub owner: AccountId,
/// The Pet's current level.
pub level: u32,
/// Experience points accumulated towards the next level.
pub experience: u64,
/// Current health points.
pub health: u32,
/// Base attack stat.
pub attack: u32,
/// Base defense stat.
pub defense: u32,
/// A measure of the bond with the owner, influencing certain abilities.
pub loyalty: u16,
// --- Metadata & Lineage ---
/// IPFS CID (Content Identifier) pointing to off-chain metadata
/// (3D model, textures, detailed lore).
pub metadata_uri: Vec<u8>,
/// The block number when the Pet was minted.
pub birth_block: BlockNumber,
/// Optional: IDs of the two parents, if the Pet was bred.
pub parents: Option<(u128, u128)>,
}
// Supporting Enum for ElementType #[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] pub enum ElementType { Aether, Data, Fire, Water, Earth, Wind, // etc. }
- Field Explanations Charter Attributes (Immutable) id: The primary key for the NFT. Uniquely identifies the pet across the entire ecosystem.
species: Determines the pet's base appearance and available ability pools.
element: Defines elemental strengths, weaknesses, and affinities, critical for the battle system.
potential: A "hidden" quality score. A pet with higher potential will gain better stats upon leveling up compared to one with lower potential, making it a key attribute for breeding.
Dynamic Attributes (Mutable) owner: The wallet address that currently holds and controls the NFT. Transfer of ownership is a core function.
level & experience: The primary progression vector. Gained through battles, quests, and other activities.
health, attack, defense: Core combat stats, calculated from base values, level, and potential.
loyalty: A crucial stat for the "emotional engagement" pillar. Higher loyalty may unlock special abilities, increase critical hit chances, or be a prerequisite for certain evolutions.
Metadata & Lineage metadata_uri: Ensures the visual and narrative assets of the pet are decentrally stored and linked to the on-chain token, preventing data loss and censorship.
birth_block: Provides a verifiable "age" for the pet.
parents: The foundation of the breeding system, creating a verifiable on-chain lineage for every pet.