Perk Choices
Perk choices put a small hand of different upgrades in front of the player at every level-up, and the player keeps exactly one. The hand is drawn by weight from a pool. Upgrades at their limit never show, some wait for another upgrade first, and a few rerolls let the player ask for a new hand.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Perk Choices" to my game.
What it should do: Perk choices make every level-up a small decision instead of a gift. Because the hand is partly luck, no two runs build the same character, and the player has to work with what shows up.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> idle
idle: No choice open
choosing: Hand shown
waiting: Choice waiting
full: Nothing left
idle --> choosing: level up
choosing --> idle: pick or skip
choosing --> waiting: pick, more are owed
choosing --> full: last upgrade taken
waiting --> choosing: next hand opens
full --> [*]
```
Use these starting values:
- offerSize: 3 items
- startingRerolls: 2 uses
- skipRerolls: 1 uses
Watch out for these common mistakes:
- Maxed upgrades keep showing: Tell your AI: before drawing a hand, remove every upgrade that has reached its limit.
- A locked upgrade shows up too early: Tell your AI: only offer an upgrade once the one it needs has been taken at least once.
- Fewer upgrades than cards: Tell your AI: show as many different cards as are left, never a blank and never a repeat.
- Nothing left, but a choice opens: Tell your AI: when nothing can be offered, skip the choice, still count the level, and clear any choices that were waiting.
- The last pick leaves a choice waiting: Tell your AI: after every pick, check whether anything is left to offer, and if not, clear the waiting choices.
- A reroll shows the same hand: Tell your AI: a reroll draws only from cards that are not in the hand, and if there are none, it refuses and costs nothing.
- A reroll shrinks the hand: Tell your AI: fill the hand up with cards from the old hand, so a reroll never shows fewer cards.
- A bad random number breaks the draw: Tell your AI: treat a missing or broken random number as zero and keep the others inside the range.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
Perk choices make every level-up a small decision instead of a gift. Because the hand is partly luck, no two runs build the same character, and the player has to work with what shows up.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- No choice open → Hand shown: level up
- Hand shown → No choice open: pick or skip
- Hand shown → Choice waiting: pick, more are owed
- Hand shown → Nothing left: last upgrade taken
- Choice waiting → Hand shown: next hand opens
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| offerSize | 3 items | How many upgrades a hand holds at most. Three is enough to feel a real choice without reading a wall of cards. One means no choice at all, only luck. |
| startingRerolls | 2 uses | How many times the player may ask for a new hand during a run. Zero makes every hand final, and a high number lets the player dig for one perfect card. |
| skipRerolls | 1 uses | How many rerolls the player gets for turning down a whole hand. Without this, skipping is never better than picking something. |
What usually goes wrong
Maxed upgrades keep showing
An upgrade the player has taken as often as it allows still lands in the hand. The player clicks it and nothing happens, or the level-up is wasted.
Fix: Tell your AI: before drawing a hand, remove every upgrade that has reached its limit.
A locked upgrade shows up too early
An upgrade that builds on another one is offered before the player has the first one. Taking it gives a bonus to something that does not exist yet.
Fix: Tell your AI: only offer an upgrade once the one it needs has been taken at least once.
Fewer upgrades than cards
Late in a run only one or two upgrades are left, but the hand wants three. The game shows blank cards, repeats a card, or crashes.
Fix: Tell your AI: show as many different cards as are left, never a blank and never a repeat.
Nothing left, but a choice opens
Every upgrade is maxed, yet each level-up opens an empty choice screen. The player is stuck on a screen with nothing to click, or the game waits for a pick that can never come.
Fix: Tell your AI: when nothing can be offered, skip the choice, still count the level, and clear any choices that were waiting.
The last pick leaves a choice waiting
The player levels up twice in a row. After the first pick the last upgrade is gone, but the second choice is still owed, and it can never open.
Fix: Tell your AI: after every pick, check whether anything is left to offer, and if not, clear the waiting choices.
A reroll shows the same hand
The player spends a reroll and gets the same cards back. It feels like a bug, and the reroll is lost.
Fix: Tell your AI: a reroll draws only from cards that are not in the hand, and if there are none, it refuses and costs nothing.
A reroll shrinks the hand
Only one new card is left, so the reroll replaces three cards with one. The player pays a reroll and gets less choice than before.
Fix: Tell your AI: fill the hand up with cards from the old hand, so a reroll never shows fewer cards.
A bad random number breaks the draw
A random number that is missing, not a number, or outside zero to one makes the draw pick nothing or pick the same card twice.
Fix: Tell your AI: treat a missing or broken random number as zero and keep the others inside the range.
How to check it works
- A new game with a pool of seven upgrades and a hand size of 3. the player levels up: a hand of 3 different upgrades opens, the level is 1 and one choice is owed.
- Two games in the same position. both level up with the same random numbers: both show the same hand in the same order.
- Four upgrades that may be offered, with weights 10, 10, 8 and 4. 320 evenly spaced random numbers each draw a single card: the cards come up 100, 100, 80 and 40 times.
- A hand of three upgrades is open. the player picks one: that upgrade counts once, the other two are gone, the hand closes and no choice is owed.
- An upgrade with a limit of 1 has been taken. the player levels up with a hand size of 6: that upgrade is not in the hand.
- An upgrade that needs another one, and the player does not have that one. the player levels up with a hand size of 6: the locked upgrade is not offered, and it is offered once the needed one is taken.
- Only two upgrades can still be offered and the hand size is 3. the player levels up: the hand has those two cards, no blank and no repeat.
- A hand is open. the player levels up twice more and then picks: 3 choices are owed first, the pick leaves 2, the hand closes, and the next hand opens only when asked.
- A hand is open and the player has 2 rerolls. the player rerolls: all three cards are replaced by cards that were not in the hand, and 1 reroll is left.
- A hand already shows every upgrade that can be offered, or the player has no rerolls. the player rerolls: the reroll is refused, the hand stays and no reroll is spent.
- A hand is open and the player has 2 rerolls. the player skips it: nothing is taken, the hand closes and the player has 3 rerolls.
- A hand is open, or no hand is open. the player picks an upgrade that is not in the hand: nothing changes except that the game notes the click did nothing.
Works well with
- Skill Tree: A tree lets the player plan, a hand makes the player adapt. Many games use both: the tree for the long plan, the hand for the small twists each level. Give the points to the tree first, then use the hand for the surprises on top.
- Loot Table: Both draw by weight from a list, so the same drawing code can serve both. The difference is that a hand has no repeats and is filtered by what the player already has.
Common questions
how do i add upgrade choices when the player levels up
Keep a pool of upgrades with a weight and a limit each. At every level-up, draw three different ones that are still allowed, let the player pick one, and count it. Tell your AI to leave out any upgrade that has reached its limit.
how many cards should a level up choice show
Start with three. That is enough for a real decision and still quick to read. With two it feels thin, and above four players stop reading and just take the first.
should players be able to reroll upgrade choices
A few rerolls help, because a bad hand with no way out feels unfair. Start with two per run, and give one back when the player skips a hand, so declining becomes a choice too.
what do i tell my ai to make a pick one of three upgrade screen
Paste this: At each level-up, show three different upgrades drawn by weight from a pool. Leave out any that are maxed or need an upgrade the player does not have. The player keeps one. If fewer than three are left, show those, and if none, skip the screen.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 24 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it