Fill an enemy wave up to a point budget without overspending or stalling
Every wave gets a number of points to spend on enemies of different cost. Simple loops either go over the budget, stop with a big chunk unused, or run forever when nothing fits. This entry shows a loop that always ends and uses the points well.
Why this works
A budget is a purse: you can only buy what you can still pay for. Choosing only from affordable things means you can never overspend, and because the purse shrinks with every purchase, the loop must end, however the dice fall.
When not to use it
Skip it when waves should be handmade, like a story fight or a boss with a fixed entourage. Random buying will then break the pacing you designed. Write that wave out by hand and keep the budget for filler waves.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 30 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Fill an enemy wave up to a point budget without overspending or stalling" (read_entry wave-budget-spend-exactly-with-weighted-picks) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP