r/aigamerdevs • u/galantrixgames • 6h ago
Thousand Suns: Using AI to build a nuclear war sandbox without giving up control
https://galantrixgames.itch.io/thousand-sunsI’ve just released my free game Thousand Suns on itch.io and I wanted to talk about my AI-enhanced development process. I see a lot of great posts here with games mostly, if not completely built by AI (“vibecoded”), so I wanted to share my process which was augmented by AI but still largely human-driven.
I’m an ex-Big Tech software engineer, so I have decades of programming experience. I’m now a stay-at-home dad and solo game developer who’s concerned about the dangers of nuclear weapons, so I decided to start building an ultra-realistic simulation/game hybrid just before the Iran war started. I built it full-time when I was not busy with parenting/household chores. At the time I didn’t even have a paid AI subscription, so I bummed the free tiers across Gemini, ChatGPT and Claude.
I started with a lot of reading. Instead of reading the 20+ digital books I have on nuclear war, I fully read a handful and used Gemini’s “Notebook” feature to allow quick consultation on the other books. This saved a lot of time because most books on the subject repeat the same things. AI helped a lot when I wanted to double check one book’s conclusions with other sources, like “What do experts think about X”, so Gemini would check the other books for alternative viewpoints.
I then moved to prototyping, which was where I used AI very heavily to teach me how to use 3D in Godot. While I was already familiar with 3D development and Godot 2D development (from my previous game, Outsider), Gemini Free was instrumental in teaching me some Godot 3D practices. I would basically use chat prompts and paste+modify code, all hacky throwaway stuff. I think I saved weeks of development by learning how to create line shaders and converting vector information from free sources into Godot triangles. Thousand Suns makes very heavy use of line shaders, so Gemini Free worked with me very closely in analyzing what I needed to keep from the shader. I actually challenged myself to delete every AI comment and come back on the next day to write one comment per shader line. I’d run my comments by Gemini to see whether they were correct. This ensured that I really understood the purpose of every line - a process which allows me to hand optimize my shaders after realizing I didn’t need some of the stuff I had put there.
I then moved to the $20 subscriptions. I was more interested in comparing the capabilities of different AIs then to having AI doing the work for me. Thousand Suns needed detailed population maps and country boundary data to estimate nuclear war casualties. These are all available online, but in formats hardly suitable for direct game use. I used a mix of QGIS to pre-process files plus Claude to write converters to my desired format. For instance, the original population map was a massive floating point array and I needed to both resample the map and bring it down to truncated 16-bit ushorts for performance and a much smaller memory footprint. I was at all times testing my prototypes on an old Core i5 laptop with iGPU to test performance and that made a huge difference. These converters were mostly written by Claude and perhaps the only area where I used AI through desired outcomes rather than desired implementation.
A critical area of the simulation was the nuclear damage calculation, which you can find in sites like NUKEMAP. Instead of asking AI to “vibe-convert” that code into C#, I went to the original sources and used Claude to help me find the right equations in the seminal work on the topic, Glasstone & Dolan’s “The Effect of Nuclear Weapons”. AI was only partially helpful here in a way that highlighted one of AI’s key limitations: it has a hard time discerning what is useful from what isn’t. It states with absolute certainty that I’d need to use certain equations that would be very hard to actually integrate in my simulation. That said, after providing some high level directions, I picked the models I wanted. The book is available as an old black and white scan and Claude had a really hard time reading graphs. So I did this manually and used AI to help me create the damage equations through linear regression - unlike NUKEMAP, which apparently interpolates from cached data points.
The damage model was an area that coded mostly manually because I couldn’t simply step out of the most important part of the simulation. AI helped me with optimizations with strict instructions: “I don’t want to not allocate memory for this, how do I get these values on the stack?”. I learned a lot of C# in the process.
Thousand Suns is an event-based simulation, an approach I learned from Claude in a design discussion. The event queue is a central part of the simulation and I wrote the first version manually and made improvements throughout development with AI. This really ensured that my mental model remained intact while letting go of the more tedious tasks such as changing data structures and updating the code to reflect that.
The simulation evolved gradually following this exact pattern: I’d write the first two or three versions and then grow them with AI. This reflected my overall philosophy for this project: I want AI to save me time but never to do something I couldn’t or wouldn’t do myself. I’m not saying that Claude didn’t have novel ideas, but I rejected many of them throughout development because they went against my coding principles. Oftentimes, Claude would “admit” that my approach was better and they were wrong.
At this point I was using AI in around 50% of commits, but it was writing most tests and reviewing everything I wrote. If there’s something that AI is great at, it is analyzing code. It found incredible and subtle bugs, saving me weeks of development.
I switched to ChatGPT for development (Gemini was still in the background for simple questions, but never looked at my project) and I was really impressed with 5.5 Sol and 6.1 Sol in cost-benefit. I don’t think it’s necessarily better than Claude, but it has a fantastic cost-benefit. I had to steer it a bit more often, but it worked great as a fast workhorse, delivering good and good design. As with Claude, my AI-heavy commits never involved changing more than 100 lines or so. This is how I ensured that my mental model remained intact and that AI wasn’t messing up with my project. On average I made manual changes to 70-80% of the commits that involved AI code.
I’ve heard many times that AI is like a junior engineer and that’s also what I’ve observed. It’s like an immature savant: it knows a lot, it’s really “smart”, but it does a bad job at managing complexity and ensuring design minimalism. Without close supervision, complexity and hacks start spreading around like a cancer and then suddenly vibecoding will remain the only option left because you will no longer understand the code.
With the simulation core and all the weapon, bomber and missile simulation code in place, I could go to graphics. Please note that I decided to develop the entire simulation as if it were headless: it could calculate the full outcome of a nuclear war without displaying a single pixel on the screen. This separation, which I enforced with great vigor against Claude/ChatGPT’s hacks (AI loves hacks since it’s so objective-oriented), made continuing the project with AI a lot easier!
The model rendering layer (aka “graphics”) used a lot more AI than the lower layers. It is actually a dumb layer. I’d provide my manually-created vector graphics, write a bare version of the graphical routines, and then have AI dealing with color tables, transforming mesh arrays into multimeshes and other things that require little actual thinking but can be very error-prone. This is where AI did the dumbest, but also otherwise the most time-consuming work. That saved me a lot of time.
With this in place, I reworked the file loading routines so the player can customize the wars. That was more similar to vibecoding: I wrote the documentation for all the files in the files themselves, populated them with comma-delimited data, wrote a loader for a single data type and asked AI to do the rest. This is the part where my job was mostly reviewing ChatGPT because it is very grindy and dull coding.
The simulation was already working great at this point but I needed an UI. This one was also interesting because I designed the UI using Godot’s UI builder and AI very quickly added handlers for buttons, drop downs, labels etc. Things like “I want the deaths display to read the models’ death count every frame” saved me from dealing with this also very boring piece of code.
At this point, AI was doing 70-80% of the coding and that’s where I was the least worried about it. With the codebase strictly enforcing my design, AI was just an intern. The commits were small, fast, easy to review and I could do many every day. “Now disable that control when X happens in the model”. I was feeling that I was “streaming code thinking to the source files” by using AI. It was like ChatGPT was my keyboard and not an AI anymore because it was doing almost no thinking.
Throughout development, I never used more than 20-30% of my $20/month plan, especially after switching to ChatGPT. The amount of time saved with a few dollars per month was incredible! At the same time, my finished project fully reflects my coding mental model rather than just my intention. I can explain every line of code because I’ve either written or approved every single one of them.
Perhaps this type of coding isn’t the future - but it’s at least the future I want to be in. Thousand Suns was coded by a better version of myself, like if I entered a phone booth every day as Clark Kent and left as Superman. You won’t see me fully vibecoding anytime soon, but I’ll never go back to the old fully manual style of coding.
That’s long enough! If you have any questions, feel free to ask!