0% found this document useful (0 votes)
49 views19 pages

AI, Games and Behaviours

This document discusses a module that explores autonomous systems in computer gaming through game design challenges. Students are asked to submit a portfolio of 3-5 software systems demonstrating game design, coding, and autonomous behaviors. Max/MSP and Unity lessons are described that teach fundamentals and techniques for creating 3D worlds, physics simulations, spawning objects, player controls, and AI behaviors like pathfinding. The author's project involves 4 game prototypes in Unity showcasing AI: Elephant Man Ant (modeled after rock paper scissors against an AI opponent), Snake vs AI, an Endless Runner with an AI that jumps at obstacles, and Tic-Tac-Toe against an AI opponent. Reflections note areas for improving the AI.

Uploaded by

fatimamaideribe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views19 pages

AI, Games and Behaviours

This document discusses a module that explores autonomous systems in computer gaming through game design challenges. Students are asked to submit a portfolio of 3-5 software systems demonstrating game design, coding, and autonomous behaviors. Max/MSP and Unity lessons are described that teach fundamentals and techniques for creating 3D worlds, physics simulations, spawning objects, player controls, and AI behaviors like pathfinding. The author's project involves 4 game prototypes in Unity showcasing AI: Elephant Man Ant (modeled after rock paper scissors against an AI opponent), Snake vs AI, an Endless Runner with an AI that jumps at obstacles, and Tic-Tac-Toe against an AI opponent. Reflections note areas for improving the AI.

Uploaded by

fatimamaideribe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

AI, GAMES AND

BEHAVIOURS
Fatima Ibrahim Maideribe
TABLE OF CONTENT
3 BREIF 16 GAME 3

4 RESEARCH 17 GAME 4

5 MAX/MSP LESSONS 18 CONCLUSION

9 UNITY LESSONS 19 REFERENCES

14 GAME 1

15 GAME 2
BRIEF
This module explores the kinds of autonomous systems that are developed in contexts such as modern
computer gaming. As such the topic overlaps with game design principles and areas such as user
interface design and human behaviour.

This module concentrates on the intersection of algorithms, software design and coding. It builds
confidence in these disciplines through weekly challenges. Each challenge will penetrate a particular AI
mechanic or game design problem that students will probe through fast iterative prototyping.

For this brief you are required to submit a portfolio of between 3 and 5 software systems which
demonstrate different facets of the material and topics covered in the teaching sessions, involving:

Game design and mechanics;


Coding and algorithms;
Coded system behaviour (which could include autonomous behaviour, “AI” or similar game
mechanics).

In your report, reflect on the topics above for each of the software systems you develop and submit.
RESERACH
According to Arm, "AI in gaming refers to responsive and
adaptive video game experiences." Non-playable characters,
enemies, event systems, etc. have started implementing AI or
some form of autonomous behaviour to add more depth and
make games more dynamic. Games like The Sims, a life
simulation game where players can control and interact with
game characters, demonstrate autonomy as the characters
carry out tasks (e.g., taking care of their needs) without
requiring player interaction. This showcases autonomy in
both playable and non-playable characters. Other games
illustrating different forms of AI include endless running
games like Temple Run and the Google Dino game, where
obstacles progressively become harder as players continue
to play.
MAX MSP
FUNDAMENTALS
In this lesson, we started off learning the fundamentals of Max.
Creating objects like the metro that act like a sort of timer. When
connected with a toggle button (that goes on and off) and a
bang button (that blinks and sends off a bang), when the toggle
button is on, the metro, depending on the speed set, will send a
bang to the button, and it will blink depending on the metro
speed, which can be changed using integers (numbers) in the
inspector panel or directly added to the metro. Also, use the
counter object and numbers to count how many blinks the
button has made. You can also print objects to see when
something happens, for example, when a bang happens. After
going over it, we started making our first game, where we used
all the fundamentals to make a counter/guess the number
game.
3D
In this lesson, we started using jit.world to create a 3D world and
objects, where you can get video visualisations of them. For jit.world to
work, it would need to be connected to the toggle button to turn it off
and on. jit.gl.handle to be able to rotate the shape object along the x,
y, and z axes. For more options for changing the object, you would
right-click, getting a drop-down menu of objects like position, scale,
colour, etc. You can edit or change the shape without adding a new
object. With it, we were able to create different polygons and shapes
with different colours and sizes.
PHYSICS
After setting up the 3D objects, we learned
how to add physics and created a game
where an object hits another with a counter
that acts as a scoring system. Unlike
creating 3D objects, when adding physics,
you would need to add a max patch and
stimulate physical interactions by adding
objects like collisions, velocities, restitution,
and mass. When adding physics to the 3D
objects, when the sphere hits the cylinder,
the number in the counter system
increases.
UNITY
UNITY FUNDAMENTALS
We later learned how to use Physic
materials, rigid bodies, and box colliders.
objects, like the sphere, to have
elements such as gravity and be able to
bounce off different planes and objects.
The coding is so that once an object
collides, the colour will change and it will
rotate.

For our first unity lesson, we learned how


to create different game objects and
shapes. Then each of the objects moves
in different directions and speeds. In
Unity, you can code in C# how you want
each aspect of your game to work.
Which gives users more options for
creating gameplay compared to Max.
SPAWN
PLAYER
CONTROLS
Once we had the basics of how Unity
worked, we learned how to spawn
objects. The objects would then
destroy themselves after a certain point
because they would continuously clone
themselves with no end. We also had
them resize and change the colour in
the code so that once the game was
running, it would change from the
original prefab object. In this same
lesson, we started implementing player
control as well. So, once the arrow keys
are pressed, the object will move in
those directions.
Drop Game and RayCast
After establishing a player and having it move when the
different keys are pressed, we then added our first
AI/autonomous behaviour. The first game, the drop game, is
where the cubes are spawned above the player and the AI
tries to hit the one close to it. For users to have a better
idea of how far and close the cube was, we used an
orthopaedic camera instead of the usual perspective.
Having the cubes blue when they are the same level as the
player and black when it's out of its reach. The other game
involved Raycast, where the player and the enemy are
separated by a wall. But once the player is around the field
of vision of the enemy (which in this case is the AI), it will
turn red and rush to get to the player. But for those two
objects to "see" each other, you would have to change
layers to ignore raycast because, without it, the code would
not function the way it was supposed to.
Game Prototypes
For My Project, I created a set of 4 different games
on Unity showcasing AI and/or Autonomous
Behaviour in the gameplay.
ELEPHANT, MAN, ANT
Elephant, Man, and Ant is a 2-player Indonesian game also known as
Rock, Paper, and Scissors in other countries. According to A World of
Children’s Games by Mary Duckert, "The players face each other with
their right hands behind their heads. They count aloud, “One, two, three,
go!” On the word "go,” they hold out their right hands in one of three
ways: the thumb, index finger, or little finger is pointed towards the
opposite player. The pointed thumb is the elephant. The pointed index
finger is the man. The pointed little finger is the ant. To decide who is
the winner, the players say whichever of the following lines is
appropriate to their two gestures: “Elephant wins over the man because
he can trample him.” “Man wins over the ant because he can stop him.”
“Ant wins over the elephant because he can run up his trunk and tickle
him to death.” If the players make the same sign, they play the game
again.” So I wanted to recreate the game on Unity so that the user or
player plays against an AI as its opponent. I originally structured the
game as a rock, paper, scissors game since the mechanics were similar.
Once the player presses the button for either the ant, man, or elephant,
the AI also chooses as well. Either leading to a tie, win, or loss.
SNAKE VS AI
For my second game, I decided to recreate the
snake game. But instead of the snake constantly
growing and trying to stay away from the wall, I
made mine so that it grows when it eats the food
that is spawned. I wanted to have two snakes to
make the game more dynamic. So one of the
snakes will be controlled by the user and the other
by the AI. The user will be able to control the snake
with the arrow keys. While the AI will try to collide
with the food object, when each snake eats the
food, they grow bigger, and the player will beat the
AI by getting a higher score.
ENDLESS RUNNER
For my third game, I created an Endless Runner game. After seeing
games like Temple Run and the Dino Chrome game, I wanted to try and
recreate them, but instead the “player” would be the AI and try and jump
when an obstacle was in front of the player. So when the AI “sees” the
game object with the “obstacle” tag, it will jump. I also added a speed
multiplier so that the obstacles spawn faster than the last time.
TIC-TAC-TOE
For my fourth and final game, I made the
classic tic-tac-toe game. Player X will be
the user, and Player O will be the AI. I
originally started by coding the game so
that two users would play, later
implementing AI. I did this by creating a
function and a checker to check if Player X
has played, and then the AI will play. So
when the user double-clicks on the
buttons, player x plays, and then the AI will
play player o. Once the board is filled up,
the user can press the reset button to reset
it.
CONCLUSION
After completing each of the games, there are a few things that I would
like to improve and fix in the future. The main thing was the AI functions
in each of the games; I felt like they were a bit simplified, especially with
the Human, Ant, and Elephant games. If I had more time, I would have
used IEnumerator. Another thing I would change is that I would simplify
the tic-tac-toe game code because I found that I repeated a lot of it.
Overall, the lessons and the whole game creation process have given me
insight into how much of an impact AI and autonomous behaviour can
have in both game and game development.
RESOURCE PAGE
RESEARCH LINKS
CHROME-
EXTENSION://EFAIDNBMNNNIBPCAJPCGLCLEFINDMKAJ/HTTPS://D3N8A8PRO7VHMX.CLOUDFRONT.NET/GLOBALMINISTRIES
/LEGACY_URL/7431/ELEPHANT-MAN-ANT.PDF?1419969463

HTTPS://WWW.ARM.COM/GLOSSARY/AI-IN-
GAMING#:~:TEXT=AI%20IN%20GAMING%20REFERS%20TO,BEHAVIOR%20IN%20THE%20GAME%20WORLD.

HTTPS://WWW.RED-GATE.COM/SIMPLE-TALK/DEVELOPMENT/DOTNET-DEVELOPMENT/CREATING-A-SIMPLE-AI-WITH-UNITY-
AND-C/

PHOTO IMAGE LINKS


HTTPS://WWW.CLEANPNG.COM/PNG-MALE-SILHOUETTE-PNG-CLIP-ART-15354/DOWNLOAD-PNG.HTML

HTTPS://WWW.CLEANPNG.COM/PNG-ELEPHANT-PNG-CLIPART-66219/DOWNLOAD-PNG.HTML

HTTPS://WWW.CLEANPNG.COM/PNG-ANT-CARTOON-ANT-101986/

HTTPS://IMAGES.APP.GOO.GL/ECJGY7XZYEPUUNB98

HTTPS://IMAGES.APP.GOO.GL/AE3UHEKFV6GMHKVCA

HTTPS://IMAGES.APP.GOO.GL/YB3E4UMCCVQCO8RZ8
HTTPS://HTTPS://PRESSSTART.VIP/ASSETS.VIP/ASSETS

You might also like