Small Nerves Logo

Swimming Fish
a proposed demonstration of NerVRML

The following example of Nerves simulates the nervous system of a very simple swimming fish. The fish's nervous system will respond to two types of stimuli:

The nervous system will drive the fish to swim with a nice undulating motion, suggestive of the real organism. The nervous system will stimulate the fish to move toward the current position of the mouse. When the fish gets close to a geometric object or the mouse itself, the nervous system will signal to stop swimming.

The appearance of the fish and its motion through the VRML world would be described and displayed by other nodes. Thus, Script or Transform nodes would access the exposedFields of the fish Nerves node and then generate or transform a VRML object description of the fish.

Nerves is proposed as a powerful means to route events between the VRML world event system, transform nodes and script nodes. However, Nerves would be more than a mere extension of the exposedFields and the ROUTE keyword. Nerves would provide a high speed behavioral model which could be operated and accessed by all the nodes and processes in a world. Thus, a Nerve Node could embody complex behaviors, moving beyond the simple signal system of events and ROUTE. We hope that Nerves could provide a "Lingua Franca" for behaviour in the interactive and multi-user VRML worlds to come.

Nerve Band

Annotated NerVRML Code Example
# An example of a Nerve Node

DEF SwimmingFish Nerves {
   field.. #definition of fields

   # exposed fields which can be used to send stimulus into the nerve net
   eventIn MFString set_proximity
   eventIn MFInt32 set_mousePosn

   # _changed fields which the nerve net can set
   eventOut MFInt32 bodyMotion_changed

   DEF tokens.. token { ... } # define token maps for
                              # mouseEvents and proximityEvents and new tokens
                              # used only inside the Nerve net (leftSwim etc)

   DEF functions.. func { ... } # define mapping of functions,
                                # followThatMouse, barrierDetector, leftSwim etc.

   # Definition of the complete nerve net, one nerve bundle at a time

   # First Nerve bundle for the fish to be able to see the mouse movement and notice when it is
   # getting close to an object
   DEF frontEnd Bundle {
      # 1. mouseEvents and proximityEvents enter the fishEye and then the visualCortex
      # 2. From the visualCortex, mouseEvent tokens are tested by followThatMouse, results sent to
      #   brainStem (as a stream of new left and right swim tokens)
      -mouseEvent,proximityEvent-fishEye-visualCortex-mouseEvent-followThatMouse-brainStem
      # 3. The visual cortex passes proximityEvents to a barrierDetector which passes new tokens
      #   (such as stopSwim) to brainStem and on to the next Nerve bundle through the stitching
      visualCortex-proximityEvent-barrierDetector-brainStem
      # 4. All unused tokens are dumped 
      visualCortex-forgetAboutIt
   }

   # Second bundle: taking all tokens into a pool called spinalTap and letting the functions
   #   leftSwim, rightSwim and stopSwim test for them and set exposedFields bodyMotion[]
   #   to permit other nodes to display the fish in an undulating motion. The tokens are all
   #   passed on down the spinal cord to the next segment bundle through spinalTap.
   DEF spinalCordSeg Bundle {
      spinalTap=leftSwim-bodyMotion[]
      spinalTap=rightSwim-bodyMotion[]
      spinalTap=stopSwim-bodyMotion[]
      # If this this the last stitch in a repeating sequence, dump remaining messages
      lastStitch-forgetAboutIt
   }

   # Now we use the Stitch keyword to connect the two Bundles and create a larger nerve net.
   # Nine instances of the spinalCordSeg Bundle are stitched onto the frontEnd at the brainStem
   # to simulate a fish with a long backbone.
   DEF fishNerves Stitch {
      frontEnd.brainStem TO 9[spinalCordSeg.spinalTap]
   }
}

# End of Example


Nerve Band

DigitalSpace Navigator Bar - please see below for links
| Frontiers | Home | Search | About Us | Feedback | At Work |