Inspiration
What it does
Illuminated is a fun autonomous on-chain mmorpg mystery game where players solve mysteries discovered by AI and initiated by human creators. Players use different methods such as pictures or prompt inputs to gather evidence and solve a mystery’s puzzles. Upon solving a puzzle receive an accuracy score from the AI Image Recognition and Analysis system based on how accurately their provided evidence solved the puzzle. Once all puzzles in a mystery have been solved the overall mystery has been solved and rewards are distributed to the most accurate solvers. With account abstracted wallets powered by Particle Network and dynamic NTFs powered by AI, Chainlink functions, and VRF we have shown it is indeed possible to dynamically create secure on-chain IP and use it in a web2 friendly on-chain game which autonomously scales to thousands of players all with web2 level UX.
How we built it
The smart contract starts by using VRF from Chainlink to help seed/provide weight(s) for the mystery phrase helping determine how difficult the mystery will be. The results from the VRF are then put into a Chainlink function together with a user’s prompt description for the mystery.
Using these inputs the Chainlink function fills in a set template prompt and calls the openAI GPT4 api with this prompt to generate a mystery.
Once the Chainlink function receives back a response it runs some validation to ensure all of the required components are included for the mystery. If they are not then it tries again and if again the generated response from openAI api still does not pass it would throw an error. Otherwise if the response passes the chainlink function will return the mystery/crime info to the smart contract which will then mint the mystery as an NFT.
Generated mysteries are displayed to players in our Nextjs frontend where they can solve mysteries and login with an account abstracted wallet using Google or their phone number. User submitted solutions to mysteries and more specifically individual puzzles are passed to our game smart contract deployed on Polygon Mumbai which uses our AI-based image verification and analysis system in conjunction with Chainlink functions to assign a solution accuracy score. Once all puzzles in a mystery have been completed the most accurate solver's of a mystery will be rewarded for their solutions with XP which in the future will be redeemable for prizes and tied to achievements.
Challenges we ran into
Working with so many different moving pieces like account abstraction, smart contracts, Chainlink functions + VRF, and backend API's proved to be rather complex. Having to develop in particular smart contracts that were unique and not standard proved extremely challenging as we did not have a lot of experience with this.
Accomplishments that we're proud of
- AI-Based Image Recognition and Analysis
- Functionality: When a player submits a photographic piece of evidence (like a photo of a feather for the "Feathered Shadow" clue), an AI system analyzes the image to determine if it matches the criteria set by the puzzle phrase.
- Implementation: The AI can use image recognition technology to identify key elements in the photo. For example, it could confirm whether the photo indeed contains a feather or a sculpture resembling a feather.
- Smart Contract Verification
- Functionality: After the AI analysis, the results are sent to a smart contract on the blockchain.
- Implementation: The smart contract contains the logic to determine if the AI's analysis meets the puzzle's requirements. If the conditions are met (e.g., the AI confirms the presence of a feather in the image), the smart contract validates the puzzle step.
- Player Confirmation and Consensus
- Functionality: Other players or teams can review and vote on the validity of the submitted evidence.
- Implementation: This can be done through a decentralized voting system where players use their in-game assets or achievements as voting power. A majority consensus is required to validate a puzzle step.
- Blockchain Record for Transparency
- Functionality: Every step of the verification process, from AI analysis to smart contract validation and player votes, is recorded on the blockchain.
- Implementation: This ensures transparency and allows players to track the verification process, understand why a solution was accepted or rejected, and see the history of puzzle-solving attempts.
- Feedback Loop for Correct/Incorrect Submissions
- Functionality: Players receive immediate feedback on their submissions.
- Implementation: If a submission is correct, players are notified and rewarded accordingly. If incorrect, they might receive hints or the chance to resubmit after a cooldown period.
- Account abstraction + game distribution with web2 sign in methods
- The integration of Particle Network allowed us to create account abstracted wallets for users using Google and phone signins which allowed us to easily integrate this with the R3L04D game distribution system to distribute game keys for Illuminated to a ready web2 community of players.
What we learned
Chainlink functions as well as automation are incredibly cool way to extend the capabilities of on-chain smart contracts that normally have a hard time working with web2 api's/services directly.
What's next for Illuminated?
Player acquisition
Built With
- chainlink
- nextjs
- polygon
- solidity
Log in or sign up for Devpost to join the conversation.