O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating E-Learning Games with Unity

Book Description

Develop your own 3D e-learning game using gamification, systems design, and gameplay programming techniques

In Detail

Unity is a fully integrated development engine providing the required functionality to create games and interactive 3D content, while reducing the time, effort, and cost of developing the content. Nowadays, many people have started to use Unity in an eLearning setting as it allows them to create real-world scenarios, or models, for training purposes. With Unity, one can develop video games that are not only fun, but are also effective teaching and learning tools. When properly designed, an engaging game is an ideal platform for the presentation, testing, and application of learning objectives.

eLearning Game Programming in Unity is a practical, hands-on guide to programming eLearning games. You will encounter a step-by-step approach to developing a 3D game that is interactive and engaging, built around sound teaching pedagogy and game theory.

In this book, the readers will be taken through the development of an eLearning game framework using the Unity engine. In addition to developing the technology for the game, we will create 3 levels (missions) in the game that teach, test, and reinforce learning. The subject matter being taught is the 50 American states and their flags. Concurrently, the book shows readers how to develop multiple game levels that support the various learning objectives of the game. In level 1, the user has to locate the missing flags and return them to the flag monument. During this time, the state flags design and state name are given to the player. This is the teaching phase. We also discuss cognitive flow and how learning is encouraged when the player is in this state.

In level 2 the user has to run a race through the park, competing against two other racers. Non-Player Characters (NPCs) are stationed along the way, and will ask questions about state flags. The user has to achieve 100 percent and first place in the race to move on to level 3. This is the testing phase, as we approach the problem from other direction with multiple choice popup cards.

In level 3, we reinforce learning through interactions with NPCs. These interactions require higher order thinking and association of the subject matter with the game experience. You will also learn how to program the interactive elements of a game to increase immersion. You will construct interactive objects that can be collected by the player and will program non-player characters that will populate the world, move, and interact with the player.

With this guide, you will learn everything you need to know to make your own effective eLearning game from start to finish.

What You Will Learn

  • Create a user interface system for pop-ups and menus
  • Develop a game framework that supports multiple scene files for multiple missions
  • Design a system to handle objective and mission tracking in the game
  • Implement an inventory system for the player to collect objects
  • Create interactive objects to populate the game world
  • Program Non-Player Characters to interact with the player
  • Use a 3D camera, character and control systems for your game
  • Design eLearning game missions to teach, test and reinforce learning

Table of Contents

  1. Creating E-Learning Games with Unity
    1. Table of Contents
    2. Creating E-Learning Games with Unity
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Introduction to E-Learning and the Three Cs of 3D Games
      1. Understanding e-learning
      2. Introducing our game – Geography Quest
      3. Comprehending the three Cs
      4. Creating our first scene
      5. Developing the character system
      6. Building character representation
      7. Developing the camera code
        1. Implementing GameCam.cs
      8. Developing the player controls code
        1. Implementing PlayerControls.cs
      9. Try it out!
      10. Summary
    9. 2. Interactive Objects and MissionMgr
      1. Understanding the base scripts
      2. Building an interactive object
        1. Implementing the CustomGameObj script
        2. Implementing the InteractiveObj script
        3. Implementing the ObjectInteraction script
        4. Implementing the InventoryItem script
        5. Implementing the InventoryMgr script
          1. Implementing the DisplayInventory method
        6. Implementing the MissionMgr script
        7. Implementing the Mission script
        8. Implementing the MissionToken script
        9. Implementing the SimpleLifespanScript
      3. Putting it all together
        1. Testing the mission system
      4. Try it out!
      5. Summary
    10. 3. Mission One – Find the Facts
      1. Finding the facts
      2. Designing games to maximize fun
      3. The teaching loop in game design
      4. Implementing the core classes for mission one
        1. Creating a terrain
        2. Creating the FlagLocators GameObject
        3. Creating the FlagMonument GameObject
          1. Creating the MonumentMgr Script
        4. Creating the InventoryPlaceOnMonument class
        5. Creating the MissionMgrHelper script
        6. Creating the TriviaCardScript script
        7. Creating the SetupMissionOne script
        8. Creating the flag Prefabs
        9. Creating the pop-up card Prefabs
        10. Creating the mission pop-up Prefab
        11. Creating the mission reward Prefabs
        12. Creating the FoundAllTheFlags Prefab
        13. Creating the ReturnedTheFlagsResult Prefab
        14. Configuring the mission manager
        15. Playing the level!
      5. Summary
    11. 4. Mission One – Future Proofing the Code
      1. Reorganizing our GameObjects in the Scene view
        1. Creating a global scene
        2. Creating a first level scene
        3. Adding new scenes to the project
        4. Creating the PopupMainMenu GameObject
      2. An introduction to Finite State Machines
        1. Implementing an FSM in a game
        2. The switch case FSM
        3. Classes implementation of FSM
      3. Implementing the GameMgr script
      4. Reflecting on our code changes
      5. Analyzing code functionality
      6. Updating some systems
      7. Making the ScorePlate active
      8. Updating the player motion algorithm
      9. Playing the level!
      10. Summary
    12. 5. User Interfaces in Unity
      1. Getting familiar with Unity UI classes
      2. Developing the pop-up system
      3. Exploring the GUIText component
        1. Interpreting the members on GUIText
      4. Exploring the GUITexture component
      5. Exploring the TextMesh component
        1. Ideal use of TextMesh
      6. Creating clickable text elements
        1. Detecting mouse clicks
        2. Detecting mouse over
        3. Detecting leaving mouse over
      7. Exploring UnityScript and the GUIButton object
        1. Using UnityGUI
        2. Creating a clickable button
        3. Detecting a mouse click
      8. Building the main menu pop up
      9. Testing our work
      10. Future extensions
      11. Summary
    13. 6. NPCs and Associated Technology
      1. Creating the NPC GameObject
        1. Implementing the npcScript class
      2. Implementing the SplineMgr class
      3. Connecting SplineMgr to NPCScript
      4. Implementing the NPC decision system
        1. Implementing the npcCondition script
        2. Implementing the npcResponse script
        3. Implementing the npcInteraction script
        4. Implementing the npcDecisionMgr script
      5. Building a collection of NPC conditions and responses
        1. Implementing the condition_closerThanThresh script
        2. Implementing the condition_fartherThanThresh script
        3. Implementing the response_changeState script
      6. Putting it all together
      7. Summary
    14. 7. Mission Two – Testing a Player's Learning
      1. Exploring the structure of mission two
      2. Defining the framework for mission two
      3. Adding a mission to the missionMgr script
      4. Extending the GameCam script
      5. Modifying the terrain
      6. Adding NpcRacers to the mission
      7. Creating the start and finish line flags
      8. Creating the LevelStart and LevelFinished pop ups
      9. Creating the setupLevel2 Prefab
      10. Creating the raceStartup Prefab
      11. Implementing the LevelLogicObj GameObject
      12. Summary
    15. 8. Adding Animations
      1. Exploring 3D hierarchies
      2. Skinned meshes in Unity3D
        1. Acquiring and importing models
      3. Exploring the Mechanim animation system
        1. Choosing appropriate animations
        2. Building a simple character animation FSM
        3. Exploring in-place versus root motion animation
        4. Adding the character script
        5. Building a zombie racer animation FSM
        6. Building a quiz racer animation FSM
      4. Exploring the Unity animation editor
      5. Summary
    16. 9. Synthesis of Knowledge
      1. Understanding the mission three GameObjects
      2. Applying learning theory to mission three
      3. Creating the structure for mission three
        1. Modifying the terrain
        2. Adding visitors to the park
      4. Modifying the pop-up system
      5. Creating the NpcLocators Prefab
      6. Creating the CorrectResponse Prefabs
      7. Modifying the quiz cards
      8. Adding another data condition
      9. Using the setupLevel3 Prefab
      10. Creating the AddScore condition
      11. Creating the ShowLevel3Results response
      12. Creating the Time object
      13. Modifying the LevelLogicObj object
      14. Rewarding the player
      15. Summary
    17. 10. An Extensible Game Framework Pattern in Unity
      1. Load additively
      2. Using delete/load patterns
      3. Refactoring our work
        1. The pop-up system
          1. Updating level 3 pop ups
          2. Updating level 2 pop ups
          3. Updating level 1 pop ups
      4. Refactoring level 2
      5. Implementing a system to connect object references
        1. Updating the SetupMission2 script
      6. Refactoring level 3
      7. Playing and distributing your game
      8. Reflecting on e-learning and game design
      9. Summary
    18. Index