Friday, December 18, 2015

Interactive Narrative


Project Overview: 

In this project, we combine all of the knowledge we've developed so far to create three stories in Unity. The first story doesn't take any input from the user and uses behavior trees (the KADAPT library) to author interactions. The second story allows a player to control a hero and interact with and change the story. The third story gives the user total control over the story  except for some required key events that must occur for the story to progress. We now discuss the story in depth.

Github: https://github.com/CG-F15-23-Rutgers/UnityProjects

Documentation: https://dl.dropboxusercontent.com/u/48369447/KnightGame/Report.docx

B3 Source Code Download: https://dl.dropboxusercontent.com/u/48369447/KnightGame/Code.zip

Story Overview: An evil Goblin has taken over the kingdom! A valiant knight must battle the goblin and his henchmen to rescue the kingdom! There are four sections to the map:
1.) The graveyard
2.) The mountain
3.) The castle
4.) The plains
5.) The forest
The player starts just outside the graveyard. Here he must face the vanguard. The vanguard consists of two of the goblin’s evil knight henchmen. He can defeat them by slashing them with his sword, scaring them by shouting at them (they flee to the forest), or throwing rocks at them. Next, he faces the mid-guard. He can choose to slay them with his sword or scare them away. The hero then can either battle the royal guard or sneak past them to battle the Goblin King. The Goblin King uses the ancient martial art of Goblin fight dancing to battle the hero. The hero defeats the Goblin King by casting a spell. If the Goblin King is defeated, the royal guards flee. The rearguard roams and patrols the plains and the skeletons/ghosts of the kingdom’s former knights roam the graveyard.

Characters:
1.) Hero: Large, distinct knight trying to rescue the kingdom from the Goblin King.
2.) Goblin King: An evil goblin that has taken over the land, castle, and country’s gold supply; resides in the castle at the top of the mountain
3.) Vanguard: Henchmen of the Goblin King. First two evil knights the Hero must face.
4.) Skeletons: Wandering ghosts of the kingdom’s former knights; roam in the graveyard
5.) Mid-Guard: Henchmen of the Goblin King; two knights stationed in the graveyard
6.) Royal Guard: Henchmen of the Goblin King; four knights stationed on the mountain
7.) Rearguard: Henchmen of the Goblin King; four knights roaming the plains

Objects:
1.) Trees: Static objects
2.) Rocks: Able to be thrown at enemies by the Hero
3.) Castle: Static object; guarded by Goblin King
4.) Gold: Static objects; surrounding and guarded by Goblin King
5.) Sword: Used by hero to slash enemies
6.) Shield: Used by hero to defend against enemy attacks

Events:
1.) Approach and Wait: An agent moves to a specified waypoint or other agent
2.) Body Animation: An agent makes a specific body animation
a. We use the “throwing” animation to cast magic spells.
b. We use the duck action to avoid attacks and pick up rocks.
c. We use the breakdance action for the Goblin’s martial arts.
d. We use the fight action for having non-Hero agents fight.
e. We use the sword swinging action for the Hero’s fight action.
f. We use the dying action when an agent is killed.
3.) Face Animation: An agent makes a specific facial expression
a. We use the following facial expressions:
i. Fire breathing is used to scare other agents.
ii. Headshaking is used to express disappointment.
4.) Hand Animation: An agent makes a specific gesture.
a. We use the following gestures:
i. Hands up
ii. Being cocky
iii. Thinking
iv. Waving
v. Pointing
vi. Clapping
5.) Look at: An agent looks at another agent or waypoint
6.) Face off: Two agents face each other
7.) Speak pair: Two agents have a conversation involving the “cocky” and “thinking” actions.
8.) Get ball and throw ball: An agent picks up a spherical object and throws it to a specified location.
9.) Fight: One agent takes the fighting stance, the other agent swings a sword, and the first agent dies.
10.) Fight Martial Arts: Fight where one agent uses martial arts (breakdancing) and the other takes the fighting stance
11.) Fight2: A choreographed battle between the hero and Goblin King. Where the hero attacks with a sword, the Goblin dodges, counteracts with martial arts, the hero dodges, casts a spell, and the Goblin dies.
12.) Flee: An agent throws his hands up, looks at the Hero, shakes his head, waves, and flees to a specified waypoint.
13.) Scare: An agent makes a fire breather expression and the other agent flees.
14.) Scare Monster: An agent scares a monster, but the monster scares back causing the agent to flee.
15.) Applaud: An agent claps for another agent.
16.) Skeleton Wander: Skeletons wander between randomly selected waypoints.
17.) Knight Patrol: Knights patrol between randomly selected waypoints
18.) Throw rock: An agents picks up and throws a rock at another agent who then dies

PART 1: No User Interaction

Video: https://www.youtube.com/watch?v=XRTXX9IO_u4



Playable Demo: https://dl.dropboxusercontent.com/u/48369447/KnightGame/Demos/Part1/Part1_Demo/Part1_Demo.html

Controls:
Press the ‘C’ key to switch views from one focused on the Hero to one showing the entire scene.

Description:
1.) One of the two vanguards is randomly selected.
2.) One of the following occurs randomly:
a. The selected knight approaches the hero and is slain.
b. The hero approaches the selected knight and slays him.
c. The hero approaches the selected knight, scares him, and makes him flee.
d. The hero grabs a rock and throws it at the selected knight, killing him.
3.) The hero then picks one of the same actions as before for the other knight.
4.) The hero moves to the graveyard.
5.) The two grave yard guards approach one another and have a random conversation.
6.) One of the two graveyard guards is randomly selected.
7.) The hero can perform one of the following actions randomly:
a. The hero approaches the selected knight and slays him.
b. The hero approaches the selected knight, scares him, and makes him flee.
8.) The hero then performs one of the same actions randomly to the other guard.
9.) The hero sneaks past the royal guards on the mountain.
10.) The hero engages in battle with the Goblin King and slays him with a spell.
11.) The royal guards flee
12.) In parallel to steps 1-11 (and each other):
a. Skeleton ghosts wander in the graveyard.
b. Evil knights patrol the plains.

Behavior Tree:



PART 2: User Controls Hero

Video: https://www.youtube.com/watch?v=kNq45E1Zg0I



Playable Demo: https://dl.dropboxusercontent.com/u/48369447/KnightGame/Demos/Part2/Part2_Demo/Part2_Demo.html

Controls:
Press the ‘C’ key to switch views from one focused on the Hero to one showing the entire scene.
The user dictates the actions the agent takes. HE/SHE MUST FOLLOW THIS PROCEDURE:
o Select an antagonist:
Press ‘1’: Knight 1 (Vanguard 1) is antagonist
Press ‘2’: Knight 2 (Vanguard 2) is antagonist
Press ‘3’: Knight 3 (Mid-guard/Graveyard Guard 1) is antagonist
Press ‘4’: Knight 4 (Mid-guard/Graveyard Guard 2) is antagonist
Press ‘5’: Knight 5 (Royal Guard/Mountain Guard 1) is antagonist
Press ‘6’: Knight 6 (Royal Guard/Mountain Guard 2) is antagonist
Press ‘7’: Knight 7 (Royal Guard/Mountain Guard 3) is antagonist
Press ‘8’: Knight 8 (Royal Guard/Mountain Guard 4) is antagonist
Press ‘G’: Goblin King is the antagonist
Press ‘S’: One of the skeletons is the antagonist
o Select an action:
Press ‘F’: Fight
Press ‘B’: Scare
o Hit the return key to perform the action
o Repeat until protagonist is dead or Goblin King is defeated.

Description:

General Requirement: protagonist and antagonist must be different and alive/not fled.

The user is free to select any set of actions, but must adhere to the basic story line:
1.) All vanguards must be defeated first, but the order in which they are defeated and how they are defeated do not matter.
2.) Once the vanguards are defeated, the hero can battle/scare the mid-guards and skeletons in any order, but not the royal guards.
3.) Scaring the skeleton will result in the skeleton scaring the player back resulting in the hero fleeing and the Goblin winning. The skeleton can be fought and laid to rest.
4.) Defeating the skeleton is optional.
5.) Once all of the mid-guards are defeated the player can battle the royal guards or go directly to the Goblin King.
6.) Defeating the royal guards is optional.
7.) Scaring the Goblin King will result in him scaring back causing the Hero to flee and lose the game.
8.) Once the Goblin King is defeated the player has won the game (and is free to go back and defeat any remaining antagonists).

Behavior Tree (Simplified, See Code for Full):












PART 3: User Can Control Any Character

Video: https://www.youtube.com/watch?v=cmeSp1qqIjc


Playable Demo: https://dl.dropboxusercontent.com/u/48369447/KnightGame/Demos/Part3/Part3_Demo/Part3_Demo.html

Controls:
Press the ‘C’ key to switch views from one focused on the Hero to one showing the entire scene.
The user dictates the actions the agent takes. HE/SHE MUST FOLLOW THIS PROCEDURE:
o Select a protagonist:
Press ‘H’: Hero is antagonist
Press ‘1’: Knight 1 (Vanguard 1) is protagonist
Press ‘2’: Knight 2 (Vanguard 2) is protagonist
Press ‘3’: Knight 3 (Mid-guard/Graveyard Guard 1) is protagonist
Press ‘4’: Knight 4 (Mid-guard/Graveyard Guard 2) is protagonist
Press ‘5’: Knight 5 (Royal Guard/Mountain Guard 1) is protagonist
Press ‘6’: Knight 6 (Royal Guard/Mountain Guard 2) is protagonist
Press ‘7’: Knight 7 (Royal Guard/Mountain Guard 3) is protagonist
Press ‘8’: Knight 8 (Royal Guard/Mountain Guard 4) is protagonist
Press ‘G’: Goblin King is the protagonist
Press ‘S’: One of the skeletons is the protagonist
o Select an antagonist:
Hold the ‘Shift’ Key and do one of the following:
Press ‘H’: Hero is antagonist
Press ‘1’: Knight 1 (Vanguard 1) is antagonist
Press ‘2’: Knight 2 (Vanguard 2) is antagonist
Press ‘3’: Knight 3 (Mid-guard/Graveyard Guard 1) is antagonist
Press ‘4’: Knight 4 (Mid-guard/Graveyard Guard 2) is antagonist
Press ‘5’: Knight 5 (Royal Guard/Mountain Guard 1) is antagonist
Press ‘6’: Knight 6 (Royal Guard/Mountain Guard 2) is antagonist
Press ‘7’: Knight 7 (Royal Guard/Mountain Guard 3) is antagonist
Press ‘8’: Knight 8 (Royal Guard/Mountain Guard 4) is antagonist
Press ‘G’: Goblin King is the antagonist
Press ‘S’: One of the skeletons is the antagonist
o Select an action:
Press ‘F’: Fight
Press ‘B’: Scare
o Hit the return key to perform the action
o Selecting a protagonist causes the camera to focus on the newly selected protagonist.
o Repeat until protagonist is dead or Goblin King is defeated.

Description:
The user is free to select any set of actions, but must adhere to the basic story line for each character.

General Requirement: protagonist and antagonist must be different and alive/not fled.

For the hero as protagonist (same as previous):
1.) All vanguards must be defeated first, but the order in which they are defeated and how they are defeated do not matter.
2.) Once the vanguards are defeated, the hero can battle/scare the mid-guards and skeletons in any order, but not the royal guards.
3.) Scaring the skeleton will result in the skeleton scaring the player back resulting in the hero fleeing and the Goblin winning. The skeleton can be fought and laid to rest.
4.) Defeating the skeleton is optional.
5.) Once all of the mid-guards are defeated the player can battle the royal guards or go directly to the Goblin King.
6.) Defeating the royal guards is optional.
7.) Scaring the Goblin King will result in him scaring back causing the Hero to flee and lose the game.
8.) Once the Goblin King is defeated (by fighting) the player has won the game (and is free to go back and defeat any remaining antagonists).

For an evil knight as protagonist:
1.) Evil knights can only interact with other knights of the same category:
a. Vanguards w/ Vanguards
b. Mid-guards w/ Mid-guards
c. Royal guards w/ Royal guards
2.) When evil knights interact with other evil knights (regardless of the user selected action), they start a conversation.
3.) Evil knights can interact with the hero only if he has defeated all evil knights of lesser rank (vanguards = lowest, mid-guards = medium, royal guards = highest)
a. “They will not leave their post unless required”
4.) If evil knights fight the hero, they will be killed.
5.) If evil knights try to scare the hero, he will scare back, and they will flee.
6.) Evil knights will not interact with skeletons because they know better.
7.) Evil knights will not interact with the Goblin King because he is their ruler.

For the skeleton as protagonist:
1.) Skeletons can only scare other agents. They cannot fight.
2.) If the skeleton scares the hero or an evil knight, the hero or evil knight will flee.
3.) If the skeleton scares the Goblin King, the Goblin King scares back, and the ghost flees. Goblin Kings are not afraid of anyone!

For the Goblin King as protagonist:
1.) When the Goblin King interacts with an evil knight (regardless of the user selected action), the evil knight will applaud the Goblin King.
2.) The Goblin King always kills when he fights as the protagonist, even the hero!
3.) The Goblin King uses martial arts when he fights.
4.) The Goblin King scares everybody causing them to flee, nobody will scare back.

Behavior Tree (Simplified, See Code for Full):















No comments:

Post a Comment