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.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Advertisements

CS 4730 Game Design Patterns CS 4730 – Computer Game Design Credit: Some slide material courtesy Walker White (Cornell)
CSCE 590E Spring 2007 Game Programming By Jijun Tang.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
How do games work? Game Workshop July 4, Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.
CSCE 590E Spring 2007 Game Architecture and Math By Jijun Tang.
Chapter 3.5 Memory and I/O Systems. Memory Management 2 Only applies to languages with explicit memory management (C, C++) Memory problems are one of.
Chapter 1 and 2 Computer System and Operating System Overview
Chapter 3.7 Memory and I/O Systems. 2 Memory Management Only applies to languages with explicit memory management (C or C++) Memory problems are one of.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
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.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
Chapter 3.4 Programming Fundamentals. 2 Data Structures Arrays – Elements are adjacent in memory (great cache consistency) – They never grow or get reallocated.
Chapter 3.4 Game Architecture. Overall Architecture The code for modern games is highly complex With code bases exceeding a million lines of code, a well-defined.
CHAPTER 17 Creating an Interactive 3D Environment © 2008 Cengage Learning EMEA.
 Introduction Introduction  Definition of Operating System Definition of Operating System  Abstract View of OperatingSystem Abstract View of OperatingSystem.
This chapter is extracted from Sommerville’s slides. Text book chapter
Chapter Languages, Programming and Architecture.
Games Development 2 Entity / Architecture Review CO3301 Week
Platforms for Learning in Computer Science July 28, 2005.
CSE 381 – Advanced Game Programming 3D Game Architecture.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
Antigone Engine Kevin Kassing – Period
Institute of Computer and Communication Network Engineering OFC/NFOEC, 6-10 March 2011, Los Angeles, CA Lessons Learned From Implementing a Path Computation.
Games Development 2 Resource Management CO3301 Week 3.
Rethinking Game Architecture with Immutability Jacob Dufault Faculty Advisor: Dr. Phil Bernhard, Dept of Computer Science, Florida Institute of Technology.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
CSCE 552 Spring 2009 Programming Fundamentals By Jijun Tang.
1 Dryad Distributed Data-Parallel Programs from Sequential Building Blocks Michael Isard, Mihai Budiu, Yuan Yu, Andrew Birrell, Dennis Fetterly of Microsoft.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
CHAPTER TEN AUTHORING.
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
“The perfect project plan is possible if one first documents a list of all the unknowns.” Bill Langley.
Games Development 2 Overview & Entity IDs and Communication CO3301 Week 1.
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,
Introduction to Interactive Media Interactive Media Tools: Authoring Applications.
Games Development 1 Review / Revision CO2301 Games Development 1 Semester 2.
Virtual Application Profiler (VAPP) Problem – Increasing hardware complexity – Programmers need to understand interactions between architecture and their.
CSCE 552 Fall 2012 Language and Programming By Jijun Tang.
1 Chapter 12 Configuration management This chapter is extracted from Sommerville’s slides. Text book chapter 29 1.
Code Optimization.
COMPUTER GRAPHICS CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
Processes and threads.
Language and Programming
CS408/533 Computer Networks Text: William Stallings Data and Computer Communications, 6th edition Chapter 1 - Introduction.
Antigone Engine.
Chapter 10 Design Patterns.
Operating Systems (CS 340 D)
Ogre Overview.
课程名 编译原理 Compiling Techniques
TerraForm3D Plasma Works 3D Engine & USGS Terrain Modeler
Northbound API Dan Shmidt | January 2017
Introduction to Computer Systems
Chapter 9: Virtual-Memory Management
BIC 10503: COMPUTER ARCHITECTURE
LTPDA Graphic User Interface summary and status
Process Description and Control
3D Game Development Time and game loop Jernej Vičič.
Process Description and Control
Process Description and Control
Process Description and Control
Process Description and Control
Process Description and Control
Process Description and Control
Games Development Game Architecture: Entities
Chapter 13: I/O Systems.
Games Development 2 Tools Programming
Games Development 1 Review / Revision
Games Development 2 Entity / Architecture Review
Presentation transcript:

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

Game Architecture The code for modern games is highly complex Code bases exceeding a million lines of code Many commonly accepted approaches Developed and proven over time Ignore them at your peril! Globally optimized and balanced Lots of very smart folks work on each of ’em CS 4455

Overall Architecture Main structure Architecture types Game-specific code Game-engine code Level of integration varies Architecture types Ad-hoc (everything accesses everything) Modular DAG (directed acyclic graph) Layered CS 4455

Overview: Initialization/Shutdown The initialization step prepares everything that is necessary to start a part of the game The shutdown step undoes everything the initialization step did, but in reverse order This is IMPORTANT Applies to main loop, down to individual steps In Unity: Start/Awake OnEnable/OnDisable OnLevelWasLoaded/OnApplicationQuit CS 4455

Overview: The Main Loop All interactive programs are driven by a loop that performs a series of tasks every frame GUI, 3D, VR, Simulation Games are no exception Separate loops for the front end and the game itself, or unified main loop Both work; a question of preference and style CS 4455

Overview: Main Game Loop Tasks Handling time Gathering player input Networking Simulation Collision detection and response Object updates Rendering Other miscellaneous tasks http://wiki.unity3d.com/index.php?title=Event_Execution_Order CS 4455

Overview: Main Game Loop Coupling Can decouple the rendering step from simulation and update steps Results in higher frame rate, smoother animation, and greater responsiveness May be necessary for complex simulations Implementation is tricky and can be error-prone Co-routines can help, but aren’t panacea CS 4455

Overview: Main Game Loop Execution order Can help keep player interaction seamless Avoid “one frame behind” problems Can maximize parallelism Exact ordering depends on hardware CS 4455

Game Entities What are game entities? Basically anything in a game world that can be interacted with More precisely, a self-contained piece of logical interactive content Only things we will interact with should become game entities CS 4455

Game Entities Organization Simple list Multiple databases Logical tree Spatial database CS 4455

Game Entities Updating Updating each entity once per frame can be too expensive Can use a tree structure to impose a hierarchy for updating Can use a priority queue to decide which entities to update every frame CS 4455

Game Entities Object creation Identification (pointers vs. uids) Basic object factories Extensible object factories Using automatic registration Using explicit registration Identification (pointers vs. uids) Communication (messages) CS 4455

Game Entities Level instantiation Loading a level involves loading both assets and the game state It is necessary to create the game entities and set the correct state for them Using instance data vs. template data CS 4455

Memory Management Only applies to languages with explicit memory management (C or C++) Memory problems are one of the leading causes of bugs in programs Or, “Reason 437 why I dislike C++” CS 4455

Memory Management Chapter in “Introduction to Game Development” (Steve Rabin) is good E.g., avoiding memory fragmentation Custom memory managers are great! Two most important reasons: Simple error-checking schemes Debugging tools Engines (e.g., Unity, C4, etc) handle much of this for you CS 4455

File I/O As with memory, Rabin book gives lots of good advice on how to deal with loading things from disk E.g., to avoid long load times Aside from efficiency, keeps things together! Unity handles much of this already For assets in your project No great support for access to other files CS 4455

Game Resources A game resource (or asset) is anything that gets loaded that could be shared by several parts of the game A texture, an animation, a sound, etc We want to load and share resources easily There will be many different types of resources in a game CS 4455

Game Resources Resource manager Uses registering object factory pattern Can register different types of resources All resource creation goes through the resource manager Any requests for existing resources don't load it again CS 4455

Game Resources Resource lifetime If resources are shared, how do we know when we can destroy them? All at once At the end of the level Explicit lifetime management Reference counting CS 4455

Game Resources Resources and instances Resource is the part of the asset that can be shared among all parts of the game Instance is the unique data that each part of the game needs to keep CS 4455

Serialization Every game needs to save and restore some game state Level editing and creation could be implemented as a saved game Many tools use this approach to create game levels E.g., Nebula2 uses a simple database For you, may also be worth doing CS 4455