Inspiration 🚀
Classic space combat games have always been a staple of gaming, but they often suffer from predictable enemy patterns. Once a player memorizes a boss's movements, the challenge completely disappears. I was inspired to solve this problem by introducing true unpredictability. I wanted to build an experience where the game actively thinks and adapts to the player's skill level, ensuring that no two boss fights are ever exactly the same.
What it does 🎮
AI Nexus: Starship Commander is a next-generation mobile-ready space shooter. Instead of relying on hardcoded enemy behavior, the game utilizes the Gemini API to dynamically generate boss encounters in real-time. The AI analyzes player telemetry and performance data to create complex, unpredictable firing patterns (like sweeping beams and earthquake attacks) and erratic boss movements on the fly. As the player gets better, the AI scales the difficulty and creates fresh tactical challenges.
How we built it 🛠️
I built the game primarily using web technologies to ensure it was completely playable in mobile browsers without any downloads.
- Frontend Engine: The core game loop, state management, and rendering are built with React and TypeScript using Vite.
- UI & Aesthetics: I used Tailwind CSS alongside shadcn/ui to create the premium, glassmorphism-inspired sci-fi interface and neon visuals.
- AI Brain: I integrated the Google Gemini API (
@google/genai) to serve as the game's director. It passes contextual game data to the LLM, which then returns structured instructions dictating the next boss phase, firing cadence, and movement vectors. - AI Assistance: AI coding tools and Lovable were used extensively to rapidly generate UI components, prototype game mechanics, and maintain aesthetic consistency throughout the hackathon's tight timeline.
Challenges we ran into 🧩
Integrating a Large Language Model into a high-speed game loop was incredibly challenging. Standard API calls take time, and a game engine needs to run at 60 frames per second. We had to implement asynchronous "AI Think" phases where the boss would physically reposition or charge an attack while the background fetch to Gemini was happening, ensuring the gameplay never froze. Additionally, translating LLM text outputs into reliable mathematical vectors for firing patterns required rigorous prompt engineering and error handling.
Accomplishments that we're proud of 🏆
I am incredibly proud of achieving a seamless mobile web experience. Rendering dynamic bullet hell patterns smoothly on mobile browsers while concurrently streaming AI API responses was a major technical hurdle. The fact that the Gemini AI can successfully invent a new attack pattern that physically challenges the player is mind-blowing to watch in action!
What we learned 🧠
I learned a massive amount about game loop optimization in React, specifically how to detach heavy rendering tasks from state updates using refs. Most importantly, I learned how to use LLMs not just as chatbots, but as procedural generation engines that output structured JSON logic to control application state.
What's next for AI Nexus: Starship Commander 🌌
In the future, I want to add an "AI Copilot" that analyzes your flight paths and gives you real-time voice or text advice on how to dodge specific attacks. I also plan to implement global leaderboards and a multiplayer mode where one player controls the ship, and the other player types prompts to command the boss!
Built With
- google-gemini-api
- lovable
- react
- shadcn-ui
- tailwind-css
- typescript
- vercel
- vite
Log in or sign up for Devpost to join the conversation.