LightMySky

AI in Computer Games

How computer game characters 'decide' what to do; simple rule-based AI vs learning AI; NPCs, difficulty adjustment; AI as the opponent in chess or board games

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Explain how a computer opponent in a game decides its moves
  • Describe the difference between a game character that follows fixed rules and one that learns from the player
  • Give an example of AI making a game more fun (adjusting difficulty, generating levels)

The lesson

When you play a video game against the computer, someone still controls the other side. That someone is a set of instructions inside the game, called AI, short for artificial intelligence. The AI follows its instructions to choose what a character does next.

Try it together

In many games, an enemy follows simple fixed rules. A guard might have this rule: if you see the player, chase them, if not, walk back and forth. The guard never thinks about anything else. It just checks the rule and acts.

Sees playerChasesLoses sightWanders
The guard's rule works like a loop: check, then act, then check again.

Some games use a different kind of AI: learning AI. Instead of one fixed rule, it watches how you play and changes its own choices. A chess program looks at many possible moves before it picks one it thinks is strong. That is very different from a guard that only knows one simple rule.

Good to know

AI can also make a game more fun without you noticing. If you keep winning easily, the game might get a bit harder. If you keep losing, it might ease up. Some games even use AI to build new levels each time you play, so it never feels exactly the same.

Game AI follows instructions: some use one fixed rule, and some watch you and adjust as you play.

Watch it

Where it sits

Learn first

This opens up

Nothing builds on it yet.

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.

AI in Computer Games · Computing, ages 7 to 9 · LightMySky