1 etc. 2 sounds fx sounds fx –wav audio files –load into memory and play it »load »play »stop...
TRANSCRIPT
1
ETCETC
2
Sounds FXSounds FX– WAV audio filesWAV audio files– Load into memory and play itLoad into memory and play it
» LoadLoad» PlayPlay» StopStop» PausePause
– 2D or 3D2D or 3D» 3D should be integrated into scene management3D should be integrated into scene management
– APIsAPIs» DirectSoundDirectSound» Direct3DSoundDirect3DSound» DirectMusicDirectMusic
Audio (1/3)Audio (1/3)
3
MusicMusic– CD audioCD audio
» Sound tracks on CDSound tracks on CD» Play by sound cardPlay by sound card» No system overheadNo system overhead
– MP3MP3» MPEGMPEG» Decode with CPU costDecode with CPU cost
– MIDIMIDI» Instrument tempoInstrument tempo» Very compactVery compact
– WAVWAV– Streaming dataStreaming data
» Load / play / load / play ….Load / play / load / play ….
– APIsAPIs» DirectMusicDirectMusic
Audio (2/3)Audio (2/3)
4
The Most Non-important Part of the Domestic The Most Non-important Part of the Domestic Games.Games.
Most Company Is Outsourcing to the Music Most Company Is Outsourcing to the Music Studio.Studio.
Do the Audio Production When Game Is Do the Audio Production When Game Is Testing (Testing ().).
The Audio Budget is Poor.The Audio Budget is Poor. On PC, Most Gamer Have Great Graphics Card On PC, Most Gamer Have Great Graphics Card
But with Onboard Sound Card.But with Onboard Sound Card. But It’s Total Different on Console Games.But It’s Total Different on Console Games.
– On Xbox, 5.1 Sound Tracks + Digital Dolby….On Xbox, 5.1 Sound Tracks + Digital Dolby…. Audio Should Be Another Entertainment Audio Should Be Another Entertainment
Element in Living Room. So, …Element in Living Room. So, …
Audio (3/3)Audio (3/3)
5
Integrated into Scene Management SystemIntegrated into Scene Management System CPU Bound ConsiderationCPU Bound Consideration
– Be aware the re-calculated frame rateBe aware the re-calculated frame rate
3D Audio3D Audio
Listener
Top direction
Face direction
Audio source
direction
Inside cone
outside cone
6
Bit-Mapped ImagesBit-Mapped Images SpritesSprites
– A set of image sequences to describe a 2D objectA set of image sequences to describe a 2D object– Playback the image (animation) to simulate the Playback the image (animation) to simulate the
motion of the 2D objectmotion of the 2D object ClipsClips
– A look of a sprite at some timeA look of a sprite at some time
2D Sprite System – An Introduction2D Sprite System – An Introduction
Clip
Sprite
7
Hot Spots Affect the Rendering OrderHot Spots Affect the Rendering Order
Hot Spot of A SpriteHot Spot of A Sprite
Hot-spot
A sprite
x
y
zHot spot coordinate
screen Rendering order
weight: z > y > x
8
Describe the Geometry Relationship of Describe the Geometry Relationship of Sprites Sprites
Hierarchy of SpritesHierarchy of Sprites
Parent Sprite
(+10,+2) (+2,+2) (+40,+15)
(0,0)
9
User InterfaceUser Interface 2D Sprite Characters in Real-time 3D World2D Sprite Characters in Real-time 3D World CursorsCursors In the Near Future :In the Near Future :
– 2D sprites support from API will disappear2D sprites support from API will disappear» After DX8 -> No DirectDraw any moreAfter DX8 -> No DirectDraw any more
– Use transformed polygons with textures to Use transformed polygons with textures to simulate the bit-mapped imagessimulate the bit-mapped images
– Chinese font set will suffer the resolutionChinese font set will suffer the resolution
2D Sprite Applications in Modern 3D Games2D Sprite Applications in Modern 3D Games
10
MouseMouse– Only on PCOnly on PC– 2D device2D device
» Mouse movement in (x, y) axesMouse movement in (x, y) axes
– BehaviorsBehaviors» Mouse movingMouse moving» Mouse button pressedMouse button pressed» Mouse button releasedMouse button released» DraggingDragging» Double-clickDouble-click
– 一鼠到底一鼠到底– ““God view”God view”
Input Devices - MouseInput Devices - Mouse
11
12
GamepadGamepad– Special buttons on one input deviceSpecial buttons on one input device– Analog controllersAnalog controllers
» JoystickJoystick» Value ranging from 0 – 255Value ranging from 0 – 255
– Digital controllersDigital controllers» ButtonsButtons» Value = 0 or 1Value = 0 or 1
– Force feedbackForce feedback– Console games mostlyConsole games mostly– ““First personal view”First personal view”– ““Third personal view”Third personal view”
Input Devices - GamepadInput Devices - Gamepad
13
14
KeyboardKeyboard– ASCII characters inputASCII characters input
HotkeysHotkeys– Key pressed or releasedKey pressed or released– Can be mapped to gamepadCan be mapped to gamepad
» A very large gamepad ?A very large gamepad ?
Input Devices - KeyboardInput Devices - Keyboard
15
DirectInputDirectInput– MouseMouse– KeyboardKeyboard– GamepadGamepad
Win32 SDKWin32 SDK– Window messagesWindow messages
» WM_XXXXXXWM_XXXXXX
– MouseMouse– KeyboardKeyboard
Input Devices - APIsInput Devices - APIs
16
Current ReleasedCurrent Released– DirectX 9.0c (Update December 2004)DirectX 9.0c (Update December 2004)– http://www.microsoft.com/DirectXhttp://www.microsoft.com/DirectX
ComponentsComponents– Direct Graphics (9)Direct Graphics (9)
» Direct3D (9)Direct3D (9) 2D functionality & helper move to Direct3D extension 2D functionality & helper move to Direct3D extension
(D3DX)(D3DX)» DirectDraw (7)DirectDraw (7)
No longer recommendedNo longer recommended
– DirectSound (9)DirectSound (9)– DirectInput (8)DirectInput (8)– DirectPlayDirectPlay (8)(8)
» Will have new update through 12/31, 2004 Will have new update through 12/31, 2004 (?)(?)
– DirectMusic (8)DirectMusic (8)– DirectShow (8)DirectShow (8)
DirectXDirectX
17
Current ReleasedCurrent Released– DirectX 9.0c (Update December 2004)DirectX 9.0c (Update December 2004)– http://www.microsoft.com/DirectXhttp://www.microsoft.com/DirectX
ComponentsComponents– DirectX Graphics (9)DirectX Graphics (9)
» Direct3D (9)Direct3D (9) 2D functionality & helper move to Direct3D extension 2D functionality & helper move to Direct3D extension
(D3DX)(D3DX)» DirectDraw (7)DirectDraw (7)
No longer recommendedNo longer recommended
– DirectSound (9)DirectSound (9)– DirectInput (8)DirectInput (8)– DirectPlayDirectPlay (8)(8)
» Will have new update through 12/31, 2004 Will have new update through 12/31, 2004 (?)(?)
– DirectMusic (8)DirectMusic (8)– DirectShow (8)DirectShow (8)
DirectXDirectX
18
2D vs 3D2D vs 3D– DirectDraw is no longer existingDirectDraw is no longer existing– Use textures for imagesUse textures for images– Use D3DXSprite interfaceUse D3DXSprite interface– Local game companies’ hurt!Local game companies’ hurt!
Shaders vs Fixed Rendering PipelineShaders vs Fixed Rendering Pipeline– GPU impactGPU impact
DirectX vs OpenGLDirectX vs OpenGL– DirectX -> OpenGLDirectX -> OpenGL
» No 2D any moreNo 2D any more» Much more easy to codeMuch more easy to code
– OpenGL -> DirectXOpenGL -> DirectX» Shader extensionShader extension» More rendering features for texturesMore rendering features for textures
Something about DirectXSomething about DirectX
19
MilestonesMilestones– 1. “Walk through”1. “Walk through”– 2. “Combat system” without FX & AI2. “Combat system” without FX & AI– 3. Add NPC AI3. Add NPC AI– 4. Add FX4. Add FX– 5. Cheat code system5. Cheat code system– 6. Levels6. Levels– 7. Add village system7. Add village system
» Major mapMajor map» VillageVillage» ……
– 8. Add cut scenes8. Add cut scenes
Game Production MilestonesGame Production Milestones
20
We have been teaching some necessary We have been teaching some necessary skills & knowledge for 3D game skills & knowledge for 3D game programming in the last 4 months.programming in the last 4 months.
We have 5 home assignments to simulate a We have 5 home assignments to simulate a war game programming jobs.war game programming jobs.
But actually we teach just-enough since But actually we teach just-enough since game type is different and the whole game type is different and the whole experience might be different.experience might be different.
This is a basic course for game This is a basic course for game programming.programming.
Next steps you can :Next steps you can :– Game engine programmingGame engine programming– Network game programmingNetwork game programming
SummarySummary
21
You might need an API for you to program a You might need an API for you to program a game.game.– Not just based on DirectX or OpenGLNot just based on DirectX or OpenGL
The game software is pretty complicated The game software is pretty complicated compared to the other software developmentcompared to the other software development– Different fields of expert involvedDifferent fields of expert involved
» Game designersGame designers CreativityCreativity
» 2D/3D artists2D/3D artists Visual artVisual art
– Not-very-friendly platformsNot-very-friendly platforms» Most of the players do not have the same level of HW as Most of the players do not have the same level of HW as
yoursyours» But they still want the same playing quality as you gotBut they still want the same playing quality as you got» PC, consoles, …PC, consoles, …
But the game programming has funBut the game programming has fun
ConclusionConclusion
22
Game Developer MagazineGame Developer Magazine Game Developer ConferenceGame Developer Conference
– GDC’05 in San Francisco during Mar, 07-11GDC’05 in San Francisco during Mar, 07-11– http://www.gdconf.com/http://www.gdconf.com/
Game Programming GemsGame Programming Gems AI Game Programming WisdomAI Game Programming Wisdom Real-time Rendering, 2Real-time Rendering, 2ndnd Edition Edition
– AK PetersAK Peters Microsoft DirectX 9 Programmable Graphics PipelineMicrosoft DirectX 9 Programmable Graphics Pipeline Programming Vertex and Pixel ShadersProgramming Vertex and Pixel Shaders
– Charles River Media, Wolfgan EngelCharles River Media, Wolfgan Engel Siggraph Courses & ProceedingsSiggraph Courses & Proceedings
Some Suggested ReferenceSome Suggested Reference