Book Image

Panda3D 1.6 Game Engine Beginner's Guide

Book Image

Panda3D 1.6 Game Engine Beginner's Guide

Overview of this book

Panda3D is a game engine, a framework for 3D rendering and game development for Python and C++ programs. It includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Also, Panda3D is Open Source and free for any purpose, including commercial ventures. This book will enable you to create finished, marketable computer games using Panda3D and other entirely open-source tools and then sell those games without paying a cent for licensing. Panda3D 1.6 Game Engine Beginner's Guide follows a logical progression from a zero start through the game development process all the way to a finished, packaged installer. Packed with examples and detailed tutorials in every section, it teaches the reader through first-hand experience. These tutorials are followed by explanations that describe what happened in the tutorial and why. You will start by setting up a workspace, and then move on to the basics of starting up Panda3D. From there, you will begin adding objects like a level and a character to the world inside Panda3D. Then the book will teach you to put the game's player in control by adding change over time and response to user input. Then you will learn how to make it possible for objects in the world to interact with each other by using collision detection and beautify your game with Panda3D's built-in filters, shaders, and texturing. Finally, you will add an interface, audio, and package it all up for the customer.
Table of Contents (22 chapters)
Panda3D 1.6 Game Engine
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing optional tools


There are a couple of optional tools that you can get for free and are worth pointing out. These tools are great for specific things, but none of them are strictly necessary for this book since all of the content they create is provided with the book. Nevertheless, we'll mention them here and provide tutorials on using some of them in the appendices for later projects when you've finished this book and need to create your own content for your own games. Since these tools are optional we won't go step-by-step through their installations, but we will tell you where you can find them.

Blender and Chicken

Blender is an open source, free to use, 3D modeling and animation package based in Python. It's a full service package that's quite powerful and even used in some professional studios. Furthermore, it has an active community and lots of tutorials available on the web to help get new users up to speed with the program. A significant portion of the Panda3D community uses Blender to create their 3D content as well.

Another feather in Blender's cap isn't part of the core package but bears mentioning. That is Chicken, a plug-in for Blender that exports models and animations in .egg files, one of the formats that Panda3D uses. Chicken let's you directly export from Blender to Panda3D without any intermediate conversions, and if you have experience with game development you know how nice that sort of simple pipeline from content creation to implementation really is. If you don't have that experience, then take our word for it. It's really nice.

You can find Blender, and some Blender tutorials, at www.blender.org. Blender v2.5 introduces some major changes that Chicken is not currently compatible with, so it may be wise to get an older version. Blender is available in executable installers, and all the default options work just fine. Do note that Blender doesn't come with Python like Panda3D does. To get the most out of Blender, install the version of Python it requires. For example, Blender v2.49 requires Python v2.6. The version of Python that comes with Panda3D is v2.5, so that won't work. Also, the latest version of Python at the time of this writing, v2.7, also won't work. Python does offer older versions on their website, and version 2.6.6 will work with Blender v2.49. Python also comes in executable installers, and again the default options are fine. Having both versions of Python on one computer won't cause any conflicts either. The Blender installer will direct us to the Python website when it fails to detect a Python version that it can use, but that website is at www.python.org if needed. Python documentation can also be found there.

You can find Chicken at http://chicken-export.sourceforge.net/. Chicken doesn't provide an executable installer, but the zip file that it does come in has a text file with installation instructions for various platforms in it. Note that in order for Chicken to work with Blender, the appropriate version of Python must be installed as noted in the previous paragraph.

Spacescape

The next optional tool was created by Alex Peterson and is used for creating sky boxes. If that's a new term to you, a sky box is basically a very large cube placed around an outdoor environment in a game that provides a backdrop. Spacescape in particular is designed for creating space environments, full of stars and nebulas. The nice thing about spacescape is that it exports all six of the images you need for a sky box, one for each face, and they are all seamless and virtually ready to use. For Panda3D, all you need to do is rename the files. Here are a few example of images you can make in Spacescape:

You can find Spacescape by searching for it on sourceforge.net or by going to Alex Peterson's blog at http://alexcpeterson.com/spacescape. Spacescape doesn't require any sort of installation, per se. All that's needed is to extract the zip file it comes in and place the folder that is contained in it somewhere on the computer. Once that's done, the program will run.

Explosion Texture Generator

This is another tool created by a single author, a gentleman by the name of Sascha Willems. Explosions are pretty common in video games but creating a series of images to turn into an animated "movie" of an explosion can be a real pain. This tool makes it much easier. All that's needed is to input a couple of values for the explosions before and the tool will produce a palette image with every frame of the animation you need. There's a good deal of customization available so you can create gobs of different explosion types. Also, the tool outputs .png files with the alpha already embedded in them, so you don't have to worry about what parts of the image need to be transparent. It's handled for you. Explosion Texture Generator can be found on Sascha Willems's web page at http://www.saschawillems.de/?page_id=253. Here's an example of the output this tool creates:

Like Spacescape, ExploTexGen doesn't require an installation. Just unzip the file and put the contents in a folder, then it will run as intended.