Book Image

Unity Game Development Scripting

By : D'Aoust
Book Image

Unity Game Development Scripting

By: D'Aoust

Overview of this book

The intuitive and powerful Unity game engine is one of the most widely used and best loved packages for game development. Unity scripting is an essential but challenging skill to master in order to create custom game elements. Learning modular scripting allows you to rewrite as little code as possible as you deploy your scripts to multiple projects and work easier, quicker, and more efficiently than before. In each chapter of this book, you'll learn how to script new game elements. Beginning with making custom controls for the keyboard and mouse, as well as the Xbox 360 Controller, you'll then get to grips with more complex systems such as inventory, data saving, and artificial intelligence. As you create these elements, you'll also learn how to make your scripts simpler and easy to use. This will allow drag-and-drop deployment, which is to be used by designers and nonprogrammers. Finally, you'll combine all of your newfound skills to create your own complete game project.
Table of Contents (17 chapters)
Unity Game Development Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Enemy and Friendly AIs

Artificial Intelligence, also known as AI, is something that you'll see in every video game that you play. First-person shooter, real-time strategy, simulation, role playing games, sports, puzzles, and so on, all have various forms of AI in both large and small systems. In this chapter, we'll be going over several topics that involve creating AI, including techniques, actions, pathfinding, animations, and the AI manager. Then, finally, we'll put it all together to create an AI package of our own.

In this chapter, you will learn:

  • What a finite state machine is

  • What a behavior tree is

  • How to combine two AI techniques for complex AI

  • How to deal with internal and external actions

  • How to handle outside actions that affect the AI

  • How to play character animations

  • What is pathfinding?

  • How to use a waypoint system

  • How to use Unity's NavMesh pathfinding system

  • How to combine waypoints and NavMesh for complete pathfinding