I figured it was time to update this guide. Since first writing it, I have discovered a much better and much easier way of working with Panda3D. I was planning to delete my first guide, but I decided to leave it, as it might be useful for reference.
Note: I use Windows, so this guide is geared towards Windows users. But I’m pretty sure the steps are much the same for the other operating systems.
Well, here it is, the new and improved:
Getting Started Guide For The Absolute Beginner
When you’re brand new to Panda3D it can be very confusing and frustrating trying to figure out how to make it work. So this is my attempt at a step by step guide to get you started.
The first thing new users of Panda3D should note is that Panda3D is a development tool; NOT an application. What does this mean? It means, that unlike all the other programs on your computer, you won’t find any program icons or shortcuts to start it. To run Panda3D you must write a python script which tells it exactly what to do.
The following steps may look a bit complicated, but they’re not really, just follow along with each one and you’ll soon be up and programming in no time.
Download and install Panda3D
-
First, visit panda3d.org/ go to the “Downloads” section and download the latest version of Panda3D (as of writing this is version 1.2.3). For Windows users download panda3d-1.2.3.exe.
-
When the download has finished, double-click the Panda3D icon to begin the installation process.
-
When the installation finishes, test that Panda3D has been successfully installed by running the ‘Panda Greeting Card’ demo (if it does not run automatically when the installation finishes, click Start > All Programs > Panda3D 1.2.3 > Panda Greeting Card).
Create a folder for your project
You need somewhere to save all your scripts and other game assets. You could save them directly into the Panda3D directory itself, but this isn’t a good idea (thanks to ynjh_jo for pointing this out ). Panda3D is frequently updated and when you install a new version, all your work will be lost. So I believe the easiest thing to do is to simply create a new folder on your desktop.
Right-click on your desktop and select New > Folder. Then type a name for it, I called mine PandaStuff (and just for fun, I also made a cute little Panda desktop icon for it ).
Copy the Panda3D ‘models’ folder to your new project folder
Panda3D is very clever, it can run a script from anywhere on your computer, but it first looks for models and other game assets in the folder that it is run from. If it can’t find them, then it will next look for them in the default ‘models’ directory within Panda3D itself. This is perfectly fine, but it can slow things down.
So open C:/Panda3D-1.2.3 and copy the ‘models’ folder to your new project folder. This serves two purposes, it speeds up the loading of Panda3D and it now gives you somewhere to save any new models that you download from the internet. And, just like your scripts, now they won’t be lost when you install a new version of Panda3D .
Set up a Development Environment
One of Python’s strong points, is that you don’t need a fancy or expensive compiler to write your scripts. Python scripts can be written in a simple text editor such as ‘Notepad’ (which is already installed on all Windows computers).
However, because Notepad isn’t really designed for writing scripts, it will make learning to program much, much harder. I honestly believe the best thing you can do for yourself is to download a proper Python Editor.
As of writing, one of the best free Editor’s available is ‘Stani’s Python Editor (SPE)’. Not only is it a Python Editor, it is also an ‘Integrated Development Environment (IDE)’ which means that you can easily launch Panda3D from within the Editor itself with the simple click of a button (no more need to use the slow and awkward ‘Command Prompt’ method ).
However, SPE needs both Python and wxPython, so you’ll need to download and install these programs. To set everything up properly, the following steps should be done in this order:
-
First, download and install Python-2.4.4.msi python.org/
-
Next, download and install wxPython the win32-unicode version for Python 2.4 wxpython.org/download.php#binaries
-
And finally, download and install SPE-0.8.2.a-wx2.6.1.0-py24 IDE sourceforge.net/project/showfile … _id=145384
Set up SPE to work with Panda3D
One final step is needed to get everything working (thanks to jspataro who figured this out). Open the C:/Panda3D-1.2.3/bin folder, locate the ‘panda.pth file’ and copy it to the C:/Python24/ folder.
Now open the copied file with Notepad, backspace out the two periods, then copy and paste the following code into it, then click Save:
C:/Panda3D-1.2.3
C:/Panda3D-1.2.3/direct/src/actor
C:/Panda3D-1.2.3/direct/src/cluster
C:/Panda3D-1.2.3/direct/src/controls
C:/Panda3D-1.2.3/direct/src/directbase
C:/Panda3D-1.2.3/direct/src/directdevices
C:/Panda3D-1.2.3/direct/src/directnotify
C:/Panda3D-1.2.3/direct/src/directscripts
C:/Panda3D-1.2.3/direct/src/directtools
C:/Panda3D-1.2.3/direct/src/directutil
C:/Panda3D-1.2.3/direct/src/distributed
C:/Panda3D-1.2.3/direct/src/extensions
C:/Panda3D-1.2.3/direct/src/extensions_native
C:/Panda3D-1.2.3/direct/src/ffi
C:/Panda3D-1.2.3/direct/src/fsm
C:/Panda3D-1.2.3/direct/src/gui
C:/Panda3D-1.2.3/direct/src/interval
C:/Panda3D-1.2.3/direct/src/leveleditor
C:/Panda3D-1.2.3/direct/src/motiontrail
C:/Panda3D-1.2.3/direct/src/particles
C:/Panda3D-1.2.3/direct/src/physics
C:/Panda3D-1.2.3/direct/src/pyinst
C:/Panda3D-1.2.3/direct/src/showbase
C:/Panda3D-1.2.3/direct/src/showutil
C:/Panda3D-1.2.3/direct/src/task
C:/Panda3D-1.2.3/direct/src/tkpanels
C:/Panda3D-1.2.3/direct/src/tkwidgets
C:/Panda3D-1.2.3/bin
Excellent! You’re now ready to begin.
Write your first script
Double click the SPE icon on your desktop to open the Editor. Then click “File > New” to open a new work environment. Now type the following code (or copy & paste it):
import direct.directbase.DirectStart
from pandac.PandaModules import*
run()
Notice that SPE automatically numbers the lines for you and highlights certain words. It will also print out any error messages at the bottom of the window (just like the Command Prompt would). This is a really marvelous little program and I highly recommend it to everyone.
Now save your new script to your project folder by clicking File > Save As:
Then browse to your project folder. Type a name for your script (I called mine myscript.py) and click the Save button.
Start Panda3D
There are two ways to launch Panda3D from within SPE itself, the first is by clicking "Tools > Run without arguments/stop:
The second is to click the Run icon on the toolbar (circled in red). A window will pop up, leave the Arguments field blank, then simply click the Run button.
If all is well, Panda3D will start and you should see the main 3D rendering window appear:
Well, that’s all there is to it. You can now edit your scripts and immediately test them in Panda3D without ever having to leave the Editor (this is vastly superior to the old ‘Command Prompt’ method shown below).
I hope this helps. Now go tackle those tutorials .
Cheers
This is the old obsolete guide
When you’re brand new to Panda3D it can be very confusing and frustrating trying to figure out how to make it work. So this is my attempt at a step by step guide to get you started.
Installing Panda3D and Creating A New Folder:
-
First, go to the Downloads section and download the latest version of Panda3D (as of writing this is version 1.2.2). For Windows users download panda3d-1.2.2.exe.
-
When the download has finished, double-click the Panda3D icon to begin the installation process.
-
When finished, make sure that Panda3D has been successfully installed by running the ‘Panda Greeting Card’ program (if it does not run automatically when the installation finishes, click Start > All Programs > Panda3D 1.2.2 > Panda Greeting Card).
-
Now, a very important thing to note, Panda3D is a development tool; NOT an application. What does this mean? It means, that unlike all the other programs on your computer, you won’t find any program icons or shortcuts to start it. To run Panda3D you must write a python script which tells it what to do (this is a great way to learn programming, because you’re basically starting from the ground up).
-
So, you now need to create a place where you can save all your scripts. Panda3D is very clever, it can run a script from anywhere on your computer, but it looks for models and other assets in the folder that it is run from. If those assets aren’t present, then you’ll get an error message when you try to run it. So, I believe that the easiest thing for the beginner to do, is to make a new folder in the main Panda3D directory itself (which already contains all the models and other assets that you’ll need).
-
To do this, click your computers ‘Start’ button, then ‘My Computer’.
Then double-click ‘Local Disk ©â€™ (if the contents of this drive are hidden, just click ‘Show the contents of this folder’). Now find the Panda3D-1.2.2 folder and double-click on it to open it.
- On the top menu bar click ‘File > New > Folder’. This will create a new folder in the Panda3D directory, backspace out the name and type a new name for it (I called mine mystuff). Good! You’re almost ready to begin.
Download a Python Editor:
One of python’s strong points, is that you don’t need a fancy or expensive compiler to write your scripts. Python scripts can be written in a simple text editor such as ‘Notepad’ (which is already installed on all Windows computers). However, because Notepad isn’t really designed for writing scripts, it will make learning to program much, much harder. So, I think the best thing you can do, is to use a proper python editor. I use PyPE (which is completely free and makes writing python scripts a whole lot easier) here’s the link:
sourceforge.net/projects/pype/
If you’re using Windows, download the PyPE 2.4-win-anzi.zip (as of writing this was the latest version). You don’t need to install this program, you just download and unzip it somewhere, then open the unzipped folder and double-click on the PyPE icon to run it (or right-click on the icon and send it to the desktop as a shortcut, then simply run it by double-clicking the icon on your desktop).
Writing Your First Script:
-
Open PyPE, then click ‘File > New’ on the top menu bar to open a new work environment.
-
Now type the following code (or just copy and paste it):
import direct.directbase.DirectStart
run()
(Notice that PyPE automatically highlights certain words and numbers the lines for you. This is a very nice feature which makes finding errors much easier ).
- Well done! You’ve just written your first Panda3D script
. It’s not much, but those few lines of code tell Panda3D to start. But before you can run this script, you must save it. So click ‘File > Save As’ on the top menu bar and a new window should open.
-
At the top of this new window there is a ‘Save in:’ text box, which is pointing to ‘PyPE-2.4-win-ansi’, you DON’T want to save your script there, so click the little down arrow beside the text box, then scroll down the list and click ‘Local Disk ©â€™, then double-click on the ‘Panda3D-1.2.2’ folder to open it.
-
Find the ‘mystuff’ folder that we created earlier and double-click on it to open it.
- Good! Now type a name for your script in the ‘File name:’ text box. I called mine myscript.py (make sure you put .py on the end of the name). Then click the ‘Save’ button.
- Very good! You can now close PyPE.
Running Your Script and Starting Panda3D:
- You now run your script by using your computer’s ‘Command Prompt’. You access this by clicking ‘Start > All Programs > Accessories > Command Prompt’. When it opens, it should look something like this:
- At the moment it’s pointing to its default directory, which in my case is ‘Documents and Settings’ (it doesn’t matter if yours is different). We need to change the directory to the one where we saved our script. To do this, we type cd. This stands for ‘change directory’. So type the following text behind the > symbol.
cd C:\Panda3D-1.2.2\mystuff\
Please note that it’s case sensitive and must match exactly. Then press the ‘Enter’ key on your keyboard. You should now have the following on the Command Prompt:
- Good! This means that it’s now pointing to the right directory. To run your script, and start Panda3D, type the following text behind the > symbol:
ppython myscript.py
Make sure you type ppython (the extra ‘p’ tells it to use the special Panda3D version of python and not just the regular version of python).
- Now press the ‘Enter’ key on your keyboard. If all is well, Panda3D will start and you should see the main rendering window appear.
Well done! But because all you’ve done so far, is simply told Panda3D to start, this window is blank and uninteresting. It’s now time to complete the first tutorial in the manual, found here: panda3d.org/manual/index.php/A … o_World%22 then work your way through the other tutorials that come with Panda3D itself.
I hope this helps to get you started. Best of luck!
Edit: If I’ve made any mistakes or something isn’t clear enough, please tell me so that I can make the proper corrections.
Cheers