TExcelTAD

The Core Loop

The game loop from the earlier lessons runs 60 times a second. The core loop is a design idea with the same shape on a human scale: the small cycle of actions the player repeats for the whole game. If that cycle is fun, the game has a chance. If it isn't, no amount of content, story or polish will save it.

Finding the core loop

Describe what the player does over and over, in three to five verbs, ending where it began:

Game type Core loop
Platformer run → jump → avoid danger → reach the goal → next screen
Roguelike explore a room → fight → collect loot → get stronger → go deeper
Farming sim plant → wait/tend → harvest → sell → buy better seeds
Puzzle observe → try a move → see the result → solve → harder puzzle
Shooter find enemies → aim and shoot → take cover → reload → push forward

Most games have loops inside loops:

  • Moment to moment (seconds): jump, shoot, dodge. This is about feel: controls, feedback, timing.
  • Session (minutes): clear a level, finish a run, complete a day in the farm.
  • Long term (hours, days): unlock new characters, upgrade the base, finish the story.

For a first game, focus almost entirely on the moment-to-moment loop. If jumping around an empty grey level is already enjoyable for a minute, you have something worth building on.

Prototype the loop first

Prototype the core loop with grey boxes before making any content: no art, no menus, no story. The question is only "is doing this fun?". If the answer is "kind of", change the verbs or the numbers, not the graphics. Some studios call this "finding the fun", and it is cheap to do early and very expensive late.

Loops have economies

Session and long-term loops usually trade something: time for gold, gold for upgrades, upgrades for faster progress. A quick simulation shows whether the pacing works before anyone plays it. This farming loop plants, harvests and buys a new plot whenever it can afford one, until the farm has 12 plots. It runs twice, with two different plot prices:

js · try it yourself
function simulate(plotPrice) {
  let gold = 20, plots = 2, day = 0;
  const seedCost = 3, cropPrice = 8;
  const purchases = [];
  while (plots < 12 && day < 100) {
    day++;
    const planted = Math.min(plots, Math.floor(gold / seedCost));
    gold += planted * (cropPrice - seedCost);             // plant in the morning, sell at night
    const price = plotPrice * plots;                      // each extra plot costs more
    if (gold >= price + seedCost * (plots + 1)) {          // keep seed money for tomorrow
      gold -= price;
      plots++;
      purchases.push(day);
    }
  }
  console.log(`plot price ${plotPrice} x plots: 12 plots on day ${day}`);
  console.log(`  new plot on days: ${purchases.join(", ")}`);
}

simulate(10);
simulate(20);
plot price 10 x plots: 12 plots on day 21
  new plot on days: 1, 4, 6, 8, 10, 12, 15, 17, 19, 21
plot price 20 x plots: 12 plots on day 41
  new plot on days: 3, 8, 12, 16, 20, 24, 29, 33, 37, 41

The output answers design questions immediately. With the cheaper plots, the player gets a new plot every two or three days: a steady rhythm of small rewards. Doubling the price doubles the time to a full farm and stretches the gaps to four or five days, which may feel like a grind. Gaps that grow longer and longer are a sign players will get bored there. Change cropPrice or the goal and watch the pacing change.

What makes a loop satisfying

  • Clear goals. The player always knows what they're trying to do next.
  • Meaningful choices. Two upgrades that are identical aren't a choice. Trade-offs (speed vs armor) are.
  • Visible progress. Numbers going up, new areas opening, a stronger character.
  • Variation. The verbs stay the same, the situations change: new enemies, new level layouts, new combinations.
  • Good feedback. Every action gets an immediate, readable response. That is the topic of the next lesson.

Test yourself

What is a game's core loop?

  1. The while loop in main()
  2. The cycle of actions the player repeats throughout the game
  3. The final boss
  4. The save system

What should a first prototype of the core loop include?

  1. Final art and music
  2. Grey boxes and the core verbs, to test whether doing them is fun
  3. A full story
  4. Online multiplayer

Why simulate a game's economy in code?

  1. It replaces playtesting
  2. To see pacing problems (stalls, runaway growth) before players do
  3. To make the game run faster
  4. Engines require it