I was thinking of how to load the sounds and building an xml file to describe those sounds.

Then I thought that it could be applied to all entities. Look at the xml sample and tell me what do you think.

<?xml version="1.0" encoding="ISO-8859-1" ?>

   <entity name="ogre">
      <model name="ogre.md2" path="path/to/model">
         <!-- put here model specific tags -->
         <script name="talk" type="animation" play="onApproach">
            <!-- to define.... -->
         <script name="talk" type="sound" play="onApproach">
            <action type="listenerApproach" samples="3">
               <loop seconds="5"/><!-- the samples will be re-played after 5 seconds if the Listener is still there -->
               <audible from="100" unitOfMeasure="cm"/>
               <sample type="SphericalSound" sequence="0" path="path/to/ogre_conversation_startup.ogg"/>
               <sample type="SphericalSound" sequence="1" path="path/to/ogre_conversation.ogg"/>
               <sample type="SphericalSound" sequence="2" path="path/to/ogre_conversation_end.ogg"/>
         <script name="walk" type="sound" play="onAction">
            <action type="grassWalk" samples="1">
               <audible from="100" unitOfMeasure="cm"/>
               <sample type="SphericalSound" sequence="0" path="path/to/grass_footsteps.ogg"/>
            <action type="rockWalk" samples="1">
               <audible from="100" unitOfMeasure="cm"/>
               <sample type="SphericalSound" sequence="0" path="path/to/rocky_footsteps.ogg"/>

its a very cool idea, but doesn’t that sort of mess around with the scene graph?

<model name="ogre.md2" path="path/to/model">

What im suggesting is that the name of the model would be a reference to an entity that has been initialised. Then, we can loop through the entities and add the sound accordingly.

Or do you have a way around this?[/code]

Err… ://

What im suggesting is that the name of the model would be a reference to an entity that has been initialised. Then, we can loop through the entities and add the sound accordingly.

I did not understand, sorry. ://

Arman, I think this is a great idea. I’d love to be able to define a complete scene via a script. It would then be very easy to build a tool that generates these scripts and non-programmers could build entire scenes.

I’m not sure what you mean by “mess around with the scene graph” DarkProphet.

I believe he’s suggesting that the script would create the scene graph. That is, the DTD of the XML would define that entities may contain other entities. Building up the scene graph from the file. the model tag would define the model perhaps and load it.

Of course, I could be misunderstanding as well.

Then I’ll go working on that. :smiley:

oups we wrote the message in the same time

so what your suggesting is that we build the entire app from XML? not just associating sounds with models?

No, the app would use the script to load the data to build the scene.

aaah, fair enough. If its that, then im all for it. My TileMap thing has an XML loader, i can send you the source if you want arman?

Go for it

its pretty simple:

 * Created on Apr 27, 2004
package com.volatile7.TileMap;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
 * @author Ahmed
public class TileMap {
   ProcessTileMap ptm;
   public TileMap(String src) {
      File f = new File(src);
      SAXParserFactory factory = SAXParserFactory.newInstance();
      ptm = new ProcessTileMap();
      try {
         SAXParser parser = factory.newSAXParser();
         parser.parse(f, ptm);
      } catch (ParserConfigurationException pce) {
      } catch (SAXException spe) {
      } catch (IOException ioe) {
   public TileMapHolder getTileMap() {
class ProcessTileMap extends DefaultHandler {
   public TileMapHolder tm;
   public ProcessTileMap() {
      tm = new TileMapHolder();
   public void startElement(String uri, String localname, String qName,
         Attributes attrib) {
      if (qName.equalsIgnoreCase("map")) {
         int width = Integer.parseInt(attrib.getValue("width"));
         int height = Integer.parseInt(attrib.getValue("height"));
         tm.initialiseMap(width, height);
      }else if (qName.equalsIgnoreCase("image")) {
         String name = attrib.getValue("name");
         String src = attrib.getValue("src");
         tm.addImage(name, src);
      }else if (qName.equalsIgnoreCase("tileProperties")) {
         float width = Float.parseFloat(attrib.getValue("width"));
         float height = Float.parseFloat(attrib.getValue("height"));
         tm.setTileDimension(width, height);
      }else if (qName.equalsIgnoreCase("tile")) {
         int x = Integer.parseInt(attrib.getValue("x"));
         int y = Integer.parseInt(attrib.getValue("y"));
         String value = attrib.getValue("image");
         tm.setTileValue(value, x, y);

A like the idea. You should be able to right an entire game with a few xml and a jar with the actions. I BIG advantage of this method would be that all the games could use one map editor like tork.

(I apologies for the bad spelling)://

For clarification: I assume you’re referring to the Torque engine by Garage Games?

"EricTheRed" wrote:
For clarification: I assume you're referring to the Torque engine by Garage Games?