โ† Back to Home Tech & AI Classes

Session 3: AI in Games! ๐ŸŽฎ

Smart Game Opponents!
๐ŸŽฎ ๐Ÿค– ๐Ÿ โš”๏ธ ๐ŸŽฏ
Teacher: Mr. Yousef Younis

AI in Games!

Smart Computer Opponents

Ever play a game where the computer fights back? Where it seems SMART? That's AI! Today we learn about game AI! ๐ŸŽฎ

๐Ÿค–

Meet NPCs! ๐Ÿ‘พ

Non-Player Characters

NPC = Non-Player Character. These are the characters in games that aren't controlled by YOU. They're controlled by AI! ๐Ÿค–

Examples of NPCs:

  • ๐ŸŽฏ Enemy soldiers trying to shoot you
  • ๐Ÿ€ Basketball player defending you
  • โš”๏ธ Dragon boss fighting you
  • ๐Ÿƒ Zombies chasing you
  • ๐Ÿš— Racing car competing against you
  • ๐Ÿง™ Wizard casting spells at you

Scratch vs Modern Games! ๐Ÿ“š vs ๐ŸŽฎ

Remember Scratch? We programmed everything! Let's compare:

โŒ Scratch Way

WE told the sprite EXACTLY what to do:

  • "Move right"
  • "Jump when you hit wall"
  • "Change color"

The sprite does EXACTLY what we programmed. Nothing more, nothing less. ๐Ÿค–

โœ… AI Game Way

AI DECIDES what to do based on what YOU do:

  • "You moved right?"
  • "I'll block you!"
  • "Let me attack!"

The AI THINKS and REACTS to what you do! ๐Ÿง โœจ

The BIG Difference! ๐Ÿ’ก

Scratch (old way):
"When X happens, do Y"

AI (new way):
"Look at what the PLAYER did, then DECIDE what to do"
๐ŸŽฎ๐Ÿง 

Game AI Examples! ๐ŸŽฎ

๐Ÿ
Racing Games

Computer cars try to win! They learn your strategy!

โšฝ
Sports Games

Computer players defend and attack smartly!

๐ŸŽฏ
Battle Games

Enemies react to YOUR moves!

๐ŸงŸ
Zombie Games

Zombies hunt you down!

โ™Ÿ๏ธ
Chess AI

Computer thinks many moves ahead!

๐Ÿ 
Simulation Games

Citizens act on their own!

How Game AI Works! ๐Ÿง 

Let's trace how a game AI makes a decision:

Step 1: AI Sees

๐Ÿ‘๏ธ AI looks at the game and sees WHERE YOU ARE

โ†“

Step 2: AI Thinks

๐Ÿง  AI decides what STRATEGY to use

โ†“

Step 3: AI Chooses Action

๐ŸŽฏ AI picks the BEST move (attack, defend, run, etc.)

โ†“

Step 4: AI Acts!

โš”๏ธ AI moves, attacks, or does something IN THE GAME

AI Learns From YOU! ๐Ÿ“š

The smarter games learn patterns from how YOU play!

AI Remembers:

  • "When I attacked, the player jumped left" ๐Ÿง 
  • "The player always runs to the right when scared" ๐Ÿง 
  • "The player likes to hide behind walls" ๐Ÿง 

So next time, AI uses what it learned!

Example: "Player always jumps left... so I'll attack LEFT this time!" โš”๏ธโœจ

Easy vs Hard AI! ๐ŸŽฎ

Games have different AI difficulty levels:

๐Ÿ˜Š

Easy AI

Makes dumb mistakes ๐Ÿคช
Slow reactions โธ๏ธ
Easier to beat โœ…

๐Ÿ˜

Medium AI

Smart but fair ๐Ÿง 
Good reactions โšก
Good challenge! ๐ŸŽฏ

๐Ÿ˜ˆ

Hard AI

Almost impossible ๐Ÿ˜ฑ
Super fast reactions โšกโšก
Very hard to beat โŒ

Activity: Which Games Have AI? ๐ŸŽฎ

Let's identify which games use AI opponents!

Games to Think About:

  • ๐ŸŽฎ Mario Kart โ€” Computer cars race you
  • โšฝ FIFA/Madden โ€” Computer teams play against you
  • ๐Ÿน Fortnite โ€” Enemy players trying to win
  • ๐Ÿ‰ Minecraft โ€” Creepers attack you
  • ๐Ÿงฉ Candy Crush โ€” Just patterns, no AI

Which ones do YOU think have AI? Why? ๐Ÿค”

Discussion Time! ๐Ÿ’ฌ

Let's Talk About Game AI:

  • What game have you played with a smart opponent?
  • Did it feel like playing against a real person?
  • Was the AI easy or hard? Did you win?
  • Can you tell when AI makes a mistake?
  • Would you rather play against AI or real people?

What We Learned! ๐ŸŒŸ

  • NPCs = Non-Player Characters (AI-controlled)
  • AI Sees what's happening in the game
  • AI Thinks about the best strategy
  • AI Acts based on its decision
  • AI Learns from how YOU play
  • Different AI Levels โ€” Easy, Medium, Hard
  • AI Makes Games Fun! โ€” Opponents react to you!

Amazing Work! ๐ŸŽ‰

You understand game AI!

Next time you play a game with an opponent...
Remember: That computer AI is THINKING and REACTING to what YOU do! ๐Ÿง ๐ŸŽฎ

๐ŸŽฎ๐Ÿค–โœจ

Next Session: Smart Predictions โ€” Autocorrect and autocomplete! โŒจ๏ธ