Spielerando

Fuel Gauge

A fuel gauge is a tank that an engine burns down and that never fills by itself. The engine burns a little just by running and more with the throttle. On the last stretch it gives only part of its power as a warning. At zero it stops and needs fuel and a fresh start.

Also called: Fuel tank, Fuel meter, Gas gauge, Jetpack fuel, Energy tank.

A frog pilot in a small blue hover-skiff glides over a crystal salt flat with a sputtering thruster, while the fuel tube on the hull is almost empty and a pump tower with a green beacon shows far ahead.
Glimmerplank Run, an invented hover-racing adventure. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Fuel Gauge" to my game.

What it should do: Fuel turns every flight or drive into a trip with a budget. The player plans how far to go, where to refill, and when to push on, so reaching a pump or a pickup feels like a real relief.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> off
  off: Engine off
  run: Running
  reserve: On reserve
  dry: Tank empty
  off --> run: engine starts
  off --> reserve: starts on reserve
  off --> dry: starts and runs dry
  run --> reserve: reserve begins
  run --> off: engine switched off
  run --> dry: tank runs dry
  reserve --> run: fuel above reserve
  reserve --> off: engine switched off
  reserve --> dry: tank runs dry
  dry --> off: fuel comes in
  dry --> run: fuel in and started
  dry --> reserve: little fuel and started
```

Use these starting values:
- tankSize: 60 units
- burnRate: 4 units/s
- idleBurn: 0.2 units/s
- reserveFraction: 0.15 share of full
- limpPower: 0.6 share of full

Watch out for these common mistakes:
- Free push on the last drop: Tell your AI: give the engine only the share of power that the burned fuel could pay for in that moment.
- The tank goes below zero: Tell your AI: never burn more than the tank holds, and stop the engine when it reaches exactly zero.
- The engine restarts by itself: Tell your AI: after the engine cuts out, it stays off until the player starts it again.
- A pickup is used up on a full tank: Tell your AI: report how much fuel the tank took, and take only that much from the can.
- The tank runs out with no warning: Tell your AI: before the tank is empty, add a reserve where the engine gives less power and the gauge warns, so the player has a few seconds to act.

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

Fuel turns every flight or drive into a trip with a budget. The player plans how far to go, where to refill, and when to push on, so reaching a pump or a pickup feels like a real relief.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

engine startsstarts on reservestarts and runs dryreserve beginsengine switched offtank runs dryfuel above reserveengine switched offtank runs dryfuel comes infuel in and startedlittle fuel and startedEngine offRunningOn reserveTank empty
How it runs, as a diagram
  • Engine off → Running: engine starts
  • Engine off → On reserve: starts on reserve
  • Engine off → Tank empty: starts and runs dry
  • Running → On reserve: reserve begins
  • Running → Engine off: engine switched off
  • Running → Tank empty: tank runs dry
  • On reserve → Running: fuel above reserve
  • On reserve → Engine off: engine switched off
  • On reserve → Tank empty: tank runs dry
  • Tank empty → Engine off: fuel comes in
  • Tank empty → Running: fuel in and started
  • Tank empty → On reserve: little fuel and started

Good starting values

ValueStart withWhat it changes
tankSize60 unitsHow big the full tank is. With the starting burn it gives about 14 seconds at full throttle, long enough for a real climb and short enough that the player watches the gauge.
burnRate4 units/sHow much the engine burns each second at full throttle. Together with the tank size it sets how far the player gets on one fill.
idleBurn0.2 units/sHow much the engine burns just by running with no throttle. A small amount stops the player from leaving the engine on for free while waiting.
reserveFraction0.15 share of fullThe share of the tank that counts as reserve. About a seventh gives the player a few seconds to find a pump after the warning.
limpPower0.6 share of fullThe most power the engine gives on reserve. Less than full makes the warning felt, and more than zero keeps the player from crashing at the exact moment it starts.

What usually goes wrong

Free push on the last drop

The tank holds a sliver, but the engine gives full power for the whole moment, as if the fuel had been enough. Over many moments that is a lot of free flying.

Fix: Tell your AI: give the engine only the share of power that the burned fuel could pay for in that moment.

The tank goes below zero

A slow moment, such as a hiccup in the game, asks for more fuel than is left. The tank ends up below zero, and the gauge draws backwards or the game stops.

Fix: Tell your AI: never burn more than the tank holds, and stop the engine when it reaches exactly zero.

The engine restarts by itself

The player picks up fuel while the throttle is held down, and the engine springs back to life with no start. It feels like a glitch, and a pickup near a cliff can push the player over.

Fix: Tell your AI: after the engine cuts out, it stays off until the player starts it again.

A pickup is used up on a full tank

The player drives over a fuel can with a nearly full tank. The tank takes what fits, but the can is gone, and the rest of its fuel is lost.

Fix: Tell your AI: report how much fuel the tank took, and take only that much from the can.

The tank runs out with no warning

The gauge looks fine and the next moment the engine dies. The player feels cheated, because there was nothing to react to.

Fix: Tell your AI: before the tank is empty, add a reserve where the engine gives less power and the gauge warns, so the player has a few seconds to act.

How to check it works

Works well with

Common questions

how does a fuel gauge work in a game

A tank goes down while the engine runs and never fills by itself. The player refills it from pickups or pumps. At zero the engine stops.

what is a fuel reserve in game design

It is the last part of the tank, where the engine gives less power as a warning. It gives the player a few seconds to react before the engine dies.

how much fuel should a jetpack have

Start with about 14 seconds of full throttle. Shorter makes the jetpack a hop, longer makes the tank a formality.

what do i tell my ai to add a fuel gauge

Paste this: Add a fuel gauge. The engine burns a little when running and more with the throttle. At 15 percent left, limit its power to 60 percent. At zero it cuts out and only restarts when the player starts it again after refuelling. A pickup fills only what fits.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

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