Difference between revisions of "Making new scene"

From XStoryPlayer Wiki
Jump to: navigation, search
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
In this tutorial we be creating a new scene that is the interior of a spaceship in which you are held captive.
 
In this tutorial we be creating a new scene that is the interior of a spaceship in which you are held captive.
  
It is assume you have [[Maya]]. If not you can follow this tutorial but cannot edit the scene in [[Maya]].
+
It is assume you have [[Maya]]. If not, you can follow this tutorial but cannot edit the scene in [[Maya]].
 +
 
 +
Scenes from [[Maya]] are converted to in-game format using the [[filemaker]]. We will replace the test scene with the spaceship scene.
 +
 
 +
==Steps==
 +
 
 +
<ol>
 +
<li>Get the <code>sources</code> directory from the '[[Tutorial resource pack]]' and place it in the <code>./pack/pack_abducted</code> directory.<br>
 +
The sources pack contains the Maya scene with the spaceship interior. It is a relative simple scene sufficient for our short story.</li>
 +
<li>Start Maya, set the the project path to the <code>./pack/pack_abducted/sources</code> directory. Do this using the menu <code>File-Project-Set...</code>. This will make sure the textures in the scene are loaded correctly when opening the scene.</li>
 +
<li>Now open the <code>./pack/pack_abducted/sources/scenes/spaceship/scene.ma</code> In Maya. Also open the <code>./pack/pack_abducted/sources/scenes/spaceship/scene.ini</code> file in a text editor.<br>
 +
Every .ma scene need to be accompanied by an .ini file. This .ini file describes how the objects in the maya scene are being used in [[XStoryPlayer]].<br>
 +
You see that objects from the Maya scene are described in the ini file.</li>
 +
<li>Before diving into the details of the Maya scene and the ini file first lets convert the scene.<br>Open the <code>start.ini</code> from the <code>filemaker</code> directory (make backup) and replace the code as follows:
 +
 
 +
<syntaxhighlight lang="cpp">
 +
//////////////////////////////////////////////////////
 +
// Defines
 +
//////////////////////////////////////////////////////
 +
 
 +
#define SOURCES  "../pack/pack_abducted/sources/"
 +
#define RUNTIME  "../pack/pack_abducted/"
 +
 
 +
//////////////////////////////////////////////////////
 +
// Convert settings
 +
//////////////////////////////////////////////////////
 +
 
 +
// Copy textures to runtime directory and create directory if it not exists
 +
maya_auto_copy = COPY_DIR;
 +
 
 +
// Use compressed color textures
 +
maya_auto_compress = COLOR;
 +
 
 +
//////////////////////////////////////////////////////
 +
// Convert maya scene
 +
//////////////////////////////////////////////////////
 +
 
 +
Maya scene
 +
{
 +
  src_path = "[SOURCES]";
 +
  run_path = "[RUNTIME]";
 +
 
 +
  in_file  = "[SOURCES]scenes/spaceship/scene.ma";
 +
}
 +
 
 +
//////////////////////////////////////////////////////
 +
// Compress textures
 +
//////////////////////////////////////////////////////
 +
 
 +
Compgen compress0
 +
{
 +
  // Comment if you don't want to compress files everytime again
 +
  compress = true;
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>The <code>start.ini</code> script contains all the code needed to convert the maya scene from the <code>sources</code> directory to the XStoryPlayer game format.<br>
 +
Make sure you have latest Beta-Patch installed (re-download and install just in case) and run the [[filemaker]].<br>
 +
If all went well, you should see a log that shows that the scene has been converted and the textures have been compressed. Also check the <code>fm_log.txt</code> and <code>fm_trace.txt</code> in the <code>filemaker</code> directory if you like.</li>
 +
<li>You should see that several files have been created in the <code>./pack/pack_abducted/scenes/spaceship</code> directory. Also several (compressed) textures have been added to the <code>./pack/pack_abducted/scenes/textures</code> directory (metal, scifi).<br>
 +
We want to replace the test scene with the spaceship scene. Do this by editing the <code>/init/story/scenes.dat</code> file like this:
 +
<syntaxhighlight lang="cpp">
 +
scene SPACESHIP1
 +
{
 +
  data
 +
  {
 +
    file_name = "scenes/spaceship/scene.scn"; // <-- Change to this
 +
 
 +
    name = "The prison";
 +
 
 +
    closed0    = 0;
 +
    closed1    = 0;
 +
    closed_text = "";
 +
   
 +
    light_ambient = (1,1,1,1);
 +
 
 +
    locked = false;
 +
 
 +
    waypoint_def = "waypoint";
 +
  }
 +
}
 +
</syntaxhighlight>
 +
Now the spaceship scene is used instead of the test scene.
 +
</li>
 +
<li>Start the Abducted story in [[XStoryPlayer]]. You should now be in spaceship cell.<br>
 +
The scene does not have collider objects, we will add these in the next tutorial '[[Editing scene]]'.<br>
 +
[[file:spaceship1.jpg|400px]]</li>
 +
</ol>

Latest revision as of 10:43, 12 January 2015

In this tutorial we be creating a new scene that is the interior of a spaceship in which you are held captive.

It is assume you have Maya. If not, you can follow this tutorial but cannot edit the scene in Maya.

Scenes from Maya are converted to in-game format using the filemaker. We will replace the test scene with the spaceship scene.

Steps

  1. Get the sources directory from the 'Tutorial resource pack' and place it in the ./pack/pack_abducted directory.
    The sources pack contains the Maya scene with the spaceship interior. It is a relative simple scene sufficient for our short story.
  2. Start Maya, set the the project path to the ./pack/pack_abducted/sources directory. Do this using the menu File-Project-Set.... This will make sure the textures in the scene are loaded correctly when opening the scene.
  3. Now open the ./pack/pack_abducted/sources/scenes/spaceship/scene.ma In Maya. Also open the ./pack/pack_abducted/sources/scenes/spaceship/scene.ini file in a text editor.
    Every .ma scene need to be accompanied by an .ini file. This .ini file describes how the objects in the maya scene are being used in XStoryPlayer.
    You see that objects from the Maya scene are described in the ini file.
  4. Before diving into the details of the Maya scene and the ini file first lets convert the scene.
    Open the start.ini from the filemaker directory (make backup) and replace the code as follows:
    //////////////////////////////////////////////////////
    // Defines
    //////////////////////////////////////////////////////
     
    #define SOURCES  "../pack/pack_abducted/sources/"
    #define RUNTIME  "../pack/pack_abducted/"
     
    //////////////////////////////////////////////////////
    // Convert settings
    //////////////////////////////////////////////////////
     
    // Copy textures to runtime directory and create directory if it not exists
    maya_auto_copy = COPY_DIR;
     
    // Use compressed color textures
    maya_auto_compress = COLOR;
     
    //////////////////////////////////////////////////////
    // Convert maya scene
    //////////////////////////////////////////////////////
     
    Maya scene
    {
      src_path = "[SOURCES]";
      run_path = "[RUNTIME]";
     
      in_file  = "[SOURCES]scenes/spaceship/scene.ma";
    }
     
    //////////////////////////////////////////////////////
    // Compress textures
    //////////////////////////////////////////////////////
     
    Compgen compress0
    {
      // Comment if you don't want to compress files everytime again
      compress = true;
    }
  5. The start.ini script contains all the code needed to convert the maya scene from the sources directory to the XStoryPlayer game format.
    Make sure you have latest Beta-Patch installed (re-download and install just in case) and run the filemaker.
    If all went well, you should see a log that shows that the scene has been converted and the textures have been compressed. Also check the fm_log.txt and fm_trace.txt in the filemaker directory if you like.
  6. You should see that several files have been created in the ./pack/pack_abducted/scenes/spaceship directory. Also several (compressed) textures have been added to the ./pack/pack_abducted/scenes/textures directory (metal, scifi).
    We want to replace the test scene with the spaceship scene. Do this by editing the /init/story/scenes.dat file like this:
    scene SPACESHIP1
    {
      data
      {
        file_name = "scenes/spaceship/scene.scn"; // <-- Change to this
     
        name = "The prison";
     
        closed0     = 0;
        closed1     = 0;
        closed_text = "";
     
        light_ambient = (1,1,1,1);
     
        locked = false;
     
        waypoint_def = "waypoint";
      }
    }

    Now the spaceship scene is used instead of the test scene.

  7. Start the Abducted story in XStoryPlayer. You should now be in spaceship cell.
    The scene does not have collider objects, we will add these in the next tutorial 'Editing scene'.
    Spaceship1.jpg