Skip to content

Adg0/silvanus

Repository files navigation

🌳 Silvanus NFT gaming

⚠️ This is a proof of concept, not to be used in production environment.

Summary

Silvanus is an on-chain dynamic NFT game.

Players water seedling NFTs to grow them into a tree.

Players race to grow their seedling before the tree NFT dies from flood or wild fire happens.

The goal of the game is to promote forestation and bring people together.

Silvanus

Demo Video

Live Demo for Optimisim Goerli

NFT drop on NiftyKit

We wrote contract for dynamic NFT with the help of openzepplen and NiftyKit.

The front end application is written with vite and generated from unity. The repository for the Front-End is available here: https://github.com/adapole/silvanus-frontend

Overview

Multiplayer mode is the major focus of our build, to bring people together we must provide a media of communication.

A voip voice communication channel is built into the game so anyone in the room can talk with each-other.

And a support for almost all modern hardware devices, from VR & AR devices to smart-phones and PC widens the reach of our game.

Game play

To win the game all you need to do is raise your seedling into a tree. Water the seedling with H2O token consistently until it becomes a tree.

Some events are triggered by game master, like Rain and Wild fire.

Rain supplies all silvanus NFT holders with water token(H2O) and on occasion it causes Flood for small seedlings.

Wild Fire is also started by game master to level the playing field so seedlings get a chance to grow and compete with bigger trees.

Floods destroy the seedlings but you get a water token airdrop nonetheless.

To survive wild fire event, pledge water for fire extinguishing; that is approve spending to contract to drain water incase a fire happens.

So Pray for protection from Flood and Fire at the temple. Or use some Magic Potion NFT to revive your tree if it dies.

Requirements

  1. NiftKit account and Hashlips
  2. Alchemy provider api or another provider

Optimism Smart Contract

Contracts are extended openzepplen contracts. The game logic consists of two NFTs and an ERC20 token.

The silvanus NFT is responsible for processing all growth event. The program is responsible for implementing all the logic for the game. And so it is a dynamic NFT.

The potion NFT is used to revive dead trees, any account that holds silvanusTree NFT gets exponential potions power minted during mint call to potion contract. Potion NFTs are thus dynamic NFT as well.

The H2O token is used to grow the silvanusTree NFT. It is a standard ERC20 token on optimism, except for airdrop function Rain.

In WaterToken.sol we keep the logic of Rain, MagicPotion.sol contains approval to apply potion and SilvanusTree.sol keeps track of tree growth variable and triggers game master events.

Contact

Twitter URL

Useful Resources

Testnet Dispensary

Optimism Bridge

Etherscan

Remix IDE

NiftyKit-Hashlips: The best no code solution for NFTs

Optimism getting started

Remix: Quick start into web3

Openzepplin: ERC standards and library

Deploying on optimism with Hardhat

Hardhat: Quick start

Metamask: Integrating web3 into dapp