This project is an onchain fantasy game powered by an autonomous agent that acts as the Game Master. The agent is responsible for creating levels, assigning them to players, evaluating their progress, and dynamically increasing difficulty as players advance.
At the core of the game is a smart contract deployed on Arbitrum, which stores game related data, including levels, active games, and player interactions. To maintain fairness and prevent players from memorizing levels before encountering them, the descriptions of levels are stored in Nillion’s SecretVault. This ensures that level details remain confidential until they are assigned to a game.
How the Game Works
Level Creation:
- Every hour, the agent generates a new level and stores it both onchain and in the SecretVault.
- The level includes a description (kept secret in Nillion) and difficulty.
Game Initialization:
- When a player starts a new game, the agent assigns them a random level with an initial difficulty setting.
- The player must complete the level to progress, but they can attempt it as many times as needed.
Player Interactions & Evaluation:
- Players interact with the level by submitting attempts to complete it.
- The agent listens for these onchain interactions and evaluates whether the player has succeeded.
- The agent records the result onchain and, if the attempt is successful, assigns a new, more difficult level to the player’s game.
Progression & Dynamic Difficulty:
- Every time a player clears a level, they receive a new one with a higher difficulty.
- This ensures that the challenge scales with player skill and prevents repetitive gameplay.
Game Completion:
- The game ends when the player successfully completes level 10.
- This provides a structured progression system with a clear goal for players to strive towards.
Why This Approach?
Onchain Transparency & Fairness:
- Since level assignments and completions are recorded onchain, the system is transparent and tamper-proof.
- Players can trust that the game is being run fairly without human intervention.
SecretVault Protection:
- By storing level descriptions in Nillion’s SecretVault, we prevent players from gaming the system by memorizing levels before encountering them.
Automated:
- The agent runs autonomously, generating levels and evaluating progress without manual oversight.
- Since levels are created regularly, the game world is continuously expanding, keeping the experience fresh for players.
By implementing this structure, the game ensures an engaging, fair, and scalable onchain experience, where players face increasingly difficult challenges until they reach the final level.
This project brings together smart contracts, decentralized storage, and an autonomous agent to create a fully onchain fantasy game where an AI powered Game Master dynamically generates levels and evaluates player progress.
Smart Contract
- Deployed on Arbitrum, the contract manages levels, games, and player interactions.
- It stores game state and emits events that the agent listens to.
- Handles onchain progression, ensuring transparency and fairness.
Game Master Agent
- Listens for onchain events such as game creation and player interactions.
- Generates new levels every hour, to assign them dynamically to players.
- Evaluates whether a player completes a level and submits onchain transactions to update game progress.
Nillion’s SecretVault for Level Storage
- Level descriptions are not stored onchain to prevent players from memorizing them.
- The agent retrieves level data securely from Nillion when needed.
- Ensures fairness while maintaining efficient storage.
Automated Level Progression
- Levels are generated dynamically and scale in difficulty based on player progress.
Development Insights & Notable Hacks
- SecretVault Integration: Offloading level descriptions to Nillion instead of encrypting them onchain ensures efficient storage and secure retrieval.
- Autonomous: The agent runs continuously, keeping the game world dynamic without manual intervention.
Why This Tech Stack?
Arbitrum → Low cost, fast transactions, we wanted to use Stylus but run out of time
Nillion's SecretVault → Secure storage for level data
Agent → Fully automated gameplay & decision making
Onchain Progression → Trustless and transparent