UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Game program main loop.

Slides:



Advertisements
Similar presentations
events reactive programming
Advertisements

Game Programming Patterns Game Loop
Video Game Design Lesson 1. Game Designer Person involved in the development of a video game Person involved in the development of a video game Usually.
1 Computer Graphics Chapter 2 Input Devices. RM[2]-2 Input Devices Logical Input Devices  Categorized based on functional characteristics.  Each device.
Can you identify the components of a computer ? Press F5 to begin! 1 st Question.
3.3. G AME I NPUT Handling input within games. In lecture exploration of answers to frequently asked student questions.
How do games work? Game Workshop July 4, Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
Game Design and Programming. Objectives Classify the games How games are design How games are implemented What are the main components of a game engine.
Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization I’m Curtis.
GPU vs. CPU computations Árni Einarsson Jacek Kolodziej.
Chapter 3.6 Game Architecture. 2 Overall Architecture The code for modern games is highly complex With code bases exceeding a million lines of code, a.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
CHAPTER 17 Creating an Interactive 3D Environment © 2008 Cengage Learning EMEA.
SE320: Introduction to Computer Games Week 8: Game Programming Gazihan Alankus.
INTRODUCTION TO SCRATCH. About Me Resources Scratch Website Learn Scratch Washington-Lee Computer.
Games and Simulations O-O Programming in Java The Walker School
Guide to Programming with Python
PacMan by Midway, released 1980 CSE 380 – Computer Game Programming Real-Time Game Architecture.
Games Development 2 Entity / Architecture Review CO3301 Week
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
CSE 381 – Advanced Game Programming 3D Game Architecture.
Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0 Key Abstractions in Game Maker Foundations of Interactive Game Design Prof. Jim Whitehead.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Introduction to Networked Graphics Part 3 of 5: Latency.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Operating Systems JEOPARDY Computer Repair NetworkOS OS Tasks ConceptsComponentsMisc
Burnout 3: Case Study (Outline) What is Burnout 3? What is Burnout 3? What does this mean? What does this mean? How did we satisfy these constraints? How.
2.1. T HE G AME L OOP Central game update and render processes.
Guide to Programming with Python Chapter Twelve Sound, Animation, and Program Development: The Astrocrash Game.
Games Development Game Architecture: Entities CO2301 Games Development 1 Week 22.
Chapter 3.6 Game Architecture. 2 Overall Architecture The code for modern games is highly complex (can easily exceed 1M LOC) The larger your program,
1 Contents  Audio  Sprite  Input devices  Game production milestones  Course summary.
11 General Game Programming Approach. The program is event-driven The program is event-driven –Messages = events –So as all windows system (for example.
Session 13 Pinball Game Construction Kit (Version 3):
© 2011 Delmar, Cengage Learning Chapter 10 Using ActionScript to Enhance User Experience.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Game Programming Patterns Game Loop From the book by Robert Nystrom
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Event Handling Tonga Institute of Higher Education.
CompSci Introduction to Jam’s Video Game Package.
Introduction to Game Programming Pertemuan 11 Matakuliah: T0944-Game Design and Programming Tahun: 2010.
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
Networked Graphics Building Networked Virtual Environments and Networked Games Chapter 11: Latency and Consistency.
CompSci 44.1 Game Package Introduction to Jam’s Video Game Package.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS The GPU.
02 |Introduction to Game Engine Eriq Muhammad Adams J |
(More) Event handling. Input and Windowed-OS’s Windowed OS’s (Windows, OSX, GUI-linux’s) send messages (events) when the user does something “on” the.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Chapter 1: Introduction to Computers and Programming
Basic coding… with TouchDevelop!!
BASIC PROGRAMMING C SCP1103 (02)
MOM! Phineas and Ferb are … Aims:
Animations.
WITH PYGAME ON THE RASPBERRY PI
Game Architecture Rabin is a good overview of everything to do with Games A lot of these slides come from the 1st edition CS 4455.
Week 2 - Friday CS 113.
BASIC PROGRAMMING C SCP1103 (02)
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Scratch – Simple Programming
3D Game Development Time and game loop Jernej Vičič.
PROCESSES & THREADS ADINA-CLAUDIA STOICA.
ICT Gaming Lesson 3.
Model, View, Controller design pattern
02 | What DirectX Can Do and Creating the Main Game Loop
Games Development Game Architecture: Entities
Games Development 2 Entity / Architecture Review
Presentation transcript:

UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Game program main loop

Goals 1. Understand the structure of the game’s main loop 2. Know how the other components affect rendering

The game’s main loop  Three things to do, periodically:  Gather inputs Mouse, keyboard, game controller, network  Run the game simulation Physics, AI, scripting, logic  Return (render) results Graphics, audio, force-feedback, network Gather inputs Game simulation Render results Execution Data

The game simulation  The key, central part that makes gameplay work  If it doesn’t run, there’s no game  Inputs and results are as loosely tied to it as possible  Multiple kinds:  Constant vs. variable rate  Deterministic vs. non-deterministic  Main graphics-related concern:  Ensure none of the rendering affects the simulation  Isolate… by all means necessary

Non-gameplay simulation tasks  For instance, physics is part of the simulation  But not all the physics!  Grenade bouncing off walls belongs in the simulation  Sparks bouncing off walls don’t belong in the simulation Eye candy only  Also, sometimes rendering uses some simulation code  Local simulation, meant to predict or extrapolate  Used to reduce perceived latency

The input  Some input is used for the simulation  Shooting or jumping buttons  Some input is used only for rendering  Mouse cursor or 1 st person camera orientation  Latency and granularity are two key concepts here  Low sampling rate: low granularity and higher latency  Latency also affected by the structure of the code

Latency  Time it takes for the player to see the reaction to her actions  It is a factor of many sequential events  Some can be budgeted  Time it takes for the CPU or the GPU to render  Some can’t be controlled  Video frame rate  Human beings can perceive latencies of 100 ms or more  Some can detect much smaller latencies Player presses button Game reads button press Game simulation finishes Game sends frame to GPU GPU renders frame Half the input sample rate Frame becomes visible 8.33 ms Simulation CPU budget8.33 ms Render CPU budget8.33 ms Half the max GPU queue33.33 ms Half the video frame rate8.33 ms

The rendering  Must aim for a constant, guaranteed framerate  At the screen’s refresh rate  Budgeted for both: CPU and GPU  Must be able to throttle back  If frames take too long to render or simulate  Keep all animation running at the intended speed  Less framerate: more choppiness, not slower animation

Main loop – Constant-step simulation startTime = GetTime(); while (true) { Process Windows messages (keep it happy) Read simulation inputs time = GetTime(); while (time – startTime > frameTime) { startTime += frameTime; Run simulation } Render frame((time – startTime) / frameTime) }

Main loop – Variable-step simulation startTime = GetTime(); while (true) { Process Windows messages (keep it happy) Read simulation inputs time = GetTime(); Run simulation(time – startTime) startTime = time; Render frame }