Preface

Pygame is a fun Python API with which we can easily create simple games. It has support for drawing, sound, images, animation, OpenGL, and more. We will explore many aspects of Pygame with more than 20 recipes in this book. The book is self-contained and only assumes that you have basic knowledge of Python programming. You are encouraged to try out all the example games and modify them to your own needs.

What this book covers

Preparing your development environment (Simple) is a basic recipe that will help you with the installation of all the necessary software required in your development environment.

Running a simple game (Simple) is where we will create a basic game to get us started. The game demonstrates fonts and screen management in the time-honored tradition of Hello world examples.

Drawing with Pygame (Simple) teaches us how to draw basic shapes such as rectangles, ovals, circles, lines, and others. We will also learn important information about colors and color management.

Animating objects (Simple) starts with the "Hit the avatar!" running game example of this book. We will learn how to animate objects in our funny little game.

Using fonts(Simple) is about fonts and font management.

Using Matplotlib with Pygame (Simple) lets us plot a graph within Pygame with the amazing open source Python plotting library Matplotlib. Matplotlib is highly versatile and offers a ton of features for plotting and visualization.

Accessing surface pixel data (Intermediate) shows us how to manipulate pixel data stored in special arrays for efficient drawing. The efficient NumPy open source Python mathematical library is introduced in this recipe.

Accessing sound data (Simple) has us process audio data as arrays. This recipe requires you to listen well while running the example code for this recipe.

Playing a movie (Intermediate) guides us through the steps required to play a movie. The value an in-game movie will add to your game is just priceless.

Pygame on Android (Intermediate) introduces us to the wonderful world of Android. Android is a well-known open source mobile computing framework originally created by Google. We create an example Android game in the process.

Artificial intelligence (Intermediate) is a hot topic these days. We dive right in with the popular Scikits-learn open source Python framework. Of course, this is a huge topic that could require years to master. We expose the tip of the iceberg and give clustering a go.

Drawing sprites (Intermediate) talks us through sprite management. Sprites is a term from computer graphics denoting two-dimensional visible objects that we can manipulate on the screen. Sprites can be grouped together for easier management.

Using OpenGL with Pygame (Advanced) helps us get a hold on OpenGL, a famous open source graphics framework that is available on a variety of platforms and programming languages. OpenGL is used in the industry to render complex two-dimensional and three-dimensional objects.

Detecting collisions (Intermediate) is essential for good game development, whether we are crashing into a car, deploying air-to-air missiles, or playing football. We will give tips on how to detect collisions with ease.

Adding networking functionality (Advanced) runs us through a rudimentary client-server setup. We will use the brilliant open source Python Twisted framework to create a networked game. The game requires us to guess a word that is only known at the server side.

Debugging your game (Intermediate) gives you the life-saving debugging techniques you will need to create a robust working game. Debugging is stressful, so it helps when you have reliable tools. We will introduce such a tool.

Profiling your code (Intermediate) is something you should do to ensure that your game performs well. Tips and ideas are given in this recipe to facilitate the profiling process.

Puzzle game with Pygame (Advanced) showcases an interactive client-server game, building on all the previously learned material.

Simulating with Pygame (Advanced) simulates life in a simplistic yet fun manner.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset