Debugging YG Scenes
as with most types of computer programming, creating scenes in YG involves lots and lots of debugging. Fixing bugs is a little like being a detective and a little like conducting experiments. In any programming language, a program almost never works exactly right the first time, so being able to debug programs is really almost as important as being able to write them in the first place. In YG, a bug means that either (a) your scene doesn't work the way you thought it would, or (b), it doesn't work at all. Debugging requires a little bit of logic, a little luck, and most importantly, lots and lots of patience. This page lists some common pitfalls and problems, and a few helpful debugging techniques, but there's no way to compile all the possible problems you might encounter.
Debugging Tools & Techniques
The first step in debugging problems is often to look in the terminal window after you quit the scene. The YG interpreter prints out a variety of information in the terminal while it's running, and you'll often find helpful error messages there. To begin with, you should understand the normal messages that YG prints out, so you'll know what the printout should look like if everything's working correctly.
[1] 6312
snerd (bergen sound server) - Version 0.4.1evl - Compiled Jul 5 2003
Ygdrasil Version 0.1.10beta0 - compiled Jul 5 2003
PF ================================================
PF = OpenGL Performer 3.1.1 =
PF = DEMO EDITION =
PF ================================================
PF = For information about purchasing the full =
PF = OpenGL Performer product, visit =
PF = http://www.sgi.com/software/performer/ =
PF ================================================
CAVE Library Version 2.7.2_EVL (+Z-up coordinates) - Compiled Nov 30 2000
CAVE: Reading configuration file /usr/local/CAVE/etc/cave.config
CAVE: Reading configuration file ./.caverc
****************************************************************
CAVE Configuration (brief):
Active walls ...................... 1
simulator [-1x-1+0+0] "" left eye(s)
Display mode ...................... mono
Tracker type ...................... simulator
Controller type .................... simulator
Network ........................... none
Distribution ...................... none
App Distribution .................. none
Scramnet .......................... n
CAVELib License Number ............ 0
****************************************************************
CAVERNsoft G2 v1.3 (Mar 05 2002) [PTHREAD VERSION WITHOUT GLOBUS]
WARNING: bergenServer failed to connect to server (localhost)
Creating new root node
TOTAL TEXTURE SIZE: 0 bytes
PF Warning/Usage(2): pfReleaseDPool() NULL pfDataPool*.
[1] + Terminated /home/badzmaru/yg_dev/bin.linux/snerd
rm: No match.
YG will always print out something like this when it runs. It tells you what version of YG, Performer, and the CAVELib you're using, and the CAVE configuration options. For CAVE configuration, note the two lines that tell you what configuration files are being used. These files are used to configure projections, tracking, etc. in the CAVE, or set up the CAVE simulator on a desktop workstation. cave.config is the system-wide configuration file; .caverc is a file you can keep in your yg directory to apply your own custom CAVE settings. The printout of the CAVE configuration tells you how many projection walls are configured, what kind of tracking system is being used, whether you're using stereo or monoscopic display, etc. For more about configuring a CAVE, see the user's manual at http://www.vrco.com/CAVE_USER/index.html.
Problems with running the scene
- RUN: command not found
make sure you are in your yg directory, and that there is a RUN script there.$ pwd /home/ben/yg $ ls audio data dso.linux modules RUN scenes users
also, make sure that it is executable. it should be green; if it isn't, try this:chmod +x RUN
finally, try this:./RUN livingroom.scene
the "./" at the beginning reminds the shell to look in the current directory for the program you're trying to execute. See Setting up your shell preferences for an explanation of how to fix this. - ERROR: ygTokenStream could not find file foo.scene
make sure you typed the name of the scene correctly.
Also, make sure that it is in your yg/scenes directory, and not somewhere else. - ERROR: ygTokenStream could not open foo.scene
not very common, but probably means that the file is corrupted, or has a problem with permissions.
Problems with loading objects, nodes, or parts of the scene
- ERROR (ygTokenStream): unclosed parenthesis in file foo.scene
This is probably the most common error YG. Nodes, messages, and events all use parentheses, and they must be properly nested. For example:
userTrigger (when(enter,cube.size(2))
This will cause an error because of the missing closing parenthesis. The size(2) message closes, the when() event closes, but there is no parenthesis closing the whole userTrigger node. The YG interpreter then gets all confused and thinks that the whole rest of your scene file is still part of the userTrigger node!
Pay attention to the syntax-coloring in Kate - nested parentheses are in different shades of blue, so they're easier to match up. Also, if all your nodes suddenly stop being syntax-colored correctly halfway through your file, this probably means you have a missing parenthesis. - ERROR: mismatched parentheses in foo.scene
Usually means you have too many closing parentheses:
userTrigger (when(enter,cube.size(2)))) - WARNING: unclosed parenthesis in message
Same as the above errors, specifically for messagses - My object isn't showing up in the scene
There's a number of different reasons this could happen.- Make sure the object is positioned somewhere you can see it
- make sure there is a light node so you can actually see things
- try using the outside-view in the CAVE simulator to look around (it might be under your feet).
- Make sure the object is in your yg/data directory. If there's a "Could
not find file" error, then that's probably the reason.
If these quick checks don't solve the problem, try previewing the object in perfly. It's usually a good idea to perfly an object before including it in your YG scene, just to make sure it will load and looks correct. To view an object in perfly:
$ cd $ cd yg/data $ perfly foo.pfb
If nothing shows up, quit perfly and look for errors in the terminal:- PF Warning: pfdFindConverterDSO() - Could not load DSO for extension "xyz"
- PF Warning: pfdLoadFile() - Unable to load file foo.xyz because of problem finding pfdLoadFile_xyz
- ERROR: cannot find DSO for node type foo
This means that you're trying to create a node in your scene file that is not recognized. Usually this is just because of a typo, or a missing parenthesis, or something small like that. If that's not the problem, then you might be trying to use a custom node type that is not installed on your computer. For instance, a node like the liveVideo node may not be installed, so you wouldn't be able to use it. Look in /usr/local/yg/dso.linux or /usr/local/yg/dso.sgi to see if the node you're trying to use is installed. - ERROR: could not find recipient node for message
This means you're trying to send a message to a node but it either doesn't exist or you typed the name wrong. Usually this is caused by typos in your node names:object mycube (file("cube.pfb")) userTrigger (when(enter,mycubr.size(2)))Or, perhaps you just forgot to name the node at all:object (file("cube.pfb")) userTrigger (when(enter,mycube.size(2)))
Problems with how objects are displayed
Problems with messages and interactivity
(c) Ben Chang