Installing Panda3D

Exclusive offer: get 50% off this eBook here
Panda3D 1.6 Game Engine Beginner's Guide

Panda3D 1.6 Game Engine Beginner's Guide — Save 50%

Create your own computer game with this 3D rendering and game development framework

€20.99    €10.50
by David Brian Mathews | February 2011 | Open Source

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.

In this article by David Brian Mathews, author of Panda3D 1.6 Game Engine Beginner's Guide, we're going to acquire Panda3D and get our work environment set up. Specifically, 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

 

Panda3D 1.6 Game Engine Beginner's Guide

Panda3D 1.6 Game Engine Beginner's Guide

Create your own computer game with this 3D rendering and game development framework

  • 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
        Read more about this book      

(For more resources on Panda3D, see here.)

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. 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.

    Installing Panda3D

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

    Installing Panda3D

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

    Installing 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.

    Installing Panda3D

  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.

    Installing Panda3D

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.

 

Panda3D 1.6 Game Engine Beginner's Guide Create your own computer game with this 3D rendering and game development framework
Published: February 2011
eBook Price: €20.99
Book Price: €34.99
See more
Select your format and quantity:

 

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:

    Installing Panda3D

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

    Installing Panda3D

  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.

    Installing Panda3D

  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.

Installing the game content

To get all the content for the game that will be used 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 article 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 component.

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. 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:

Installing Panda3D

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:

Installing Panda3D

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 article 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.


Further resources on this subject:


Panda3D 1.6 Game Engine Beginner's Guide Create your own computer game with this 3D rendering and game development framework
Published: February 2011
eBook Price: €20.99
Book Price: €34.99
See more
Select your format and quantity:

About the Author :


Dave Mathews is a graduate in Electronic Visualization program from the University of Illinois at Chicago. He began programming in the fifth grade with QBASIC and has been designing games of various kinds, from table-top board games to computer games, since childhood. Prior to entering higher education, he served for two years in the United States Navy as a nuclear engineer before being honorably discharged for medical reasons, where he learned discipline, advanced mathematics, and nuclear theory, as well as teamwork and leadership skills. During his years in school, Mathews earned valuable experience with professional game development methods working both by himself and with teams. He is skilled at programming, 3D modeling and animation, drawing, and 2D compositing.

Books From Packt


Panda3D 1.6 Game Engine Beginner's Guide
Panda3D 1.6 Game Engine Beginner's Guide

Away3D 3.6 Essentials
Away3D 3.6 Essentials

Python 2.6 Graphics Cookbook
Python 2.6 Graphics Cookbook

3D Graphics with XNA Game Studio 4.0
3D Graphics with XNA Game Studio 4.0

Flash Multiplayer Virtual Worlds
Flash Multiplayer Virtual Worlds

Panda3D 1.7 Game Developer's Cookbook
Panda3D 1.7 Game Developer's Cookbook

Blender 2.5 Project Development Hotshot
Blender 2.5 Project Development Hotshot

Cocos2d for iPhone 0.99 Beginner's Guide
Cocos2d for iPhone 0.99 Beginner's Guide


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software