Builder
From NS2 community wiki
The Builder is a system tray application that automatically detects changes to source files and loads them into the NS2 engine on the fly.
- Converts .DAE (COLLODA) model files to the .model format for the Spark engine.
- Converts Photoshop .PSD files to the DX5 : ARGB : 8bit : Interpolated Alpha .DDS file format.
- Handles Sounds, Cinematics, Maps and SWF Files. These will be documented at a later date.
Getting Started - Setting up the Spark Builder
Running
- Double-click Natural Selection 2 in your Steam games list
- Select Run Launch Pad...
Configure for Natural Selection 2
This stage tells the Builder where to copy your compiled materials/models/etc to.
- Click the Create Game button.
- Name: Natural Selection 2 or Your Mods name.
- Output Directory: Select the ns2 folder where Natural Selection 2 is installed (Program Files\Steam\SteamApps\common\natural selection 2\ns2)
- (If you are creating a mod, replace any instance of "ns2" in this document with your own mod folder name.)
- Press OK and the game will appear in the Drop List.
Source Files Directory
This will contain all your Textures, Models, Sounds, Ui's, Cinematics, Levels and LUA source files. These files will have the same directory structure as the NS2 directory. The Builder will maintain the folder structure when it copies/converts contents to ns2 or your mod.
Location
You can put it anywhere you want on your hard drive. Example: D:\Developer\NS2\Builder
Directory Structure
The Builder requires the following folders inside the directory to compile and copy game resources to the NS2 folder:
- materialsrc - Converts .PSD
- modelsrc - Converts .DAE, .PSD only
- mapsrc - Copies .level files. (TIP: Save your levels Spark Editor to this folder)
- cinematics - Copies .level and .cinematic
- soundsrc - Converts/Packs .fdp to FMOD format/library
- ui - Copies SWF, converts PSD
- lua - Copies LUA files
- D:\Developer\NS2\Builder\materialsrc - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\materials
- D:\Developer\NS2\Builder\modelsrc - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\models
- D:\Developer\NS2\Builder\mapsrc - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\maps
- D:\Developer\NS2\Builder\cinematics - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\cinematics
- D:\Developer\NS2\Builder\soundsrc - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\sound
- D:\Developer\NS2\Builder\ui - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\ui
- D:\Developer\NS2\Builder\lua - represents Program Files\Steam\SteamApps\common\natural selection 2\ns2\lua
The Builder also supports subfolders:
D:\Developer\NS2\Builder\modelsrc\custom\my_folder\mytexture.psd will be converted and placed in: Program Files\Steam\SteamApps\common\natural selection 2\ns2\models\custom\my_folder\mytexture.dds
Configure the Builder
Now we have our working directory sorted out and we understand how it is going to work we will now launch the builder and configure it.
The following step only has to be done once when you first launch the builder.
- File > Load Setup...
- Open builder_setup.xml (Program Files\Steam\SteamApps\common\natural selection 2)
- File > Settings...
- Set "Source Directory:" to the source files directory you created before (D:\Developer\NS2\Builder)
- Set "Utils Directory:" to (C:\Program Files (x86)\Steam\steamapps\common\natural selection 2\utils)
- Set "Output Directory:" to (C:\Program Files (x86)\Steam\steamapps\common\natural selection 2\ns2)
Finished
If you have managed to follow this setup guide correctly then you are ready to produce ns2 content and mods.
Building Textures
Building Models
If you have followed the steps above to setup the builder then you will have your "modelsrc" folder all ready to go.
Remember: If setup correctly the Builder will copy your folder structure and .material files over to the ns2/models folder and will also convert and export your PSD's and Colloda (.dae) files.
(For the Models textures follow the Importing Custom Textures Tutorial with the excpetion that the files for the model remain along side the model in the modelsrc folder.)
You should have the following files for a successful compile:
modelsrc\my_folder\my_model_name.dae (See Trouble Shooting below)
modelsrc\my_folder\my_model_name.dds (Model Texture)
modelsrc\my_folder\my_model_name.material (Model Textures Material file)
modelsrc\my_folder\my_model_name.model_compile (One for each model, The .model file that is exported will inherit the name of this file.)
.model_compile should contain these lines:
<model> <geometry "my_model_name.dae" /> <materials_path "models/props/my_map_name" /> <physics "my_model_name_physics.dae" /> <scale 1.0 /> </model>
- Information on physics mesh coming later. Exclude the physics line unless you know what you're doing!
Thats all you have to do, Now you can go to the Builder and Click: Build > Build
Trouble Shooting Models
My Model is untextured?
You may need to edit the .DAE file in Notepad. Goto Edit > Find and enter: <library_images>, This should help you find the following section:
<library_images>
<image id="generic_litter_docume-img" name="generic_litter_docume-img">
<init_from>DRIVE_LETTER:\path\to\model\export\dir\my_model_name.dds</init_from>
</image>
</library_images>
You should ideally alter the path to match the path being copied to your NS2 Model Directory like this:
<library_images>
<image id="generic_litter_docume-img" name="generic_litter_docume-img">
<init_from>models\my_folder\my_model_name.dds</init_from>
</image>
</library_images>
As opposed to just pointing to the file without the path, if you do this without the path you won't have to rebuild the model with a new path should you choose to change the folder structure. I have not come across any problems with excluding the path suffix so far.
Warning: If you place a model in the editor then change the folder it is in the editor won't be able to find the file and the prop_entity will become empty and unselectable.
