Beginning Game Development with Python and Pygame

Free Download

Authors:

ISBN: 978-1-59059-872-6, 1-59059-872-5

Size: 9 MB (9025595 bytes)

Pages: 342/342

File format:

Language:

Publishing Year:

Category:

Will McGugan978-1-59059-872-6, 1-59059-872-5

Like music and movies, video games are rapidly becoming an integral part of our lives. Over the years, you’ve yearned for every new gaming console, mastered each blockbuster within weeks after its release, and have even won a local gaming competition or two. But lately you’ve been spending a lot of time thinking about a game idea of your own, or are exploring the possibility of making a career of this vibrant and growing industry. But where should you begin?
Beginning Game Development with Python and Pygame is written with the budding game developer in mind, introducing games development through the Python programming language and the popular Pygame games development library. Authored by industry veteran and Python expert Will McGugan, who most recently worked on the MotorStorm game for Play Station 3, you’ll be privy to insights that will not only help you to exploit PyGame to its maximum potential, but also make you a more creative and knowledgeable games developer all round.
– Learn how to create advanced games by taking advantage of the popular open source Python programming language and Pygame games development library.
– Learn about coding gaming preferences, sound, visual effects, and joystick/keyboard interaction.
– Discover the concepts that are crucial to success in todays gaming industry, such as support for multiple platforms, and granting users the ability to extend and customize your games.
What you’ll learn
– Take advantage of Python and the Pygame library to build compelling cross-platform games.
– Learn to best use these technologies to turn your dream game into reality.
– Create professional games by accounting for sound, special effects, and user interaction through the joystick and keyboard.
– Build both two- and three-dimensional games, and learn more about the factors that contribute to choosing one approach over the other.
– Provide users with the means for extending your games through level creation and custom modifications as a means to build a vibrant community around your product.
– Package your games in a manner that allows even novice computer users to install, use, and update your games with ease.
Who is this book for?
This book has been written for any budding games developer. While knowledge of the Python language helps, it isn’t required. To help new programmers along, two early chapters are devoted to an overview of Python.
About the Apress Beginning Series
The Beginning series from Apress is the right choice to get the information you need to land that crucial entry-level job. These books will teach you a standard and important technology from the ground up because they are explicitly designed to take you from “novice to professional.” You’ll start your journey by seeing what you need to know, but without needless theory and filler. You’ll build your skill set by learning how to put together real-world projects step by step. So whether your goal is your next career challenge or a new learning opportunity, the Beginning series from Apress will take you there. It is your trusted guide through unfamiliar territory!

Table of contents :
Beginning Game Development with Python and Pygame: From Novice to Professional……Page 1
Contents at a Glance……Page 7
Contents……Page 9
About the Author……Page 17
About the Technical Reviewer……Page 19
Acknowledgments……Page 21
Who This Book Is For……Page 23
How This Book Is Structured……Page 24
Contacting the Author……Page 25
Your First Look at Python……Page 27
Numbers……Page 28
Strings……Page 31
Concatenating Strings……Page 32
Parsing Strings……Page 33
Slicing Strings……Page 35
String Methods……Page 36
Modifying List Items……Page 37
Removing List Items……Page 38
List Methods……Page 39
Unpacking……Page 40
Dictionaries……Page 41
Loops……Page 42
Summary……Page 44
Creating Scripts……Page 45
Understanding Booleans……Page 46
And Operator……Page 47
Not Operator……Page 48
Understanding Functions……Page 49
Defining Functions……Page 50
Default Values……Page 51
Introducing Object-Oriented Programming……Page 52
Using Classes……Page 53
Python in Practice……Page 57
Introducing import……Page 61
Math Module……Page 62
Datetime Module……Page 63
Random Module……Page 64
Summary……Page 65
Introducing Pygame……Page 67
Using Pygame……Page 68
Hello World Revisited……Page 70
Retrieving Events……Page 76
Handling Mouse Button Events……Page 79
Handling Keyboard Events……Page 80
Posting Events……Page 82
Full-Screen Displays……Page 83
Resizable Pygame Windows……Page 85
Additional Display Flags……Page 87
Using the Font Module……Page 88
When Pygame Goes Wrong……Page 89
Pygame in Action……Page 90
Summary……Page 91
Using Pixel Power……Page 93
Working with Color……Page 94
Representing Color in Pygame……Page 95
Scaling Colors……Page 97
Blending Colors……Page 99
Using Images……Page 101
Working with Surface Objects……Page 102
Converting Surfaces……Page 103
Rectangle Objects……Page 104
Subsurfaces……Page 105
Setting Pixels in a Surface……Page 106
Locking Surfaces……Page 107
Blitting……Page 108
pygame.draw.rect……Page 109
pygame.draw.polygon……Page 110
pygame.draw.circle……Page 111
pygame.draw.ellipse……Page 112
pygame.draw.line……Page 113
pgame.draw.lines……Page 114
Summary……Page 115
Understanding Frame Rate……Page 117
Moving in a Straight Line……Page 118
It’s About Time……Page 119
Diagonal Movement……Page 123
Exploring Vectors……Page 124
Storing Vectors……Page 125
Vector Magnitude……Page 126
Unit Vectors……Page 128
Vector Addition……Page 129
Vector Negation……Page 131
Vector Multiplication and Division……Page 132
Game Objects Vector Class……Page 133
Diagonal Movement……Page 134
Summary……Page 136
Controlling the Game……Page 137
Detecting Key Presses……Page 138
Directional Movement with Keys……Page 141
Rotational Movement with Keys……Page 144
Implementing Mouse Control……Page 146
Rotational Movement with the Mouse……Page 147
Implementing Joystick Control……Page 150
Joystick Buttons……Page 151
D-pads……Page 154
Analog Sticks……Page 156
Seeing Joysticks in Action……Page 159
Summary……Page 163
Creating Artificial Intelligence for Games……Page 165
Exploring AI……Page 166
Implementing State Machines……Page 167
Game Entities……Page 169
Building Worlds……Page 170
Ant Entity Class……Page 173
Building the Brains……Page 174
Summary……Page 189
Creating the Illusion of Depth……Page 191
Understanding 3D Space……Page 193
Using 3D Vectors……Page 195
Time-Based Movement in 3D……Page 196
Projecting 3D Points……Page 197
Perspective Projections……Page 198
Field of View……Page 199
A 3D World……Page 201
Summary……Page 205
What Is a Matrix?……Page 207
Matrix Components……Page 209
Translation Matrix……Page 211
Scale Matrix……Page 212
Rotation Matrix……Page 213
Matrix Multiplication……Page 215
Matrices in Action……Page 217
Installing PyOpenGL……Page 222
Resizing the Display……Page 223
Initializing OpenGL Features……Page 224
Drawing in Three Dimensions……Page 226
Normals……Page 227
Display Lists……Page 228
Seeing OpenGL in Action……Page 229
Summary……Page 236
What Is Sound?……Page 237
Storing Sound……Page 238
Sound Formats……Page 239
Creating Sound Effects……Page 240
Playing Sounds with Pygame……Page 242
Sound Objects……Page 243
Sound Channels……Page 244
Hearing the Mixer in Action……Page 247
Obtaining Music……Page 252
Playing Music……Page 253
Hearing Music in Action……Page 254
Summary……Page 259
Uploading Textures with OpenGL……Page 261
Texture Coordinates……Page 264
Rendering Textures……Page 265
Seeing Textures in Action……Page 266
Mip Mapping……Page 270
Min and Max Filters……Page 271
Texture Wrapping……Page 272
Storing Models……Page 274
Parsing OBJ Files……Page 275
Seeing Models in Action……Page 276
Using the Model3D Class……Page 283
Summary……Page 286
Understanding Lighting……Page 289
Setting Light Parameters……Page 290
Tweaking Parameters……Page 292
Using Blending……Page 293
Alpha Blending……Page 295
Subtractive Blending……Page 296
Seeing Blending in Action……Page 297
Fog Parameters……Page 301
Seeing Fog in Action……Page 302
Rendering the Backdrop……Page 303
Creating Skyboxes……Page 304
Seeing Skyboxes in Action……Page 305
Where to Go for Help……Page 308
Summary……Page 309
gameobjects.color.Color……Page 311
Methods……Page 312
Attributes……Page 313
Methods……Page 314
Class Methods……Page 315
Methods……Page 316
Attributes……Page 317
Class Methods……Page 318
Creating Windows Packages……Page 319
Building the Installer……Page 320
Creating Packages for the Mac……Page 322
Index……Page 323

Reviews

There are no reviews yet.

Be the first to review “Beginning Game Development with Python and Pygame”
Shopping Cart
Scroll to Top