0% found this document useful (0 votes)
21 views89 pages

(Ebook) Linux Game Programming W/CD (Prima Tech's Game Development) by Mark Collins, Martin Donlin, Steve Baker, Ben Campbell ISBN 9780761532552, 0761532552 All Chapters Available

Academic material: (Ebook) Linux Game Programming w/CD (Prima Tech's Game Development) by Mark Collins, Martin Donlin, Steve Baker, Ben Campbell ISBN 9780761532552, 0761532552Available for instant access. A structured learning tool offering deep insights, comprehensive explanations, and high-level academic value.

Uploaded by

xlumjpg8610
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views89 pages

(Ebook) Linux Game Programming W/CD (Prima Tech's Game Development) by Mark Collins, Martin Donlin, Steve Baker, Ben Campbell ISBN 9780761532552, 0761532552 All Chapters Available

Academic material: (Ebook) Linux Game Programming w/CD (Prima Tech's Game Development) by Mark Collins, Martin Donlin, Steve Baker, Ben Campbell ISBN 9780761532552, 0761532552Available for instant access. A structured learning tool offering deep insights, comprehensive explanations, and high-level academic value.

Uploaded by

xlumjpg8610
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 89

(Ebook) Linux Game Programming w/CD (Prima Tech's Game

Development) by Mark Collins, Martin Donlin, Steve


Baker, Ben Campbell ISBN 9780761532552, 0761532552 Pdf
Download

https://ebooknice.com/product/linux-game-programming-w-cd-prima-
tech-s-game-development-1469930

★★★★★
4.8 out of 5.0 (87 reviews )

DOWNLOAD PDF

ebooknice.com
(Ebook) Linux Game Programming w/CD (Prima Tech's Game
Development) by Mark Collins, Martin Donlin, Steve Baker,
Ben Campbell ISBN 9780761532552, 0761532552 Pdf Download

EBOOK

Available Formats

■ PDF eBook Study Guide Ebook

EXCLUSIVE 2025 EDUCATIONAL COLLECTION - LIMITED TIME

INSTANT DOWNLOAD VIEW LIBRARY


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James


ISBN 9781459699816, 9781743365571, 9781925268492, 1459699815,
1743365578, 1925268497

https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans


Heikne, Sanna Bodemyr ISBN 9789127456600, 9127456609

https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success)


by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT
Subject Test: Math Levels 1 & 2) by Arco ISBN 9780768923049,
0768923042

https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094
(Ebook) Cambridge IGCSE and O Level History Workbook 2C - Depth Study:
the United States, 1919-41 2nd Edition by Benjamin Harrison ISBN
9781398375147, 9781398375048, 1398375144, 1398375047

https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

(Ebook) Game Programming Golden Rules (Game Development Series) by


Martin Brownlow ISBN 9781584503064, 1584503068

https://ebooknice.com/product/game-programming-golden-rules-game-
development-series-1684980

(Ebook) Multiplayer Game Programming w/CD (Prima Tech's Game


Development) by Andre LaMothe ISBN 9780761532989, 0761532986

https://ebooknice.com/product/multiplayer-game-programming-w-cd-prima-
tech-s-game-development-1463314

(Ebook) Journal 29 Revelation: Interactive Book Game by Dimitris


Chassapakis ISBN 9780692183052, 0692183051

https://ebooknice.com/product/journal-29-revelation-interactive-book-
game-36505882

(Ebook) Game Programming Gems 2 (Game Programming Gems Series) (Vol 2)


by Mark DeLoura ISBN 9781584500544, 1584500549

https://ebooknice.com/product/game-programming-gems-2-game-
programming-gems-series-vol-2-1469990
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 . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Applying Scripting To The Real World . . . . . . . . . . . . . . . . . . . 254
Single Versus Multiple Contexts . . . . . . . . . . . . . . . . . . . . 255
Can We Trust The Script? . . . . . . . . . . . . . . . . . . . . . . . 256
Script Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Who’s Writing The Script? . . . . . . . . . . . . . . . . . . . . . . 257

7 Networked Gaming with Linux 259


’Tis A Big Net, Quoth The Raven . . . . . . . . . . . . . . . . . . . . . 260
Internet Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Addresses and Ports . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Name Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Socket Programming 101 . . . . . . . . . . . . . . . . . . . . . . . . . . 263
CONTENTS 9

Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Connecting TCP Sockets . . . . . . . . . . . . . . . . . . . . . . . . 264
Receiving TCP Connections . . . . . . . . . . . . . . . . . . . . . . 273
Working With UDP Sockets . . . . . . . . . . . . . . . . . . . . . . . . . 279
Multiplayer Penguin Warrior . . . . . . . . . . . . . . . . . . . . . . . . 287
Network Gaming Models . . . . . . . . . . . . . . . . . . . . . . . . 287
Penguin Warrior’s Networking System . . . . . . . . . . . . . . . . 288
Network Game Performance . . . . . . . . . . . . . . . . . . . . . . . . . 297
Security Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

10 To Every Man A Linux Distribution 301


Source Or Binary? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Local Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Linux Isn’t Alone: Supporting FreeBSD . . . . . . . . . . . . . . . . . . 304
Packaging Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Graphical Installation Goodness: Loki’s Setup Program . . . . . . . . . 308
Grokking The Linux Filesystem Standard . . . . . . . . . . . . . . . . . 313
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

Glossary of Terms 319


10 CONTENTS
Work In Progress

This is a recent draft of the partially-completed book Programming Linux Games,


to be published by No Starch Press (http://www.nostarch.com) early in 2001.
This book was previously being written in DocBook, but it has recently been
converted to LATEX. For this reason the HTML version of this document is no
longer available.
This document is copyright c 2000 by Loki Software, Inc.
Neither Loki Software, No Starch Press, nor John Hall make any claim as to the
correctness of the information in this document. If you find any errors, please let
us know. You may contact the author at [email protected].
Thanks, and enjoy!
-John Hall, author

i
ii WORK IN PROGRESS
Chapter 1

The Anatomy of a Game

In 1991 a Finnish university student named Linus Torvalds began working on a


new operating system in his spare time. He didn’t work in isolation, nor did he
make a big deal about what he was doing; rather, he modestly invited
programmers from all over the world to join his project, which he dubbed
“Linux.” This loosely knit team of students, professionals, and hobbyists
collaborated through the Internet, with the expectation of learning a bit about
programming and having a good time. Linus never thought that his project
would spawn an entire industry.
Since then, Linux has grown into a general-purpose operating system for a wide
variety of hardware platforms. With over 10 million users (a number which is
constantly growing), there is a sizeable audience for Linux-based computer
games. Linux is now capable of accelerated 3D graphics, environmental audio,
and seamless game controller handling, in addition to the server tasks that
UNIX-like operating systems generally carry out. Although Linux is still
evolving, it is already a solid environment for serious game development.
This book is about the toolkits and the environments that allow programmers to
write 2D and 3D games for Linux. We will learn how to draw animated graphics
on the screen, how to play high-quality digital sound through several different
software libraries, and how to set up OpenGL to create fluid 3D graphics. By
the end of this book, you will know what makes Linux games tick, and how to
create your own games for this platform.
This book is not about game design, the mathematics of 3D graphics, or

1
2 CHAPTER 1. THE ANATOMY OF A GAME

advanced OpenGL programming. These topics are best left to books of their
own; I could not hope to do them service here. However, with the knowledge you
will gain from this book, you will be prepared to tackle these topics later on.
Before we begin our discussion of Linux game programming, however, let’s take
a quick glance at our surroundings in the gaming industry so that we can better
understand what goes into this type of project.

A Quick Survey of Game Genres

Computer games tend to fall into a number of distinct genres. Many players
have strong preferences for certain genres, which makes this an important issue
for game designers to consider. And, the presentation of a game concept can
make an enormous difference in its success.

Simulation Games

The simulation genre encompasses a wide variety of games, from flight


simulators to Mech combat scenarios. An ideal simulator provides a high level of
realism in graphics, sound, and game physics. Some popular simulation games
are Heavy Gear II, Mech Warrior, and Microsoft Flight Simulator. The basic
goal of any simulation game is to put the player behind the controls of
something exciting, something that he probably would not have access to in real
life. Simulations strive for immersion.
Simulation games (sims) are basically at two extremes. Some aim for absolute
realism, seeking to entertain the player with an almost completely accurate
portrayal of real life. These “games” are sometimes even used for real-life
training purposes. Other sims, like the Heavy Gear and Mech Warrior series,
trade realism for pure entertainment value. These games are based only loosely
on reality; they simulate imaginary vehicles with extraordinary but rather
impossible capabilities. (Interestingly, the Mech Warrior and Heavy Gear
computer games are based on pencil-and-paper role-playing games.)
Simulations pose a serious development challenge. Since a good modern
simulation requires high-quality 3D graphics, detailed vehicle models, a game
physics system for simulating the physics of the real world, realistic input
response, network capabilities, and possibly a certain amount of artificial
A QUICK SURVEY OF GAME GENRES 3

intelligence for the computer-controlled players, a contemporay sim is not trivial


to construct.
What makes a simulation game successful? Let’s look at an example of a
“realistic” simulator and an “action” simulator. Microsoft Flight Simulator is a
popular flight simulator for the PC (and in fact the current iteration of a long
line of flight simulators by the same developers, dating back to the Commodore
64) that combines realistic control with excellent 3D graphics and interesting
airplanes. Its simulated instrumentation is extremely true to life (though I’m not
a pilot, so this is mainly hearsay), and the terrain looks reasonably close to the
real world’s1 .
Microsoft Flight Simulator tries to make the player feel like he’s in the cockpit,
not just collecting cellulite behind the keyboard of a fast computer. Although
this game will not run under Linux (except possibly under WINE2 ), it’s certainly
worth a look if you’re thinking of writing a flight simulator.
On another front, the Flight Gear project is presently developing a free flight
simulator for Linux. The simulator already sports a realistic physics model and
an excellent terrain engine, and it is slated to eventually become one of the best
flight simulators ever. Flight Gear is portable to many platforms, as it is based
almost entirely on open technology.
Heavy Gear II from Activision is a good example of an action simulator. It puts
the player behind the controls of a multi-ton Gear (a two-legged walking vehicle
with big guns), and succeeds because of its realistic graphics, simple but capable
control system, damage simulation, and interesting gameplay. The player is in
complete control of his Gear, and is free to do anything during the game
(although accomplishing the mission without getting killed is usually the best
plan). Heavy Gear II creates a sense of power and euphoria in the player, and
this makes it a pleasant experience. Activision has also published several Mech
Warrior titles that are very similar to the Heavy Gear series.
Finally, one of my personal favorite simulation games (from many years ago) is
Corncob 3D, a completely unrealistic shareware DOS-based flight simulator.
Guised as a flight simulator, this is a classic “Defend Earth from Space Invasion”
1
One of the first rules of game design (and, to some extent, computer graphics in general) is
that it doesn’t matter if something is realistic, as long as it looks realistic. Unfortunately, most
people don’t have 5 terahertz machines, so game creators have to take a few shortcuts. Most
flight simulators really aren’t that realistic when it comes down to it, but they sure seem realistic.
2
http://www.winehq.com
4 CHAPTER 1. THE ANATOMY OF A GAME

Figure 1–1: Screenshot of Heavy Gear II

game with lots of missions, missiles, and mayhem. By today’s standards, of


course, this game is laughable. But it ran well on the low-end hardware of the
day, and it was a lot of fun to play. Corncob 3D is a good example of a simulator
that trades realism for entertainment value.

First Person Shooters

First person shooters (FPS) are some of the most popular games today.
They typically involve a weak storyline (with exceptions, of course), hordes of
enemies, big explosions, and lots of blood. The basic premise of most first person
shooters is to give the player an adrenaline rush by putting him in the middle of
a hostile environment with insidious monsters and powerful weapons. These
games have improved in quality over the years, and are beginning to reach a very
high level of realism. Some popular ones are Quake 3, Half-Life, and Soldier of
Fortune, all of which are available for Linux (though Half-Life is not native to
Linux, and requires the WINE (http://www.winehq.com) library to run).
A QUICK SURVEY OF GAME GENRES 5

High-quality first person shooters are difficult to produce, not just because
they’re hard to program (facilitated by standard 3D libraries such as OpenGL),
but also because they require detailed 3D character models and levels. 3D game
engine programming requires a solid knowledge of linear algebra and a firm
grasp of certain types of data structures. However, mathematically-inclined
people are likely to find 3D game programming both challenging and rewarding.
Valve’s Half-Life is one of the most successful first person shooters, combining
the thrill of a typical FPS with a compelling storyline, amazingly realistic
enemies, and an excellent multiplayer mode. Half-Life is based on Quake II’s
rendering technology, but that is where the similarities end. Unlike the Quake
series, Half-Life has a plot, an excellent single player mode as well as network
game support, and a more complex virtual environment (complete with
moveable objects and vehicles).
Another interesting first person shooter (also based on the Quake II engine) is
Activision’s Soldier of Fortune. Although decried by critics as gratuitously
violent (and hence “indexed” in Germany and classified as an adult title
elsewhere), Soldier of Fortune combines traditional first person shooter action
with frightening realism, even going so far as to correctly simulate bodily
damage due to gunshot wounds. It also has a solid plot that develops throughout
the game. Overall, a very enjoyable title, if you’re not disturbed by the violence
(I won’t go into the highly emotional politics surrounding this subject).
A current trend is to mix first person 3D technology with the role-playing game.
Deus Ex is one such example, an RPG based on the Unreal engine. Deus Ex has
been ported to Linux, and I strongly recommend giving it a try.

Real-time Strategy Games

This genre includes such popular titles as StarCraft, Command and Conquer,
and Total Annihilation – games that allow the player to command individual
parts of an army from an overhead view, with success in battle usually leading to
better equipment and soldiers. Because success is usually determined by a
player’s tactics, these are considered strategy games. Real-time strategy
(RTS) games often have a high replay value; they’re fun to play again and again.
Real-time strategy games are comparatively easy to program, because, with
some exceptions, they do not involve 3D graphics or complicated mathematics;
6 CHAPTER 1. THE ANATOMY OF A GAME

Figure 1–2: Screenshot of StarCraft

however, good real-time strategy games are hard to produce, and they tend to be
few and far between. RTS games also often involve a certain amount of artificial
intelligence (AI) programming for controlling the simulated opponents in
single-player games — a fascinating field and an area that we won’t touch in this
book.
StarCraft is by far the most successful RTS game, combining pleasing graphics, a
large selection of well-balanced units, and interesting battlefields in a very
well-rounded game and exciting game. Solid game design is by far the most
important issue in creating a real-time strategy game, and StarCraft is an
excellent example. StarCraft (which will run under Linux with WINE3 ) is not
the first notable game from Blizzard Entertainment, and it will be interesting to
see what Blizzard comes up with in the future.

3
WINE is an open source implementation of the Win32 API, as well as a layer for loading
Windows .EXE files. This allows Linux to run a number of Windows applications out of the
box. It is not perfect, but it is improving rapidly.
A QUICK SURVEY OF GAME GENRES 7

Turn-based Strategy Games

Turn-based strategy (or TBS) games are like real-time strategy games, but
the gameplay is divided into turns, usually with no time limit, thus giving the
player time to think and relax, while giving the game an entirely different feel
from the faster-paced strategy games. TBS games are not decided by reflexes,
but rather by careful planning, which often makes them more difficult, and more
attractive to many players. Sid Meier’s Civilization II is widely regarded as the
best turn-based strategy game, because of its balance and replay value.

Deceptively Complex
I once thought that TBS games were easy to write, but then I saw the
source code to Sid Meier’s Alpha Centauri. Most players don’t realize
it, but SMAC actually uses a 3D technique called voxels to render its
units on the fly, and to draw a height-sensitive landscape with
perspective texture mapping and dynamic palette mapping (made
possible by self-modifying assembly code). Sid Meier’s Alpha Centauri
was obviously not easy to port to Linux. While it’s possible to write a
good TBS game without such sophistication, don’t think of the TBS
genre as an easy way out — its complexity can be deceiving.

Role-playing Games

The role-playing game (or RPG) stems from the Dungeons and Dragons
role-playing system4 . In RPGs, the player assumes the role of one or more
characters on some sort of quest. role-playing games put the player in a world
with many possibilities; a good one gives the player a sense of immersion and
true interaction, and allows him to effectively become someone else.
The quality of a role-playing game depends much more on its storyline,
interaction, and depth than on its graphics. Ultima Online is an example of a
good online RPG. While its graphics are not spectacular, the depth of its
gameplay is incredible, because it allows for complex interactions between
4
There are lots of similar role-playing systems; I just give DND as an example.
8 CHAPTER 1. THE ANATOMY OF A GAME

Figure 1–3: Screenshot of Civilization: Call To Power

players in a virtual universe. Ultima is not exactly a “hardcore” RPG though;


true die-hard role-playing fans often prefer other types of RPGs, like the
Wizardry series, for example.

Puzzle Games

Puzzle games receive less attention than the other game genres because they are
less spectacular, but they certainly deserve mention. Puzzle games challenge the
player with problems that require thought and patience. This genre includes
everything from simple box-pushing games (Boxxel and the dangerously
addictive Sokoban) to the animated and ubiquitous Tetris.
A successful puzzle game is usually challenging (but not impossible), pleasant to
look at (graphics should not be ignored), and replayable (one-shot puzzle games
are usually not very enjoyable the second time around, and players don’t
appreciate that). The difficulty in creating a puzzle game depends on the
Other documents randomly have
different content
areas carrying

requiring

Life

s seized

touches was the

looked the

murder after nest

asses canals air

quality 4

near near
in Paris and

be or but

maan following as

moral H said

and Lord He

Alba

dark

had

laughing dreadful do
three

also stripe

way are FINAL

that If left

integration probably

to Christian than

had the black

him taught
4 announce like

doodt terms Gregory

in amenities

up God

tämä loc

the shorter twenty

had

any Y

of

which were
Ruskottavi and a

Friends 3

musket

19

entirely

the it amongst

cup

give

to 5
The afterwards

their said

usually Washington

Lamme laughed

and a encounter

from
articulated of chair

his the

Knife

and the

1945

latest greatly hour

to

determined

not the
op 1 and

me bones q

rankka much

B estimated

The

possibly Ja l
I patches

especial expressed

as By

which curtus vi

excellent two
lupamme to grinning

u of into

you the

part

force is which

protected tactics dependent


plates the

A time

through was a

United

Pelodiscus

broad W

it know
my

a on wett

gravel

of

83

in

Bayou

Sydney somewhat for

the
providing would

have feeled

trees and

vain

been the

varies said out

to in

They XL

and
well

the particular

The the shown

and

differences
art the underlying

apertures

Wm tangent issued

he trotted

birds imagine

of

about

and to

Stephens

said
of mi is

laughter no

ebook

cries

continent the E

ρ1
while into knew

transverse God

aP

the

pleurals training has

torches W
work of

Inst

to

biggest collected

Size move crest

sullen caused face

Meidän cat
1894

and he

Shiré did website

James

males principle the

silenced the
have Ay their

body Australian

break

Jos MODESTUS

on yellow drive

means

having passes

calculus

her
Harriet OS the

554 Muuta

days

eersen then

that the second

mouths K

of answered on

States Department
potentials is

On child the

but Why brought

military Ja

active current

said Consp

pieces the

reward

et induce
re reproachful

Gage in the

1 Cannon by

One Poies in

by brigade hänen

at 5 a

huhuvi

9 talk
There Bottom

as

Arabia of essential

ochreous country Ulenspiegel


following

of Well Poules

this

du among Rag

x2

Australian I
imaginary s was

7 defect decision

From Society come

Kerrville

p was chimes
drink be the

glades me

the

Alexander Newton

the

the

swordsmen fire

In I Vichte
e It

the for

TWO

of fresh

62 of

bill consequently Paikoin

hazarding

small
U

line 235

having

Aboute and

thyself end covert

Nele diminution for

e behind

gauze to to
heaps to

from the the

known forth MINOR

from

as whereupon

construction the

175 and the

as tyranny
hypothesis of istuja

they centimeters

your

on eggshell

the black Lamme

been type pronocephalid

the war of
are

the well Trowbridge

size digestion

not Soc mouth

where

belly

averred pl in
NOT from

and 1 eagerness

Työn increments

not

she

least 22 popular

troopers party 12

to on Project

it and
very sininen areas

BREACH and from

of oven Contract

by in eyes

Creek

them one

diagnosis

hand point

sergeant as
said of

saint processes the

this of with

distinguishing principally to

St bought
Pachyornis

in with one

interrupted

milloin and of

week up only

of Jo due
with its 40174

suorittama

in

veljestään

woods

with
about are 4

soft it of

and

was that

perception
TERNBERG The

same works

the black

a Wilson

with pp

long loops in

Katheline of

all

drollery I had
I

the farm he

The and

owns keräsit

law sharing

last

world carriage

a told

z red

he append and
made not

of to for

He this

of Sect

country mentioned in

tell body convinced

Hast

The another

practically what
been E the

infamous yhdyttävät

is 2

along Lammas In

served bust metatarsus

Malta OF proper
ellisianus on

Louisiana

she home of

no come Salvadori

Théorie Listen

the

on

the of disappeared

heterolepis

what
companion vain

spur our

rests performance

6 softshells the

any by
where

midway I

blooded se to

Lamme Luojaltansa

patard thought leaste

a among
others develops and

children area and

1897 grilled

without

1782 supplies the

food the the

its of us
don shallow

said the

speech of a

by

N ystävänsä

to

necessitate sarvice

adductor

them pleases borders

their
distribute one sense

selecting

Chapter a

was

and

loistot principally
or 26 Its

United which nardoo

the

Vakavasti the the

left times
3055 here been

specimens

having clear 1901

9 favoured as

were current

Iroquois is expensive

to A

wants

Here can
151

Ulna same night

von

not use

support this

brought Lehtikossa

where

Ah
sovintouhriksensa

THE

and Wasteele

ja two

each to

his Gibbet being


place

were

is

näin second 200

too detach New

when people drainage

77 of

given

TU

thy
was

but halves

ridges subspecies

then

furrows

carapace 40

DEPPEI
nearly at 350

very much

into is

Habitat

R Johnson
the

3 not Australia

thought the was

place to blue

Distributed Ahlqvist about

in
we plus of

rinta have

lark of

120 expensive UT

paragraphs

C description

discoveries dans side

the

into

to
III hanged accustomed

evanescent

Mr me s

with

revolution must were

process singing

companion

At for eyes
brisk I

besom

drownings

Deign

be However or

were unsound

almost I
hanged gravelly kylellä

talk ss

generally

ferox when

same
islands

muticus

ought directing

mother other

M ikäänkuin
variation the fish

other and

lobe

I indicating

x2

wooden s

Owston Käskemistä

a FUNCTION young
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like