130 likes | 420 Views
Introduction to Game Programming Pertemuan 11. Matakuliah : T0944-Game Design and Programming Tahun : 2010. The Component of Game Programming. Game Loop. Shutdown. Initialization. Synchronize Display. Retrieve Player Input. Perform AI and Game Logic. Render Next Frame.
E N D
Introduction to Game ProgrammingPertemuan 11 Matakuliah : T0944-Game Design and Programming Tahun : 2010
The Component of Game Programming Game Loop Shutdown Initialization Synchronize Display Retrieve Player Input Perform AI and Game Logic Render Next Frame
The Component of Game Programming Initialization Memory allocations, resource acquisition, loading data from disk, etc. Enter Game Loop This is where the action begins and continues until user exits the main loop. Retrieve Player Input Retrieve player input from keyboard, mouse or joystick. Perform AI and Game Logic This section contains the majority of the game code. Render Next Frame This section draws the image on an off-screen buffer area, and then copied very quickly to the visible display. Synchronize Display Manage the frame rate. Usually 30 fps is considered to be optimal. Shutdown Indicates the end of the game. This section perform cleanup and exit to operating systems.
Windows Programming Model Multitasking Windows allows a number of different applications to be executed simultaneously an a round robin fashion, where each application gets a small time slice to run in and then the next application takes its turn. Game Program Print Spoiler Paint Program CPU Word Processor
Windows Programming Model Multithreading Programs are really composed of a number of simpler threads of execution. These threads are scheduled just like heavier-weight processes, such as programs. Process 0 Thread 0 Thread 1 Thread 2 CPU Thread 0 Thread 1 Thread 0 Thread 1 Thread 2 Process 1 … Process n
Windows Programming Model Event-Driven Model Windows programs sit and wait for the user to do something, which fires an event, and the Windows responds to the event an takes action. System Event Queue Message 1 Message 2 … … … Message n WinMain(){ … } WinMain(){ … } WinProc() Local Even Queue Local Even Queue WinProc()
API (Application Programming Interface) Is a programmatically implemented interface provided in the form of a library. This interface provide a certain number of services for use by an application program. Common APIs: Windows 32 API. int MessageBox(HWND hwnd, LPCTSTR lptext, LPCTSTR lpcaption, UINT utype) DWORD GetTickCount(void); Windows GDI BOOL LineTo(HDC hdc, int xEnd, int yEnd) BOOL Rectangular (HDC hdc , int nLeftRect , int nTopRect , int nRightRect , int nBottomRect) OpenGL graphic API Microsoft DirectX API Sun Microsystem’s Java Platform Xbox 360’s XInput API
Introduction to DirectX Basically a system of software that abstracts video, audio, input, networking, installation, and more. DirectX technology is many times faster and more robust that GDI and/or MCI (Media Control Interface) Direct Draw Direct 3D Direct Input Direct Play Direct Setup Direct Sound Direct Sound 3D Direct Music Direct Show Windows Win32 Application GDI Windows Device Driver Interface Hardware Emulation Layer Hardware Abstraction Layer Hardware: Audio, Video, Input, Storage
Introduction to OpenGL Is a procedural-based 3D graphics API explicitly designed by Silicon Graphic for the standardized development of 3D and 2D graphical applications. OpenGL is also designed for the creation and execution of graphical applications over networked computing enviroment. Example: glColor(), glVertex(), glBegin()
Game Programming Topics Algorithm, Data Structure, Memory Management Arrays, Linked List, Recursion, Tree, Multiple Player Management Artificial Intelligence Deterministic Algorithm, Patterns and Scripts, Behavioral state system, Memory and Learning, Path-finding, Neural Network, Genetic Algorithm, Fuzzy Logic. Physic Modeling Fundamental laws of physics: Mass, Time, Position, Velocity, Acceleration, Force, Momentum. Gravity, Friction, Collision response, Forward kinematics, Particle system.
Game Programming Resource Game Programming Website http://www.gamedev.net http://www.gamesdomain.com http://www.gdconf.com Game Development Magazine http://www.gdmag.com http://www.gamasutra.com