Applied Interactive Story - PowerPoint PPT Presentation

1 / 66
About This Presentation
Title:

Applied Interactive Story

Description:

In a game, the world has (at least) these parts: terrain ... Creating houses, scenery, props. Managing the primitive budget. a prim = cube, cylinder, etc. ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 67
Provided by: jmm5
Category:

less

Transcript and Presenter's Notes

Title: Applied Interactive Story


1
Applied Interactive Story
  • DIG 6551
  • Fall 2009
  • J. Michael Moshell
  • University of Central Florida
  • Lecture 3
  • Game Engines

Original image by Moshell et al .
2
Game Engines Some Concepts
  • World editor
  • Physics engine
  • Lighting Texturing
  • Meshes
  • Terrain
  • Scene management
  • Multiplayer networking system
  • Animation
  • Special effects
  • Sound
  • Scripting

3
Game Engines What and Why
  • A software tool-kit of resources for making
    games.
  • Usually includes an integrated development
    environment (IDE)
  • Game Engines often result from
  • a game design project that worked.

www.tbase.com
4
Game Engines What and Why
  • In a word REUSE.

5
Game Engines What and Why
  • In a word REUSE. (In two morphemes Re-Use)

6
Game Engines What and Why
  • In a word REUSE. (In two morphemes Re-Use)
  • Two dimensions of reuse

7
Game Engines What and Why
  • In a word REUSE. (In two morphemes Re-Use)
  • Two dimensions of reuse

8
World Editor (Whats a world?)
  • ltltDiscuss World Editorgtgt

9
World Editor (Whats a world?)
  • ltltDiscuss World Editorgtgt
  • In a game, the world has (at least) these parts
  • terrain
  • static and dynamic models (houses, trees, tools)
  • avatars
  • rendering (lighting, texture)
  • AND may also have de luxe features such as
  • atmospherics, animations, sounds, AI,
    multiplayer

10
World Editor (Whats a world?)
  • World Editors almost always provide control of
  • terrain
  • static and dynamic models (houses, trees, tools)
  • avatars
  • rendering (lighting, texture)
  • AND may also have de luxe features such as
  • atmospherics, animations, sounds, AI,
    multiplayer

11
World Editor (Whats a world?)
  • and LIMITED control of
  • avatars
  • ... because articulated figure design is so
    complex,
  • most world editors just provide parameter
    tweaking.

12
A Terrain Editor
ltltDiscuss terraingtgt
13
A Terrain Editor
ltltDiscuss terraingtgt ltltDemonstrate Second Life
Terrain Editorgtgt
14
Terrain Management
  • ltltDemonstrate Second Life Terrain Editorgtgt
  • This reveals the mesh structure of the terrain.
  • Problems that the terrain system must solve,
    include
  • level of detail
  • texture overlaying
  • (sometimes) terrain following for models and
    avatars
  • elevation editing
  • dynamic terrain (can scripts change the land?)
  • special terrain features such as water

15
A feature editor Second Life
  • ltltDemonstrate Second Life Feature Editorgtgt
  • - Creating houses, scenery, props
  • Managing the primitive budget
  • a prim cube, cylinder, etc.
  • Second Life rations to about 125 prims per 512
    m2
  • Constructive Solid Geometry (CSG) for building
  • texture maps
  • You can store any number pay per upload

16
An avatar tweaker Second Life
  • ltlt Demonstrate Second Life
  • Avatar Editor gtgt
  • Changing properties
  • of a fixed structure

johndavidhead.com
17
Behind the scenes Some triage to fit the
lecture into an hour
  • BRIEF SUBJECTS
  • - Meshes
  • Lighting
  • Texturing
  • Special effects
  • Scene Management
  • Threading
  • Sound
  • Animation
  • DEEP SUBJECTS
  • Physics Engine Simulation
  • Networking System
  • Scripting
  • Artificial Intelligence
  • for games

18
Behind the scenes Meshes
  • FACE LIST

Y
Z
  • OBJECT LIST

6
4
3
5
1
X
2
I told you about hierarchical polygonal modeling
but sometimes its simpler than that. . . . .
19
Behind the scenes Meshes
2
3
1
An initial triangle of edges can be extended ...
20
Behind the scenes Meshes
4
2
3
1
An initial triangle of edges can be extended
... By adding one vertex you get another triangle
...
21
Behind the scenes Meshes
4
2
3
5
1
An initial triangle of edges can be extended
... By adding one vertex you get another triangle
... And continuing, you can efficiently define an
entire 3d surface. Cost 3 numbers per vertex,
or (about) 3 numbers/triangle.
22
Terrain grids are not meshes. Why?
4
2
3
5
1
Each terrain post is at a known x,y position
So you only have to store one number (height
z) per post. So you get approximately two
triangles for every post that you add.
23
Terrain grids are not meshes. Why?
4
2
3
5
1
Each terrain post is at a known x,y position
So you only have to store one number (height
z) per post. So you get approximately two
triangles for every post that you add.
24
Terrain grids are not meshes. Why?
4
2
3
5
1
Each terrain post is at a known x,y position
So you only have to store one number (height
z) per post. So you get approximately two
triangles for every post that you add.
25
Lighting
4
2
3
5
1
For each light source For each polygon Compute
ambient, diffuse specular light to calculate
that polygons overall (R, G, B)
26
Lighting
  • Ambient liquid light
  • no direction
  • Diffuse flat light
  • only O matters

O
4
2
3
5
1
For each light source For each polygon Compute
ambient, diffuse specular light to calculate
that polygons overall (R, G, B)
27
Lighting
  • Ambient liquid light
  • no direction
  • Diffuse flat light
  • only O matters
  • Specular Mirror light
  • - W matters too

O
W
4
Viewer
2
3
5
1
For each light source For each polygon Compute
ambient, diffuse specular light to calculate
that polygons overall (R, G, B)
28
Texturing
Viewer
www.neotex.com
3
5
1
Mapping pixels from a stock image into a polygon
or curved surface requires some understanding.
29
Texturing
www.slworld.info
Modeling packages (Maya, 3Dmax) manage this
mapping, but game engines must ACCEPT their
mappings. Often this is a major difficulty.
www.dimitridarras.com
30
Special Effects
Distance haze (a. k. a. aerial diffusion)
  • - Moving texture maps
  • (flowing water)
  • Sky and horizon maps
  • (Clouds, mountains)
  • Diurnal cycles
  • (Night illumination)

www.dimitridarras.com
31
Scene Management
Bringing terrain, models and avatars before the
virtual camera
CAMERA POSITION - First person One less avatar
to render (except hands, weapons) - Over the
shoulder Viewpoint management tracks player
POV - Virtual camera Camera smartly chooses a
viewpoint
  • LEVEL OF DETAIL
  • How far can I see? How big is the world?
  • Whats in RAM and whats on disk?
  • Can distant things be simplified? (Manually?
    Automatically?)

32
Threading
How often must things be updated?
RENDERING - 30 to 60 times a second is
sufficient for smooth motion.
  • COMMUNICATION (in shared worlds)
  • 15 times a second is usually enough, due to net
    delays
  • PHYSICS MODELING
  • If manual feedback is involved (e. g. Wii) 200
    cycles/second
  • or more high fidelity requires gt1000
    cycles/second.

33
Threading
So, multiple processes are managed synchronized.
RENDERING
COMM
PHYSICS
TIME
34
Animation
  • - Snippets for use by props and avatars
  • Cut-scenes between game segments
  • May come from Mocap, or animation modeling
  • Key distinction
  • Animation is not interactive, but may be
    environment-sensitive
  • (e. g. a walking cycle may follow the terrain)
  • If you need a swordfight that responds in
    realtime to the player,
  • you need a script rather than a single animation.
  • John Madden Football has a (BIG) script, which
    manages
  • thousands of animations.

35
Sound
Three basic categories
1. Ambient music and effects - winter wind,
combat music .....
2. Sound effects - weapons clash, trolls roar,
buttons go ping ...
3. Speech communication controlling who hears
you Categories 2 and 3 include range effects and
sometimes occlusion.
36
Physics in Games
How real do you want it?
0. Basic movement no collision testing, no
inertia, gravity. World seems highly
unrealistic, jerky.
37
Physics in Games
How real do you want it?
  • 0. Basic movement no collision testing, no
    inertia, gravity.
  • World seems highly unrealistic, jerky.
  • Kinematics. Ease-in, ease-out No infinite
    acceleration.
  • Collisions (with static objects) are
    reflections.
  • Inverse kinematics (IK) can help articulated
    figures

38
Physics in Games
How real do you want it?
  • 0. Basic movement no collision testing, no
    inertia, gravity.
  • World seems highly unrealistic, jerky.
  • Kinematics. Ease-in, ease-out No infinite
    acceleration.
  • Collisions (with static objects) are
    reflections.
  • Inverse kinematics (IK) can help articulated
    figures
  • Force and Momentum. (We explore this level
    further.)

39
Physics in Games
How real do you want it?
  • 0. Basic movement no collision testing, no
    inertia, gravity.
  • World seems highly unrealistic, jerky.
  • Kinematics. Ease-in, ease-out No infinite
    acceleration.
  • Collisions (with static objects) are
    reflections.
  • Inverse kinematics (IK) can help articulated
    figures
  • Force and Momentum. (We explore this level
    further.)
  • Dynamics Energy conservation. Real physics.
  • 3.5 Particle systems dynamics on point clouds.
    Doable.

40
Physics in Games
How real do you want it?
  • 0. Basic movement no collision testing, no
    inertia, gravity.
  • World seems highly unrealistic, jerky.
  • Kinematics. Ease-in, ease-out No infinite
    acceleration.
  • Collisions (with static objects) are
    reflections.
  • Inverse kinematics (IK) can help articulated
    figures
  • Force and Momentum. (We explore this level
    further.)
  • Dynamics Energy conservation. Real physics.
  • 3.5 Particle systems dynamics on point clouds.
    Doable.
  • Fluid dynamics Real flowing water, soil. Rare in
    games.

41
Physics in Games
First, we review Descartes and Galileos kinematic
definitions.
  • X position the distance to the right from the
    origin.
  • 2. V velocity how much X changes in one
    second.
  • X Vt Xo. A velocity of 3 m/s for 4 s adds
    12m to X.
  • A acceleration how much V changes in one
    second.
  • V At Vo. An accel of 2 m/s2 for 3s adds
    6m/s to V.

42
Physics in Games
First, we review Descartes and Galileos kinematic
definitions.
  • X position the distance to the right from the
    origin.
  • 2. V velocity how much X changes in one
    second.
  • X Vt Xo. A velocity of 3 m/s for 4 s adds
    12m to X.
  • A acceleration how much V changes in one
    second.
  • V At Vo. An accel of 2 m/s2 for 3s adds
    6m/s to V.
  • (Only strictly correct for CONSTANT velocity,
    acceleration.)

43
Physics in Games
And Descartes invented GRAPHS!
X
Xo4m
Time
V
2 m/s
Time
44
Physics in Games
And Descartes invented GRAPHS!
X
Xo4m
Time
V
2 m/s
Time
45
Physics in Games
And Descartes invented GRAPHS!
X
Xo4m
Time
V
2 m/s
Time
46
Physics in Games
And Descartes invented GRAPHS!
X
Xo4m
Time
V
2 m/s
Time
No physical object can accelerate instantly from
V0 to V2 m/s.
47
Physics in Games
Next, we review Newtons three laws.
  • Momentum An object retains its state of motion
    unless an external force is applied to it.
  • 2. Force and Acceleration Force mass
    acceleration.
  • Equivalently A f/m
  • 3. Reaction For every action there is an equal
    and opposite reaction.

48
Physics in Games
We need one more law, before we play!
  • Springs Hookes law F -kL
  • where F force and
  • L length of the springs distortion, and
  • k the spring constant of that spring.

m
x
1
2
3
0
-1
-2
49
Physics in Games
Now what happens if we tweak it? boing boing -
boing
F -kX A F/m V At Vo X Vt Xo
m
x
1
2
3
0
-1
-2
50
Physics in Games
Now what happens if we tweak it? boing boing -
boing
F -kX A F/m V At Vo X Vt Xo
m
x
1
2
3
0
-1
-2
51
Physics in Games
Now what happens if we tweak it? boing boing -
boing
x
t
m
x
1
2
3
0
-1
-2
52
Physics in Games
If the time step is too coarse, the integration
gets inaccurate.
x
t
m
x
1
2
3
0
-1
-2
53
Physics in Games
Congratulations now you understand Differential
equations! Its the difference from one step to
the next that drives the simulation.
F -kX A F/m V At Vo X Vt Xo
F, A, V, X are called state variables. Every
physical object in the game has them. When
objects interact, they exchange F.
m
x
1
2
3
0
-1
-2
54
Physics in Games
Ah, the sticky wicket Collision detection
F, A, V, X are called state variables. Every
physical object in the game has them. When
objects interact, they exchange F. But how do
we tell when objects collide?
55
Physics in Games
Ah, the sticky wicket Collision detection
F, A, V, X are called state variables. Every
physical object in the game has them. When
objects interact, they exchange F. But how do
we tell when objects collide?
56
Physics in Games
Ah, the sticky wicket Collision detection
F, A, V, X are called state variables. Every
physical object in the game has them. When
objects interact, they exchange F. But how do
we tell when objects collide?
57
Physics in Games
Ah, the sticky wicket Collision detection
F, A, V, X are called state variables. Every
physical object in the game has them. When
objects interact, they exchange F. But how do
we tell when objects collide?
58
Physics in Games
Ah, the sticky wicket Collision detection
F, A, V, X are called state variables. Every
physical object in the game has them. When
objects interact, they exchange F. But how do
we tell when objects collide? Dudes truck is
now INSIDE the wall not good!
Small steps help, but collision detection is a
subtle science!
59
Networking for Multiplayer
How can we distribute this action?
  • The key question is
  • How much shall we handle in the CLIENT
  • and how much shall we handle in the SERVER?

Server
Client
Client
Client
Client
Client
60
Networking for Multiplayer
How can we distribute this action?
  • The key question is
  • How much shall we handle in the CLIENT
  • and how much shall we handle in the SERVER?
  • Or ... indeed ... do we need a server at all?

Client
Client
Client
Client
Client
61
Networking for Multiplayer
How can we distribute this action?
  • The key question is
  • How much shall we handle in the CLIENT
  • and how much shall we handle in the SERVER?
  • Or ... indeed ... do we need a server at all?

Server
Client
Client
Client
Client
Client

It seems like a good place to charge folks for
the privilege of playing ...!
62
Networking for Multiplayer
How can we distribute this action?
Even in peer-to-peer systems (e. g. Torque) one
station is usually designated the Server to
simplify conflict resolution.
Server State Vars for all objects Master map
Client Copies of State Vars for SOME
objects Subset of Master map
Client
Client
Client Copies of State Vars for
OTHER objects Different subset of Master map
Client
63
Networking for Multiplayer
How can we distribute this action?
The client has responsibility to render
images from their partial model, because
the local bandwidth is much greater than the
bandwidth available from the server.
Server State Vars for all objects Master map
Client Copies of State Vars for SOME
objects Subset of Master map
Client Copies of State Vars for
OTHER objects Different subset of Master map
Local Rendering
64
Scripting for games
  • A halfway house between
  • Simple modifications of the world map models
  • and
  • - Hard-core programming of the game engine.
  • Scripts are based on EVENTS (like in Alice)
  • Scripts modify properties of objects (like
    avatars)
  • They are written in customized languages (often
    styled after C)
  • A special class of scripts controls the behavior
    of NPCs.
  • Dialog generators.

65
Artificial Intelligence for games
Most AI in games is not very intelligent. Some
systems have path-finding built in, so your
automatic enemies can find you.
66
Artificial Intelligence for games
Most AI in games is not very intelligent. We
will have a subsequent lecture on the state of
research in real Artificial Intelligence Meanwh
ile Id like to know what you have encountered in
games, that seemed intelligent.
Write a Comment
User Comments (0)
About PowerShow.com