AgentGames

Search titles, descriptions, models and tags. Press Enter to see results.

🪵 Guide

How to make a survival game with AI

A survival game is four or five timers quietly fighting the player. Ask for them all at once and you get a mess. Ask for one, make it hurt, then add the next.

Updated 5 October 2026 5 min read By the Agent Games team
Jump to a section
  1. Add one pressure at a time
  2. The first prompt, and the four that follow
  3. The numbers that decide whether it is fun
  4. What breaks in a survival game
  5. Common questions
  6. Where to go next

Ask for one pressure, not a world. Start with sixty seconds of staying alive, add hunger when that works, then night, then gathering, and save the game last. Every step has to be playable on its own before the next one arrives.

Why this is the one genre that punishes a big first prompt

A platformer with a broken jump is obviously broken. A survival game with four half working systems feels vaguely bad, and no single thing is wrong enough to point at. That is much harder to fix, and it is what one large prompt produces.

Add one pressure at a time#

Survival is not a setting, it is arithmetic. Something drains, something refills it, and the refill is guarded by a risk. Each pressure you add is another instance of that shape, and they only feel good once they start arguing with each other.

Add one pressure at a time A survival game is several timers fighting the player. Ask for all of them at once and none works. 1 Stay alive for 60 seconds Movement, one threat, a clock, a death screen. 2 Hunger One bar that falls. Food on the map that refills it. 3 Night Every 90 seconds it gets dark and more things hunt you. 4 Gathering and building Wood and stone become a wall, a fire, a weapon. 5 Saving The run survives a closed tab. Add this last, never first. Each step is playable on its own. If step two is not fun, step four will not rescue it.
Five prompts, not one. By step three you have a game people will finish a round of, and the later steps are optional.

The order matters because each step tests the one before it. Hunger is meaningless until the map is worth crossing. Night is meaningless until hunger makes you leave the safe corner. Crafting is meaningless until night is dangerous enough to want a wall.

The first prompt, and the four that follow#

PromptStep one. Copy this and send it
Build the first slice of a survival game as ONE self-contained .html
file. This is step one of several, so keep it small and keep it readable.

WORLD: a square map seen from above, about three screens wide, with grass,
rocks and trees drawn as flat canvas shapes. The view follows the player.

PLAYER: moves with W, A, S, D. One health bar.

THREAT: wolves wander the map. Touching one takes health. They are slow
enough to outrun and there are never more than four.

GOAL: survive 60 seconds. Then a results screen with the time survived,
the best time, and a key to play again.

FOOD: berries scattered about restore a little health when walked over,
and do not come back.

ART: canvas shapes and flat colour only. No image files.

Base movement on seconds between frames, capped at 0.05. Put every number
I might want to tune into one CONFIG object at the top of the script.

Do not add hunger, crafting, day and night, or an inventory. I will ask
for those one at a time.

That last paragraph does more work than anything else in the prompt. Without it you get all five pressures half built, which is the exact outcome this guide exists to avoid.

Play it. If sixty seconds is boring, nothing you add later will fix it. Change the wolves or the map rather than piling a crafting system on top. When it holds your attention, the next four prompts are each one sentence.

  1. Hunger. Add a hunger bar that empties over about three minutes. At zero it drains health. Berries fill it. Show it next to health.
  2. Night. Every 90 seconds the screen darkens and the wolves get faster and more numerous. Dawn resets them.
  3. Gathering. Trees and rocks give wood and stone when stood next to. Five wood builds a wall segment, ten builds a fire that holds the wolves back.
  4. Saving. Keep the world, the inventory and the clock in localStorage, and restore them on load.

The numbers that decide whether it is fun#

Survival games are tuned, not designed. The same code is tedious or tense depending on four or five values, which is exactly why the prompt asks for one CONFIG object. These are reasonable places to start and none of them is correct.

NumberStart atWhat goes wrong at each end
Hunger bar empties in3 minutesFaster and the player does nothing but eat. Slower and hunger is decoration.
Day length90 secondsShorter and nothing can be built. Longer and night stops being a threat.
Food per screen2 or 3 itemsMore and there is no scarcity. Less and the game is unwinnable by luck.
Threats at nightDouble the day countLess is not noticed. More and a careful player still dies, which reads as unfair.
Wall cost5 woodCheaper and there is no decision. Dearer and nobody ever sees a wall.

Starting values for the prompts above. Change one, play two rounds, then change the next.

Ask for the change by its effect rather than its value. Hunger runs out too fast to explore gets a better result than set hungerPerSecond to 0.004, because the model can see the whole config and you cannot.

What breaks in a survival game#

These four turn up again and again, and none of them looks like a bug while you are building. They look like the game being slightly dull.

The loop that gets you a finished game Write the brief Seven fields, once. Generate One file, no build step. Play it for a minute Actually play. Do not skim. Name ONE thing that is wrong Screenshot it. Quote the error text. Say what you expected, and what happened instead. repeat 8 to 15 times What not to do “It is broken, rewrite the whole thing.” You lose every fix you already landed. Each pass changes one thing, so you always know what broke it.
One pressure per message, then one fault per message. The loop is the same, and the discipline matters more here than in any other genre.
  • The infinite corner. Resources respawn where the player is standing, so the best strategy is to stand still. Ask for spawns away from the player and a cap per area.
  • Death with no explanation. A bar reaches zero off the edge of the screen and the player has no idea what killed them. Flash the bar that caused it and name the cause on the results screen.
  • The unwinnable seed. A random map sometimes starts a player in a corner with no food. Ask for a guaranteed cluster near the start point.
  • The save that loads a broken world. Half the state restores and the rest is a fresh game, so wolves are hunting a player who already died. Save and load the whole state object, never the fields one at a time.

🪵Survival games written by AI

Common questions#

Can AI make a survival game?

Yes, as long as you ask for it in stages. A model will happily write hunger, crafting, day and night and saving in one answer, and all four will roughly work and none will feel right. Asking for one pressure at a time gets a game you can actually play.

What is the simplest survival game to start with?

Stay alive for sixty seconds on a map with one threat and a little food. That is a complete game, it takes one prompt, and it tells you whether the movement and the map are worth building anything on top of.

How do I add hunger without making the game annoying?

Start with a bar that empties in about three minutes and only drains health once it is empty. Hunger should push the player out of a safe corner, not interrupt them. If they are eating more often than they are exploring, it is too fast.

Should a browser survival game save progress?

Add it last. Saving the whole state to localStorage on a timer is a single prompt. Doing it early means every later change has to be migrated into existing saves, including your own from an hour ago.

How long does a survival game take to build with AI?

The first playable slice is about ten minutes. The games on this site that people finish averaged hours spread over several sessions, and survival is at the slower end because tuning takes more rounds than building does.

How big should the map be?

About three screens wide for a first build. Big enough that crossing it is a decision, small enough that the player is never lost and that you are not asked to write a minimap in the first prompt.

Where to go next#

When a round of it is genuinely tense, publish it. The page it gets records the model, the prompt and the tokens behind it, and anybody can play without an account.

The method behind the staged prompts is in how to make a game with AI. Ready prompts for the faults above are in the prompt guide, and the drawing and movement side is covered in the 2D guide. For ideas, the survival games here are the biggest category on the site.