Chapter 3.2-3.7 Languages, Programming and Architecture.

Slides:



Advertisements
Similar presentations
Configuration management
Advertisements

Configuration management
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
Debugging Mohammad Zikky, M.T. 2 Debugging Introduction (1 of 2)  Debugging is methodical process for removing mistakes in a program  So important,
Chapter 3.5 Debugging Games
CS 4730 Game Design Patterns CS 4730 – Computer Game Design Credit: Some slide material courtesy Walker White (Cornell)
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
CSCE 590E Spring 2007 Game Programming By Jijun Tang.
How do games work? Game Workshop July 4, Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
CSCE 590E Spring 2007 Game Architecture and Math By Jijun Tang.
Chapter 3.2 C++, Java, and Scripting Languages “The major programming languages used in game development.”
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.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
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.
Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.
Guide To UNIX Using Linux Third Edition
ASP.NET Programming with C# and SQL Server First Edition
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
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.
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.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
CHAPTER 17 Creating an Interactive 3D Environment © 2008 Cengage Learning EMEA.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
This chapter is extracted from Sommerville’s slides. Text book chapter
Games Development 2 Entity / Architecture Review CO3301 Week
Dakota Humphries (Project Lead) Thomas Impellitteri (Tech Lead) Daryl McGhee II (Design Lead) Keith Rosier (Asset Lead)
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
CSE 381 – Advanced Game Programming 3D Game Architecture.
Systems Analysis and Design in a Changing World, Fifth Edition
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.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
 To explain the importance of software configuration management (CM)  To describe key CM activities namely CM planning, change management, version management.
12 Systems Analysis and Design in a Changing World, Fifth Edition.
CSCE 552 Spring 2009 Programming Fundamentals By Jijun Tang.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Games Development 2 Review & Revision Strategy CO3301 End of Semester 1.
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,
CSCE 552 Fall 2012 Language and Programming By Jijun Tang.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
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.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
EPICS and LabVIEW Tony Vento, National Instruments
First appeared Features Popular uses Basic This language emphasises on ease of use, allowing general purpose programming to those with a small amount of.
CSCE 552 Spring 2011 Language and Programming By Jijun Tang.
Code Optimization.
Language and Programming
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.
Chapter 5 Conclusion CIS 61.
Introduction to Computer Systems
Chapter 2: Operating-System Structures
Games Development Game Architecture: Entities
Chapter 2: Operating-System Structures
Games Development 1 Review / Revision
Games Development 2 Entity / Architecture Review
Presentation transcript:

Chapter Languages, Programming and Architecture

CS “Core” languages C/C++: fast compiled languages Java: getting better, still not there! –Niche games (web, slow-paced games, etc.)

CS Scripting Languages Why use scripting languages? –Ease and speed of development –Short iteration time –Code becomes a game asset Popular scripting languages –Most common: Python, Lua –Other: Tcl, Ruby, Perl, Javascript, Scheme –Custom scripting languages UnrealScript, QuakeC, NWNScript

CS Scripting Languages Key issue –How will you use it? Speed only an issue if in main loop –Even then, perhaps not! Interactive runtime consoles –Extremely powerful for debugging –Esp. via network connection

CS Flash, Director, etc. (ch 3.3) Self contained, interactive development environments If they meet your game needs, they can’t be beat! Excellent for prototyping –Very commonly used in this way

CS Programming Fundamentals (ch 3.4) Some ideas are review Others may be new Key point –This is how engines are written! –Useful for writing your own games, vital for understanding existing tools!

CS Debugging (ch 3.5) Debugging RT interactive systems is HARD –Probe effects –Hard to reproduce errors A great collection of debugging ideas and guidelines! –For more than just games

CS Adding Infrastructure to Assist in Debugging Interactive shells –Alter game variables during gameplay Visual diagnostics –AI, entity state Logging capability –With different “severity” levels, control via shell Recording and playback capability –Controllable global time Track memory allocation –(Return to this later) Print as much information as possible on a crash

CS Prevention of Bugs Set compiler to highest warning level Set compiler warnings to be errors Compile on multiple compilers Write your own memory manager Use asserts to verify assumptions Initialize variables when they are declared Bracket loops and if statements Use cognitively different variable names Avoid identical code in multiple places Avoid magic (hardcoded) numbers Verify code coverage when testing

CS 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!

CS Overall Architecture Main structure –Game-specific code –Game-engine code Architecture types –Ad-hoc (everything accesses everything) –Modular –DAG (directed acyclic graph) –Layered

CS 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

CS 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 Overview: Main Game Loop Tasks –Handling time –Gathering player input –Networking –Simulation –Collision detection and response –Object updates –Rendering –Other miscellaneous tasks

CS 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

CS 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 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 Game Entities Organization –Simple list –Multiple databases –Logical tree –Spatial database

CS 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 Game Entities Object creation –Basic object factories –Extensible object factories –Using automatic registration –Using explicit registration Identification (pointers vs. uids) Communication (messages)

CS 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 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 Memory Management Chapter gives lots of good advice on how to deal with memory and WHY –E.g., avoiding memory fragmentation Custom memory managers are great! For you, probably most important reasons: –Simple error-checking schemes –Debugging tools

CS File I/O As with memory, chapter 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! For you, probably not worth doing

CS 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 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 For you, worth doing!

CS 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 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 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