Gathering Nodes
A gathering node is a tree, rock or herb patch with a few pickings in it. The player holds a button to take one, may need a better tool, and sometimes gets a lucky extra. A node picked clean stays empty for a while and then comes back full.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Gathering Nodes" to my game.
What it should do: Nodes put the materials of the world in places the player can find, learn and come back to. They turn walking around into a small hunt, and the limit on pickings and the wait for the node to return keep the world from running dry or being drained in a minute.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> full
full: Full
worn: Partly picked
depleted: Used up
full --> worn: first picking taken
worn --> full: all grown back
worn --> depleted: last picking taken
depleted --> full: node comes back
```
Use these starting values:
- maxCharges: 3 pickings
- gatherTime: 2 s
- regrowTime: 20 s
- respawnTime: 60 s
- bonusChance: 0.15 chance
- requiredTier: 1 level
Watch out for these common mistakes:
- Two players take the last picking: Tell your AI: let one place own the node. Handle the players one after the other and let each one's finish take the picking before the next one is checked.
- Letting go keeps the progress: Tell your AI: reset the progress to zero as soon as the player stops holding, steps away or switches tool.
- The node comes back and is picked on the same tick: Tell your AI: a node that was empty when the tick began cannot be picked on that tick. The hold counts from the next one.
- A long frame gives a whole node at once: Tell your AI: take at most one picking per tick, and keep the time that ran past for the next tick.
- The lucky roll is spent on nothing: Tell your AI: draw one random number for each picking, at the moment it is taken, and hand it in as a value.
- Regrowth restarts with every picking: Tell your AI: start the regrow timer only when none is running. Later pickings leave it alone.
- The wrong tool wastes the player's time: Tell your AI: check the tool as soon as the button goes down and refuse at once with a clear sign, so the player knows what is missing.
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
Nodes put the materials of the world in places the player can find, learn and come back to. They turn walking around into a small hunt, and the limit on pickings and the wait for the node to return keep the world from running dry or being drained in a minute.
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
- Full → Partly picked: first picking taken
- Partly picked → Full: all grown back
- Partly picked → Used up: last picking taken
- Used up → Full: node comes back
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| maxCharges | 3 pickings | How many pickings a full node holds. At least two, so that a node is always seen to run down before it goes empty. More pickings make the spot worth a longer visit. |
| gatherTime | 2 s | How long the player holds the button for one picking. Long enough to feel like work and to give the animation time, short enough not to bore. Rare nodes can take longer. |
| regrowTime | 20 s | How long one picking takes to grow back in a node that is not empty. It lets a patient player pick the same spot again without waiting for the whole node to return. |
| respawnTime | 60 s | How long an empty node stays empty before it comes back full. A minute is a good start: long enough to make the player move on, short enough to be worth returning to. |
| bonusChance | 0.15 chance | The chance that a picking gives one extra item, from 0 to 1. A small surprise keeps routine work interesting. It costs the node nothing. |
| requiredTier | 1 level | The tool level needed here. Zero means bare hands. A higher level gives a reason to improve tools and lets the world hold nodes the player cannot use yet. |
What usually goes wrong
Two players take the last picking
Two players hold the button on the same node and both finish on the same tick. If each looks at the node separately, both get the last picking.
Fix: Tell your AI: let one place own the node. Handle the players one after the other and let each one's finish take the picking before the next one is checked.
Letting go keeps the progress
The progress stays when the player lets go. Tapping the button over and over then takes pickings in tiny pieces, and the hold time means nothing.
Fix: Tell your AI: reset the progress to zero as soon as the player stops holding, steps away or switches tool.
The node comes back and is picked on the same tick
An empty node returns on the tick the player is holding the button. If the picking can start at once, the player gets a picking from a node they could not see yet.
Fix: Tell your AI: a node that was empty when the tick began cannot be picked on that tick. The hold counts from the next one.
A long frame gives a whole node at once
One very long tick, for example after the game was stuck, adds up to more time than three pickings. If every full gather time in it counts, the node is emptied in a blink.
Fix: Tell your AI: take at most one picking per tick, and keep the time that ran past for the next tick.
The lucky roll is spent on nothing
The game draws a random number every tick. Then the bonus depends on the frame rate and on how often the player is checked, and a replay cannot reproduce it.
Fix: Tell your AI: draw one random number for each picking, at the moment it is taken, and hand it in as a value.
Regrowth restarts with every picking
Each picking sets the regrow timer back to full. A player who keeps picking never sees a picking grow back, and the node only ever runs down.
Fix: Tell your AI: start the regrow timer only when none is running. Later pickings leave it alone.
The wrong tool wastes the player's time
The player holds the button for two seconds with a tool that is too weak, and only then finds out nothing happens.
Fix: Tell your AI: check the tool as soon as the button goes down and refuse at once with a clear sign, so the player knows what is missing.
How to check it works
- A full node and a gather time of 2 seconds. the player holds the button: nothing is given for the first 1.9 seconds, then one picking at 2 seconds.
- The player has held for 1.5 seconds. they let go for a moment and hold again: the progress is back at 0, and a picking needs the full 2 seconds again.
- A full node with 3 pickings. the player takes all three: the node is empty and a 60 second wait begins.
- An empty node. the player holds the button for 5 seconds: nothing is given and no progress builds up.
- An empty node, 60 seconds from returning. 60 seconds pass: it is still empty at 59.9 seconds and full with 3 pickings at 60.
- An empty node that comes back on this tick. the player is already holding the button: the node is full but no progress has built up yet.
- A node with 1 of 3 pickings left. it is left alone for 20 seconds, then 20 more: it has 2 pickings after the first 20 and is full after 40.
- A full node. one picking is taken: a 20 second wait for one to grow back begins.
- A node where one picking is growing back. the player takes a second picking 2 seconds later: the wait does not start over, it is down by about those 2 seconds.
- A node that needs tool level 1. the player holds the button with bare hands for 10 seconds: the game says no, nothing is given and no progress builds up.
- A node that needs tool level 1. the player uses level 1, or level 4: a picking is taken either way.
- A bonus chance of 0.15. the roll is 0.1, then 0.15: 0.1 gives 2 items and 0.15 gives 1, and a chance of 0 never gives an extra.
- A full node. a picking gives the lucky extra: 2 items come out but only 1 picking is used up.
- A gather time of 2 seconds and a tick of 3 seconds. the player holds through it, then one more second: one picking comes at once, and the leftover second makes the next one come after the one more second.
- A full node. one tick of 100 seconds passes while the player holds: only one picking is taken.
- A node with 1 picking left. a long tick finishes it with time to spare: the node is empty and the spare time is dropped.
Works well with
- Loot Table: The node decides when something is given, the table decides what. Keep the bonus roll and the table roll apart. Roll what a picking gives from a table, once per picking.
- Item Durability: A tool that breaks in the middle of a hold wastes the player's time. Check before the hold starts. Wear the tool when a picking is taken, not while holding.
- Stamina System: Gathering can cost stamina. If the bar runs out during the hold, the progress is lost, so refuse the start instead. Spend the stamina for the whole picking when the hold starts.
- Crafting System: If a recipe needs ten of something, count how many nodes and how much waiting that takes. Let nodes supply what recipes ask for, in amounts the player can plan.
- Day-Night Cycle: A flower that only opens at night is a nice reason to come back. Make sure the reason is visible on the node. Let the time of day decide which nodes can be picked.
Common questions
how do i add resource nodes to my game
Paste this: Add gathering nodes. Each node has 3 pickings. The player holds a button for 2 seconds to take one, and letting go starts the hold over. An empty node comes back full after 60 seconds, and a partly picked node grows one picking back every 20 seconds. Some nodes need a tool of a certain level.
how long should a node stay empty
Long enough that the player moves on and finds another one, and short enough that coming back is worth it. Start with about a minute for common things, and make rare things wait longer.
should the player be able to hold the button for several pickings in a row
Yes, it is kind: after a picking the hold carries on with the next one until the node is empty or the player lets go. Just make sure each picking still takes its full gather time.
why can two players both get the last item
Each one checks the node on their own and sees one picking left. Let one place own the node and handle the players one after the other, so the second one sees an empty node.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 19 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