Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Panda3D 1.7 Game Developer's Cookbook

You're reading from   Panda3D 1.7 Game Developer's Cookbook Over 80 recipes for developing 3D games with Panda3D, a full-scale 3D game engine

Arrow left icon
Product type Paperback
Published in Mar 2011
Publisher
ISBN-13 9781849512923
Length 336 pages
Edition Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (20) Chapters Close

Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Setting Up Panda3D and Configuring Development Tools FREE CHAPTER 2. Creating and Building Scenes 3. Controlling the Renderer 4. Scene Effects and Shaders 5. Post-Processing and Screen Space Effects 6. 2D Elements and User Interfaces 7. Application Control 8. Collision Detection and Physics 9. Networking 10. Debugging and Performance 11. Input Handling 12. Packaging and Distribution 13. Connecting Panda3D with Content Creation Tools Index

Building Panda3D from source code


When developing a game with Panda3D you may want to—and most likely will need to—compile the engine from source code. This recipe will show how to do this and show which options there are for configuring how your custom build of Panda3D is created.

Getting ready

The following instructions rely on the target system having installed Microsoft Visual Studio 2008 or Microsoft Visual C++ Express 2008. To build the DirectX 8 and 9 renderers, you also need the DirectX SDK, which can be downloaded from msdn.microsoft.com/en-us/directx/aa937788.aspx. If you have the Professional Edition of Visual Studio, you're set and ready to go.

For making the recipe work with the Express Edition you will need to download and install the Windows Server 2003 R2 Platform SDK, as recommended in the documentation of Panda3D. It can be obtained from the following URL: www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB

How to do it...

Work through these tasks to build Panda3D from source code:

  1. Go to www.panda3d.org/download.php?platform=windows&version=1.7.0&sdk, download the Panda3D Complete Source Code package and unzip the archive at a location of your choice.

  2. Open the file makepanda\makepanda.bat in a text editor and change the line if %PROCESSOR_ARCHITECTURE% == AMD64 goto :AMD64 to REM if %PROCESSOR_ARCHITECTURE% == AMD64 goto :AMD64.

  3. Open a Visual Studio 2008 Command Prompt by clicking Microsoft Visual Studio 2008 | Visual Studio Tools | Visual Studio Command Prompt in the Start menu. If you have Visual C++ Express 2008, you can find it under Microsoft Visual C++ Express 2008 | Visual Studio Tools | Visual Studio Command Prompt.

  4. Change to the directory you unpacked the source code to. If you enter the dir command and see the following directory listing (or a similar looking one) you are in the right directory:

  5. Type makepanda\makepanda.bat --everything.

How it works...

Panda3D uses its own custom build system to produce builds from source code. In step 2, we need to modify the build system's start script to prevent it from throwing an error if the build system is using a 64-bit processor. Building 64-bit executables does not work with version 1.7.0 of Panda3D and isn't officially supported, so we force the build system to compile 32-bit executables and libraries.

In the following steps we open a Visual Studio 2008 Command Prompt, which guarantees that all required search paths are set properly and kick off a complete build of Panda3D. Please note that such a build, depending on the power of your machine, takes about one hour to complete!

Once the build is complete, the freshly compiled version of Panda3D can be found in the built subdirectory.

There's more...

Panda3D's build system allows us to configure the build using a number of command line flags. The --everything option we already used before will instruct the makepanda script to build Panda3D and all third party libraries.

The exact counterpart of the --everything option is --nothing, which will disable all third party libraries to be built.

Of course there isn't just on and off. The makepanda build script allows us to set which libraries we do and do not want to include in our build. This can be done by setting the various --use-xxx and --no-xxx flags, where xxx stands for a library to be included or left out of the resulting executable. For a full list, just issue the command makepanda\makepanda.bat from the top level of the unpacked source package.

The --optimize option allows to set the optimization level used when compiling Panda3D on a range from 1 to 4, where 1 creates a debug build and 4 enables the most aggressive optimizations, including link time code generation. If not set, this value defaults to 3, which provides a safe default while generating a very well performing build.

Lastly, we can use the --installer flag to generate an installer, which for example makes it easier to redistribute the custom build of the engine to other developers on a team.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Panda3D 1.7 Game Developer's Cookbook
You have been reading a chapter from
Panda3D 1.7 Game Developer's Cookbook
Published in: Mar 2011
Publisher:
ISBN-13: 9781849512923
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon