36
CSE 786 Game CSE 786 Game Presentation Presentation June 9, 2009 June 9, 2009 Game: Game: “Little Robot’s “Little Robot’s Adventure” Adventure” Team: Team: OgreNoName OgreNoName Hiroshi Hayashi Hiroshi Hayashi Bryan Linthicum Bryan Linthicum Brett Kizer Brett Kizer

CSE 786 Game Presentation June 9, 2009 Game: “Little Robot’s Adventure” Team: OgreNoName Hiroshi Hayashi Bryan Linthicum Brett Kizer

Embed Size (px)

Citation preview

CSE 786 Game CSE 786 Game PresentationPresentation

June 9, 2009June 9, 2009

Game:Game: “Little Robot’s “Little Robot’s Adventure”Adventure”

Team:Team: OgreNoNameOgreNoNameHiroshi HayashiHiroshi Hayashi

Bryan LinthicumBryan Linthicum

Brett KizerBrett Kizer

Game OverviewGame Overview

What is “Little Robot’s Adventure”?What is “Little Robot’s Adventure”? Game Genre: ‘Fantasy RPG’ (Role Playing Game Genre: ‘Fantasy RPG’ (Role Playing

Game)Game)

What is the game objective?What is the game objective? Kill all monsters (enemies) in the player’s Kill all monsters (enemies) in the player’s

level.level.

How many players?How many players? Single player (no networking)Single player (no networking)

Game Overview - StoryGame Overview - Story

Player is a robot, starting in a burning Player is a robot, starting in a burning village.village.

Ogres and Ninjas are wrecking havoc to Ogres and Ninjas are wrecking havoc to the local population.the local population.

Starting NPC gives player the mission to Starting NPC gives player the mission to kill all enemies in the region.kill all enemies in the region.

Speaking with other NPCs gives the Speaking with other NPCs gives the player more information about the world player more information about the world and storyline.and storyline.

Based off of…Based off of… Diablo II Diablo II (2000) – Blizzard Entertainment(2000) – Blizzard Entertainment

Enemy Status

PlayerHP/MP

Player Experience

PlayerSkill

Game Play - FeaturesGame Play - Features

Minimap

Menu

Game Play - FeaturesGame Play - Features

Player Movements (A,S,D,W)Player Movements (A,S,D,W) Fixed game play camera (Fixed game play camera (Diablo II styleDiablo II style)) Updates player / NPC locations on Mini-Updates player / NPC locations on Mini-

mapmap Disable/Enable spell icons when Disable/Enable spell icons when

rechargingrecharging Ability to speak with NPCsAbility to speak with NPCs

NPCs tell the story of the gameNPCs tell the story of the game Ability to return to starting MenuAbility to return to starting Menu

Level Editor - FeaturesLevel Editor - Features

Level Editor GUI

Map Propertie

s

ObjectSelection

List

Level Editor - FeaturesLevel Editor - Features

Moveable Editor WindowMoveable Editor Window Camera movements (A,S,D,W)Camera movements (A,S,D,W) Camera rotation (right mouse click/drag)Camera rotation (right mouse click/drag) (Select, Place, Move, Rotate, Scale) Objects(Select, Place, Move, Rotate, Scale) Objects Display # of objects on map and current Display # of objects on map and current

FPSFPS Save / Load maps for Editing and Save / Load maps for Editing and

PlayabilityPlayability File overwrite confirmationFile overwrite confirmation Ability to return to starting MenuAbility to return to starting Menu

Game Design & Game Design & ArchitectureArchitecture

State DiagramState Diagram

Intro

Main Menu

Gameplay State

Finished loading

CreditExitLevel Editor

Select ‘New’ or ‘Load’ Game

Select ‘Level Editor’

Select ‘Return to Main Menu’

Select ‘Credits’

Select ‘Quit Game’

Automatically return to Menu upon completion

Select ‘Quit to Main Menu’

Select ‘Quit Game’

Particle Systems – Editor and ScriptsParticle Systems – Editor and Scripts

particle_system fireBall{

quota 2000material PE/explosionparticle_width 2particle_height 2cull_each falserenderer billboardbillboard_type point

emitter Ellipsoid{angle 2colour 1 1 1 1colour_range_start1 1 1 1colour_range_end

1 1 1 1direction -1 0 0emission_rate 2000position 0 0 0velocity 2velocity_min 2velocity_max 2time_to_live 0.2time_to_live_min

0.2time_to_live_max

0.4duration 0duration_min 0duration_max 0

repeat_delay 0repeat_delay_min

0repeat_delay_max

0width 6height 0

depth 6}

}

OGRE Particle Editor

Particle Systems - SpellsParticle Systems - Spells

Passive Spell - Local to player - Restores 20% of players Hit Points (HP) - Uses 100% of magic

Passive Spell - Local to player - Damage to player reduced by 50% while spell is active - Uses 100% of magic

Heal: Barrier:

Particle Systems - SpellsParticle Systems - Spells

Damaging Spell - Projectile - Deals 25% damage to enemy - Uses 50% of magic

Damaging Spell - Projectile - Deals 25% damage to enemy - Uses 50% of magic

Damaging Spell - Local to player - Deals 25% damage to enemy - Uses 100% of magic

Fire Ball: Ice Attack:

Area Attack:

Particle Systems - EnvironmentalParticle Systems - Environmental

Audio & Sound Effects: SoundManagerAudio & Sound Effects: SoundManager

SoundManager Instance

Sound1

Channel1

………

Sound2

Channel3

Channel2

Channel4

………

…………………........

CreateSound()

CreateSound()

PlaySound()

PlaySound()

Audio & Sound Effects: Audio & Sound Effects: SoundManagerSoundManager

Can create:Can create: 2D Streams (single-shot or looped)2D Streams (single-shot or looped) 3D Sounds (single-shot or looped)3D Sounds (single-shot or looped)

2D Streams2D Streams Call PlaySound() once->sound plays on channel and Call PlaySound() once->sound plays on channel and

then channel is set to INVALIDthen channel is set to INVALID 3D Sounds3D Sounds

Based on Listener (Player) and Sound positionBased on Listener (Player) and Sound position Sound output needs to periodically update Sound output needs to periodically update

(SoundManager FrameStarted function)(SoundManager FrameStarted function) SoundManager maintains array of active channels, uses SoundManager maintains array of active channels, uses

sound position and listener position/orientation to sound position and listener position/orientation to determine speaker outputdetermine speaker output

Entity Class HierarchyEntity Class Hierarchy

BaseEntity

•Scene Node•Velocity•3D Mesh

Monster Projectile

•Health•Speed•AI State

•Particle Effect•Speed

Bullet Flame FrostBolt

FireBall

Player

Ogre

EliteOgre

Ninja NPC

attack()die()

fire()

think()spawn()

Entity Class HierarchyEntity Class Hierarchy Advantages:Advantages:

Allows shared code between object entity Allows shared code between object entity typestypes

Entity Class HierarchyEntity Class Hierarchy Advantages:Advantages:

Allows shared code between object entity Allows shared code between object entity typestypes

Derived class entities are naturally more Derived class entities are naturally more specific in terms of properties, i.e. an Ogre is a specific in terms of properties, i.e. an Ogre is a more specific kind of Monstermore specific kind of Monster

Entity Class HierarchyEntity Class Hierarchy Advantages:Advantages:

Allows shared code between object entity typesAllows shared code between object entity types Derived class entities are naturally more specific in Derived class entities are naturally more specific in

terms of properties, i.e. an Ogre is a more specific terms of properties, i.e. an Ogre is a more specific kind of Monsterkind of Monster

When we deal with entities in other subsystems, we When we deal with entities in other subsystems, we can pass around a BaseEntity* pointer that contains can pass around a BaseEntity* pointer that contains the interface necessary for that subsystem, i.e.:the interface necessary for that subsystem, i.e.:

pBaseEntity->mPositionpBaseEntity->mPosition pBaseEntity->mVelocitypBaseEntity->mVelocity pBaseEntity->collideablepBaseEntity->collideable

are all that is needed from physics perspectiveare all that is needed from physics perspective

Entity ManagerEntity Manager Each concrete class on previous slide has an associated factory within the Each concrete class on previous slide has an associated factory within the

FactoryDictionaryFactoryDictionary

EntityManager installFactory (factoryType t) findFactory (string ClassName) createEntity (string ClassName) Map <string, EntityFactory>:

Create ()Destroy ()

Create ()Destroy ()

Create ()Destroy ()

Create ()Destroy ()

Create (string className)Destroy (BaseEntity* e)

Entity Manager <think Entity Manager <think ()>()>

think ( )think ( ) Defined in BaseEntity interfaceDefined in BaseEntity interface EntityManager checks current time against think EntityManager checks current time against think

intervals every frameintervals every frame Intervals specified within think ( ) functions, i.e.:Intervals specified within think ( ) functions, i.e.:

Ninja::think ( ) {Ninja::think ( ) {

......

setNextThink ( 0.1 ); //think again in 0.1s (100 ms)setNextThink ( 0.1 ); //think again in 0.1s (100 ms)

}} All AI and decision making goes into think ( ) or is All AI and decision making goes into think ( ) or is

called from withincalled from within

EntityManager <think EntityManager <think ()>()>

Advantages:Advantages: Allows entities to update less frequently than every Allows entities to update less frequently than every

frame and also vary the interval.frame and also vary the interval.

EntityManager <think EntityManager <think ()>()>

Advantages:Advantages: Allows entities to update less frequently than every Allows entities to update less frequently than every

frame and also vary the interval.frame and also vary the interval. Examples: Examples:

If the player is very far away, we can think less often If the player is very far away, we can think less often (performance boost)(performance boost)

EntityManager <think EntityManager <think ()>()>

Advantages:Advantages: Allows entities to update less frequently than every Allows entities to update less frequently than every

frame and also vary the interval.frame and also vary the interval. Examples: Examples:

If the player is very far away, we can think less often If the player is very far away, we can think less often (performance boost)(performance boost)

Control timing of events, i.e.:Control timing of events, i.e.:

<Code handling monster’s death: ><Code handling monster’s death: >

{{

… …..

setThinkFunc (&deathLimbo); // this function beginssetThinkFunc (&deathLimbo); // this function begins

// removing entity// removing entity

setNextThink ( 8.0 ); // think in 8.0 secondssetNextThink ( 8.0 ); // think in 8.0 seconds

return;return;

}}

Console SystemConsole System

Console VariablesConsole Variables Variables alterable via in-game console Variables alterable via in-game console

(~) to control gameplay aspects such (~) to control gameplay aspects such as:as: Player speedPlayer speed Monster damageMonster damage

Console SystemConsole System

Console VariablesConsole Variables Variables alterable via in-game console Variables alterable via in-game console

(~) to control gameplay aspects such (~) to control gameplay aspects such as:as: Player speedPlayer speed Monster damageMonster damage

Allows rapid fine-tuning of gameplay Allows rapid fine-tuning of gameplay attributesattributes

Console SystemConsole System

Console VariablesConsole Variables Variables alterable via in-game console (~) to Variables alterable via in-game console (~) to

control gameplay aspects such as:control gameplay aspects such as: Player speedPlayer speed Monster damageMonster damage

Allows rapid fine-tuning of gameplay attributesAllows rapid fine-tuning of gameplay attributes Globals defined anywhere in code, i.e.:Globals defined anywhere in code, i.e.:

ConVar cvarOgreAttackRate (ConVar cvarOgreAttackRate (

“ “ogre_rate”, ogre_rate”, //variable name in console//variable name in console

“ “2.0”,2.0”, //initial value //initial value

“ “ogre’s attack rate in hits/sec” //short descriptionogre’s attack rate in hits/sec” //short description

););

cvarOgreAttackRate.getReal(); //returns real 2.0cvarOgreAttackRate.getReal(); //returns real 2.0

Console SystemConsole System

Console CommandsConsole Commands Accessible via console just like VariableAccessible via console just like Variable Is linked to C++ call-back functionIs linked to C++ call-back function

Console SystemConsole System

Console CommandsConsole Commands Accessible via console just like VariableAccessible via console just like Variable Is linked to C++ call-back functionIs linked to C++ call-back function Examples:Examples:

spawn <entity name> spawn <entity name> -- spawns named entity in -- spawns named entity in front of playerfront of player

killkill -- kills currently -- kills currently selected entityselected entity

move x y zmove x y z -- moves player to given -- moves player to given coordinatescoordinates

Monster AIMonster AI

Managing of thisManaging of this

state is controlled in state is controlled in

Monster classMonster class

IDLEPURSUITBATTLEATTACK

DEAD

dist(player,me) < battleDist

nextAttackToggle up?

deal damagedist(player,me)

> battleDist

Deletion

dist(player,me) < chaseDist

dist(player,me) > chaseDist

Creation

GUI SystemGUI System

Crazy Eddies GUI (aka. CEGUI)Crazy Eddies GUI (aka. CEGUI) Use XML scripts to create GUIUse XML scripts to create GUI

.Scheme.Scheme list of Widget names & namespacelist of Widget names & namespace .Layout.Layout position & properties of each Widgetposition & properties of each Widget .Looknfeel.Looknfeel list of Image names & sizeslist of Image names & sizes

Some CEGUI widget types:Some CEGUI widget types: Buttons, Static Image/Text, DropMenu, Lists, Buttons, Static Image/Text, DropMenu, Lists,

etc.etc. In code, ‘clickable’ items need to be In code, ‘clickable’ items need to be

‘subscribed’ to the CEGUI listener in ‘subscribed’ to the CEGUI listener in order to function.order to function.

GUI SystemGUI System<?xml version="1.0" ?><?xml version="1.0" ?>

<I<Imageset mageset Name="noname_gamegui_images" Imagefile="noname_gameGui01.png" Name="noname_gamegui_images" Imagefile="noname_gameGui01.png" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">

<Image Name= "blank" XPos="0" YPos="0" Width="1" Height="1" /><Image Name= "blank" XPos="0" YPos="0" Width="1" Height="1" />

<Image Name= "gamegui_spell_01" XPos="0" YPos="96" Width="63" Height="63" /><Image Name= "gamegui_spell_01" XPos="0" YPos="96" Width="63" Height="63" />

</Imageset></Imageset>

<?xml version="1.0" ?><?xml version="1.0" ?>

<<GUISchemeGUIScheme Name="gameGui"> Name="gameGui">

<Imageset Name="noname_gamegui_images" <Imageset Name="noname_gamegui_images" Filename="noname_gameGui.imageset" />Filename="noname_gameGui.imageset" />

<Font Name="BlueHighway-12" Filename="bluehighway-12.font" /><Font Name="BlueHighway-12" Filename="bluehighway-12.font" />

<LookNFeel Filename="noname_gameGui.looknfeel" /><LookNFeel Filename="noname_gameGui.looknfeel" />

<WindowRendererSet Filename="CEGUIFalagardWRBase" /><WindowRendererSet Filename="CEGUIFalagardWRBase" />

<FalagardMapping WindowType="gameGui/StaticImage" TargetType="DefaultWindow" <FalagardMapping WindowType="gameGui/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="gameGui/StaticImage" />Renderer="Falagard/StaticImage" LookNFeel="gameGui/StaticImage" />

<FalagardMapping WindowType="gameGui/ImageButton" <FalagardMapping WindowType="gameGui/ImageButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="gameGui/ImageButton" />LookNFeel="gameGui/ImageButton" />

</GUIScheme></GUIScheme>

GUI SystemGUI System<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?>

<<GUILayoutGUILayout > >

<Window Type="TaharezLook/StaticText" Name="error_text" ><Window Type="TaharezLook/StaticText" Name="error_text" >

<Property Name="Font" Value="BlueHighway-12" /><Property Name="Font" Value="BlueHighway-12" />

<Property Name="Text" >CAUTION...<Property Name="Text" >CAUTION...

Could not open file: SavedMaps.txtCould not open file: SavedMaps.txt

Existing map list cannot be shown!Existing map list cannot be shown!

</Property></Property>

<Property Name="Alpha" Value="0.75" /><Property Name="Alpha" Value="0.75" />

<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /><Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />

<Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.3,0},{0.65,0},{0.5,0}}" /><Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.3,0},{0.65,0},{0.5,0}}" />

<Window Type="TaharezLook/Button" Name="error_button" ><Window Type="TaharezLook/Button" Name="error_button" >

<Property Name="Font" Value="BlueHighway-12" /><Property Name="Font" Value="BlueHighway-12" />

<Property Name="Text" Value="Continue" /><Property Name="Text" Value="Continue" />

<Property Name="InheritsAlpha" Value="False" /><Property Name="InheritsAlpha" Value="False" />

<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /><Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />

<Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.775,0},{0.99,0},<Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.775,0},{0.99,0},{0.99,0}}" />{0.99,0}}" />

</Window></Window>

</Window></Window>

</GUILayout></GUILayout>

GUI SystemGUI SystemWidget 1

Widget 2

Widget 3

Widget 4

Widget 5

Widget 0

GAME DEMOGAME DEMO