some basic questions about Roaming Ralph tutorial

rencently i want to make a little fps demo for exercise so i look into this tutorial. Here is my question:

  1. what is egg.pz, how convert it from/to egg file?

  2. i try to load another world, but get error in “ralphStartPos = self.environ.find(”**/start_point").getPos()". then i disable this line and line “self.ralph.setPos(ralphStartPos)”, the world change, but ralph can not move forward, just stick in the same place. do i need to set “start_point” in the egg file? how to do?

  3. manual said there is a much better way to detect the height of the terrain. what is that?

questions outside this tutorial:

  1. is there any good sample for fps with collision?

  2. whether i can use models/maps from Half Life, Quake etc. in panda?( if it is possible to convert them to egg does it make sense? because i cann’t model myself)

  3. how to convert pyc to py for reading?

thanks for taking your time.

.pz is a filed zipped with the Panda3D zip tool: pzip. To convert it back you can use punzip. Don’t ask me internals about the zip algorithm. I think they just left away some header info. But you could check the pzip source if you want to know more.

The egg file in the Roaming Ralph demo contains not only the visible geometry, but also a starting point (named “start_point”). But instead of reading the position from the egg file you can set it yourself:

        ralphStartPos = Point3(-107, 26, 0)

Just replace the above line, and don’t forget to import Point3 somewhere at the beginning of the script.

(3) (4)
Hmm… I skip these two, since I am using non-Panda3D collision systems.

Milkshape is a good for converting various model formats (especially models from various FPS games), but you have to pay for it. USD 25 I think.

Not a nice thing to ask for. Everybody asks how it is possible to hide their code, and you try to hack their work by decompyling it. Maybe you should ask this question on alt.2600 :stuck_out_tongue:


thank you very much enn0x. your information is pretty helpful. but still i have question.

if i want to set startPos in the egg, is it done in modelling software or somewhere else?

i load another scene model replace the original world and set the ralph’s startPos as your code, ralph just stick at the startPos, cann’t move forword. why is that, any special thing should be set in the scene model?

if i don’t use the collision system build-in, what’s the alternative most people use?

and i want to explain that i really don’t want to hack other’s code, i’ve installed some game to learn but found the sourcecode file are all *.pyc. maybe i should find the source package:)

thanks for taking your time.

I use only Blender, and the Chicken exporter won’t do this for you. Don’t know about the Maya exporter or others.

In general I would expect no as the answer for all modeling applications, since the modeling application usually doesn’t know about Panda3D specific features. But the exporter could use naming conventions or whatever to map modeler objects to Panda3D features.

Ah, ok, forgot about this. Your world file has to contain a group with name “terrain”. The roaming ralph code checks for this name somewhere in the “move” method.

I think most people use the Panda3D native system. Some use ODE for physics and collision. ODE is open-source, and the Python bindings are mature. I dabble with PhysX, but my Python bindings are in a very early stage. And PhysX is not open source. The same goes for Newton. Closed source and my Python bindings need a review.

Yep. If there are no source packages then you could send them a mail and ask for particular parts of the code. Maybe they are friendly enough to send it to you.


thanks a million, enn0x. i’ll keep learning.

Maybe this thread helps you I’ve created the example egg with blender. start_point consist of only one vertex.

so it is ok with that example in the roaming ralf tut if you keep the ennox pos3 code (the import is “from pandac.PandaModules import *”) with the Azraiyl terrain the actor will still got stick , just uncomment


to understand that it’s always collide, even if you put it at (0,0,3) !!!

therefore it never moves; somebody knows ?

I see Azraiyl already answered the question in the other thread.

For clarification: The node “start_pos” is just for setting the position where the player is located at the start of the demo. Having start_pos defined inside the terrain model can be handy in some cases, e.g. several levels with different start position for each level. Setting it by hand can be useful too, e.g. if the game is loaded from a saved state, and the player wants to continue where he stopped the last time.

“Ralph not moving” is a completely different problem. The tutorial codes assumes the world model has a node named “terrain”. This node is used in the method “move”, for collision detection and response.

By the way: I discourage using “from module import *”. This might be faster to type (and can be used for interactive sessions with the interpreter), but it often causes poorly readable code and clutters the module namespace. Using “from module import name” is the recommended notation.


YEs I’ve read somewhere that this is not a good thing as it looks like a “brutal load everything”.

By the way, I understand that you need a start point for the

find. getpos. 

There is also a “terrain” node in the level, as I took the example from azraiyl.

What is confusing is how do you set that pos, I did not found where the doc explains

2/ and also does it mean that you have to define the start points (in case of many actors) by hand and for each level in milkshape or blender ?

(sorry with these annoying questions)

For anything egg related you should read this: panda/src/doc/eggSyntax.txt. You will have to download the source packages, or browse the CVS on sourceforge.

In my world.egg.pz I have this code:

<Group> start_point {
  <DCS> { net }
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      -107.575 -0.490075 -26.6066 1
    <Translate> { 0 0 0 }

So a group with name “start_point” is created. The groups has a dynamic coordinate system (DCS) with the given transform. The transform has no rotation (the first three rows of the matrix), and a translation by x=-107, y=-0.49, z=-26 (the last row of the matrix). The interesting part is that this group does not have a vertex pool or polygons, like normal geometry groups. It just has a coordinate system.

To have a start point in your own models just copy this code to your egg and modify the last line of the transform matrix. You can do this several times, for defining different start points, but then I suggest you give them different names, e.g. “start_point_1”.

Since you are looking at eggSyntax.txt anyway: take your time and look around some more. There are lots of interesting things you can do inside egg files, e.g. creating triggers.


I guess you can name or group a vertex in the 3d modeling program,
so you can pinpoint where you want the start point to be.
then you can open it up in notepad and ‘search’ for ‘start point’,
to make sure things look right.

let me try to explain what the following matrix stands for (simplified).

1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.100000 1.000000

scale-x 0.0 0.0 0.0
0.0 scale-y 0.0 0.0
0.0 0.0 scale-z 0.0
translate-x translate-y translate-z 0.0

This means: scale the model on each axis with the factor 1.0, therefore change nothing. Also move the model 0.1 units along the z axis. But this group contains no polygons, it is a empty node path. With Blender you can easly recreate this egg file if you create a model with only one vertex while moving around the model (N key).

I don’t know a simple website with a an easy to understand explanation about matrices, escpecially 4x4 matrices, which may help you.

wow, more guys joined this thread, seems that i can learn more than i expected. tell you my little experiment:

i edit another world.egg, and rename some group with “terrain”, and set the start_point with a vertex within that group, then Ralph move in an area which the group stand for.

BTW, the real problem with the lazy way of importing" (import *) is what happens when you combine it with the lazy way of exporting. A module is supposed to define an exports list like this:

all = [“class1”, “class2”, “func1”]

If you’re lazy don’t do that, then a module will export everything. If you combine that with import *, then you’ve exported everything that you’ve imported. In the end, every module ends up exporting thousands of symbols. This used to cause tons of name conflicts in panda. We finally solved it by putting all assignments in most of our modules.

Sorry being late to answer but did not receive email notification (??)

as DP said “if you’re lazy, just stay to bed”, thus this was just a copy-paste from a documentation I’ve found and it was more a lack of knoledge that lazyness in fact.Thank you for the precision,

humm , I did not succeed to install that chicken export into blender (plugin path), is that because this is 2.44 and the script declare a 2.42 ?.

For the matrix it’s ok, as it a simple maths theory, and thak you very much for all those precise explanations.

with the chicken export, the misunderstanding was that this a script, not a plugin, so
has some details on it, and
this is just a simple copy of the directories within.

hope that will help for future questions.

Now, that works I can try those advices

Hi, I wanted to add some more Actors and Models in Roaming Ralph tutorial but when I add new actor, it is not displayed on the terrain.
For example, I added a new actor at the ‘start_point’ (-107.575 -2.490075 -26.6066) but still it is not showing up.

Secondly, is there any good and easy way to set the position using setPos? Basically we have to fill in coordinates in setPos and I am not sure how to get a coordinate of a particular point in 3D world by guessing. (Maybe there is a way which displays real time coordinates on the screen while Ralph is moving on the terrain?)

Have you reparented the actor to render?
Also, notice that your coords receive the influence from other transformations, such as scale, if you set the scale to 0.5 the model will be loaded at its reference system.

If you want to be absolutely sure about it, you can set the inside a task, it will then look at your model (or at the position it should be, you can be loading it inside another model or something).

About the model positioning, you can use the scene editor, take a look at the manual, it is one of the last topics, but it is not complicated at all and can help you a lot.

Hey KnolanCross!
Thanks a LOT!!! :smiley:

The scene graph thing is super awesome! Now adding models have become a lot easier. Thanks again for solving my queries :slight_smile:

Hi again! :slight_smile:

I am trying to edit the roaming ralph tutorial by addying my own actor.
Whenever I add any other line in the ‘World’ class, it gives me an indentation error even though the code is properly aligned??!

Secondly, i wish to add a collision sphere to my actor (to detect collision from new obstacles which i am adding) even though it has the collision ray coming out of it.
Is it possible to add 2 collision solids to a single actor?
if yes, the kindly explain how to add the collision sphere to it.