1

I'm looking to make a game on solona. Each player will have multiple characters, so I want to use NFT to store character information like Ethereum's ERC721. Can I use lang neo to create NFTs and distribute them to players?

1 Answer 1

2

I am not familiar with ERC721 or lang neo, but on Solana you can use a PDA to save extra player data and use the mint of the NFT as a seed like so:

#[account( 
    init,
    payer = signer,
    space = 800,
    seeds = [b"player".as_ref(), signer.key().as_ref(), nftMint.key().as_ref()],
    bump,
)]
pub player: Account<'info, PlayerData>,

#[account]
pub struct PlayerData {
    pub authority: Pubkey,
    pub board: BoardData,
    pub score: u32,
    pub game_over: bool,
    pub new_tile_level: u32,
    pub xp: u32,
    pub level: u32,
etc...
}

Like this you can have one game state per NFT for example or save things like xp and level etc. Here is a complete on chain game which uses this technic: https://github.com/solana-developers/solana-2048

2
  • 1
    Hello, thank a lot! Jan 12 at 9:03
  • Excited to see what you are building :)
    – Jonas H.
    Jan 12 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.