A3P [formerly Stainless]

Hmm, when I run it, I see this in the log:

  File "VFSImporter", line 153, in load_module
  File "main.py", line 12, in <module>
ImportError: No module named datetime
Successfully joined thread: 0
Failure on startup.

which points out a problem with running packp3d.p3d–it doesn’t have any way to find additional Python modules that aren’t part of your source, but also weren’t included in the Panda3D distribution. Hmm, let me investigate this. If nothing else, one ugly workaround would be to copy datetime to your source directory before packaging.

Also, it looks like the plugin isn’t doing a good job of displaying the “failure” icon when the program triggers an exception at startup. I’ll look into this too.

Note that you can inspect the logfiles in your Panda3D directory; p3dsession.log is the one that contains the Python session like this, and is most likely to be interesting. The location of your Panda3D directory varies according to your OS. On Windows XP, it’s in c:\Documents and Settings<your name>\Local Settings\Application Data\Panda3D; on Vista and Win7, it’s in c:\Users<your name>\AppData\Local\Panda3D (or LocalLow\Panda3D in IE with UAC enabled).


Actually, I’m getting the same behavior from Tagger. Note: I’m using rdb’s 0.9.7 runtime build he linked in the Tagger thread.

If this helps at all, here’s my p3dplugin.log for Tagger (after closing the window):


NP_GetEntryPoints, pluginFuncs = 00939180
browserFuncs = 0093B008
Browser version 0.19
Plugin compiled with version 0.19
new instance 008D0060
new instance->pdata = 02898BC8
start_download: http://runtime.panda3d.org/contents.xml?1260221031
SetWindow 0, 0, 640, 480
NewStream application/xml, http://runtime.panda3d.org/contents.xml?1260221031, 14254, notifyData = 00542FA0
NewStream application/x-panda3d, http://www.ddrose.com/~drose/tagger/tagger.p3d, 2683139, notifyData = 00000000
StreamAsFile http://runtime.panda3d.org/contents.xml?1260221031, 14254, notifyData = 00542FA0
Attempting to load core API from C:\Users\et1337\AppData\Local/Panda3D/coreapi/win32/p3d_plugin.dll
DestroyStream http://runtime.panda3d.org/contents.xml?1260221031, 14254, notifyData = 00542FA0, reason = 0, for 008D0060, 02898BC8
URLNotify: http://runtime.panda3d.org/contents.xml?1260221031, notifyData = 00542FA0, reason = 0
start_download: http://runtime.panda3d.org/contents.xml?1260221032
NewStream application/xml, http://runtime.panda3d.org/contents.xml?1260221032, 14254, notifyData = 0054FBD0
DestroyStream http://runtime.panda3d.org/contents.xml?1260221032, 14254, notifyData = 0054FBD0, reason = 0, for 008D0060, 02898BC8
URLNotify: http://runtime.panda3d.org/contents.xml?1260221032, notifyData = 0054FBD0, reason = 0
Got p3d instance to stream 3
SetWindow 0, 0, 640, 480
destroy instance 008D0060, 02898BC8
save = 0257F6AC
Stopping stream ð–

It looks like you didn’t wait for the p3d file to finish downloading. Did you see a blue progress bar fill up below the cute panda?


Ah, I have the solution to the datetime problem. In the beginning of your pdef file, add the lines:

import sys

and then it will search your own Python directory for datetime.pyd and add it to the p3d file. Two caveats: (1) you must point it to the same version of Python used by the runtime (2.6 at the moment), and (2) this will make your p3d file platform-dependent, because datetime.pyd is platform-dependent.

I’ll add the -p option to packp3d to do the same thing.


  1. I waited at least 20 minutes for tagger. It was frozen about 2 pixels from 100% most of the time. Might just be my computer or my runtime. I’m using rdb’s 0.9.7 CVS build.

  2. Glad that’s fixed, but I think I’ll find a cross-platform work-around for datetime… :wink:

Hmm, this is a little worrisome. Did you notice whether you got that stall while downloading the p3d file (the blue bar would have no label) or while downloading the Panda3D runtime (the label would say “Panda3D” or something)?


The loading bar was always blank.

[edit:] I updated the p3d file with a workaround to exclude datetime.

I found a better, more long-term solution to problems like datetime: I defined an optional package called “morepy” which includes all standard Python modules that are not already part of the Panda3D mainline release.

So, in the future, if you try to build a p3d file and you discover it depends on a missing Python module, you can just add “-r morepy” to the packp3d command like (or require(‘morepy’) to your pdef file) and you’ll pick up the missing module(s).

The cost of this additional functionality is a mere 2MB additional download.

I’m downloading the new stainless p3d file now. Funny, it seems to think it doesn’t know how big the download is–the loading bar is always at the top, as if the server weren’t reporting the download size. But I think it does. Hmm.

Edit: and it doesn’t appear to want to cache the p3d file from one session to the next. Most curious.

Anyway, after loading, I can start the tutorial–looks great!–and then it soon crashes with this stack trace:

:task(error): Exception occurred in PythonTask Game loop
Traceback (most recent call last):
  File "C:\panda3d\built_cmu\direct\p3d\AppRunner.py", line 396, in run
  File "C:\panda3d\built_cmu\direct\task\Task.py", line 482, in run
  File "C:\panda3d\built_cmu\direct\task\Task.py", line 440, in step
  File "main.py", line 752, in gameLoop
  File "main.py", line 374, in update
  File "src\entities.py", line 62, in update
  File "src\net.py", line 520, in update
  File "src\controllers.py", line 989, in serverUpdate
  File "src\controllers.py", line 538, in serverUpdate
  File "src\controllers.py", line 489, in serverUpdate
  File "src\components.py", line 161, in serverUpdate
ValueError: need more than 2 values to unpack

That looks like your problem to me. :slight_smile:

If, however, I click on “Host”, it crashes immediately with this stack trace, which looks like my problem:

:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
  File "C:\panda3d\built_cmu\direct\p3d\AppRunner.py", line 396, in run
  File "C:\panda3d\built_cmu\direct\task\Task.py", line 482, in run
  File "C:\panda3d\built_cmu\direct\task\Task.py", line 440, in step
  File "C:\panda3d\built_cmu\direct\showbase\EventManager.py", line 61, in eventLoopTask
  File "C:\panda3d\built_cmu\direct\showbase\EventManager.py", line 55, in doEvents
  File "C:\panda3d\built_cmu\direct\showbase\EventManager.py", line 122, in processEvent
  File "C:\panda3d\built_cmu\direct\showbase\Messenger.py", line 325, in send
  File "C:\panda3d\built_cmu\direct\showbase\Messenger.py", line 410, in __dispatch
  File "C:\panda3d\built_cmu\direct\gui\DirectButton.py", line 103, in commandFunc
  File "main.py", line 690, in startServer
  File "src\online.py", line 14, in registerHost
  File "C:\panda3d\thirdparty\win-python\lib\httplib.py", line 898, in request
  File "C:\panda3d\thirdparty\win-python\lib\httplib.py", line 915, in _send_request
  File "C:\panda3d\thirdparty\win-python\lib\httplib.py", line 842, in putrequest
LookupError: unknown encoding: ascii

I think this is another case of not including a standard Python library, in this case the “encodings” module and all of its fiddly bits. I’ve added this to the morepy module.

Your game is turning out to be an excellent customer to find the rough edges in the plugin support. Thanks for your patience!


You were right about the first bug. Thanks for reporting that, it’s fixed now.

And actually, the second error is due to me importing httplib to try and communicate with a makeshift sort of lobby server. I’m pretty sure I’m not doing that any more, so no need to worry.

On a related note, anyone know of a free web host that will let me listen for UDP traffic? :laughing: I need to do some NAT punch-through. [edit: Never mind, looks like I might be able to do this with some basic PHP…]

OK, I’ve figured out why we’re not getting a progress indication from the Sourceforge server on the download. It’s because Sourceforge doesn’t recognize the p3d extension, and assumes the file is type text/plain, then tries to live-gzip it during the download, which prevents the server from knowing exactly how much data it’s sending us. This also, incidentally, breaks the caching mechanism, so it’s bad all around.

Try creating an .htaccess file in the same directory with the following contents:

AddType application/x-panda3d .p3d

For my part, I’ll add code to the plugin to better handle drawing the progress bar in cases where the server won’t tell us how much data we’re getting.


Okay, I added the .htaccess file. Still doesn’t load for me, but I do see the progress bar moving steadily up till the end. I also changed from using httplib to Panda3D’s own HTTP functions, and the networking is now all UDP. Technically, online play is fully ready to go, but the SourceForge server isn’t receiving my UDP packets, so no NAT punch through right now. Hopefully I can find a way around that.

It doesn’t load for you? What do you see in the logs?

I was able to get in and start playing in single-player mode just fine. Firefox still isn’t caching the file for me for some reason, though. Maybe it doesn’t like to cache large files. Guess there will be a good reason to move to a separate p3d file and mf package eventually.

The game certainly looks beautiful! After a couple of minutes of gameplay, I got this:

ODE INTERNAL ERROR 1: assertion "bNormalizationResult" failed in _dNormalize4() [../../include/ode/odemath.h]

I’ve never been really happy with UDP over the internet. It seems it’s always being stopped by every firewall between you and the server you want to reach.


Oops, on the second launch of the game I get this error immediately:

  File "main.py", line 27, in <module>
  File "src\engine.py", line 78, in loadConfigFile
ZeroDivisionError: float division

Looking in the “config” file (which gets written into the game’s start directory, which is Panda3D/start unless the game specifies otherwise), I see that window-width and window-height are set to 0. Could this be the problem? I removed the config file and it ran.


Yeah, that was the problem. I added a check for zero so that doesn’t happen, but I’m wondering why it was zero in the first place. It just saves the values of base.pipe.getDisplayWidth() and height.

I think it’s just not working on my Windows 7 machine, I got it working on an XP machine in FF3. On Win 7 in FF3, I’ll get the play button, the screen flashes black, and then the panda comes back. On Win 7 in Chrome, the loading bar stays perpetually a few pixels away from loading. The logs are pretty much the same as the one I posted earlier.

Reason I switched to UDP is so that I can do NAT punch-through, which apparently is incredibly difficult to do with TCP. I found an eight-page white paper on it. :open_mouth:

Ah, this method is not implemented on all platforms. It particular, it always reports 0 on Mac OSX, which is where I happened to be running when I got that crash.

Would you mind posting the logs from one of these failed sessions anyway? The log you posted from the failed attempt to load tagger shows it downloading 60.3% of the p3d file, and then you left the page. It never got to 100%. It’s not clear whether the download had stalled, or some other connectivity issue had occurred. However, from your Win7/FF3 report, it sounds like the game launched but immediately exited (the p3dsession.log file should be interesting). On the Win7/Chrome report, it sounds like another connectivity issue, maybe a failure to contact runtime.panda3d.org. The log file would clarify this. :slight_smile:


Actually, neither log file is very interesting. I think it hard-crashes upon starting my game; double-clicking the p3d file now results in a hard crash, with no log error info. Don’t worry about it, though. I think something got screwed up with my install, because like I said, it works on my XP machine. I’ll try this again after a new runtime / packp3d comes out, and see how it goes then.

For the record, I just checked in support for display_width/display_height on OSX to CVS. Should be in my next plugin release (which I’m going to do later this week).

FYI I’ve just updated the plugin builds:
discourse.panda3d.org/viewtopic … 8710#48710

Among the improvements are getDisplayWidth/Height support on OSX, a “morepy” package and David’s plugin fixes.

This release worked great in FF3, Chrome, and IE8 all running on Win7! I put the new P3D up here, complete with plugin detection/installation JavaScript shamelessly ripped from drwr’s plugin demo site.

I had one problem which probably has as much to do with my game as it does with the plugin. It crashes upon trying to read a replay file from a previous game. I can see that it successfully writes the replay file, but apparently it can’t read it back. The log files haven’t shown anything useful so far. Since the main menu will try and play back the last game replay, you’ll have to delete the “replays” folder in %Panda3Dfolder%\start if you want to play more than one game.

I also had a weird bug when double-clicking the p3d file, where the window came up minimized by default, and I could only get it to show by doing a “show desktop” and then restoring all the windows.

Known bugs on my end include the tutorial mode not working at all, and there’s no easy way to release focus from the game.

Anyways, great work rdb and drwr! This is awesome!

Looking great! For whatever reason, Firefox is caching the p3d file for me now, so I only have to suffer the download on the first run. :slight_smile:

I do get this error consistently as soon as I start to roll:

IndexError: list index out of range
le "C:\Users\et1337\Documents\Stainless\dist\src\net.py", line 466, in update
  File "C:\Users\et1337\Documents\Stainless\dist\src\net.py", line 364, in processPacket
  File "C:\Users\et1337\Documents\Stainless\dist\src\controllers.py", line 847,
in clientUpdate
  File "C:\Users\et1337\Documents\Stainless\dist\src\controllers.py", line 599,
in clientUpdate
IndexError: list index out of range

As for this error:

I know what this is–the window is actually being placed offscreen by mistake. Makes it hard to find it. :slight_smile: I’ve already checked in a fix, and it will be available with the next plugin update.