Reader small image

You're reading from  Unity AI Programming Essentials

Product typeBook
Published inDec 2014
Publisher
ISBN-139781783553556
Edition1st Edition
Tools
Right arrow
Author (1)
Curtis Bennett
Curtis Bennett
author image
Curtis Bennett

Curtis Bennett has been a developer in the games and computer graphics industry for several years. He has worked on developing immersive virtual environments, published research in visual simulation, taught college courses in game development, and worked for various game studios, and he was also an engineer on early versions of the RAIN AI plugin for Unity. Currently, he is the Technical Director for Creative Services at Ideum, which focuses on creating interactive media projects.
Read more about Curtis Bennett

Right arrow

The chase and attack demo


In the first demo, we will build an enemy ship that senses for the player, and if it sees the player, it starts moving toward it and then attacks it. A simple version of this would be to have the enemy wander with a visual sensor to detect the player, and if it sees the player, the enemy will move toward it and attack it. This would work but it really wouldn't be any different from the demo from Chapter 7, Adaptation, where the ship had to search for and collect gold. To make it a little different, we'll use a two-sensor approach. We will have one larger sensor on the enemy that detects the player, and if the enemy senses the player aspect, it will start chasing the player. Then, there is a second smaller sensor that attacks the player, that is, if it senses the player, then the enemy stops chasing and it instead attacks. This gives the effect of chasing the player but when the enemy gets closer, it stops and starts attacking, instead of just chasing and attacking...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity AI Programming Essentials
Published in: Dec 2014Publisher: ISBN-13: 9781783553556

Author (1)

author image
Curtis Bennett

Curtis Bennett has been a developer in the games and computer graphics industry for several years. He has worked on developing immersive virtual environments, published research in visual simulation, taught college courses in game development, and worked for various game studios, and he was also an engineer on early versions of the RAIN AI plugin for Unity. Currently, he is the Technical Director for Creative Services at Ideum, which focuses on creating interactive media projects.
Read more about Curtis Bennett