Programming Linux Games

Programming Linux Games

Programming Linux Games John R. Hall Loki Software, Inc. January 15, 2001 2 Contents Work In Progress i 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 . 5 Turn-based Strategy Games . 7 Role-playing Games . 7 Puzzle Games . 8 Multi User Dungeons . 9 A Quick Look Under The Hood . 11 The Input Subsystem . 11 The Display Subsystem . 12 The Audio Subsystem . 13 The Network Subsystem . 13 The Update Subsystem . 14 The Game Loop . 15 3 4 CONTENTS 2 Linux Development Tools 17 Programming Editors . 17 vi..................................... 18 Emacs . 19 NEdit . 20 Compiling Programs Under Linux . 21 Using The Make Utility . 23 Creating Makefiles . 24 Error Handling . 28 Working With Libraries . 28 Static Libraries . 28 Shared Libraries . 29 Linux Linker Quirks . 32 Debugging Linux Applications . 33 Compiling For Debugging . 33 The GNU Debugger, gdb . 34 The Data Display Debugger . 40 Bug Tracking . 41 Project Management With CVS . 42 A Brief CVS Tutorial . 43 Other Useful Tools . 49 Rapid Text Searching with grep . 49 Updating Source with diff and patch . 50 3 Linux Gaming APIs 53 Times Have Changed . 53 CONTENTS 5 Graphics APIs . 55 SVGALib . 55 General Graphics Interface, LibGGI . 56 Simple DirectMedia Layer, SDL . 56 ClanLib . 56 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 The Open Sound System, OSS . 61 Advanced Linux Sound Architecture, ALSA . 61 The Enlightened Sound Daemon, EsounD . 62 The Open Audio Library, OpenAL . 62 Scripting Libraries . 63 Tcl.................................... 63 Guile and MzScheme . 63 Python and Perl . 64 Networking APIs . 64 6 CONTENTS BSD Sockets . 64 OpenPlay . 65 IPX and SPX . 65 File Handling . 66 libpng and libjpeg . 66 libaudiofile and libsndfile . 66 Ogg Vorbis . 67 The SDL MPEG Library, SMPEG . 67 zlib . 68 4 Mastering SDL 69 Computer Graphics Hardware . 70 The Framebuffer . 71 The SDL Video API . 72 Setting Up The Display . 73 Direct Surface Drawing . 77 Drawing With Blits . 82 Colorkeys And Transparency . 85 Loading Other Image Formats . 89 Alpha Blending . 90 Achieving Smooth Animation With SDL . 95 Input and Event Processing . 105 Processing Mouse Events . 105 Processing Keyboard Events . 110 Joystick Events . 113 Portable Threading Support . 117 CONTENTS 7 SDL Audio Programming . 121 Representing Sound with PCM . 121 Feeding a Sound Card . 124 An Example . 125 Integrating OpenGL with SDL . 135 Penguin Warrior . 139 Creating Graphics . 141 Implementing a Parallaxing Scroller in SDL . 142 A Simple Particle System . 147 Game Timing . 152 To Be Continued... 153 5 Linux Audio Programming 155 Competing APIs . 156 Introducing Multi-Play . 157 Loading Sound Files . 157 Using libsndfile . 158 Other Options . 163 Using the Open Sound System . 163 Reality Check . 168 Squeezing Sound Performance with Direct DMA Access . 171 Playing Sound with ALSA . 181 Sharing the Sound Card with ESD . 187 Building Multi-Play . 192 Environmental Audio with OpenAL . 198 OpenAL Basics . 198 8 CONTENTS Adding Environmental Audio to Penguin Warrior . 204 Implementing Game Music with Ogg Vorbis . 212 Working with Vorbis Files . 213 Adding Music to Penguin Warrior . 216 6 Game Scripting Under Linux 227 A Crash Course in Tcl . 228 Built-in Tcl Commands . 230 Interfacing Tcl With C . 235 Linking Against Tcl . 236 Executing Scripts . 236 Commands And Objects . 240 A Simple Scripting Engine . 241 Designing A Game Script ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    334 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us