advanced game design
DESCRIPTION
Advanced Game Design. Prof. Roger Crawfis Computer Science & Engineering The Ohio State University. Course Overview. Project-based / Team-based Little lecturing Focus on programming for games Systems integration – graphics, sound, AI, networking, user-interfaces, physics, scripting - PowerPoint PPT PresentationTRANSCRIPT
Prof. Roger CrawfisComputer Science & Engineering
The Ohio State University
Advanced Game Design
Course OverviewProject-based / Team-based
Little lecturingFocus on programming for games
Systems integration – graphics, sound, AI, networking, user-interfaces, physics, scripting
Utilize higher-level toolkits, allowing for more advanced progress while still developing programming skills.
Course StructureWe will lecture for about the first two
weeks.Student game project groups will provide
several presentations on their game ideas and progress.
Student technology teams will provide an intermediate and an advanced lecture on their findings and analysis about their area.
Project GoalsLarge-scale software developmentTeam-based (synergistic development)Toolkit-based (fast-start development)Learn and utilize the many non-graphical
elements needed for games.Leverage and extend your graphics and AI
expertise.
ElementsGaming Engine
Responsible for providing primitivesHardware abstractionHandle different areas of the game
Physics, AI, etc.
GameDefined by a genreDefines the gameplay
Requirements of a gaming engineStunning VisualsArtificial IntelligenceImmersive sound stageSimulationAnimationNetworking
Requirements of a gameScriptingVaried input/output devicesSupporting Tools
Optimizing game contentDeveloping game contentExtending game contentDebugging / Tuning of game performance
Stunning VisualsAdding realismSmarter ModelsClutterUse hardware
Bump-mappingDynamic water or other liquidsRich textures (Billboards, gloss-maps, light-
maps, etc.)ShadowsParticle systems
Artificial IntelligenceGames need specialized AI
StrategyPath findingModeling behaviorLearning
Immersive sound stageMulti-track sound supportPositional sound effects (3D immersion)Dynamic sounds / movement (doppler
effects)
Input devicesCommonly available devices are
Keyboard, mouse, gamepads and joysticks
Force feedback (haptic) devices are gaining popularitySteering wheelsJoysticksMotion tracking
Output devicesMultiple monitorsHead mounted displays
ScalabilityMultiple hardware capabilitiesMulti-resolution modelsMulti-user supportLOD
Multiple model definitionsMulti-res modelsSubdivision surfaces
ScalabilityMultiple hardware capabilitiesMulti-resolution modelsMulti-user supportLOD (Level-Of-Detail)
Control – when to switchConstruction – what levels to have
AnimationLinear transformationsModeled animations
Articulated motionLip syncingFacial Expressions
Blending animations
Networking
Multi-player support essentialCommon problems
LatencySynchronizationScalabilityConsistent game stateSecurity
ScriptingStrict coding is tedious Support for scripting is essential for RADScripting has added a whole new fun factor
for many games.
Artificial IntelligenceGames need specialized AI
StrategyPath findingModeling behaviorLearning
Non-perfect!Fast!
ToolsCreating varied content
models, video, images, soundIntegrating content
Common file format supportSupporting existing popular tools via plug-
ins3DS Max, Lightwave, Maya etc.Adobe premier, Adobe Photoshop
Interactive ProgramsGames are interactive systems - they must
respond to the userHow?
Interactive Program Structure
Event driven programmingEverything happens in
response to an eventEvents come from
two sources:The userThe system
Events are also called messagesAn event causes a
message to be sent…
Initialize
User Does Somethingor
Timer Goes Off
System Updates
User EventsThe OS manages user input
Interrupts at the hardware level …Get converted into events in queues at the
windowing level …Are made available to your program
It is generally up to the application to make use of the event stream
Windowing system / Game Framework may abstract the events for you
Polling for Events
Most windowing systems provide a non-blocking event functionDoes not wait for an event, just returns NULL if one
is not readyWhat type of games might use this structure?Why wouldn’t you always use it?
while ( true )if ( e = checkEvent() )
switch ( e.type )…
do more work
Waiting for Events
Most windowing systems provide a blocking event functionWaits (blocks) until an event is availableUsually used with timer events. Why?
On what systems is this better than the previous method?
What types of games is it useful for?
e = nextEvent();switch ( e.type )
…
The Callback AbstractionA common event abstraction is the callback
mechanismApplications register functions they wish to
have called in response to particular eventsTranslation table says which callbacks go with
which eventsGenerally found in GUI (graphical user
interface) toolkits“When the button is pressed, invoke the callback”Many systems mix methods, or have a catch-all
callback for unclaimed eventsWhy are callbacks good? Why are they bad?
Upon Receiving an Event …Event responses fall into two classes:
Task events: The event sparks a specific task or results in some change of state within the current modeeg Load, Save, Pick up a weapon, turn on the lights, …Call a function to do the job
Mode switches: The event causes the game to shift to some other mode of operationeg Start game, quit, go to menu, …Switch event loops, because events now have different
meanings
Software structure reflects this - menu system is separate from run-time game system, for example
Real-Time Loop
At the core of interactive games is a real-time loop:
What else might you need to do?The number of times this loop executes
per second is the frame rate# frames per second (fps)
while ( true )process eventsupdate animation / scenerender
LagLag is the time between when a user does
something and when they see the result - also called latencyToo much lag and causality is distortedWith tight visual/motion coupling, too much lag makes
people motion sickBig problem with head-mounted displays for virtual reality
Too much lag makes it hard to target objects (and track them, and do all sorts of other perceptual tasks)
High variance in lag also makes interaction difficultUsers can adjust to constant lag, but not variable lag
From a psychological perspective, lag is the important variable
Computing LagLag is NOT the time
it takes to compute 1 frame!
What is the formula for maximum lag as a function of frame rate, fr?
What is the formula for average lag?
Process input
Update state
Render
Process input
Update state
Render
Process input
Frame time
Lag
frlag
frlag
average
5.1
2max
Event time
Frame Rate QuestionsWhat is an acceptable frame rate for twitch
games? Why?What is the maximum useful frame rate?
Why?What is the frame rate for NTSC television?What is the minimum frame rate required
for a sense of presence? How do we know?How can we manipulate the frame rate?
Frame Rate Answers (I)
Twitch games demand at least 30fs, but the higher the better (lower lag)Users see enemy’s motions soonerHigher frame rates make targeting easier
The maximum useful frame rate is the monitor refresh rateTime taken for the monitor to draw one screenSynchronization issues
Buffer swap in graphics is timed with vertical sweep, so ideal frame rate is monitor refresh rate
Can turn of synchronization, but get nasty artifacts on screen
Frame Rate Answers (II)NTSC television draws all the odd lines of the
screen, then all the even ones (interlace format)Full screen takes 1/30th of a secondUse 60fps to improve visuals, but only half of each
frame actually gets drawn by the screenDo consoles only render 1/2 screen each time?
It was once argued that 10fps was required for a sense of presence (being there)Head mounted displays require 20fps or higher to
avoid illnessMany factors influence the sense of presencePerceptual studies indicate what frame rates are
acceptable
Reducing Lag
Faster algorithms and hardware is the obvious answerDesigners choose a frame rate and put as much into the
game as they can without going below the thresholdPart of design documents presented to the publisherThreshold assumes fastest hardware and all game features
turned onOptions given to players to reduce game features and improve
their frame rateThere is a resource budget: How much of the loop is
dedicated to each aspect of the game (graphics, AI, sound, …)
Some other techniques allow for more features and less lag
Decoupling ComputationIt is most important to minimize lag between
the user actions and their direct consequencesSo the input/rendering loop must have low latency
Lag between actions and other consequences may be less severeTime between input and the reaction of enemy can be
greaterTime to switch animations can be greater
Technique: Update different parts of the game at different rates, which requires decoupling themFor example, run graphics at 60fps, AI at 10fpsDone in Unreal engine, for instance
Animation and SoundAnimation and sound need not be
changed at high frequency, but they must be updated at high frequencyFor example, switching from walk to run can
happen at low frequency, but joint angles for walking must be updated at every frame
Solution is to package multiple frames of animation and submit them all at once to the rendererGood idea anyway, makes animation
independent of frame rateSound is offloaded to the sound card