SlideShare a Scribd company logo
1 of 33
Developing the Game Functionality
Lesson 6
Exam Objective Matrix
Skills/Concepts MTA Exam Objectives
Programming the
Components
Understand Components (1.5)
Capture User Data (1.6)
Work with XNA (1.7)
Handling Game Data Work with XNA (1.7)
Programming the Components
• A significant part of game development
goes into creating and programming the
game functionality.
• The game development process
comprises of the following elements:
– Creating tools
– Programming the game
– Incorporating AI
Understanding Tool Creation
• Almost every game involves the use of
game tools for tasks such as importing or
converting art, building levels, and so on.
– Tool creation is the process when a game
programmer creates game tools.
• Tools created might include:
– Asset conversion tools, level editors or
map editors.
Tools
• Asset conversion tools are programs that
convert the artwork such as 3D models
into formats required by the game.
• Level editor tools allow the game player to
customize or modify levels within a game.
• Map editor tools allow the game player to
create custom maps with no knowledge of
programming skills.
Programming the Game
• After you load or add game components,
such as sprites, textures, game models,
and images in your game, you need to
make the components functional.
• To make the components functional, as
per the player’s input or as per the game’s
progress, you need to further program the
components.
Programming the Game: Showing Changes
Full health Low health
Programming the Game: Health Change
• The code sample in the textbook provides an
easy way to show changes in the player
character’s health by pressing keyboard keys.
• In the actual game, you would need to map
these changes in variable value to events such
as taking damage or picking up a health kit.
• Notice the color change as an extra indicator to
the player of the character's health state.
Programming the Game: Showing Changes
Full magazine Partially full magazine
Programming the Game: Using Bullets
• The code sample in the textbook provides
an easy way to show changes in the
number of bullets in the character’s
magazine by pressing keyboard keys.
• In the actual game, you would need to
map these changes in variable value to
events such as shooting the gun (pressing
a button) or picking up ammunition.
Programming the Game: Working the Deltas
• Notice that in both of the previous
examples, the majority of the game assets
were unchanged.
• As the player’s health changed, or the
number of remaining bullets changed, only
those items required an update.
• You’ll want to change as little as possible
by using drawable components.
Incorporating Artificial Intelligence (AI)
• Incorporating AI involves programming the
behavior of the nonplayer character (NPC) as
close to a human as possible.
• You can add AI for various game scenarios, as
each technique indicates.
• Popular AI techniques:
– Evading AI
– Chasing AI
– Flocking or Grouping AI
– Path finding AI
Evading AI
• One of the scenarios that present an opportunity
to incorporate AI is to make the movement of an
object or NPC intelligent.
• Simple sample of evading AI:
1. Get the player character's position on the screen.
2. If the player character's position is in the defined range, then assign
a random wait time to the sprite.
3. Do not move the sprite until the waiting time is over; allows the
player to catch the sprite if he reaches the sprite before the wait
time is over.
4. As soon as the wait time is over, make the sprite appear in some
other place on the scene.
5. Continue steps 2 to 4 until the player catches the sprite.
Chasing AI
• The player must evade the AI instead of chasing
(or catching the AI).
• The chasing AI is used when the player must
battle the computer controlled NPC.
• Simplified process:
1. Calculate the difference between the player position
and the AI position and decide on the AI direction of
travel.
2. Normalize the direction, then add randomness to the
direction.
3. Move towards the calculated player position.
Flocking or Group AI
• Certain NPCs, such as a group of soldiers,
should to move together without walking over
each other.
• Based on the Craig Reynolds algorithm.
• This algorithm follows three simple rules:
– Steer and avoid colliding into other members of the
group.
– Align towards the average heading of the members of
the group.
– Steer or move toward the average position of the
members of the group.
Path Finding AI
• This AI involves moving a game object in an
effort to find a path around an obstacle.
• Most common techniques:
– Breadcrumb path following: The player character
progresses through the game marking some invisible
markers or "breadcrumbs" on her path unknowingly.
– Waypoint navigation: Allows you to place reference
points in the game world which allows the use of
these precalculated paths in the appropriate path
finding algorithms.
Other Pathfinding AI Techniques
• Terrain analysis helps to increase the capabilities of an
AI opponent by providing information about the game
world. For example, information about hills, ambush
points, water bodies, and so on can be used by the AI
opponent to its advantage.
• An influence map is a technique that warns the
computer-controlled opponent when its enemy is
spotted.
• Visibility graphs break down larger areas into smaller
areas that are interconnected. This technique is also
used to give the game AI an advantage over the player.
Handling Game Data
• Game data means information about every
element in a game. It includes the player or user
data that encompasses the AI data and the level
data. The AI data includes information about the
position of the NPC and the position of the
player character on the game screen.
• Handling game data involves
capturing/retrieving the game data back and
forth from a disk file and managing the state of
the game.
Primary Reasons to Save Game Data
• Allows storing the player’s progress in the
current game session and reloading the game
from the last saved point in the next session.
• To allure customers, game manufacturers today
provide the player with the flexibility of saving
the game at any point of time during the
gameplay, at the end of each game level, or at
the specific designated areas within the game.
Capturing User Data
• You can capture the game data by using
the XmlSerializer and the
StorageContainer classes in XNA 4.0.
• The XmlSerializer class serializes
objects into XML documents and
deserializes the objects from XML
documents.
Serializing Data
• Serializing an object means translating its
public properties and fields into a serial
format, such as an XML document for
storage or transport.
– It is the way of saving an object's state into
a stream or buffer.
• Deserialization is the process of getting
back the object in its original state from the
serialized form.
Storage of Game Data
• The StorageContainer class is a
logical set of storage files.
• You can create files to store the state of
the various objects and components in the
game and store the files in a
StorageContainer object.
Storing the Game Data
• To store the game data, you need to write code
to perform the following tasks:
– Define all of the data that is to be stored (level, score,
character name chosen, etc.).
– Serialize the game data into the required game file.
• Use the FileExists method of the
StorageContainer class to check if a save
file exists, or use the DeleteFile method to
delete an existing save file.
Defining Game Data to Save
public struct PlayerData
{
public string PlayerName;
public Vector2PlayerPosition;
public int Level;
public int Score;
public List<string> completedAchievements;
/* If game is having 24 hr day night system we need to
save that.*/
public System.TimeSpan currentGameTime;
/* If your game has some weather condition , need to
save it too . My game has a fog effect.*/
public bool fogEnable;
}
Creating a StorageContainer Object
// Open a storage container.
IAsyncResult asyncResult=
device.BeginOpenContainer("SavingPlayerProfile",
null, null);
// Wait for the WaitHandle to become signaled.
asyncResult.AsyncWaitHandle.WaitOne();
StorageContainer container =
device.EndOpenContainer(asyncResult);
// Close the wait handle.
asyncResult.AsyncWaitHandle.Close();
Checking if Save File Exists
string filename = "savedGameState.sav";
// Check to see whether the save exists.
if (container.FileExists(filename))
// Delete it so that we can create one fresh.
container.DeleteFile(filename);
Create the Save File and XMLSerializer Object
// Create the file.
Stream fileStream = container.CreateFile(filename);
// Convert the object to XML data and put it in the
stream.
XmlSerializer serializer = new
XmlSerializer(typeof(PlayerData));
Stream Data into the Save File, Close the File
PlayerData playerData = new PlayerData();
/* Then set playerData with appropriate info from
game */
playerData.fogEnable = true;
playerData. PlayerName = “your name”;
playerData.Score = 300;
serializer.Serialize(fileStream, playerdata);
// Close the file.
fileStream.Close();
//dispose the containder
Container.Dispose();
Loading the Game Data
• Loading or reading the game data from the
game file involves the following tasks:
– Create a StorageContainer object to
access the game file
– Deserialize the game data to load using the
Deserialize method of the
XmlSerializer object.
– Close the stream and dispose of the
StorageContainer object.
Managing Game States
• A game state defines the behavior of
every object at any given point in the
game.
• In general, the simplest of games can
have the following game states:
– Initialize
– DisplayMenu
– PlayerPlay
– PlayerLose
– GameOver
Managing Game States
• In general, the game tends to behave
according to the value of the game state.
• You manage game states according to the
player’s action(s).
• You must first define all possible game
states, then program the code to support
the various states and the transition
between the states.
Basic Switch Logic for Managing Game State
• Not all inclusive below!
switch (currentGameState)
{
case GameState.PlayerPlay:
updatePlayerGamePlayLoop(gameTime);
break;
case GameState.PlayerLose:
if (player.IsReplay)
{
player.Reinitialize();
currentGameState = GameState.PlayerPlay;
}
else
{
currentGameState = GameState.GameOver;
}
Recap
• Programming the Components
• Understanding Tool Creation
• Tools
• Programming the Game
• Incorporating Artificial
Intelligence (AI)
• Evading AI
• Chasing AI
• Flocking or Grouping AI
• Path finding AI
• Other Pathfinding AI Techniques
• Handling Game Data
• Capturing User Data
• Serializing Data
• Storage the Game Data
• Loading the Game Data
• Managing Game States

More Related Content

What's hot

What's hot (20)

How to deliver a game in kodu
How to deliver a game in koduHow to deliver a game in kodu
How to deliver a game in kodu
 
Tools for Tabletop Game Design
Tools for Tabletop Game DesignTools for Tabletop Game Design
Tools for Tabletop Game Design
 
Introduction To 3D Gaming
Introduction To 3D GamingIntroduction To 3D Gaming
Introduction To 3D Gaming
 
Impossible mission: estimating (game) development
Impossible mission: estimating (game) developmentImpossible mission: estimating (game) development
Impossible mission: estimating (game) development
 
Ai on video games
Ai on video gamesAi on video games
Ai on video games
 
What We Talk About When We Talk About Mid-Core
What We Talk About When We Talk About Mid-CoreWhat We Talk About When We Talk About Mid-Core
What We Talk About When We Talk About Mid-Core
 
Game designdocs
Game designdocsGame designdocs
Game designdocs
 
3D Games
3D Games3D Games
3D Games
 
User Interface
User InterfaceUser Interface
User Interface
 
Zombi - Shoot for Survive
Zombi - Shoot for SurviveZombi - Shoot for Survive
Zombi - Shoot for Survive
 
Game designdocs
Game designdocsGame designdocs
Game designdocs
 
3. research
3. research3. research
3. research
 
Prototyping
PrototypingPrototyping
Prototyping
 
Presentation
PresentationPresentation
Presentation
 
Video game initial plans
Video game initial plansVideo game initial plans
Video game initial plans
 
Video game initial plans
Video game initial plansVideo game initial plans
Video game initial plans
 
Gamemaker - Intro and Core Objects
Gamemaker - Intro and Core ObjectsGamemaker - Intro and Core Objects
Gamemaker - Intro and Core Objects
 
Video game initial plans
Video game initial plansVideo game initial plans
Video game initial plans
 
Game elements
Game elementsGame elements
Game elements
 
Game Elements
Game ElementsGame Elements
Game Elements
 

Viewers also liked

Viewers also liked (19)

MVA slides lesson 3
MVA slides lesson 3MVA slides lesson 3
MVA slides lesson 3
 
98 366 mva slides lesson 8
98 366 mva slides lesson 898 366 mva slides lesson 8
98 366 mva slides lesson 8
 
MVA slides lesson 5
MVA slides lesson 5MVA slides lesson 5
MVA slides lesson 5
 
98 366 mva slides lesson 7
98 366 mva slides lesson 798 366 mva slides lesson 7
98 366 mva slides lesson 7
 
MVA slides lesson 1
MVA slides lesson 1MVA slides lesson 1
MVA slides lesson 1
 
MVA slides lesson 4
MVA slides lesson 4MVA slides lesson 4
MVA slides lesson 4
 
98 366 mva slides lesson 6
98 366 mva slides lesson 698 366 mva slides lesson 6
98 366 mva slides lesson 6
 
98 374 Lesson 04-slides
98 374 Lesson 04-slides98 374 Lesson 04-slides
98 374 Lesson 04-slides
 
98 374 Lesson 05-slides
98 374 Lesson 05-slides98 374 Lesson 05-slides
98 374 Lesson 05-slides
 
Roles and Responsibilities: Developing the Team
Roles and Responsibilities: Developing the TeamRoles and Responsibilities: Developing the Team
Roles and Responsibilities: Developing the Team
 
The career search project word
The career search project wordThe career search project word
The career search project word
 
Max2015 ch01
Max2015 ch01Max2015 ch01
Max2015 ch01
 
Chapter 5 balance
Chapter 5 balanceChapter 5 balance
Chapter 5 balance
 
Chapter 13 color
Chapter 13 colorChapter 13 color
Chapter 13 color
 
Lesson 11
Lesson 11Lesson 11
Lesson 11
 
Ic3 gs4exam1
Ic3 gs4exam1Ic3 gs4exam1
Ic3 gs4exam1
 
The career search project
The career search projectThe career search project
The career search project
 
Chapter 5 balance
Chapter 5 balanceChapter 5 balance
Chapter 5 balance
 
Computer Literacy Lesson 1: Computer and Operating Systems
Computer Literacy Lesson 1: Computer and Operating SystemsComputer Literacy Lesson 1: Computer and Operating Systems
Computer Literacy Lesson 1: Computer and Operating Systems
 

Similar to 98 374 Lesson 06-slides

Unreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorUnreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorNick Pruehs
 
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay
GDC 2010 - A Dynamic Component Architecture for High Performance GameplayGDC 2010 - A Dynamic Component Architecture for High Performance Gameplay
GDC 2010 - A Dynamic Component Architecture for High Performance GameplayTerrance Cohen
 
Initial design (Game Architecture)
Initial design (Game Architecture)Initial design (Game Architecture)
Initial design (Game Architecture)Rajkumar Pawar
 
Earthworm Platformer Package
Earthworm Platformer PackageEarthworm Platformer Package
Earthworm Platformer PackageOh DongReol
 
Sephy engine development document
Sephy engine development documentSephy engine development document
Sephy engine development documentJaejun Kim
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac ToeSarthak Srivastava
 
Supersize Your Production Pipe
Supersize Your Production PipeSupersize Your Production Pipe
Supersize Your Production Pipeslantsixgames
 
Enterprise Tic-Tac-Toe
Enterprise Tic-Tac-ToeEnterprise Tic-Tac-Toe
Enterprise Tic-Tac-ToeScott Wlaschin
 
Introduction to Artificial Intelligence
Introduction to Artificial IntelligenceIntroduction to Artificial Intelligence
Introduction to Artificial IntelligenceAhmed Hani Ibrahim
 
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...Terrance Cohen
 
Artificial Intelligence gaming techniques
Artificial Intelligence gaming techniquesArtificial Intelligence gaming techniques
Artificial Intelligence gaming techniquesSomnathMore3
 
Thomas Blair Portfolio
Thomas Blair PortfolioThomas Blair Portfolio
Thomas Blair PortfolioBlixtev
 
Hybrid Game Development with GameSalad
Hybrid Game Development with GameSaladHybrid Game Development with GameSalad
Hybrid Game Development with GameSaladmirahman
 
Optimizing mobile applications - Ian Dundore, Mark Harkness
Optimizing mobile applications - Ian Dundore, Mark HarknessOptimizing mobile applications - Ian Dundore, Mark Harkness
Optimizing mobile applications - Ian Dundore, Mark Harknessozlael ozlael
 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hdslantsixgames
 
Game object models - Game Engine Architecture
Game object models - Game Engine ArchitectureGame object models - Game Engine Architecture
Game object models - Game Engine ArchitectureShawn Presser
 

Similar to 98 374 Lesson 06-slides (20)

Chess Engine
Chess EngineChess Engine
Chess Engine
 
Unreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorUnreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal Editor
 
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay
GDC 2010 - A Dynamic Component Architecture for High Performance GameplayGDC 2010 - A Dynamic Component Architecture for High Performance Gameplay
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay
 
Initial design (Game Architecture)
Initial design (Game Architecture)Initial design (Game Architecture)
Initial design (Game Architecture)
 
Earthworm Platformer Package
Earthworm Platformer PackageEarthworm Platformer Package
Earthworm Platformer Package
 
Sephy engine development document
Sephy engine development documentSephy engine development document
Sephy engine development document
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
Supersize Your Production Pipe
Supersize Your Production PipeSupersize Your Production Pipe
Supersize Your Production Pipe
 
Enterprise Tic-Tac-Toe
Enterprise Tic-Tac-ToeEnterprise Tic-Tac-Toe
Enterprise Tic-Tac-Toe
 
Introduction to Artificial Intelligence
Introduction to Artificial IntelligenceIntroduction to Artificial Intelligence
Introduction to Artificial Intelligence
 
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...
GDC 2010 - A Dynamic Component Architecture for High Performance Gameplay - M...
 
Artificial Intelligence gaming techniques
Artificial Intelligence gaming techniquesArtificial Intelligence gaming techniques
Artificial Intelligence gaming techniques
 
Segap project(lncs)
Segap project(lncs)Segap project(lncs)
Segap project(lncs)
 
Thomas Blair Portfolio
Thomas Blair PortfolioThomas Blair Portfolio
Thomas Blair Portfolio
 
Hybrid Game Development with GameSalad
Hybrid Game Development with GameSaladHybrid Game Development with GameSalad
Hybrid Game Development with GameSalad
 
0507 057 01 98 * Adana Cukurova Klima Servisleri
0507 057 01 98 * Adana Cukurova Klima Servisleri0507 057 01 98 * Adana Cukurova Klima Servisleri
0507 057 01 98 * Adana Cukurova Klima Servisleri
 
Optimizing mobile applications - Ian Dundore, Mark Harkness
Optimizing mobile applications - Ian Dundore, Mark HarknessOptimizing mobile applications - Ian Dundore, Mark Harkness
Optimizing mobile applications - Ian Dundore, Mark Harkness
 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hd
 
Game object models - Game Engine Architecture
Game object models - Game Engine ArchitectureGame object models - Game Engine Architecture
Game object models - Game Engine Architecture
 
Ddn
DdnDdn
Ddn
 

More from Tracie King

Interface: Creating the connection
Interface: Creating the connectionInterface: Creating the connection
Interface: Creating the connectionTracie King
 
Gameplay: Creating the Experience
Gameplay:  Creating the ExperienceGameplay:  Creating the Experience
Gameplay: Creating the ExperienceTracie King
 
Game Story and Character Development
Game Story and Character DevelopmentGame Story and Character Development
Game Story and Character DevelopmentTracie King
 
Production and Management: Developing the Process
Production and Management: Developing the ProcessProduction and Management: Developing the Process
Production and Management: Developing the ProcessTracie King
 
Chapter1 design process
Chapter1 design processChapter1 design process
Chapter1 design processTracie King
 

More from Tracie King (19)

Interface: Creating the connection
Interface: Creating the connectionInterface: Creating the connection
Interface: Creating the connection
 
Gameplay: Creating the Experience
Gameplay:  Creating the ExperienceGameplay:  Creating the Experience
Gameplay: Creating the Experience
 
Game Story and Character Development
Game Story and Character DevelopmentGame Story and Character Development
Game Story and Character Development
 
Production and Management: Developing the Process
Production and Management: Developing the ProcessProduction and Management: Developing the Process
Production and Management: Developing the Process
 
Max2015 ch03
Max2015 ch03Max2015 ch03
Max2015 ch03
 
Max2015 ch02
Max2015 ch02Max2015 ch02
Max2015 ch02
 
Max2015 ch05
Max2015 ch05Max2015 ch05
Max2015 ch05
 
Max2015 ch04
Max2015 ch04Max2015 ch04
Max2015 ch04
 
Max2015 ch06
Max2015 ch06Max2015 ch06
Max2015 ch06
 
Max2015 ch07
Max2015 ch07Max2015 ch07
Max2015 ch07
 
Max2015 ch08
Max2015 ch08Max2015 ch08
Max2015 ch08
 
Max2015 ch09
Max2015 ch09Max2015 ch09
Max2015 ch09
 
Max2015 ch10
Max2015 ch10Max2015 ch10
Max2015 ch10
 
Max2015 ch11
Max2015 ch11Max2015 ch11
Max2015 ch11
 
Max2015 ch12
Max2015 ch12Max2015 ch12
Max2015 ch12
 
Max2015 ch13
Max2015 ch13Max2015 ch13
Max2015 ch13
 
Max2015 ch14
Max2015 ch14Max2015 ch14
Max2015 ch14
 
Max2015 ch15
Max2015 ch15Max2015 ch15
Max2015 ch15
 
Chapter1 design process
Chapter1 design processChapter1 design process
Chapter1 design process
 

Recently uploaded

MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 

Recently uploaded (20)

MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 

98 374 Lesson 06-slides

  • 1. Developing the Game Functionality Lesson 6
  • 2. Exam Objective Matrix Skills/Concepts MTA Exam Objectives Programming the Components Understand Components (1.5) Capture User Data (1.6) Work with XNA (1.7) Handling Game Data Work with XNA (1.7)
  • 3. Programming the Components • A significant part of game development goes into creating and programming the game functionality. • The game development process comprises of the following elements: – Creating tools – Programming the game – Incorporating AI
  • 4. Understanding Tool Creation • Almost every game involves the use of game tools for tasks such as importing or converting art, building levels, and so on. – Tool creation is the process when a game programmer creates game tools. • Tools created might include: – Asset conversion tools, level editors or map editors.
  • 5. Tools • Asset conversion tools are programs that convert the artwork such as 3D models into formats required by the game. • Level editor tools allow the game player to customize or modify levels within a game. • Map editor tools allow the game player to create custom maps with no knowledge of programming skills.
  • 6. Programming the Game • After you load or add game components, such as sprites, textures, game models, and images in your game, you need to make the components functional. • To make the components functional, as per the player’s input or as per the game’s progress, you need to further program the components.
  • 7. Programming the Game: Showing Changes Full health Low health
  • 8. Programming the Game: Health Change • The code sample in the textbook provides an easy way to show changes in the player character’s health by pressing keyboard keys. • In the actual game, you would need to map these changes in variable value to events such as taking damage or picking up a health kit. • Notice the color change as an extra indicator to the player of the character's health state.
  • 9. Programming the Game: Showing Changes Full magazine Partially full magazine
  • 10. Programming the Game: Using Bullets • The code sample in the textbook provides an easy way to show changes in the number of bullets in the character’s magazine by pressing keyboard keys. • In the actual game, you would need to map these changes in variable value to events such as shooting the gun (pressing a button) or picking up ammunition.
  • 11. Programming the Game: Working the Deltas • Notice that in both of the previous examples, the majority of the game assets were unchanged. • As the player’s health changed, or the number of remaining bullets changed, only those items required an update. • You’ll want to change as little as possible by using drawable components.
  • 12. Incorporating Artificial Intelligence (AI) • Incorporating AI involves programming the behavior of the nonplayer character (NPC) as close to a human as possible. • You can add AI for various game scenarios, as each technique indicates. • Popular AI techniques: – Evading AI – Chasing AI – Flocking or Grouping AI – Path finding AI
  • 13. Evading AI • One of the scenarios that present an opportunity to incorporate AI is to make the movement of an object or NPC intelligent. • Simple sample of evading AI: 1. Get the player character's position on the screen. 2. If the player character's position is in the defined range, then assign a random wait time to the sprite. 3. Do not move the sprite until the waiting time is over; allows the player to catch the sprite if he reaches the sprite before the wait time is over. 4. As soon as the wait time is over, make the sprite appear in some other place on the scene. 5. Continue steps 2 to 4 until the player catches the sprite.
  • 14. Chasing AI • The player must evade the AI instead of chasing (or catching the AI). • The chasing AI is used when the player must battle the computer controlled NPC. • Simplified process: 1. Calculate the difference between the player position and the AI position and decide on the AI direction of travel. 2. Normalize the direction, then add randomness to the direction. 3. Move towards the calculated player position.
  • 15. Flocking or Group AI • Certain NPCs, such as a group of soldiers, should to move together without walking over each other. • Based on the Craig Reynolds algorithm. • This algorithm follows three simple rules: – Steer and avoid colliding into other members of the group. – Align towards the average heading of the members of the group. – Steer or move toward the average position of the members of the group.
  • 16. Path Finding AI • This AI involves moving a game object in an effort to find a path around an obstacle. • Most common techniques: – Breadcrumb path following: The player character progresses through the game marking some invisible markers or "breadcrumbs" on her path unknowingly. – Waypoint navigation: Allows you to place reference points in the game world which allows the use of these precalculated paths in the appropriate path finding algorithms.
  • 17. Other Pathfinding AI Techniques • Terrain analysis helps to increase the capabilities of an AI opponent by providing information about the game world. For example, information about hills, ambush points, water bodies, and so on can be used by the AI opponent to its advantage. • An influence map is a technique that warns the computer-controlled opponent when its enemy is spotted. • Visibility graphs break down larger areas into smaller areas that are interconnected. This technique is also used to give the game AI an advantage over the player.
  • 18. Handling Game Data • Game data means information about every element in a game. It includes the player or user data that encompasses the AI data and the level data. The AI data includes information about the position of the NPC and the position of the player character on the game screen. • Handling game data involves capturing/retrieving the game data back and forth from a disk file and managing the state of the game.
  • 19. Primary Reasons to Save Game Data • Allows storing the player’s progress in the current game session and reloading the game from the last saved point in the next session. • To allure customers, game manufacturers today provide the player with the flexibility of saving the game at any point of time during the gameplay, at the end of each game level, or at the specific designated areas within the game.
  • 20. Capturing User Data • You can capture the game data by using the XmlSerializer and the StorageContainer classes in XNA 4.0. • The XmlSerializer class serializes objects into XML documents and deserializes the objects from XML documents.
  • 21. Serializing Data • Serializing an object means translating its public properties and fields into a serial format, such as an XML document for storage or transport. – It is the way of saving an object's state into a stream or buffer. • Deserialization is the process of getting back the object in its original state from the serialized form.
  • 22. Storage of Game Data • The StorageContainer class is a logical set of storage files. • You can create files to store the state of the various objects and components in the game and store the files in a StorageContainer object.
  • 23. Storing the Game Data • To store the game data, you need to write code to perform the following tasks: – Define all of the data that is to be stored (level, score, character name chosen, etc.). – Serialize the game data into the required game file. • Use the FileExists method of the StorageContainer class to check if a save file exists, or use the DeleteFile method to delete an existing save file.
  • 24. Defining Game Data to Save public struct PlayerData { public string PlayerName; public Vector2PlayerPosition; public int Level; public int Score; public List<string> completedAchievements; /* If game is having 24 hr day night system we need to save that.*/ public System.TimeSpan currentGameTime; /* If your game has some weather condition , need to save it too . My game has a fog effect.*/ public bool fogEnable; }
  • 25. Creating a StorageContainer Object // Open a storage container. IAsyncResult asyncResult= device.BeginOpenContainer("SavingPlayerProfile", null, null); // Wait for the WaitHandle to become signaled. asyncResult.AsyncWaitHandle.WaitOne(); StorageContainer container = device.EndOpenContainer(asyncResult); // Close the wait handle. asyncResult.AsyncWaitHandle.Close();
  • 26. Checking if Save File Exists string filename = "savedGameState.sav"; // Check to see whether the save exists. if (container.FileExists(filename)) // Delete it so that we can create one fresh. container.DeleteFile(filename);
  • 27. Create the Save File and XMLSerializer Object // Create the file. Stream fileStream = container.CreateFile(filename); // Convert the object to XML data and put it in the stream. XmlSerializer serializer = new XmlSerializer(typeof(PlayerData));
  • 28. Stream Data into the Save File, Close the File PlayerData playerData = new PlayerData(); /* Then set playerData with appropriate info from game */ playerData.fogEnable = true; playerData. PlayerName = “your name”; playerData.Score = 300; serializer.Serialize(fileStream, playerdata); // Close the file. fileStream.Close(); //dispose the containder Container.Dispose();
  • 29. Loading the Game Data • Loading or reading the game data from the game file involves the following tasks: – Create a StorageContainer object to access the game file – Deserialize the game data to load using the Deserialize method of the XmlSerializer object. – Close the stream and dispose of the StorageContainer object.
  • 30. Managing Game States • A game state defines the behavior of every object at any given point in the game. • In general, the simplest of games can have the following game states: – Initialize – DisplayMenu – PlayerPlay – PlayerLose – GameOver
  • 31. Managing Game States • In general, the game tends to behave according to the value of the game state. • You manage game states according to the player’s action(s). • You must first define all possible game states, then program the code to support the various states and the transition between the states.
  • 32. Basic Switch Logic for Managing Game State • Not all inclusive below! switch (currentGameState) { case GameState.PlayerPlay: updatePlayerGamePlayLoop(gameTime); break; case GameState.PlayerLose: if (player.IsReplay) { player.Reinitialize(); currentGameState = GameState.PlayerPlay; } else { currentGameState = GameState.GameOver; }
  • 33. Recap • Programming the Components • Understanding Tool Creation • Tools • Programming the Game • Incorporating Artificial Intelligence (AI) • Evading AI • Chasing AI • Flocking or Grouping AI • Path finding AI • Other Pathfinding AI Techniques • Handling Game Data • Capturing User Data • Serializing Data • Storage the Game Data • Loading the Game Data • Managing Game States

Editor's Notes

  1. Tip: Add your own speaker notes here.
  2. Tip: Add your own speaker notes here.
  3. Tip: Add your own speaker notes here.
  4. Tip: Add your own speaker notes here.
  5. Tip: Add your own speaker notes here.
  6. Tip: Add your own speaker notes here.
  7. Tip: Add your own speaker notes here.
  8. Tip: Add your own speaker notes here.
  9. Tip: Add your own speaker notes here.
  10. Tip: Add your own speaker notes here.
  11. Tip: Add your own speaker notes here.
  12. Tip: Add your own speaker notes here.
  13. Tip: Add your own speaker notes here.
  14. Tip: Add your own speaker notes here.
  15. Tip: Add your own speaker notes here.
  16. Tip: Add your own speaker notes here.
  17. Tip: Add your own speaker notes here.
  18. Tip: Add your own speaker notes here.
  19. Tip: Add your own speaker notes here.
  20. Tip: Add your own speaker notes here.
  21. Tip: Add your own speaker notes here.
  22. Tip: Add your own speaker notes here.
  23. Tip: Add your own speaker notes here.
  24. Tip: Add your own speaker notes here.
  25. Tip: Add your own speaker notes here.
  26. Tip: Add your own speaker notes here.
  27. Tip: Add your own speaker notes here.
  28. Tip: Add your own speaker notes here.
  29. Tip: Add your own speaker notes here.
  30. Tip: Add your own speaker notes here.
  31. Tip: Add your own speaker notes here.