# AGENTS.md: MonoGame (C#)

## Commands
`dotnet build` · `dotnet run --project src/Game` · `dotnet test` · content: `dotnet mgcb-editor` (GUI) or build via the `Content.mgcb` file

## Structure
- `Game1` (rename to the game's name) only wires services and the scene manager. Each scene/screen is a class with `Load`, `Update(GameTime)`, `Draw(SpriteBatch)`, `Unload`.
- Game logic (rules, AI, physics math) in plain C# classes without MonoGame dependencies where possible, so they're unit-testable.
- Assets go through the content pipeline (`Content.mgcb`); load with `Content.Load<Texture2D>("sprites/player")` once in `LoadContent`/scene load, never in `Update` or `Draw`.

## Loop rules
- Use `(float)gameTime.ElapsedGameTime.TotalSeconds` for movement; consider a fixed timestep (`IsFixedTimeStep = true`) for physics.
- Input through a small input service that tracks previous and current `KeyboardState`/`GamePadState` for "pressed this frame" checks.
- One `SpriteBatch.Begin/End` per layer; sort and batch by texture (use texture atlases). Use `SamplerState.PointClamp` for pixel art.
- Avoid allocations in `Update`/`Draw`: no LINQ, no `new` per frame, reuse lists, pool bullets/particles, cache strings for HUD text.
- Resolution independence via a render target at the virtual resolution, scaled to the window.
- Dispose `RenderTarget2D` and other GPU resources you create.

## Done
Build has no warnings, tests pass, and the game runs and plays the changed feature.
