LightMySky

AI in Computer Games

How computer opponents choose game actions using fixed rules, move search or learning from examples; difficulty adjustment and level generation; why changed behavior alone does not prove learning

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Explain how instructions help a computer opponent choose an action
  • Distinguish fixed rules from learning from examples, and explain why changed behavior alone does not prove learning
  • Describe difficulty adjustment and explain why a new level layout alone does not prove that AI generated it

1 · Read

You have learned that computers follow instructions. Game AI, short for artificial intelligence, is software that chooses actions for computer opponents. A game-controlled character is often called an NPC, or non-player character. People write the software that makes its choices.

Try it together

A guard follows this fixed rule: if the player is in sight, chase; otherwise, patrol. Its action changes when the player comes into view, but its rule stays the same. A changed action does not prove that the guard learned.

Player out of sightPatrolPlayer in sightChase
Match each situation to its action. The guard follows the same rule in both situations.

Learning AI uses examples to learn patterns. Some game systems learn before play starts; others can learn during play. People write the learning software. A chess program can also compare possible moves using its existing software, without learning from its opponent during that game.

A fixed rule can adjust difficulty: after three wins, choose a harder track. Some games also use AI tools to create levels. Other games create layouts with rules and chance. Seeing a new layout alone does not tell you which method made it.

Three winsApply difficulty ruleChoose harder track
This rule changes the challenge without learning a new rule.

Game AI can use rules, compare possible moves or learn patterns. A prediction is a guess about what could happen next. Past moves can provide clues, but they do not guarantee your next move. The game's software also decides what information its computer opponent can use.

Game AI uses software to choose actions. Changing an action, adjusting difficulty or making a new layout does not by itself prove learning.

How did the game choose? was written for this dataset using fictional game examples.

More to read

How did the game choose?

Imagine a gatekeeper in a game. A written rule says to open the gate for a player carrying a key. For a player without a key, the gate stays closed. Two different actions can come from the same rule.

A different game system studies examples of play to learn patterns. Its software may be trained before the game begins. Learning from examples does not have to happen during every round.

A board-game program has another option: compare possible moves and what might follow them. Searching those possibilities does not by itself mean it learned from the current opponent.

When a game changes its challenge or makes a fresh maze, ask how it did that. A difficulty rule can choose a harder track. Rules and chance can make a maze. An AI tool can also create layouts. Seeing the result is not enough to identify the method.

2 · Watch

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Where this leads

Jobs that lean on this skill. Follow one to see everything it is built on.

Then practise

8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
AI in Computer Games · Computing, ages 7 to 9 · LightMySky