Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Panda3D 1.6 Game Engine Beginner's Guide
Panda3D 1.6 Game Engine Beginner's Guide

Panda3D 1.6 Game Engine Beginner's Guide: This is the A-Z of Panda3D for developers who have never used the engine before. Step-by-step, it takes you from first principles to ultimately creating a marketable game. You’ll learn through first-hand experience and clear explanations.

$28.99 $19.99
Book Feb 2011 356 pages 1st Edition
eBook
$28.99 $19.99
Print
$48.99
Subscription
$15.99 Monthly
eBook
$28.99 $19.99
Print
$48.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Feb 9, 2011
Length 356 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849512725
Category :
Table of content icon View table of contents Preview book icon Preview Book

Panda3D 1.6 Game Engine Beginner's Guide

Chapter 1. Installing Panda3D and Preparing a Workspace

It's time to take the first big step. In this chapter we're going to acquire Panda3D and get our work environment set up. Once we have all that done, we're going to take a look at the game we'll be creating over the course of this book.

In this chapter we shall:

  • Download and install Panda3D

  • Download and install Notepad++

  • Install all of the content necessary for the game

  • Demo the game we'll be creating

  • Install any optional tools desired

    • Blender and Chicken

    • Spacescape

    • Explosion Texture Generator

There's no time to waste, so let's get cracking!

Getting started with Panda3D installation packages


The kind folks who produce Panda3D have made it very easy to get Panda3D up and working. You don't need to worry about any compiling, library linking, or other difficult, multi-step processes. The Panda3D website provides executable files that take care of all the work for you. These files even install the version of Python they need to operate correctly, so you don't need to go elsewhere for it.

Time for action – downloading and installing Panda3D


I know what you're thinking: "Less talk, more action!" Here are the step-by-step instructions for installing Panda3D:

  1. Navigate your web browser to www.Panda3D.org.

  2. Under the Downloads option, you'll see a link labeled SDK. Click it.

  3. If you are using Windows, scroll down this page you'll find a section titled Download other versions. This book is written for Panda3D version 1.6.2, which is the most current stable version at the time of writing. Find the link to Panda3D SDK 1.6.2 and click it. If you aren't using Windows, click on the platform you are using (Mac, Linux, or any other OS.). That will take you to a page that has the downloads for that platform. Scroll down to the Download other versions section and find the link to Panda3D SDK 1.6.2, as before.

  4. When the download is complete, run the file and this screen will pop up:

  5. Click Next to continue and then accept the terms. After that, you'll be prompted about where you want to install Panda3D.

  6. The default location is just fine. Click the Install button to continue. Wait for the progress bar to fill up. When it's done, you'll see another prompt.

  7. This step really isn't necessary. Just click No and move on.

  8. When you have finished the installation, you can verify that it's working by going to Start Menu | All Programs | Panda3D 1.6.2 | Sample Programs | Ball in Maze | Run Ball in Maze. A window will open, showing the Ball in Maze sample game, where you tilt a maze to make a ball roll around while trying to avoid the holes.

What just happened?

You may be wondering why we skipped a part of the installation during step 7. That step of the process caches some of the assets, like 3D models and such that come with Panda3D. Essentially, by spending a few minutes caching these files now, the sample programs that come with Panda3d will load a few seconds faster the first time we run them, that's all.

Now that we've got Panda3D up and running let's get ourselves an advanced text editor to do our coding in.

Switching to an advanced text editor


The next thing we need is Notepad++. Why, you ask? Well, to code with Python all you really need is a text editor, like the notepad that comes with Windows XP. After typing your code you just have to save the file with .py extension. Notepad itself is kind of dull, though, and it doesn't have many features to make coding easier.

Notepad++ is a text editor very similar to Notepad. It can open pretty much any text file and it comes with a pile of features to make coding easier. To highlight some fan favorites, it provides language mark-up, a Find and Replace feature, and file tabs to organize multiple open files. The language mark-up will change the color and fonts of specific parts of your code to help you visually understand and organize it. With Find and Replace you can easily change a large number of variable names and also quickly and easily update code. File tabbing keeps all of your open code files in one window and makes it easy to switch back and forth between them.

Time for action – downloading and installing Notepad++


Now that you're convinced, let's get Notepad++ up and running. If you aren't convinced or want to use some other software to code with, that's fine. Just skip to the next section.

  1. Navigate your web browser to http://notepad-plus-plus.org. Click on the Download tab on the page.

  2. Click the link to Download Current Version.

  3. Click the link that ends with Installer.exe.

  4. When your download is finished run the file and you'll see this screen pop up:

  5. Click Next to get the installation started and accept the terms. You'll be prompted again about where you want to install.

  6. Again, the default directory is just fine. Click Next and you'll find yourself prompted once more, this time about the components you want to install.

  7. The default configuration contains everything you'll need, so just click Install. When it's done go ahead and open Notepad++ so it can update itself if necessary.

What just happened?

That does it for Notepad++. Next we need to install all the game content we'll be using as we go through the tutorials in this book.

Installing the game content


To get all the content for the game that will be used over the course of the book, head to the Packt website and download the code file . Unzip the file, and place the folder BGP3D in an easy-to-get-to place on the system. For Windows users, the C: drive is recommended.

Time for action – demoing Suicide Jockeys


The last thing we'll cover in this chapter is how to load a Panda3D game from the command prompt. Until the game is packaged and ready for shipping, this is how we'll run it. Don't worry, it's easy.

  1. Open a command prompt by going to the Start menu | All Programs| Accessories and choosing Command Prompt.

  2. Open Windows Explorer the same way.

  3. In Windows Explorer click on the View menu at the top, highlight toolbars, and if Address Bar does not have a check before it, click on it. This will show your current directory in the window.

  4. Navigate Windows Explorer to BGP3D/Demo and copy the entire address bar with Ctrl+C or by right-clicking and selecting Copy.

  5. Return to the Command Prompt window and type in cd followed by a space. Then right-click on the Command Prompt window and select Paste. This will insert the directory address you copied from Windows Explorer.

  6. Hit Enter and you'll see the directory in the Command Prompt change. Next, type in python main.py and hit Enter. The game will launch.

What just happened?

Not bad, right? We just learned how to run a Python file from the command prompt, something we'll be doing quite a bit. The python command we used tells the system to use the Python interpreter to run the file we supply.

main.py is the name of the file that starts Panda3D and the game components. We'll go into more depth about how that works in the next chapter, so get ready!

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.

Summary


We spent most of the chapter installing the tools we need to use Panda3D.

We talked about and installed:

  • Panda3D 1.6.2

  • Notepad++

We also talked about some helpful optional tools that can be useful for creating game content. Oh, and let's not forget that we took a look at the demo for the game we'll be making over the course of this book!

We've got everything prepared now; it's time to move on to the real deal.

Left arrow icon Right arrow icon

Key benefits

  • The first and only guide to building a finished game using Panda3D
  • Learn about tasks that can be used to handle changes over time
  • Respond to events like keyboard key presses, mouse clicks, and more
  • Take advantage of Panda3D's built-in shaders and filters to decorate objects with gloss, glow, and bump effects
  • Follow a step-by-step, tutorial-focused process that matches the development process of the game with plenty of screenshots and thoroughly explained code for easy pick up

Description

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.

What you will learn

Create and use tasks Respond to and handle events Implement texturing with built-in shaders Exercise collision detection Implement a graphical user interface Utilize the Panda3D animation system Master the power and purpose of intervals Add audio and use the OpenAL library Understand garbage collection Package the game into an installer Use Spacescape and explosion texture generator to create certain art assets

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Feb 9, 2011
Length 356 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849512725
Category :

Table of Contents

22 Chapters
Panda3D 1.6 Game Engine Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Installing Panda3D and Preparing a Workspace Chevron down icon Chevron up icon
Creating the Universe: Loading Terrain Chevron down icon Chevron up icon
Managing Tasks Over Time Chevron down icon Chevron up icon
Taking Control: Events and User Input Chevron down icon Chevron up icon
Handling Large Programs with Custom Classes Chevron down icon Chevron up icon
The World in Action: Handling Collisions Chevron down icon Chevron up icon
Making it Fancy: Lighting, Textures, Filters, and Shaders Chevron down icon Chevron up icon
GUI Goodness: All About the Graphic User Interface Chevron down icon Chevron up icon
Animating in Panda3D Chevron down icon Chevron up icon
Creating Weaponry: Using Mouse Picking and Intervals Chevron down icon Chevron up icon
What's that Noise? Using Sound Chevron down icon Chevron up icon
Finishing Touches: Getting the Game Ready for the Customer Chevron down icon Chevron up icon
Creating a Sky Sphere with Spacescape Chevron down icon Chevron up icon
Using Egg-Texture-Cards and ExploTexGen Chevron down icon Chevron up icon
Pop quiz Answers Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.