Getting Started Guide For The Absolute Beginner (UPDATED!)

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

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

  2. When the download has finished, double-click the Panda3D icon to begin the installation process.

  3. 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 :smiley:). 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 :smiley:).

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

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

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:

  1. First, download and install Python-2.4.4.msi python.org/

  2. Next, download and install wxPython the win32-unicode version for Python 2.4 wxpython.org/download.php#binaries

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

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:

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

  2. When the download has finished, double-click the Panda3D icon to begin the installation process.

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

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

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

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

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

  1. Open PyPE, then click ‘File > New’ on the top menu bar to open a new work environment.

  2. 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 :smiley:).

  1. Well done! You’ve just written your first Panda3D script :smiley:. 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.

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

  2. Find the ‘mystuff’ folder that we created earlier and double-click on it to open it.

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

  1. Very good! You can now close PyPE.

Running Your Script and Starting Panda3D:

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

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

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

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

All ive gotta say is thanks tiptoe its helped lots :slight_smile:

I think its worth stickifying it until we find a better solution :slight_smile:

Good job. Really. :slight_smile:

Regards, Bigfoot29

Oh boy! I earned a sticky! :smiley:

Thanks a lot guys, I’m glad you found it useful.

Cheers

Well, a real beginners tut seemed to be neccessary, so of course, contributed work is always welcome. :slight_smile:

Due to the fact that many ppl are asking again and again why the demos don’t start right away, thats a nice step into the right direction :slight_smile:

Regards, Bigfoot29

I’ve added it to the manual panda3d.org/manual/index.php/S … e_Beginner
at the bottom.
Please check it for mistakes and move it to a good position
Martin

Thanks heaps Martin, I’m really honored that you think it’s worthy of inclusion in the manual :smiley:.

However, it’s lost some of its formatting, I like to put paragraph breaks between each step and the pictures themselves, I just feel that it makes it easier to read.

I tried to login to the manual to edit it, but it wouldn’t let me, it kept telling me that there was no user named Tiptoe :imp: which is daft, cause here I is.

Ah well, if you get the time, maybe you could put the breaks in for me.

Thanks a lot.

It’s very worthy of inclusion, and I plan (when I have a little more time) to integrate it into the first chapter of the manual.

Tiptoe - I’m pretty sure you need to register a seperate account on the wiki (the wiki software is seperate from the software that runs the forum).

So just register an account on the wiki, and you should be able to make the changes.

Ok as Tiptoe wished i’ve done some formating.
“More paragraph breaks”

If I have the time i’ll load the pictures in the wiki so they couldn’t get lost.
I think its better to rename it like “Start Guide for the absolute Beginners Windows”

That’s wonderful, thanks very much.

Ok i’ve done it. All pictures are now in the wiki.

Just a question: Shouldn’t we transform the pictures to a lower quality level to have a shorter loading time and less trafic? or are the pictures ok?

I wouldn’t mess with the images. They’re already showing a little of that jpeg blurriness — not so much that it’s hard to read, but I’m worried that if we made them smaller, they would become unreadable.

That the best guide ever. I always wanted to know how to use panda

Excellent intro - I suspect a lot of potential users are lost from projects like this due to the lack of just such a “first few steps to make it go” guide.

Minor correction - although various panda and python internals are case sensitive, DOS commands such as “cd c:\panda3d-1.2.2” are not.

nb

WOOOW…!
Tiptoe, Tiptoe, girl, maam, or what should I call you?
What have you done?

Are you tried to make the beginners to love Panda or just get confused and irritated ?

Come on, I believe there are other ways to help them all, other ELEGANT ways.
Here, I found few things that are inefficient and irritating:

  1. Don’t make a new folder in Panda installation folder.
    Create it somewhere else, somewhere completely safe from get erased due to uninstallation of Panda.
    Later version of Panda released frequently, so we have to secure our codes somewhere else, coz all we want is the latest version.
    Your excuse was to ease Panda in looking for models.
    That’s not correct, coz Panda add the folder /models and some other folders to the environment path of windows. So, whereever you put your scripts, Panda will look for the models firstly in your working folder, and if Panda can’t find it there, it will then look in the /models folder and the other folders.
    These folders are the last priority location in searching for models.
    These folders are written to the config.prc file during Panda installation process.
    So, there should be no neccesary to create working folder inside Panda installation folder.

  2. Well, this is a LOT more ridiculous, yeah they are beginners of Panda, but you treated them like they are beginners of windows, too.
    Ouuuch, come on, it can hurt people.
    Avoid using the command prompt to start Panda. Coz there are ELEGANT way to do this just by clicking the .py file and Panda will run.
    (----Come on, don’t SLOW everything DOWN. Once we can boost it, then BOOST it !
    I HATE slow things. Hey, I even add some turbo before I shift the transmission up, you know, it’s just a bicycle, with my left leg for turbo—).
    All we have to do is to tell Windows to run .py files with ppython.exe.
    But by doing this we are not inside the python prompt, so if errors occur, the console window will be terminated at once and we can’t even read the error messages.
    My better way is not directly open .py files with ppython.exe, but creating a batch file that will execute ppython.exe with -i option, which will activate the debug mode, so when errors occur, the console window remains open.
    Like this:
    ppython -i %1
    the %1 is the parameter that will be replaced with the absolute path of the .py file when the batch file runs.
    And then we execute the .py file using that batch file.
    Done, that simple, nice, fast, and clean.

Ooops, looks like I just treated you like a new programmer, sorry for that.

  1. Well, I’m not too sure about this one, coz I haven’t try PyPE.
    I’m using CONTEXT instead, and I think it’s a lot more sophisticated than PyPE.
  • It can recognize many other languages, not just python.
  • It is fully customizable, the text color for keywords, scripts, numbers, strings, floating points, comments, and many more.
  • This is what I love, that we can run the script just by pressing ONE key, yes, I repeat, ONE key. The optional keys are F9, F10, F11, and F12. All these keys can be set for differrent execution settings.
    So, if we need other settings, we can assign them to the other keys.

I think I’m not gonna try other editors, coz I’ve fall in love with this one.
ha…ha…ha…SUPERB

#######
Alright, this is the closure.
If you want to create something GREAT, make it so GREAT that other people will NOT DARE to compare it.
Don’t get it half done like this, BAD habits always harmful.

Do you noticed, there are 3 word ‘LOVE’ in this post, I hope it’s enough to change your mind and make you overhaul your “first steps tutorial”.
You dare to start it, then you must finish it, in ELEGANT way,
alright, please…

long post and best regards,

JO

Well, actually we have had quite a BUNCH of ppl who did have quite some problems launching their first own piece of code when following the tut. So for me this advanced tut is very welcome. (I don’t need it but it reduces the requests like "help! I installed it and clicked XXX, but it doesn’t work!!!)

Your first point (having the panda3d-work-folder outside the installation directory) is in fact true. Well, mistakes happen. TipToe, would you mind changing that maybe? :slight_smile:

Point2: Your version is for advanced beginners. If you REALLY start developing, you WILL go to the command prompt and start your code directly using “ppython code.py”. Its the more natural way. (if you want to do it the clean fast way, you would just type ppy->TAB co->TAB (where TAB means: press the TAB key twice). I guarantee you that I am faster with that than you with your links :wink: - however, I am using another OS, so thats not a usefull comparison. TipToe did it the way he thinks its best. noone stops you from saying in short clear words “a hint for the beginners: If you want to have some more comfort do this or that”.
Starting an insult (kinda reads like that even if you didn’t meant it that way) doesn’t help there much :wink:

As for your finishing words: Its up to each of the readers to read the total beginners tut. Everyone who has a basic set of programming skills should be able to skip that tut anyway starting with the “hello world” tut from the manual.

Anyways… have fun here. :slight_smile:

Regards, Bigfoot29

That’s ok Jo, I AM a new programmer :blush:. Ah well, it looks like I might have to do a re-write of the guide.

I suppose, to be honest, I’m really not the best person to be writing Panda guides. But because it took me ages to figure out how to start Panda (and because there’s not really any help for the ‘absolute beginner’), I figured I’d write it up as a guide to help other newbies.

I always knew that there had to be a better way than mine though :blush:. If you don’t mind, while I’ve got you here, I’d like to pick your brain. You said:

If I double-click on a .py file, nothing happens. The only way I’ve been able to get my scripts to run is by using the Command Prompt. I too, find this way a bit slow. How were you able to get your .py scripts to run just by clicking on them?

You also said:

Yowzer!!! You’ve lost me. This is embarrasing, but I don’t know what a batch file is, or how to create one. So if you’ve got some time, it’d be really great (for me and all the other newbies) if you’d write a ‘step by step’ guide on how to do this.

And for this next quote, I should have thought of this myself. Sorry guys.

I’ll try to correct this as soon as possible. But this next quote could be a problem:

You see, whenever I’ve tried to run a script from a folder that doesn’t have the models in it, I’ve gotten an error message telling me that Panda can’t find the model path. My solution to this, has been to copy the models from Panda into the folder I want to run my script from. This is not very efficient, and I’m sure there’s a better way, so any advice here would be most welcome.

Once we get this all sorted out, I’ll write up a new (hopefully better) guide :smiley:. Thanks for the input.

I have created the guide to simplify Panda3D execution process, and I’ve posted it -[HERE]-.

You are new programmer you said ? But your post is almost 100, wow what is that all about?

I start my coding world from DOS and DOS based programs, such as BASIC, Pascal. Batch file is a file type inside the DOS environment. Basically, it is a file that consists of DOS commands, using DOS regular commands, such as dir, del, copy, and all other commands. It is for manipulating files, input and output, just using DOS environment. It is just like program code, in this case, using DOS commands. It is consists of command lines, as any other program code, that can be saved an run.
It’s just as simple as what we call as FUNCTION, that is for storing codes that we need to execute regularly, so that it will save our time in typing it again, and again, everytime we need it to run. The batch file is the file with .BAT extension.

In DOS environment, you can create it by typing:
copy con filename.bat (press Enter)

and now you’re ready to enter the DOS commands.
One line of command must be ended by pressing Enter.
You can add parameters that will be passed to the batch file you created.
This parameters are started with percent symbol ‘%’ and followed by a number. You can create several parameters, such as %1, %2, %3, and so on.
These parameters is used as input for the batch file.
You can save the batch file by pressing F6 or Ctrl+Z.
Or you can create it using any text editor and save it with .bat extension.

Example :

copy con list_of.bat
dir *.%1
^Z

This batch file will list all file with extension you supply to it.
Like this :

list_of txt

The ‘txt’ will be passed to the list_of.bat as the %1 or the 1st parameter. Then the result is you will get the list of anyfile with extension TXT.
The parameters passed to the batch file will be in order as you supply them.

Other example:

copy con backup.bat
echo off
echo You are about to copy your EGG, BAM, PY, JPG, and PNG files from Panda3d-1.2.2\mystuff to C:
pause
c:
cd c:\Panda3d-1.2.2\mystuff
copy *.egg c:
copy *.bam c:
copy *.py c:
copy *.jpg c:
copy *.png c:
echo Done !
^Z

= ‘echo off’ means to hide the prompt. If echo is on, then after each line of command, the prompt will re-appear, it’s just unpleasant.
= ‘echo text text text text’ means that ‘text text text text’ will be generated to the console.
= ‘pause’ means it will wait for your keypress before execute the next line.

PS: when you create the batch file directly from command prompt, once you press Enter at the end of line, you will no longer able to edit the previous lines.

Well, I can’t explain everything here, it’s just too much, even for me.

About the error loading models or textures :

That is terrible !
For how long have you suffer like this ?
Something is definitely wrong with your Panda3D installation.
Obviously, after installing itself, Panda3D will add the /models folder to the environment variable PATH.
Well, it ever happened to me too, when installing version 1.2.1. Then I re-logged in, and everything was back to normal, because Panda3D always put these folders in the config.prc file, so it will refer to these folders in looking for models and textures.

Have you ever try to run your script somewhere else after you restart your system since the installation ?

If it remains ‘blind’, then you must add those folders to the environment variables yourself.

First, open the config.prc file inside the Panda3D\etc folder. Find the part that record these folders, this is it :

These specify where model files may be loaded from. You probably

want to set this to a sensible path for yourself. $THIS_PRC_DIR is

a special variable that indicates the same directory as this

particular Config.prc file.

model-path .
model-path $THIS_PRC_DIR/…
model-path $THIS_PRC_DIR/…/models
sound-path .
sound-path $THIS_PRC_DIR/…
sound-path $THIS_PRC_DIR/…/models
texture-path .
texture-path $THIS_PRC_DIR/…
texture-path $THIS_PRC_DIR/…/models

You can see that the Panda3D has set the models location in /models.

Go to Control Panel>System. Open Advanced tab and click on the Environment Variables. Look at the System variables, click the PATH variable and click Edit.
Now you can add the fullpath of /models folder to the ‘Variable value’.
When you add them, replace the ‘…’ with your Panda3D installation folder (fullpath, e.g. C:\Panda3D-1.2.2\models).

God bless you.

mkay… Dos basics… fine :smiley:

This is really getting a absolutely beginners READ-ME-FIRST-GODDAMNIT :smiley:

Regards, Bigfoot29