hackquest logo

Maze

An on-chain autonomous AI-powered labyrinth game where agents explore smart contract–generated mazes, collect onchain items and fragments, and solve puzzles to unlock the final treasure.

视频

描述

This project is an on-chain autonomous AI-powered labyrinth game built on the Monad network, designed to combine the interactivity of a maze puzzle with blockchain mechanics and AI reasoning. From a non-technical perspective, the game presents players or AI agents with a procedurally generated labyrinth composed of multiple rooms, each containing clues, puzzles, or collectible fragments. The main goal is to navigate through the maze, collect all four fragments represented by the letters O, K, A, and Y, as well as optional items like hearts (extra lives), hammers (tools to break obstacles), and master keys (to bypass locked gates). Players must strategically explore rooms, claim items scattered across the maze, and solve puzzles to progress toward the exit room where a smart contract piggy bank holds the final reward. The AI agent acts autonomously by observing room states, reading on-chain clues, deciding moves, using items when necessary, and performing transactions to claim fragments or progress in the maze. The system emits events for every action such as fragment collection, item claims, and room entry, which can be indexed and consumed by the AI agent to make informed decisions. This creates a dynamic, self-contained read-process-act loop that makes gameplay both interactive and automated.

From a technical perspective, the project uses three core smart contracts: a Factory contract to deploy and manage game rounds and room instances, Room contracts representing each maze node with associated clues and state, and a PiggyBank or Exit contract containing the reward tokens. When a round starts, the Factory creates a session for the player or AI agent and deploys the initial room. Each room may automatically deploy three child rooms to expand the maze dynamically. Rooms store clues and may trigger randomized outcomes such as instant death (losing a heart) or carrot rewards, using blockhash-based pseudo-randomness for hackathon purposes with optional hooks for Chainlink VRF in production. Items and fragments are not stored directly in rooms but exist as collectible entities bound to the player session. Functions like createRound, enterRoom, collectFragment, claimItem, useItem, moveTo, exitWithdraw, and revive allow the player or agent to interact with the maze. All claims and actions are validated against the player’s Smart Account or delegated agent using access controls, reentrancy guards, and per-session limits. Events such as RoundCreated, RoomDeployed, RoomEntered, FragmentCollected, ItemClaimed, ItemUsed, PlayerKilled, CarrotFound, and ExitClaimed are emitted for off-chain indexing, enabling AI agents to subscribe via Envio, analyze room states, reason over puzzles, and execute on-chain transactions autonomously. The fragments collected are combined to form a final composite key, verified on-chain through keccak256 hashing, to unlock the PiggyBank and allow withdrawal. The UI interacts with these contracts, showing the maze layout, inventory, fragments, and lives, while the AI agent continuously makes decisions based on on-chain state and event feeds, creating a fully autonomous on-chain game experience.

本次黑客松进展

100

技术栈

Solidity
Web3
envio
smart account
metamask delegation
monad
队长
CCadalt
赛道
GamingAI