Imagine a world where artificial intelligence doesn't just write stories or answer questions, but actually builds a functioning video game from scratch. It sounds like science fiction, right? Well, a few years ago, this very thing happened, and the results were more surprising than anyone expected.
This isn't about an AI designing game levels or characters. This is about an AI writing the entire backend code, the frontend logic, and making it all work together. It was a true test of what large language models could do, pushing boundaries in a way that quickly got overshadowed by new AI breakthroughs.
The Wild Idea: Could AI
Code a Game?
The initial spark for this project was a simple, yet ambitious, question. Could a powerful AI, like ChatGPT, be prompted to write a complete, playable video game? The challenge wasn't just about generating snippets of code. It was about creating a coherent application with a user interface, game logic, and server-side operations.
The person behind this experiment decided to give the AI a very specific task. They wanted a simple game, something turn-based, but built with a technology stack known for its real-time capabilities. This choice would truly test the AI's understanding of complex programming frameworks.
Choosing
Elixir and LiveView: A Bold Move
What made this experiment even more fascinating was the choice of programming languages and frameworks. The developer didn't ask ChatGPT to build the game in a common language like Python or JavaScript. Instead, they opted for Elixir and LiveView.
Elixir is a functional programming language known for building scalable, fault-tolerant systems. LiveView, part of the Phoenix framework for Elixir, allows developers to build rich, interactive user interfaces with server-rendered HTML. It's a powerful, but somewhat niche, combination. Asking an AI to work with it was a bold move, almost like asking it to paint a masterpiece using only rare, antique brushes.
"The real test wasn't just if it could write code, but if it could understand and implement a complete system using less common, specialized tools."
This choice meant ChatGPT had to do more than just recall syntax. It had to understand the architectural patterns, the state management, and the real-time communication inherent in LiveView applications. It was a steep climb, even for a human developer.
The Iterative
Dance of Code and Prompts
The process wasn't a one-shot command where the AI instantly spat out a perfect game. Instead, it was an iterative conversation. The developer acted as a project manager, guiding the AI step by step. They would ask for a component, test it, find errors, and then feed those errors back to ChatGPT for correction.
Think of it like this:
-
Initial Request: "Write an Elixir LiveView game where players take turns clicking a button."
-
AI Response: Provides initial code, often with some flaws or missing pieces.
-
Developer Feedback: "This part isn't working," or "How do I add a score counter?"
-
AI Correction/Improvement: Adjusts the code, adds new features.
This back-and-forth went on for hours. It showed that while AI could generate code, human oversight and debugging were still crucial. It was a collaboration, not a complete replacement of the developer.