chapter 14 simulation, graphics, gaming and other applications

57
Chapter 14 Simulation, Graphics, Gaming and Other Applications

Upload: alexia-sims

Post on 25-Dec-2015

265 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Chapter 14

Simulation, Graphics, Gaming and Other

Applications

Page 2: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Chapter Goals – THE BIG SLICES

•Models and Simulation•Computational Biology•(Complex) Computer Graphics•Computer Gaming

2

Page 3: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Chapter Goals

•Models and Simulation• Complex Systems• Continuous and Discrete simulation• Object-oriented design and building models• Queuing systems• Weather and Seismic models

3

Page 4: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Chapter Goals

•Computational Biology• Bioinformatics• Computational Biomodeling• Protein Modeling• Molecular Modeling

4

Page 5: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Chapter Goals

•Computer Graphics• The CREATION of complex images• CAD• Fractal and Other Techniques• Light and Rendering• Movement

5

Page 6: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Chapter Goals

•Computer Gaming• The LAYERS• Design and Development• Game Programming

6

Page 7: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Complexity!

• Some real-world systems are complicated

• We want to model complex systems to:– better understand them– predict the future

14-7

Page 8: Chapter 14 Simulation, Graphics, Gaming and Other Applications

14-8

What is a Model?

• An Abstraction of a Real World System– A representation of the objects or quantities

within the system (Noun, the Data)

– and the rules that govern the interactions between them (Verb, the Code & Algorithms)

– Systems that are best suited to being simulated are dynamic, interactive, and complicated

Page 9: Chapter 14 Simulation, Graphics, Gaming and Other Applications

14-9

What Is Simulation?

• Simulation is RUNNING a model to PREDICT the results of experimental CHANGES in the system

• Doing “What If” analysis“What happens if I change this?“What happens if I don’t?”

Page 10: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Kinds of Models

13-10

Page 11: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Kinds of Models• There are 2 Big Slices:

–Discrete Models–Continuous Models

13-11

Page 12: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Kinds of Models

•Discrete event simulation•Made up of entities, attributes, and events

– Entity The representation of some object in the real system

– Attribute Some characteristic of a particular entity

– Event An interaction between entities

12

Page 13: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Air Traffic – A Discrete Model

• Air Traffic in USA– Planes are

objects– Attributes

include speed– Events are

planes entering and leaving airspace

14-13

Page 14: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Kinds of Models

• Continuous simulation

– Treats time as continuous

– Expresses changes in terms of a set of differential equations that reflect the relationships among the quantities in the model

– Meteorological models falls into this category

14

Page 15: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Hurricanes – A Continuous Model

14-15

Page 16: Chapter 14 Simulation, Graphics, Gaming and Other Applications

A Continuous Models and FEA

14-16

• Finite Element Analysis (FEA): Dividing a volume of space into small cubes, which contain our quantities of interest

• Many Continuous Models Use FEA

Page 17: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Queuing Systems

13-17

Page 18: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Queuing Systems

Queuing system: A particular kind of discrete-event model

The system is made up of – Server objects– Clients objects– Queues of clients to be served

18

Please Wait….

Page 19: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Queuing Systems

•Can you name at least three queuing systems that you interact with every day?

19

Please wait!

Page 20: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Queuing Systems

• To construct a queuing model, we must know – The number of events and how they affect the system in

order to determine the rules of entity interaction

– The number of servers

– The distribution of arrival times in order to determine if an entity enters the system

– The expected service time in order to determine the duration of an event

20

Page 21: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Queuing Systems

•Given a hypothetical service station, what are • the events?• the number of servers?•How can you determine• distribution of arrival time?• expected service time?

21

Page 22: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Meteorological Models

13-22

Page 23: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Weather – A Continuous Model

14-23

Page 24: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Meteorological Models

Meteorological models •Models based on the time-dependent partial differential equations of fluid mechanics and thermodynamics•Initial values for the variables are entered from observation, and the equations are solved to define the values of the variables at some later time

24

Page 25: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Meteorological Models

25

How muchmath

does ittake tobe a

meteorologist?

Page 26: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Weather – A Continuous Model

14-26

Page 27: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Hurricane Tracking

27

Figure 14.2 Improvements in hurricane models

(GFDL) Geophysical and Fluid DynamicsLaboratory

Page 28: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Computational Biology

13-28

Page 29: Chapter 14 Simulation, Graphics, Gaming and Other Applications

29

Computational Biology

The application of computer science to problems in biology (or is it the other way around?? )

Encompasses:

• bioinformatics

• computational biomodeling

• molecular modeling

• protein structure prediction

Page 30: Chapter 14 Simulation, Graphics, Gaming and Other Applications

30

Computational Biology

•Bioinformatics• Discovering and Processing DNA sequences• Human Genome Project and Others

Page 31: Chapter 14 Simulation, Graphics, Gaming and Other Applications

31

Computational Biology

•Computational Biomodeling• The simulation of biological systems

Cell Wall Protein

Knees

Cell Metabolism

Page 32: Chapter 14 Simulation, Graphics, Gaming and Other Applications

32

Computational Biology

•Protein Structure Modeling• Simulating 3-Dimensional Structure and

Function of Protein Molecules

Page 33: Chapter 14 Simulation, Graphics, Gaming and Other Applications

33

Computational Biology

•Molecular Modeling• Simulating Structure and Function of Chemical

Molecules (usually drug discovery)

Page 34: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Graphics

13-34

Page 35: Chapter 14 Simulation, Graphics, Gaming and Other Applications

“Traditional” Graphics

•Technical or Engineering Graphics •Originally a language of communication for engineers, designers, and architects•Computer-Aided Design (CAD) •A system that uses computers with advanced graphics hardware and software to create precision drawings or technical illustrations

35

Page 36: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Graphics for Computer Aided Design

36

Figure 14.3 Geometric modeling techniques

Page 37: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Simulating Light

37

Ray TracingThe projection of a 3-Dimensional model onto a 2-Dimensional computer screen

Page 38: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Simulating Light

38

Illumination modelUsed to simulate the interaction of light with objects

Objects areShadedRendered

Page 39: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Fractal Techniques

13-39

Page 40: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Modeling Complex Objects

40

Whatgraphics

challengesare

inherentin

naturallandscapes

?

Figure 14.5 A natural computer generated landscape

Page 41: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Fractal Terrain

41

Fractal terrains viaMidpoint subdivision(Fractal Mountains)

Page 42: Chapter 14 Simulation, Graphics, Gaming and Other Applications

“Cell” Models

13-42

Page 43: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Earth, Wind, Fire and Water

14-43

•Cell-Based Models• Like continuous FEA models• Uses quantities and laws from physics• “How is a hurricane like a glass of water?”• Or a Cloud?• Or Fire?• Or Smoke?

Page 44: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Cell Models

44

Figure 14.7 Water pouring into a glass

Page 45: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Cell Models

45

Figure 14.8 Cellular automata-based clouds

Page 46: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Modeling Complex Objects

46

Figure 14.9 A campfire

What do clouds, smoke andfire have in common?

Cell Models

Page 47: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Gaming

13-47

Page 48: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Computer Gaming• A simulation of a virtual world• Usually based on the rules of our real world• Some rules can be bent• Some rules can be broken•

48

Page 49: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Computer Gaming•Game designers need to know the LAYERS:

– Computer graphics– Artificial intelligence– Human-computer interactions and simulation– Software engineering (management of large complex

projects)– Computer security– Laws of physics relating to gravity, elasticity, light & sound

49

Page 50: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Creating the Virtual World

•Game engine: •A software system within which games can be created (A tool to create games)

•Analogous to a compiler (A tool to create programs)

•(Similarly, some people write engines, some people write games)50

Page 51: Chapter 14 Simulation, Graphics, Gaming and Other Applications

A Game Engine Provides

•A rendering engine for graphics•A physics engine for collision detection and dynamics•A sound-generating component•A scripting language apart from the code driving the game•Character Animations•Algorithms (e.g., path-finding algorithms)•Artificial intelligence algorithms (NonPlayerCharacters)

51

Page 52: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Game Engine Scene Graphs• Where is your toothbrush?• Where did you park your car?• You use a Scene Graph to find these things in your

brain first

52

• A way to store object locations and other data in memory

Page 53: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Soft Skills Needed

•High Quality Game Design and Development Requires Effective Use of “Soft Skills”:

• Effective collaboration with designers, programmers, and artists on various technical ideas throughout entire game design and development process

• Flexibility and adaptability as the game design constantly evolves and changes throughout the development and production process

53

Page 54: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Game Programming

•After all the design decisions have been finalized, programmers produce the code to create the virtual world of the game

•Popular languages include: C++, Java, and C

•Some well-established game engineers have created custom languages based on their games, e.g., Epic Game’s UnrealScript for the Unreal Game

54

Page 55: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Game Programming API’s and Platforms

•Application Programmers Interface (API): A set of commands used in a programming language to interface with another piece of software

•Game Engines provide APIs to help developers with key programming tasks

•Game Engines usually target a particular platform such as PC or Xbox or PlayStation, etc

55

Page 56: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Game ProgrammingThe “Game Loop”

•Coding process begins with the creation of the “game loop”•Game loop is responsible for managing the game world, regardless of any input from the user•For example, the game loop might update enemy movement in the game or check for victory/loss conditions•Basically, the game loop manages the simulation

56

Page 57: Chapter 14 Simulation, Graphics, Gaming and Other Applications

Game ProgrammingTeams and Roles

•Large design teams have different programmers focus on different aspects of the game•Thus, you might find yourself working as: – A Junior Engine programmer writing and

maintaining code for the game loop or a– A 3D Software Programmer designing and

implementing the 3D graphics component or a– A User-Interface Programmer working on the APIs

in the game engine– Etc…

57