
Programming Linux Games
Building Multimedia Applications with SDL, OpenAL, and Other APIs
Résumé
Programming Linux Games discusses the most important Linux multimedia toolkits and teaches the basics of game programming, all in the context of real-world examples. The author starts with an overview of Linux gaming and then introduces the use of essential tools in the Linux development environment. Detailed discussions cover such topics as graphics, sound, and input programming; audio programming to get the most out of the major audio APIs; how to develop a powerful game engine and write a game in Tcl; the X Window System and its performance; networked gaming; and Linux game licensing issues.
Table of Contents- Foreword ..... I
- Preface ..... III
- Who This Book Is For ..... IV
- Online Resources ..... IV
- Acknowledgments ..... V
- 1: The Anatomy of a Game ..... 1
-
- A Quick Survey of Game Genres ..... 2
- Simulation Games ..... 2
- First-Person Shooters ..... 4
- Real-time Strategy Games ..... 6
- Turn-Based Strategy Games ..... 7
- Role-Playing Games ..... 7
- Puzzle Games ..... 9
- Multiuser Dungeons ..... 10
- A Quick Look Under the Hood ..... 11
- The Input Subsystem ..... 12
- The Display Subsystem ..... 12
- The Audio Subsystem ..... 13
- The Network Subsystem ..... 14
- The Update Subsystem ..... 14
- The Game Loop ..... 15
- 2: Linux Development Tools ..... 17
-
- Programming Editors ..... 17
- vi ..... 18
- Emacs ..... 19
- NEdit ..... 20
- Compiling Programs Under Linux ..... 20
- Using the Make Utility ..... 24
- Creating Makefiles ..... 24
- Error Handling ..... 28
- Working with Libraries ..... 29
- Static Libraries ..... 29
- Shared Libraries ..... 29
- Linux Linker Quirks ..... 32
- Debugging Linux Applications ..... 33
- Compiling for Debugging ..... 33
- gdb ..... 34
- ddd ..... 41
- Bug Tracking ..... 42
- Project Management with CVS ..... 42
- A Brief Tutorial on CVS ..... 43
- Other Useful Tools ..... 49
- Rapid Text Searching with grep ..... 49
- Updating Source with diff and patch ..... 50
- 3: Linux Gaming APIs ..... 53
-
- Graphics APIs ..... 55
- SVGALib ..... 55
- GGI ..... 56
- SDL ..... 56
- C1anLib ..... 57
- OpenGL ..... 57
- Plib ..... 57
- Glide ..... 58
- Xlib ..... 58
- Graphical User Interface Toolkits ..... 59
- GTK+ ..... 59
- Tk ..... 59
- Fltk ..... 60
- Qt ..... 60
- SDL GUI Support ..... 60
- Audio APIs ..... 61
- OSS ..... 61
- ALSA ..... 62
- ESD ..... 62
- OpenAL ..... 63
- Scripting Libraries ..... 63
- Tcl ..... 63
- Guile and MzScheme ..... 63
- Python and Perl ..... 64
- Networking APIs ..... 64
- BSD Sockets ..... 65
- OpenPlay ..... 65
- IPX and SPX ..... 65
- File Handling ..... 66
- libpng and libjpeg ..... 66
- libaudiofile and libsndfile ..... 67
- Ogg Vorbis ..... 67
- The SDL MPEG Library, SMPEG ..... 68
- zlib ..... 68
- 4: Mastering SDL ..... 69
-
- Computer Graphics Hardware ..... 70
- The Framebuffer ..... 71
- The SDL Video API ..... 72
- Setting Up the Display ..... 74
- Direct Surface Drawing ..... 77
- Drawing with Blits ..... 83
- Colorkeys and Transparency ..... 87
- Loading Other Image Formats ..... 92
- Alpha Blending ..... 92
- Achieving Smooth Animation with SDL ..... 97
- Input and Event Processing ..... 107
- Processing Mouse Events ..... 108
- Processing Keyboard Events ..... 112
- Processing Joystick Events ..... 116
- Multithreading with SDL ..... 120
- SDL Audio Programming ..... 125
- Representing Sound with PCM ..... 125
- Feeding a Sound Card ..... 128
- An Example of SDL Audio Playback ..... 129
- Integrating OpenGL with SDL ..... 140
- Penguin Warrior ..... 144
- Creating Graphics ..... 146
- Implementing a Parallaxing Scroller in SDL ..... 147
- A Simple Particle System ..... 153
- Game Timing ..... 158
- 5: Linux Audio Programming ..... 161
-
- Competing APIs ..... 162
- Introducing Multi-Play ..... 163
- Loading Sound Files ..... 164
- Using libsndfile ..... 164
- Other Options ..... 170
- Using OSS ..... 170
- Reality Check ..... 175
- Achieving Higher Performance with Direct DMA Buffer Access ..... 178
- Playing Sound with ALSA ..... 187
- Sharing the Sound Card with ESD ..... 195
- Building Multi-Play ..... 200
- Environmental Audio with OpenAL ..... 206
- OpenAL Basics ..... 207
- Adding Environmental Audio to Penguin Warrior ..... 213
- Implementing Game Music with Ogg Vorbis ..... 222
- Working with Vorbis Files ..... 223
- Adding Music to Penguin Warrior ..... 227
- 6: Game Scripting Under Linux ..... 237
-
- A Crash Course in Tel ..... 238
- Built-in Tel Commands ..... 241
- Interfacing Tel with C ..... 245
- Linking Against Tel ..... 246
- Executing Scripts ..... 246
- Understanding Commands and Objects ..... 250
- A Simple Scripting Engine ..... 252
- Designing a Game Script ..... 258
- Applying Scripting to the Real World ..... 265
- Single Versus Multiple Contexts ..... 266
- Can We Trust the Script? ..... 267
- Script Performance ..... 267
- Who's Writing the Script? ..... 268
- 7: Networked Gaming with Linux ..... 271
-
- 'Tis a Big Net, Quoth the Raven ..... 272
- Internet Protocols ..... 272
- Addresses and Ports ..... 273
- Name Resolution ..... 274
- Socket Programming 101 ..... 275
- Sockets ..... 275
- Connecting TCP Sockets ..... 276
- Receiving TCP Connections ..... 285
- Working with UDP Sockets ..... 292
- Multiplayer Penguin Warrior ..... 300
- Network Gaming Models ..... 301
- Penguin Warrior's Networking System ..... 302
- Network Game Performance ..... 311
- Security Issues ..... 312
- 8: Gaming with the Linux Console ..... 315
-
- Pros and Cons of the Linux Framebuffer ..... 316
- Setting Up a Framebuffer Device ..... 318
- A First Foray into Framebuffer Programming ..... 318
- Setting Framebuffer Video Modes ..... 326
- How Video Scanning Works ..... 327
- The Mode Database ..... 330
- An Example ..... 330
- Use the Source, Luke! ..... 337
- Console Input Handling ..... 337
- Keyboard Input from a Terminal ..... 338
- Mouse Input with GPM ..... 348
- 9: Finishing Penguin Warrior ..... 355
-
- Adding Weapons ..... 355
- Drawing Phasers ..... 356
- Detecting Phaser Hits ..... 362
- Imposing a Sane Rate of Fire ..... 364
- Creating Status Displays ..... 364
- In Retrospect ..... 375
- 10: To Every Man a Linux Distribution ..... 379
-
- Source or Binary? ..... 380
- Local Configuration ..... 381
- Linux Isn't Alone: Supporting FreeBSD ..... 383
- Packaging Systems ..... 384
- Graphical Installation Goodness: Loki's Setup Program ..... 387
- Understanding the Linux Filesystem Standard ..... 393
- Glossary of Terms ..... 399
- Bibliography ..... 405
L'auteur - John R. Hall
John R. Hall is a computer science student at Georgia Institute of Technology and a contractor with Loki Software
Caractéristiques techniques
PAPIER | |
Éditeur(s) | No Starch Press |
Auteur(s) | John R. Hall |
Parution | 01/08/2001 |
Nb. de pages | 416 |
Couverture | Broché |
Intérieur | Noir et Blanc |
EAN13 | 9781886411494 |
ISBN13 | 978-1-886411-49-4 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse
- Informatique Systèmes d'exploitation UNIX
- Informatique Systèmes d'exploitation Linux
- Informatique Développement d'applications Programmation UNIX / Linux
- Informatique Développement d'applications Programmation graphique et multimédia Programmation de jeux
- Graphisme & Photo Graphisme 3D Direct X et Direct 3D