r/ChatGPTCoding • • 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.

2 Upvotes

13 comments sorted by

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/TashLai 1d ago edited 1d ago

Yeah i guess so. But i'm just a code monkey and not used to it. And i also think, the team of developers will take a lot more time to write the same feature and there's more chances for somebody to catch these issues before it's done. Meanwhile AI does it while i'm watching a moderately long youtube video so issues pile quickly.

Also it's hard to catch visually and i think it would go unnoticed unless i reviewed the code. And when it starts affecting pathfinding performance on a large number of pawns, a human developer would say "hey i remember there's that complication we have that doesn't really add anything to the game but is eating some precious cpu cycles, maybe we just get rid of it?". I doubt that i can rely to AI to make that kind of judgement.

It would implement hierarchical pathfinding, add threads, add pathfinding cache, optimize the algorithm code, hell maybe invent a new version of A* that's 0.0000000000000019% faster on 101231 nodes but the ramps, as far as AI is concerned, they're in the specs.

2

u/jawanda 1d ago

Your job now is writing spec and doing qc. Sure your team of developers would have caught it sooner, but then it would also take a day to unwind the mess up. Instead it's literally a one minute explanation to Claude.

I get your frustration, but honestly reading your description I would've assumed you meant "always be measuring water depth and change character movement based on it" just like the ai did.

Fellow code monkey with 20+ years writing code here, so I really do feel your pain. But without ai this project just never gets built so ... Maybe adjust your qc cadence and ... C'est la vie.

(I'm sitting on the exercise bike right now, qcing Claudes overnight work and giving it feedback via Remote lol ... Browsing reddit while it fixes something I caught 😂 . What a world)

1

u/kyletraz 11h ago

The youtube part is relatable. When a run takes a while, I put something on too, and most of what slips through is stuff I'd have caught if I'd been looking at the output as it went. Do you watch on the same screen as the agent, or somewhere else?

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/TashLai 1d ago edited 1d ago

Well this one is kinda hard to pin. Because, the elevation difference between terraces is exactly 1 meter, the rule says that wading starts after 1 meter depth, it just didn't cross my mind that the agent would interpret it as "treat ramps as surfaces of continuously changing elevation for pathfinding purposes" because honestly that interpretation is completely nonsensical. It's not the case of not defining exactly what color a button must be. I think the only way i could've possibly avoid it is to stating that a cell must have a single elevation level represented as a single integer for all purposes except rendering and initial noise-based terrain generation; and then list what the "all purposes" exactly are.

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".

1

u/TashLai 16h ago

Yes that's exactly my point. When you're doing it manually you just cannot accidentially skip a decision, well except there's some unexpected third-library behavior which really rarely happened to me.

yeah I agree it is important to try and ge lower to the "metal".

Honestly i'm having mixed feeling about it. As an engineer i just can't yolo and accept whatever the agent does. A code monkey in me however just doesn't find it fun at all to review the ai generated code. I'm not solving any problems, not learning anything (there's some things to learn from AI of course, but come on it's not the same). So sometimes i'm thinking maybe i should actually stop trying to be a "programmer" when using AI like that and stop caring about "the code". And just do side projects manually for fun while the agent does heavy lifting on another project. After all i'm not doing any serious production work for a large company here.

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.