Book of Dreams


Description

Book of Dreams is a 2D beat-em-up where 1-4 pillow-wielding players fight their way through a vibrant dream world. As a sequel to Oneironauts, the game focuses on fun, energetic combat encounters with mysterious enemies like cavities, and a reverse mermaid.

Technical Details

Currently in an alpha state, Book of Dreams is being developed as a senior project at DigiPen using the proprietary game engine, Unity. The development of the game can be followed at our production site.

Technical Features

AI NavGraph

BookOfDreams_NavGraph

AI NavGraph Construction using Unity’s PolygonCollider2D

Although Book of Dreams is a 2D game, the players and enemies can move forward and backward as well as side-to-side. So, one of my first priorities when starting the AI for the game was the pathfinding system.

Unity provides a built-in NavMesh, but unfortunately it’s intended to create NavMeshes on the x-z plane whereas Unity’s 2D workflow utilizes the x-y plane. Sprites and objects could be rotated to match the mesh, but this would make Unity’s 2D physics and camera system impractical. So, it makes more sense to create a custom pahtfinding solution – and that’s what we did.

BookOfDreams_Pathfinding

Enemy pathfinding on NavGraph

Fortunately, Unity provides some nice tools that can be utilized for AI navigation. Particularly, Unity’s PolgonCollider2D, which allows users to edit a 2D polygon from within the Unity Editor. Using this as an editing framework, a system was created to generate a corner graph based on the polygon. The idea is fairly simple, a pathfinding node is added at each concave vertex of the polygon, then each node is linked to each other reachable node. The system also allows for adding obstacles within the NavGraph, which generates nodes on the graph with a similar approach. A partial implementation of the graph can be seen here.

Behavior Tree Debugger

BookOfDreams_BehaviorDebugger

Debugger showing the status of an enemy behavior tree

In Oneironauts, state machines were used to bring enemies to life. However, moving into Book of Dreams, we wanted enemy behavior to be more open to change and scalable. With state machines, adding new states or changing the connections between the states requires a lot of overhead. So, the decision was made to utilize behavior trees for the enemies in Book of Dreams.

Behavior trees provide a much more extensible interface. However, one notable disadvantage to behavior trees is debugging. With state machines, simply printing the current state of an object can go a long way. With behavior trees, there could be multiple behaviors running concurrently at any given moment, so the information isn’t as practical. Although a simple logging system could be integrated within either architecture, it’s often quicker and certainly more digestible to visually see what’s happening. This is especially true in the case of a tree.

So, a simple behavior debugger was created using Unity’s Editor Windows. It allows users to select an object within the editor and draw its behavior tree visually. The debugger displays structure of the tree as well as the current status of each node: whether it’s currently running, failed, succeeded, or if it hasn’t ran at all yet.

Credits

Andi Baker » Producer & Gameplay Programmer
Nadia Carrim » Character Artist & Animator
Connor Hollis » Tools & Gameplay Programmer
David Knopp » Gameplay & AI Programmer, Mechanics Designer
Kiem Lam » Environment Artist
Liz Pulanco » Art Director, Character Artist & Animator

Images

 BookOfDreams_Alpha_2