SIEGE UNIVERSITY 2

Siege University II Tutorials
Modding FAQ
095: Upgrading DSII
100: The Basics of Siege Editor
201: Compass Map Radar
202: Conversations
203: Journal
204: Quest Indicator Icons
205: Start Positions
206: Teleporters
207: Town Portal Restrictions
208: Weapon Effects
209: Flick
210: Tuning Grids
211: Setting Up Good Map Lighting
212: Setting Up Simple Node Fading
215: Building Data Tables

Siege University I Tutorials
200: Concepts and Terminology
201: Templates
203: Triggers
204: Moods
205: Fades
206: Elevators
211: Naming Key
213: Dungeon Siege Resource System
301: Introduction to Dungeon Siege Architecture

Third Party Tutorials
A Simple Mod Part One - Armor Textures
A Simple Mod Part Two - A New Armor
Beginners Guide to Stitching Regions
How to Open and Create Tanks
Making Chants Work in a New Map
Ornaments
Understanding the NKK

Useful Links
Siegetheday.org
Dungeon Siege Outpost
Dungeon Raider
Kdawg.org - List of useful Links
MCarp DS Nodes
Dungeon Siege 2 at Gamefront
Broken World at Gamefront

Overview

During the development of DS2, the "tuning grid" system was created to allow monster to be dynamically generated as nodes streamed into the frustum. This tuning system is composed of a series of weighted blocks created in Siege Editor on a region by region basis. The system takes a list of templates generated by the developer and assigns properties to each creature and their blocks. By doing this a developer is able to create a dynamic combat experience that changes each time a party runs through the region but appears random and is correctly balanced.

The creation of a tuning path is an advanced application and requires that the developer understands the fundamentals of how .gas, .skrit, inheritance and template files work. This lesson is written with those assumptions in mind.

Tech Specific Glossary

There is specific terminology used in discussion of tuning path technology. Listed here are the most common and those used in this lesson:

·         dev_path_point: These are objects that are placed in a region using SE that are used to calculate where to dynamically place monsters.

·         Tuning Path: This is a series of dev_path_point objects that are all linked via a tool in SE.

·         Spawn: The act of a creature being propagated into the tuning path when a node streams into the party frustum.

·         Tuning Cube: A 3D space in a region that a monster will spawn onto. Cubes will only be generated on valid pathable terrain.

·         Build: When a tuning path has been defined, a tool in SE is used to generate the cubes and monster grouping for the grid.

·         Tuning Grid: This is the result of a tuning path that has been built. It is a set of cubes on pathable terrain where actors can potentially spawn.

·         Power Level: A float variable that indicates how strong the monster is and thus, where it can appear in the tuning path.



Files Overview

There are several files that are part of any map that contains a tuning path:

·         ...\info\tuning_placement.gas - Created and edited by the developer to define the path properties for the whole map.

·         ...\info\tuning_placement.skrit - The skrit file that generates the tuning grid.

·         ...\YOUR_REGION_NAME_HERE\tuning\tuning_monsters.gas - Created by SE during the building of a tuning path, this file is a list on monsters, groupings of each and their weight.

·         ...\YOUR_REGION_NAME_HERE\tuning\tuning_placement.gas - Information used for debugging, not used by SE or ingame.

·         ...\YOUR_REGION_NAME_HERE\tuning\region_monsters.gas - A list of monster for the region.

·         ...\YOUR_REGION_NAME_HERE\tuning\tuning_groupings.gas - Not used by SE or the game executables, but rather by the developer for debug purposes..

·         ...\YOUR_REGION_NAME_HERE\tuning\tuning_data.tnp - A binary file used by the game executable to generate the tuning grid.

·         ...\YOUR_REGION_NAME_HERE\tuning\dir.lqd22 - Compressed directory structure of gas files used by SE.



Part 1: Setup

 

Setup A Map

Two files called tuning_placement.gas and tuning_placement.skrit are needed by the editor in order to use tuning placement. Both must be located in the maps' info directory. You can either copy tuning_placement.gas from the DS2_world map or generate it in SE. The file tuning_placement.skrit will have to be copied from the DS2_World directory though. Even though SE can generate this file, you will most likely need to do some hand editing in order to prepare it for use. To have SE generate the file:

1.) Launch SE.

2.) From the Tools menu, select Tuning and then Map Tuning Placement Settings. This will launch a small wizard.

3.) Select the map you wish to use and click Next.

4.) The next page is the property page, adjust any of the properties you want and then click Next.

5.) Click Finish to save.

The map is now ready to use tuning placement.

Tuning Settings

Below is a breakdown of the various properties to a tuning_placement.gas file:

[tuning_settings]

{

  f grid_x = 5.000000;

  f grid_y = 5.000000;

  f grid_z = 5.000000;

  f monster_density = 0.10000;  // Minimum: 0.0, Maximum: 1.0

}

NOTE: Any fields found in the file that DO NOT appear in the above block have been removed from the tuning grid system and are nonfunctional.

The grid_x, grid_y, grid_z determine the size of the grid cubes that will be used for tuning placement. The larger the cube size, the less overall cubes that will be generated but more points will be available to place monsters in. Smaller cube size means more cubes but less points for monster placement.

The monster_density variable is one of the most important of them all. This determines how many VALID tuning cubes may be used within a given tuning region. Valid tuning cubes are the cubes generated by the Build Grid functionality of SE. When a grid is built it does several passes through the region. The first pass generates a cube for every last inch of a region. The subsequent passes during the Build Grid event eliminate cubes from the grid. These cubes are eliminated if any of the following are true:

·         The node falls within the radius of a cube_disabler object.

·         The node does not have enough valid placement points within the cube.

·         No monsters are allowed to be on that node because:

·         The floor is flagged as unpathable.

·         Terrain permissions.

·         Path distances.

·         No monsters in the region_monsters.gas

·         Monsters not being of the correct level to spawn within a particular path level.


Finally, using the example above with f monster_density = 0.10000;, only 10 out of every 100 valid cubes will be activated and have monsters spawn in them.

 

Monster Groups

Monster groups can be considered the "difficulty" definition groups. There is no limit to the amount of groups a region can have and the naming of the groups is completely arbitrary. For example, the groups can be defined as "easy", "medium", "hard", "miniboss", "weenies", or "jimmy-joe-joe-jimmy-shabadoo".
After SE has created the file, debug information for the monster groupings can be found in the files:

·         ...\info\tuning_placement.gas

·         ...\YOUR_REGION_NAME_HERE\tuning\tuning_groupings.gas



Base Units

Each group has a number of base units that can be set to it. This determines how many or how tough the monsters can be in that group.

[base_unit_by_group]// group = units

{

        easy = 1;

        medium = 2;

        hard = 4;

        miniboss = 8;

} 

This is the map that the monster groups will use to determine what kind of monsters can be used. Here's how to make sense of these numbers:

1.) Each monster has a power_level that they either inherit from a template that they specialize or have one defined in the [actor] block of their template.

2.) The starting point of a tuning path in a region has to be assigned a level, which corresponds to the level the party will be when encountering that path the first time.

3.) The level of the path will be calculated in a formula within the map's tuning_placement.skrit file. This will determine which group category the monster will fall in.

4.) Each path is assigned monsters that can be pulled for use in the tuning combos. The monster power levels MUST be within the level of the path!


For example, a monster is flagged by the tuning_placement.skrit file to have a power level 40 and is considered "easy". That monster will have a base unit value of 1 using the above example. If a hard grid cube is activated, the system will allocate 4 base units for the grid to truly be considered hard. In this case, the system could take four of those power level 40 monsters (for a total of 4 base units) and offer that as a possible option for this cube when it activates.

 

Sample Monster Group

Here's a sample monster group with comments:

[t:group,n:hard]

{

   // Order stands for two things.  It is used to ID the group, so each group must have

   // a unique order.  Also, the order determines when the grid cubes will be activated

   // for this group.  Since this group is order 0, all the hard grids will be calculated

   // first.

   order = 0;

 

   // Base units were described above.

   base_units = 8;

 

   // This is for visual and debugging purposes only.  It is an optional field, but very

   // useful when loading grids.

   color = 0xffff0000;

 

   // Percentage determines how many of the total allowed tuning cubes can be activated.

   // Here is the formula:

   // number of activated "hard" cubes = (total cubes * monster density) * "hard group" percent

   percent = 0.10;

 

   // Spatial rules determine the distance between cubes and the distances from the path.

   [spatial_rules]

   {

      [grid_distance]

      {

        // This says that a hard cube has to be at least 2 cubes away from another "hard" cube.

        hard = 2;                                       

 

        // Note that there is no spatial rules for distances from "easy" and "medium".

        // This is because this group is the FIRST ORDER, so as cubes of this group are activated FIRST, there

        // are no easy and medium tuning cubes to worry about. 

        // This being the case, spatial restrictions for "hard" in the "medium" and "easy" groups are required

        // since they are evaluated after the "hard" groups.

        // When the medium group is written out as order 1, it doesn't need to worry about grid distance

        // for "easy" because "easy" hasn't had its turn yet.

      }

      [path_distance]

      {

        // This says that a "hard" cube MUST be at least 0-7 grid cubes away from the path, no more, no less.

        min = 0;

        max = 7;

                                       

        // There is no limit to the amount of path weights that can be defined.  This allows certain areas to have a higher

        // chance of activating.  This example path weight says that there is a 60% chance of being activated

        // when the cube is 0 distance from the path.

        [path_weight]

        {

           min = 0;

           max = 0;

           weight = 0.6;

        }

      }

      [path_point_distance]

      {

         // This says that NO points may be activated that are within 2 grids from the FIRST tuning point.

         first_point = 2;

 

         // This says that NO points may be activated that are within 2 grids of the LAST tuning point.

         last_point = 2;

               

         // This is a weight based on the distance of a grid from the first point.

         [first_point_weight]

         {

            // The grid must be in this range from the first point in order to get this weight affecter.

            // The weight affecter is only applied to the combined weight!  It is not a separate weighting.

            min = 2;

            max = 4;

            weight = 0.1;                                       

         }

 

         // This is a weight based on the distance of a grid from the last point

         [last_point_weight]

         {

            // The grid must be in this range from the last point in order to get this weight affecter.

            // The weight affecter is only applied to the combined weight!  It is not a separate weighting.

            min = 0;

            max = 4;

            weight = 0.2;                                       

         }

      }       

   }

  }

 

Part 2: Monster Power Levels

Each monster that appears in the tuning system has a property (either assigned to them or inherited from a specialized template) that appears in their actor block called power_level or PL. This PL property is what the tuning_grid.skrit file uses to calculate the use of a monster in the path they are specified in.

The table below is provided for PL calculations and contains the following components:

·         Hero Uber Level: This is the level of the main character when they experience this path for the first time.

·         Weak PL: Creatures that inherit weak base template stats have a PL of this value in their respective paths.

·         Normal PL: Creatures that inherit normal base template stats have a PL of this value in their respective paths.

·         Strong PL: Creatures that inherit strong base template stats have a PL of this value in their respective paths.

 

Calculating PL

As stated, the PL of a monster is the ONLY property that the tuning_grid.skit file looks for in building the tuning paths for a region. Here is an example of how to calculate the correct PL to place in a template:

1.) In the Hero Uber Level row, find the party level when they are to first experience the path.

2.) Find the corresponding number below the Hero Uber Level if the creature is weak, normal or strong.

3.) Assign the creatures power_level property this value

Monster List

SE is unable to properly edit the monster list for a region at this time so the file region_monsters.gas must be edited by hand using a common text editor. If the region has not had a tuning grid ever then it will need to be created. The best way to do this is by simply copying a file from the DS2 untanked content into the region being tuned. This file MUST exist and be in place BEFORE a tuning path is installed. The file is located at:

...\DS2_REGION_NAME_HERE\tuning\region_monsters.gas

The file should look similar to the below example:

[region_monsters]

{

        [hj_01_jungle_path_1]//The path name and is completely arbitrary.  In DS2 the naming scheme was "tuning_path" or "tuning_path_2".

        {

                [tuning_boggrot]//This is the template name of a creature that is available for placement in the path.

                {                                                

                        [distances]//Defines where the creature will appear in the path.  No limit to the amount of distance entries for a template.

                        {                       

                                * = 0,1;//Indicates that this template may spawn between 0 and 1 meters on the tuning path.

                                * = 5,10;//Indicates that this template may ALSO spawn between 5 and 10 meters on the tuning path.

                        }                       

                       

                        [pairings]

                        {

                                * = tuning_taclak;//If path and cube restrictions allow, this creature will spawn with the tuning_boggrot.

                        }                       

                }

                [tuning_undead_pirate]//This is the minimal amount of info needed.  By default this creature will spawn through the whole path.

                {                        

                }                       

        }

}

The region_monsters.gas file is the heart of the tuning system. It contains all the information about what creatures will appear in the region, how they will appear, with who they will group and where they can potentially appear. When defining which creatures will appear in the tuning path for a region, follow these steps to edit the template with the correct values:

1.) Select the desired monster of choice and open it's template in a text editor.

2.) Follow the inheritance tree up through the template to see if it is a weak, normal, or strong monster.

3.) Edit the monster_level property of the skills subblock in the actor block of the template so the creature is approximately the same level as the party when they FIRST experience it.

NOTE: The monster_level property has NOTHING to do with the calculation of the tuning paths. It is entirely possible to have super weak creatures with high PL values in a path causing them to spawn super rarely. The tuning grid system care only about the PL property.

4.) In the actor block of the creature, place or edit the power_level property to the desired value as shown in the table above.

5.) Save the template.

6.) Edit the region_monsters.gas file for the desired region and add the appropriate templates to the file as shown above.

 

Part 3: Installing Tuning Grids

 

Installing Objects

Once a map has been created, a region built and tuning enabled with the steps above, it is ready to have a path installed. As noted earlier, the tuning grid system runs off of dev_path_point objects that are placed in a region using SE. Below is a walk through on installing a sample path. At this point, this lesson assumes that the reader understands the fundamentals of map and region creation as well as object placement using SE.

1.) Open the desired region in SE.

2.) Ensure that the following tools are turned on:

* Toggle Placement Mode

* Auto-snap to Terrain

* Movement Mode

* View Objects

* Object Editing Mode

3.) From the Tools menu navigate to the Tuning flyout menu and select Tuning Editor. This will bring a UI up for the tuning system.

4.) From the Paths tab on the UI click the Add Path to open the Add Tuning Path naming UI.

5.) Name the tuning path EXACTLY AS IT IS NAMED IN THE REGION_MONSTERS.GAS FILE or the path will not build.

6.) The name of the path should appear in the Paths tab now, select it and then click the Place Points button to enable object placement.

NOTE: At this point SE is in object placement mode. Clicking ANY valid terrain will place a dev_path_point object. Clicking the Place Points button again will toggle the object placement of dev_path_point.

7.) Click valid terrain to place 10 points through the region. The first point will appear as a simple arrow. The remaining will appear as an arrow as well and be linked in a line.

NOTE: The tuning point object appears in SE as a large arrow. The direction the object faces on the node is irrelevant, the direction of the connection line between points isn't though. The first point should have a line of animated arrows that connect it to the next and so forth. These animated arrows indicate which direction the path "flows".

8.) Click the Place Points button again to stop adding points to the path.

9.) Click the first point in the path to select it and then right click it again and open the Properties window for the object.

10.) Scroll down the properties window and change the following properties under the dev_path_point block:

Level: This should be checked and equal to the Hero Uber Level when they first experience the path.

used_in_tuning_placement: This should be checked and set to a value of TRUE.

path_name: This should ALREADY be checked and contain the name of the tuning path created.

11.) Close the Properties window by pressing the OK button after making changes.

12.) From the Tuning Grid tab of the Tuning Editor UI, ensure that the Draw Grid and Draw Solid Grid checkboxes are enabled.