My inspiration for this project came from the desire to build a fun and engaging game while utilizing the power of blockchain technology. I wanted to explore how decentralized finance (DeFi) and smart contracts could be used to create a game with real-world value.
My game is a roguelike dungeon crawler where players battle enemies, collect coins, and improve their scores. Players can connect their wallets (via Phantom) to the game to track their in-game balance and scores on the Solana blockchain. The game integrates with Solana’s decentralized network to store high scores on the blockchain, allowing players to compare their progress with others in a secure and transparent way.
The game was built using Phaser.js for the frontend, which provided the framework for the 2D game world, character animations, and physics. I used Solana’s blockchain to integrate a decentralized economy into the game. The backend was powered by Solana’s smart contracts, written in Rust and deployed using Anchor to simplify the development process.
Frontend (Phaser.js): Phaser provided the visual environment, handling the game scenes, character movements, and collision detection.
Blockchain (Solana with Anchor): Anchor made it easier to deploy and interact with Solana smart contracts. We created a contract to store player scores and reward players with SOL for achieving high scores.
Wallet Integration (Phantom): We used the Phantom wallet to allow players to connect their Solana wallet to the game, enabling interactions with the blockchain.
Challenges: Smart Contract Deployment: Setting up and deploying a smart contract to the Solana devnet was more complicated than anticipated. I faced issues with ensuring the smart contract interacted correctly with the frontend game logic and tracked high scores in a meaningful way.
Wallet Integration: The wallet connection, especially using Phantom, was tricky at first. Ensuring the game communicated with the blockchain through Phantom’s wallet was a challenge, but I managed to make it work eventually.
Time Constraints: Due to time limitations, I failed to fix the Solana code and was unable to run the part of the smart contract that updates scores for a player. Here is the contract: E9XSLRwSaTvLS9GRgc6KRSg2oMo3UgC1tjLTovy3tniV. You can view this on solscan devnet.
Smart Contract Deployment: Successfully wrote and deployed the smart contract to the Solana devnet, enabling score storage and interactions with players' wallets.
Wallet Integration: Integrated Phantom wallet into the game, allowing users to connect their Solana wallet and interact with the blockchain.
Game Mechanics: I managed to develop a working game where players can collect coins, earn points, and engage with the blockchain using real-world assets (SOL).
I learned that despite planning, I still faced time constraints. Knowing how to prioritize tasks in a hackathon environment is key to completing the most crucial features.
Whats next: Full Deployment: I plan to finish the integration of the smart contract with the frontend, ensuring that players’ scores are properly stored on the blockchain and rewarded with SOL. More Game Features: Expanding the game with more levels, enemies, and challenges will make the game more engaging. I also plan to implement better game mechanics and rewards. Mainnet Deployment: Moving the game from devnet to mainnet once I finish debugging and improving the game, which will allow real SOL transactions and a live player ecosystem. AI integration: I want to use AI to generate levels based on how the user is doing.
Built With
- javascript
- phaser.js
- solana
Log in or sign up for Devpost to join the conversation.