Developing the Game Functionality Lesson 6. Exam Objective Matrix Skills/ConceptsMTA Exam Objectives Programming the Components Understand Components.

Slides:



Advertisements
Similar presentations
Debugging ACL Scripts.
Advertisements

Heuristic Search techniques
Pathfinding Basic Methods.
1 AI for Computer Game Developers Finite state machines Path finding and waypoints A-Star path finding.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
RED DEAD REVOLVER Artificial Intelligence Critique By Mitchell C. Dodes CIS 588.
Chapter 8: I/O Streams and Data Files. In this chapter, you will learn about: – I/O file stream objects and functions – Reading and writing character-based.
ASP.NET Programming with C# and SQL Server First Edition
Tactical AI in Real Time Supervisor: Aleks Jakulin Crew: Damir Arh, Matija Jekovec, Mitja Luštrek Gregor Leban, Martin Žnidaršič, Uroš Čibej Translation:
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
SELECT A LESSON 1. A WORLD AND CHARACTERS 2. PATHS AND ENEMIES 4. USING PAGES TO CHANGE THE RULES 5. GAME ANALYSIS AND DESIGN 6-7. CREATING YOUR OWN GAME.
Android 4: Creating Contents Kirk Scott 1. Outline 4.1 Planning Contents 4.2 GIMP and Free Sound Recorder 4.3 Using FlashCardMaker to Create an XML File.
Fundamentals of Python: From First Programs Through Data Structures
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
A Scratch tutorial. Description: You have 6 bullets to shoot at 2 targets. Every time you hit any of them you get two extra bullets but the targets get.
CSCI 101 Introduction to Software Development and Design.
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
An Introduction to Textual Programming
Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0 Key Abstractions in Game Maker Foundations of Interactive Game Design Prof. Jim Whitehead.
Topics Introduction Hardware and Software How Computers Store Data
Artificial Intelligence in Game Design Problems and Goals.
Mobile search engine for a smart phone / navigation system can be used to search and compare hundreds of stores and their products in seconds. © 2001 –
Networking Networking is done via a single component that is persistent in each machine’s game. This multiplayer manager component handles all Unity RPC.
Introduction to Python
Game Maker Day 2 Making a Maze Game.
Town Defenders Strategy Game prepared by: Osama N
Othello Artificial Intelligence With Machine Learning
Developing the Game User Interface (UI) Lesson 5.
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving vi Session Aborting Editing Session.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Event Driven Programming, The.
The Design Document The Design Document Introduction Game Mechanics Artificial Intelligence Characters, Items, and Objects/Mechanisms Story.
Hashing Table Professor Sin-Min Lee Department of Computer Science.
Learning the skills for programming Advanced Visual Programming.
Artificial Intelligence in Game Design
Test Environment Algorithm Program Requirements/ Enhancements Analyze the Problem and Design a Solution Programming Software Translates the Source Code.
Artificial Intelligence in Game Design Dynamic Path Planning Algorithms.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
Sample Video Game & Sound. The Plan 1.Game Theme 2.Game Structure 3.Sprites 4.Trackers 5.Collisions 6.Score 7.Levels 8.Splash Screens 9.Design 10.Implementation.
GAME:IT Helicopter Objectives: Review skills in making directional sprites Create objects that shoot and destroy for points Create random enemies on the.
Lesson 4 Using Variables in Python – Creating a Simple ChatBot Program.
Game Maker Terminology
Application of AI techniques for Computer Games BSc Computer Games Programming, 2006 Julien Delezenne GAMES ARTIFICIAL INTELLIGENCE.
Shooters in GameMaker J Parker.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
AI Evaluation David Nowell CIS 588 2/14/05 Baldur’s Gate.
F.E.A.R. Game AI Evaluation by Robert Rak. What is F.E.A.R. ? FEAR is a First Person Shooter game Player takes on the role of an elite strike force team.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Agenda Using vi Editor Starting vi Session Command / Input Modes
CHAPTER 14 Classes, Objects, and Games XNA Game Studio 4.0.
Super EastGate Jon Caron, Ryan Fleming, Antonio Guarino, and Mike LoVerme Merrimack College Introduction Super EastGate is a 2D side scroller game that.
Dr Nick Mitchell (Room CM 224)
Word Create a basic TOC. Course contents Overview: table of contents basics Lesson 1: About tables of contents Lesson 2: Format your table of contents.
© 2014 International Technology and Engineering Educators Association STEM  Center for Teaching and Learning™ Game Art and Design Unit 2 Lesson 1 Skills.
Designing Design Tools. What is design tools? Why do we need them?
Tank Game Part 3 of 6. Secondary Weapons and Pick ups Pick ups will appear randomly in the battle area and can be collected by driving into them. Each.
Finite State Machines Logical and Artificial Intelligence in Games Lecture 3a.
GAME:IT Mario Creating Platform Games Level 4 with GML Game Maker Language (GML) allows users more flexibility in game design. GML is similar to how real.
The Stingray Example Program CMT3311. Stingray - an example 2D game May be useful as a simple case study Most 2D games need to solve generic problems.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Martin Norris Computing Teacher/Leader at Moldgreen Community Primary School, Huddersfield
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
Movement Game Design (Scratch).
Game Art and Design Unit 2 Lesson 1 Skills in the Game Industry
An Introduction to Structured Program Design in COBOL
Topics Introduction Hardware and Software How Computers Store Data
File Input and Output.
Presentation transcript:

Developing the Game Functionality Lesson 6

Exam Objective Matrix Skills/ConceptsMTA Exam Objectives Programming the Components Understand Components (1.5) Capture User Data (1.6) Work with XNA (1.7) Handling Game DataWork 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 healthLow 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 magazinePartially 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 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