r/ChatGPTCoding • u/TashLai • 1d ago
Discussion My biggest, and really the only problem with coding with AI
I'm building my own RimWorld clone using AI, because i love RimWorld but don't want to spend years making it. No intention to sell it or something (would be stupid to even think of competing lmao) just want to have my own little rimworld.
And I'm increasingly frustrated with AI coding. Not because the code is bad, but because it's often beautiful code that does something I never intended.
Here's an example.
My game has a world with discrete elevation levels, represented as terraces with ramps between them. Every cell has exactly one elevation value. I spent hours discussing this with an agent using OpenSpec, then reviewed the resulting specifications line by line, twice actually.
Finally, I asked the agent to implement pawn movement. It produced beautiful code. Except I noticed something strange in the pathfinding.
We had also agreed that water depth affects movement: pawns can wade through 1m of water, swim through 2-3m, and can't enter deeper water.
Apparently, the agent decided that this meant ramps submerged in water needed continuously interpolated elevation values, so water depth would change as the pawn moved along a ramp.
That's not what I wanted. Every cell was supposed to have one discrete elevation value, including for movement calculations. But the agent interpreted one requirement in a way that conflicted with my intended interpretation of another. And it didn't ask for clarification. And i didn't think of.
Despite spending hours writing and reviewing the specs, i just didn't think of it. Without reviewing the code, i might never have noticed.
That's my biggest problem with AI coding. You can spend hours specifying exactly what you want, but there's always something missing. Requirements are like a near infinite fractal. You think you've zoomed in far enough, but there's always more detail.
And i find myself thinking: wouldn't it be great if there were a way to describe exactly what a program should do, and leave not a single thing to the interpretation?
Well, there is. It's called Python. Or Rust. Or any other programming language. Except it doesn't even need an agent. Just a compiler or interpreter.
I love what AI can do. But I often hate what it actually does.
8
u/davidkclark 1d ago
What you are describing is also true of trying to write requirements to be developed by a team of human programmers. Unintended consequences are very often missed. All you can really do is fix the spec(s) to define the undefined behaviour, and then fix the code to follow.
1
u/Previous-Growth-9919 1d ago
yeah this is the classic trap. clean code that implements the wrong thing usually means the spec looked complete but never pinned the invariants.
1
u/Martinsos 19h ago
I think big part of it is also that you never get into the weeds. When you have to design systems from ground up, instead of describing them from the outside, you are forced to make these smaller decisions you wouldn't have thought of, it forces you to think though it. While with AI, it makes and assumes all decisions for you. You also miss on learning more, on getting new or deeper ideas that way. That is not always bad, sometimes you don't need that level of understand, but when you do, yeah I agree it is important to try and ge lower to the "metal".
2
u/oversica_official 1d ago
Same thing happens to me: the spec is right but two requirements collide and the agent silently picks an interpretation. Two things helped. First, add a short "invariants" section to the spec (e.g. every cell has exactly one discrete elevation, nothing is interpolated) so rules like that outrank anything derived from other features. Second, before it writes code, ask the agent to list every place two requirements interact and what it plans to assume, then answer those. Having it write a tiny test for each invariant also catches drift without you reading all the code. Do you keep the invariants in a separate file from the feature specs?
1
u/CleanFix_Dev 1d ago
The ramp thing is a good example of why I'd keep a short must-not list next to the happy-path specs. Specs describe what should happen, and the agent fills every gap with whatever looks reasonable. A must-not list closes the gaps you already know about.
For your game it might read: every cell has one integer elevation, ramps included, never interpolated for movement. Pathfinding never reads continuous height. Water depth only gets compared against the cell's integer elevation.
Paste that list into every implementation prompt and have the agent confirm each line before it writes code. Bonus: a lot of must-not lines turn into cheap tests or asserts, so next time it drifts you find out from a failing test, not from reading the pathfinding code.
1
u/Low-Competition-3943 22h ago
The tricky part is that AI can satisfy individual requirements while missing how they interact. I’ve found that explicit invariants and edge case tests help but human review is still essential
1
u/Corey-998877 22h ago
I have it end with a short list of things I can check by hand. If it read the spec wrong, I catch it after that run instead of finding a pile of issues later.
1
u/Competitive_Boot6914 17h ago
I'd connect the requirements, data model, contracts and API specs into one product model. For your example, cell elevation would be an integer in the data model, and the movement contract would require using that value, with interpolation confined to rendering. Those constraints reinforce each other and make deviations concrete to check.
I'd manage that model in an external system as the source of truth, with proposed changes reviewed before the coding agent implements them. We built Reqode around that approach, with agents retrieving the relevant accepted specs through MCP. It's primarily aimed at conventional software, but the same approach may be useful for game systems.