Trials and Errors with Cross-Platform Game Libraries : Panda3D

Panda3D isn't bad at all. I like it!


The *.deb works fine for Ubuntu. I had to build the tarball on Gentoo, apart from fussing with library paths, that goes smoothly too. Or rather, I don't remember being driven into fits of rage by it, which, given my experiences with game engines so far, is positively an endorsement.

On Gentoo, you need to set your environment variable LD_LIBRARY_PATH=/usr/lib/panda3d so that Python knows where to find Panda. Or do the lazy thing and just add it to every invocation of a Panda program.

LD_LIBRARY_PATH=/usr/lib/panda3d python

LD_LIBRARY_PATH=/usr/lib/panda3d pview

How to make a 2D Tile for Panda3D with Blender

Get the Chicken exporter script and follow the README, it'll tell you about Ubuntu's symlinks making you put each part in the right folder, and you'll have to do it from the command line so you can sudo to cope with messed up file permissions

This was baffling task for me, so simple and yet hard to figure out.

I hate Blender's UI with the fire of 10,000 suns. When using it on a laptop with a tiny screen and a touchpad, the fire of 10 million suns.

  1. We make a plane. I centered it at the origin.

  2. Switch to edit mode and unwrap the UV mesh. You can either press the U key or find it in the Mesh menu.

  3. In the UV/Image editor (top-right), select Image and open whatever image you want to use as the texture.

  4. In the Buttons window, select Shading (F5), and click on Add New to link to the object.

  5. Then click TexFace. All done. So, save and check how it renders with F12.

  6. In the File menu, select Export, and find the Chicken exporter to make your shiny new tile.egg.

Pview won't be able to see the tile because of the way the plane is oriented. If you move the camera up just slightly you may catch a glimpse of it.

And it puts it on upside down! Probably my fault.

Once I got a tile, I poked around in the file itself. Blender is overkill for creating a unit plane with a picture stuck on it.

Orthographic Camera

Sample code is clearer than any explanation I can come up with. And, yup, these 5 lines of code at the top are all it takes.

import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.task.Task import Task
#We get a nice 2D view, without perspective messing everything up
lens = OrthographicLens()

#From the Panda3D manual, the film size should be the unit size of
#your view of the world
#Any Z value greater than zero works for position, you will always 
#get the same view,0,1),0,0)

tile = loader.loadModel("tile.egg")

#blender makes a 2 unit x 2 unit tile 
tile.setScale(0.5, 0.5, 0.5)

#not quite correct code borrowed from a hexagonal tile map example
#in the Panda3D forums  
map = NodePath('map')
for x in xrange(-9,9):
    for y in xrange(-7,7):

February 10, 2010