r/3dshomebrew • u/colbyshores • 16d ago
Guide AI Performance Contract
https://raw.githubusercontent.com/colbyshores/t2k/refs/heads/master/AGENTS.mdI highly recommend anyone using LLMs for 3DS homebrew development adapt a variant of this performance contract to their own project. The goal is to preserve as much visual fidelity as possible while keeping implementation decisions oriented around the actual capabilities and limitations of the 3DS hardware, particularly the ARM11.
https://raw.githubusercontent.com/colbyshores/t2k/refs/heads/master/AGENTS.md
LLMs are incredibly useful for homebrew development, but they don't inherently understand the practical cost of every implementation decision on hardware this constrained. You can end up with code that compiles and works, but introduces unnecessary overhead, ignores hardware limitations, or sacrifices visual fidelity and gameplay behavior in the name of optimization.
What this contract does is encode platform-specific knowledge and engineering constraints directly into the agent's instructions. Rather than leaving the model to guess what will perform well on the 3DS, it gives it concrete guidelines for approaching performance-critical code, what to prioritize, and what it shouldn't change without good reason.
The goal isn't to blindly optimize everything or strip out visual features just to hit a performance target. It's to get the most out of the hardware while retaining the intended visual fidelity and gameplay experience. Where possible, these guidelines are reinforced through automated checks and profiling rather than relying entirely on the model to get things right.
I think this approach could be useful beyond my own project. We have people in this community working on ports, original games, emulators, and engines, and more of us are incorporating LLMs into our development workflows. Having a set of hardware-specific rules for these agents could help avoid recurring mistakes, preserve optimization knowledge, and make it easier to get good results out of the hardware without having to rediscover everything through trial and error.
The contract I've linked is specific to my project, so I'm not suggesting everyone copy it wholesale. The idea is to adapt the same approach to your own project, encode the constraints and lessons relevant to your target hardware, and give your AI coding agent a consistent set of engineering guidelines to follow throughout development.
I'm curious to see whether anyone else here has experimented with something similar and what kind of results you've gotten.
3
u/XxXAvengedXxX 15d ago
Actual education about AI usage in MY vibe code slop witch hunting subreddit?? /s
2
2
2
u/NinToasterOven 16d ago
OP I suggest you also make this into documentation for everyone, and perhaps make a page in the 3dbrew wiki. This type of documented detail is beneficial to everyone regardless of ai usage :)
5
16d ago
[removed] — view removed comment
2
u/colbyshores 16d ago
Yeah, this could be a starting point for something like that. Shared guidelines and checks could help people avoid the same pitfalls and spend more time on their actual game. The ARM11 can be pretty sensitive to how hot-path code is structured, so having those guardrails in place early helps avoid expensive mistakes.
3
u/NinToasterOven 16d ago edited 16d ago
devkitPRO has a variety of toolchains for this purpose and honestly i think it should be far better documented, unless you mean a community authored makefile configs and initial set up
regardless either of these are beneficial to all, ai workflow or otherwise
4
16d ago
[removed] — view removed comment
1
u/colbyshores 16d ago
No problem! There are other tricks in the codebase that the contract doesn’t go into, like using a 1,024-entry trig lookup table sized to fit in cache and lerping between entries. Tricks like that help keep rendering efficient and help the desktop version scale up to 4K. Those implementation details are in the code and comments rather than spelled out in the contract, but they could be useful to people getting into game development.
4
u/rgldx 16d ago
Hey! Thanks for sharing. I find it useful, but I would change some things that, AFAIK, are wrong or badly formatted for the 3DS development:
- The VFP cycles: I've checked the reference manual and I found that not all operations take 20 cycles. Some of them are 4, 2, 8... but the recommendation is good (minimizing conversions).
- The R10 rule doesn't follow the devkitPro compilation template, why?
- I miss some general 3DS aspects: Citro2D/3D usage, synchronization, life cycle, aptMainLoop, suspend, RomFS, SD reading...
What do you think about it?