YG Project Directories and the RUN script

A Ygdrasil project has a number of different parts - 3D model files, sound files, custom C++ code, texture image files, and a scene file to tie them all together. Before you start working on a yg project, you'll want to set up your directories.

There are actually many ways of setting up your directories, but this standard setup will work for most projects:

Home Directory
    yg/ 
    	audio/      contains sound files    
        data/       contains model files and textures
	dso.linux/  contains custom yg nodes (plugins)
	modules/    contains source code for custom yg nodes
	scenes/     contains yg scene files
	users/      contains files for avatars

Creating your Directories

You can create your directories from the KDE or Gnome desktop, or like this in the terminal:

$ cd ~
$ mkdir yg
$ cd yg
$ mkdir audio
$ mkdir data
$ mkdir dso.linux
$ mkdir modules
$ mkdir scenes
$ mkdir users

The RUN Script

The RUN Script is what actually runs the YG program, loads your scene, etc. It tells YG where to look for different types of files, starts the sound server, and tells the yg program what scene file to load. The RUN script is just a text file with a series of shell commands, which you can execute as a program. To make a RUN script, download this example, or copy the example below, paste it into a text editor, and save it as a file called RUN in your yg directory.
#!/bin/csh -f if ($?ARCHITECTURE == 0) then setenv ARCHITECTURE linux endif if ($?YG_DIR == 0) then setenv YG_DIR /usr/local/yg endif if ($?BERGEN_DIR == 0) then setenv BERGEN_DIR /usr/local/bergen endif setenv YG_PATH audio:data:scenes:users setenv YG_DSO_PATH dso.${ARCHITECTURE}:${YG_DIR}/dso.${ARCHITECTURE} #setenv YG_DEBUG "world.sentmessages *.volume" setenv YG_DEBUG "*.volume" #setenv BERGEN_SERVER chicago.evl.uic.edu #setenv YG_PRELOAD_CLASSES "mirror clipPlane" #setenv YG_NET_SERVER localhost setenv YG_NET_PORT 3500 #setenv YG_CPP_COMMAND "/usr/bin/gcc -E -I${YG_DIR}/data -I${YG_DIR}/examples" setenv YG_CPP_COMMAND "/lib/cpp -E -Idata -Iusers -Iscenes" ${BERGEN_DIR}/bin.${ARCHITECTURE}/snerd & ${YG_DIR}/bin.${ARCHITECTURE}/yg $1 $2 killall snerd rm -f /usr/tmp/pfutil* #/usr/share/Performer/bin/rmsem

Once you have the RUN script in your yg directory, you need to make it executable - turn it into a runnable program.

$ cd ~
$ cd yg
$ ls

audio data dso.linux modules RUN  scenes  users

$ chmod +w RUN
$ ls

audio data dso.linux modules RUN  scenes  users

$ ./RUN

This should open the CAVE simulator. You won't see anything, of course, since we haven't given it an actual scene to run, but do this anyway just to make sure it works.
(c) Ben Chang