Book Image

Python Game Programming By Example

By : Alejandro Rodas de Paz, Joseph Howse
Book Image

Python Game Programming By Example

By: Alejandro Rodas de Paz, Joseph Howse

Overview of this book

With a growing interest in learning to program, game development is an appealing topic for getting started with coding. From geometry to basic Artificial Intelligence algorithms, there are plenty of concepts that can be applied in almost every game. Python is a widely used general-purpose, high-level programming language. It provides constructs intended to enable clear programs on both a small and large scale. It is the third most popular language whose grammatical syntax is not predominantly based on C. Python is also very easy to code and is also highly flexible, which is exactly what is required for game development. The user-friendliness of this language allows beginners to code games without too much effort or training. Python also works with very little code and in most cases uses the “use cases” approach, reserving lengthy explicit coding for outliers and exceptions, making game development an achievable feat. Python Game Programming by Example enables readers to develop cool and popular games in Python without having in-depth programming knowledge of Python. The book includes seven hands-on projects developed with several well-known Python packages, as well as a comprehensive explanation about the theory and design of each game. It will teach readers about the techniques of game design and coding of some popular games like Pong and tower defense. Thereafter, it will allow readers to add levels of complexities to make the games more fun and realistic using 3D. At the end of the book, you will have added several GUI libraries like Chimpunk2D, cocos2d, and Tkinter in your tool belt, as well as a handful of recipes and algorithms for developing games with Python.
Table of Contents (9 chapters)
8
Index

What this book covers

Chapter 1, Hello, Pong!, details the required software, its installation, and the basic syntax of Python: data structures, control flow statements, object orientation, and so on. It also includes the first game of the book, the classic "Hello, world" game.

Chapter 2, Cocos Invaders, introduces the cocos2d game engine and explains how to build a game similar to Space Invaders to put this knowledge into practice. Here, you learn the basics of collisions, input handling, and scene setup.

Chapter 3, Building a Tower Defense Game, is where you learn to develop a full-fledged game with cocos2d. This game includes some interesting components, such as a HUD and a main menu.

Chapter 4, Steering Behaviors, covers seemingly intelligent movements for autonomous characters. You will be adding these strategies gradually, in different levels of a basic game built with particle systems.

Chapter 5, Pygame and 3D, presents the foundations of 3D and guides you through the basic structure of an OpenGL program.

Chapter 6, PyPlatformer, is where you develop a 3D platformer game with all the techniques learned in the previous chapter.

Chapter 7, Augmenting a Board Game with Computer Vision, introduces the topic of computer vision, which allows software to learn about the real world via a camera. In this chapter, you build a system to analyze a game of checkers (draughts) in real time as players move pieces on a physical board.