48
CSCE 552 Fall 2012 AI By Jijun Tang

CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Embed Size (px)

Citation preview

Page 1: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

CSCE 552 Fall 2012

AI

By Jijun Tang

Page 2: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Homework 3

List of AI techniques in games you have played;

Select one game and discuss how AI enhances its game play or how its AI can be improved

Due Nov 28th

Page 3: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Announcements

Final demo Dec 5th, Wednesday, 12:30pm, 2A14 Open to public with pizza and drink

Homework 4 User Manual Due (printed) on the demo

Homework 5 Evaluating others Due (printed) on the demo

Page 4: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Random Trace (continued)

How will Random Trace do on the following maps?

Page 5: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Breadth-First

Finds a path from the start to the goal by examining the search space ply-by-ply

Page 6: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Best-First (continued)

Page 7: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Dijkstra Example

Page 8: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Cost Map

Page 9: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Audio Programming

Page 10: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Audio Programming

Audio in games is more important than ever before

Page 11: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Programming Basic Audio

Most gaming hardware has similar capabilities (on similar platforms) Mostly programming interfaces differ

Learning fundamental concepts of audio programming is important

Page 12: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

API Choices

DirectSound (part of DirectX API) Only available on Windows platforms XACT for XNA

OpenAL Newer API Available on multiple platforms

Proprietary APIs Typically available on consoles

3rd Party Licensable APIs Can offer broad cross-platform solutions

Page 13: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Analog Sound Wave

Page 14: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Basic Audio Terminology and Physics

Amplitude Measurement of a sound wave’s pressure

Frequency Measurement of the interval between wave cycles,

typically measured in Hertz Pitch

The perception of frequency Tuning

Musical distribution of frequencies over keys Decibel

Measures sound amplitude

Page 15: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Digital Representation of a Sound Wave

Page 16: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Sampling

Most common technique Sampling involves measuring the amplitude

of the analog wave file at discrete intervals The frequency of sampling is known as sampling

rate Each sample is typically stored in a value ranging

from 4 to 24 bits in size The size of the sample value in bits is known as

the ‘bit depth’ Music CDs have a sample rate and bit depth of

44.1 kHz (samples/sec) and 16 bits (sample size)

Page 17: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Quantization Error in Sampling

Page 18: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Bit Depth and Signal Noise

Bit depth of sample data affects signal noise Signal to noise ratio = number of available bits /

1 For example, 8-bit samples have a 256:1 SNR

(~48 dB), and 16-bit samples have a 65,536:1 SNR (~96 dB)

Decibel ratio is calculated using 10 x log10 (ratio) or 8.685890 x log e (ratio)

Page 19: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Sampling Frequency and Frequency Reproduction

Sampling frequency affects range and quality of high-frequency reproduction

Nyquist Limit Frequencies up to one-half the sampling

rate can be reproduced Audio quality degrades as frequency

approaches this limit

Page 20: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Sampling Errors vs. Sampling Frequency

Page 21: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Modern Audio Hardware

Samples are piped into sound “channels” Often a hardware pipeline from this point

Various operations, such as volume, pan, and pitch may be applied

3D sounds may apply HRTF algorithms and/or mix the sound into final output buffers.

Page 22: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Sound Playback Techniques

Two basic playback methods:1. Play sample entirely from memory buffer2. Stream data in real-time from storage medium

Streaming is more memory efficient for very large audio files, such as music tracks, dialogue, etc

Streaming systems use either a circular buffer with read-write pointers, or a double-buffering algorithm

Page 23: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Playback

Page 24: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Sample Playback and Manipulation

Three basic operations you should know Panning is the attenuation of left and right

channels of a mixed sound, results in spatial positioning within the aural stereo field

Pitch allows the adjustment of a sample’s playback frequency in real-time

Volume control typically attenuates the volume of a sound

Page 25: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Compressed Audio Format

Compressed audio formats allow sound and music to be stored more compactly

Bit reduction codecs generally are lightweight ADPCM compression is implemented in hardware on all

the major current video game console systems Psycho-acoustic codecs often have better

compression Discard sounds our ears would not typically be able to

hear Require substantially more computational horsepower to

decode

Page 26: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

MP3, Ogg Vorbis,Licensing & Patent Issues

The MP3 format is patented Any commercial game is subject to licensing

terms as determined by Fraunhofer & Thompson Multimedia, the holders of the patents

Ogg Vorbis is similar to MP3 in many ways Open source and patent-free (royalty-free)

Be aware of patent and license restrictions when using 3rd party software

Page 27: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

3D Audio

Two sets of data required when working in world coordinates: Listener Data

Composed of world position and orientation (virtual microphone in the world)

Source Data Composed of sound position, orientation,

velocity, etc (virtual sound source in the world)

Page 28: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Listener/Source

Page 29: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Unity

Audio Listener The Audio Listener acts as a microphone-like device. It receives input from any given Audio Source in the

scene and plays sounds through the computer speakers. For most applications it makes the most sense to attach

the listener to the Main Camera. Audio Source

The Audio Source plays back an Audio Clip in the scene.

If the Audio Clip is a 3D clip, the source is played back at a given position and will attenuate over distance.

Individual filters can be applied to each audio source for an even richer audio experience.

Page 30: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Environmental Effects

Environmental effects nearly always implemented in hardware

Sound transmission is categorized in three ways Direct transmission Early reflections (echo) Late reflections (reverberation)

Page 31: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Sound Transmission Categories

Page 32: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

EnvironmentalEffects Standards

EAX 2.0 and beyond EAX 2.0 developed by Creative Labs and

released as an open standard EAX 3.0 and 4.0 remain proprietary

Creative Labs standards I3DL2

Open standard developed by IA-SIG, similar to EAX 2.0 in functionality

Page 33: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Programming Music Systems

Two common music systems MIDI-based systems

(Musical Instrument Digital Interface) Digital audio streaming systems

(CD audio, MP3 playback, etc)

Page 34: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Advantages and Disadvantages of MIDI

Actual music data size is negligible Easy to control, alter, and even

generate in real-time High quality music is more difficult to

compose and program Only effective if you can guarantee

playback of a common instrument set

Page 35: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Example

Go online and find MIDI

Page 36: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Other MIDI-based technologies to be aware of

DLS (DownLoadable Sound) Format A standardized format for instrument

definition files iXMF (Interactive eXtensible Music

Format) New proposed standard for a container

format for interactive music

Page 37: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Advantages / Disadvantages of Digital Audio Streams

Superb musical reproduction is guaranteed

Allows composers to work with any compositional techniques

Some potential interactivity is sacrificed for expediency and musical quality

Generally high storage requirements

Page 38: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

A Conceptual Interactive Music Playback System

Divide music into small two to eight-bar chunks that we’ll call segments.

A network of transitions from segment to segment (including loops and branches) is called a theme.

Playing music is now as simple as choosing a theme to play. The transition map tracks the details.

Page 39: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Advanced Audio Programming

3D Audio Environmental Effects Integration

Audio Scripting and Engine Integration Lip-sync Technology Advanced Voice Playback Voice Recognition

Page 40: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

3D Audio Environmental Effects Integration

Environmental effects should be driven by a room’s shape and material composition. Can determining the optimal effect

settings be done automatically? This may be important as game worlds

become larger and more complex

Page 41: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

3D Audio Environmental Effects Integration (cont)

Sound occlusion and damping is a particularly difficult problem to solve This is essentially a pathfinding problem

for audio. Doors can dynamically affect a sound’s

properties Very few titles have even attempted a

robust, general-purpose, and automated solution to these problems.

Page 42: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Room Acoustics

Page 43: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Dynamic Occlusion

Page 44: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Audio Scripting and Engine Integration

Very little audio programming should be done by general game programmers

Game Engine should offer robust support for audio triggers and scripts

Engine should deal with audio scripts, not “sound files”

Why is this so important?

Page 45: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Audio Scripting

Many situations require much more information than can be embedded in a linear audio file Sound Variation Sound Repetition Complex Sound Looping Background Ambience

Page 46: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Lip-sync Technology

Lip-sync technology is a blending of audio and visual techniques to create realistic-looking speech by in-game actors. Simple techniques such as waveform amplitude

measurement has worked previously, but… In future titles, it will be considered inadequate. Much work can still be done in this field.

Page 47: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Advanced Voice Playback

Real-time spoken feedback is especially important in sports titles (simulated announcers)

Game are reaching the limits of what current techniques (canned, prerecorded phrases combined in series) can provide.

Again, this is an opportunity for future groundbreaking audio work.

Page 48: CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play

Voice Recognition

Spoken commands are much easier to deliver in certain situations.

A great example of this? Squad-based tactical shooters.

Current generation systems are still very error prone. A great opportunity for breakout audio technology.