SEED - Spawnargs

From The DarkMod Wiki
Revision as of 08:11, 10 September 2010 by Tels (talk | contribs) (add)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Introduction

The new LODE system an entity manager and creation system. It also contains a ModelGenerator, which can not only generate models, but also combine render models to improve performance.

This article describes in depth all the spawnargs you can set on the LODE, LODE inhibitors as well as on entities created by the LODE:

Spawnargs on the LODE

These spawnargs can be set on the LODE itself and set defaults or influence overall strategies:

spawn_class/spawn_count/spawn_skin

Defines an entity class, the count of entities, and their skin to spawn. This can be used instead of creating entities and linking them from the LODE, saving on entity count on map start.

If you f.i. wanted to have the lode spawn randomly either one apple or one pear, the traditional "target" method requires you to place one LODE, one apple and one pear entity, for a total of 3 entities, even tho during runtime only one entity would actually survive.

You can use multiple of these, and combine it with a overall max_entities count, too:

"remove"         "1"           // remove the LODE after spawning the entities
"max_entities"   "4"
"spawn_class"    "atdm:moveable_food_apple"
"spawn_count"    "3"
"spawn_skin"     "tdm_fruit_brownish"
"spawn_class_1"  "atdm:moveable_food_pear"
"spawn_count_1"  "2"

This would spawn at most 3 apples and at most 2 pears, but overall not more than 4 entities. Remember to make the LODE space big enough so that all to-be spawned entities will fit!

Do not confuse spawn_class with spawnclass, this will make the LODE stop working!

angle

Rotates the LODE shape around the z-axis. F.i. angle=45 would create a rectangle rotated by 45°.

Note: Do not rotate the LODE entity or LODE brush inside DR itself, this will only increase the LODE bounds, but not actually rotate the LODE shape!
The angle spawnarg

bunching

Default: "0" (Off). Number from 0.0 to 1.0, giving the probability that a randomly created entities "bunches" up with an already existing entity. Can be overriden for each entity class with lode_bunching.


color_min/color_max

Sets the random color variance bounds min/max. Can be overriden per entity class with lode_color_min and lode_color_max.

Works only on light entities or entities that use a skin with a colorable material. If combine is true, the material also needs a "vertexColor" stage, or all the combined entities will have the same color.

Example:

 "color_min"   "0.7 0 0.2"
 "color_base"  "0.8 0.5 0.7"

combine

Default: 1 (true). If set to 0, this LODE will never try to combine rendermodels of entities together, this will result in much slower rendering.

Can be overridden on a per-class basis with lode_combine.

cull_range

Default: 150 units. Entities further away from the player than hide_distance (as defined on each LOD entity) + cull_range will be removed from the game world. When they come closer to hide_distance + (cull_range / 2), they will respawn automatically.

Can be overridden on a per entity-class basis with lode_cull_range.

Set to 0 to disable any entity culling for this LODE. This should be only used for LODEs with a small number of entities, otherwise you can easily run out of entity slots.

debug

Debug level, default: 0. If > 0, more debug messages are printed to the console. Warning: Can generate massive amounts of output!

density

Default: 1.0. A factor multiplied with the number of entities generated if max_entities is 0.

The density spawnarg controls how many entities are generated when max_entities is 0.
Note: The density is slightly influenced by the menu setting "Object Detail". Make sure you test your map with the "Normal" setting. If you can, test as well as the "Lowest" and "Highest" to get a feeling for the extremes that can appear.

Each class can have its own lode_density factor that will be multiplicated with the LODE density.

falloff

Default: none. Defines a function that influences the probability that an entity will be generated. If set to none, all positions are equally likely, resulting in a square shape. All other values (except "func") create a ellipse defined by the corners of the LODE and distribute the entities inside that shape.

The value can be set on a per-class base with lode_falloff.

Possible values:

  • none - entities all over the square, none outside
  • cutoff - no falloff, but entities restricted inside the ellipse formed by LODE corners
  • square - elliptical like cutoff, but square falloff from the center
  • exp - elliptical like cutoff, but exponential falloff from the center
  • func - a function calculated from parameters, see LODE - Falloff function for details and images.
The falloff spawnarg controls the distribution of the entities.

falloff_map

Specifies the path to an image map (8bit greyscale TGA), where black is 0% and white is 100% spawn probability.

Example:

"falloff_map" "textures/lode/heightmap.tga"

Note: The image base map is combined with whatever distribution you set with falloff, also inhibitors are still taken into account.

floor

Default: 0 (Off). If set to 1, all generated entities will be floored, that is their position will be adjusted so that they touch whatever is under them. They start out at the height the template entity is placed in the editor. This works with dynamically created terrain or terrain consisting of irregular heights like when it was made from patches. See also lode_collide and lode_stack.

Finding the height where the entity is placed is a three-step process, and the "floor" (or lode_floor per class) disables/enables the second step. Here is how it works:

First, the entities are placed in whatever height you place the template in the editor. This way you can control their maximum height - entities will only sink down from there (unless the sink_min/sink_max spawnargs are negative, then entities will raise from this point on).

Step 1: With floor off: Placing entities at the editor height.
Step 1: With floor on: Placing entities at the editor height.

If "floor" is true, then the second step will place entities downwards so their origin touches the terrain. Note that nothing happens when "floor" is off!

Step 2: With floor on: Touch down to the terrain.

In the third step random sinking/raising of the entities is done according to the "sink_min" and "skin_max" spawnargs:

Step 3: With floor on: Random sinking.
Step 3: With floor off: Random sinking.

impulse_min/impulse_max

Only used for moveables, ignored for all other entities. Sets the minimum and maximum limits for an random impulse that is applied to each moveable when it spawns for the first time. Can be overridden on a per-class basis with lode_impulse_min and lode_impulse_max.

lod_scaling_limit

Default: 10. Integer.

The max_entities number scales slightly with the GUI setting "Object details". This is generally a good thing, as it allows the player to lower/raise the details according to his machine. However, in specific circumstances you want a LODE control exactly so many entities as specified. This spawnarg gives the limit under that the scaling for the entity count will be skipped.

Example: You want to a LODE that always creates exactly 16 crates: Set the following spawnargs:

"lod_scaling_limit" "16"
"max_entities"      "16"

lod_scale_density

Default: 1. Boolean.

The density scales slightly with the GUI setting "Object details". This is generally a good thing, as it allows the player to lower/raise the details according to his machine. However, in specific circumstances you want a LODE to create an entity pattern that is not influenced by the menu setting, f.i. because it looks out-of-place with too many or too little entities. This spawnarg gives you the ability to turn the scaling off.

Note: Should only be used very seldom.

max_entities

Default: 0. The maximum number of entities generated. If 0 (the default), then the number will be computed from the aprox. area the LODE covers, taking into account the density spawnarg. Can be overridden by each entity class with lode_max_entities.

Note that the LODE might generate less entities, f.i. when entities do not all fit into the LODE area, or the inhibitors inhibit too many entities.

probability

Default 1.0. Is used as default probability for entities to spawn on certain surface types, but only when you define lode_material_xyz spawnargs on the template/target entities. See there for an explanation on how this lets you spawn entities only on some surfaces but not on others.

remove

Default: 0. Boolean, if set to 1, the LODE will spawn all entities immediately (instead of spawning only the ones that are visible to the player) and then remove itself.

rotate_min/rotate_max

Default: 0 0 0 and 5 360 5. The range for each axis on how much the entity will be randomly rotated around it. In the order "Ymin Zmin Xmin" and "Ymax Zmax Xmax" (or pitch, yaw, roll (yzx), where the actual rotation order will be yaw, pitch, roll, e.g. "zyx").

The default makes entities yaw randomly between 0 and 360 degress around Z (turn), and pitch/roll between 0 and 5 degrees on the other two axes. Can also be overwritten on each class with lode_rotate_min and lode_rotate_max.

scale_min/scale_max

Default: Both 1.0 1.0 1.0. Floats, one per axis in the order X Y Z.

Can be overridden on a per-class case with lode_scale_min and lode_scale_max.

Note: Clipmodels cannot be scaled, so this only works properly for non-solid ("solid" "0") entities.

seed

Default: 0. The random seed. If not set or set to 0, a random value will be used (this is the recommended way, as it generates different results every time you start the map anew, but still keeps the entities when you f.i. save and then load a game).

If set to > 0, the random number generator will always generate the same sequence, so you get still randomly distributed results, but they are always the same.

sink_min/sink_max

Default: Both to 0. In Units.

Define the range (minimum/maximum) of how much entities randomly sink into the floor. Can be overridden on a per-class case with lode_sink_min and lode_sink_max. This is in addition to the "base line floor" of the entity, which is either determined by the placement of the template entity in DR (if lode_floor is false), or by the point where the entity origin touches the ground (if "lode_floor" is true).

This can f.i. be used to let all floored entities sink 1 or 2 units into the ground, to avoid that the entity, if placed on a step incline, sinks at one side into the ground, but stands "on air" on the other side.

See also [[#z_min/z_max|z_min/z_max].

Note: If sink_max is smaller than sink_min, it will be set to sink_min.

Usages:

  • sink_min = 0, sink_max = 0 - all entities are at the same "height"
  • sink_min = 5, sink_max = 5 - all entities sink 5 units "down"
  • sink_min = 1, sink_max = 15 - all entities sink between 1 and 15 units "down"
  • sink_min = -10, sink_max = -5 - all entities raise between 5 and 10 units "up" (note seemingly reversed numbers)

"Down" here refers to the gravity normal of the Lode, e.g. at the moment just down the z-axis.

spacing

Default: 0. Defines a minimum distance between placed entities. If set to > 0, implies collision check at creation time between all entities.

wait_for_trigger

Boolean, default: 0. If set to 1, causes the LODE wait after generating the entity positions until it is triggered, and only then spawn the actual entities. Using the remove spawnarg will work correctly together with this, the LODE will first wait, then spawn, then remove itself.

z_invert

Boolean, default: false (0). If true, units will be placed only lower than z_min and only higher than z_max, but not between.

Can be overriden per entity class with lode_z_invert.

z_min/z_max

Float, default -1000000 and +100000 (e.g. off for all practical purposes).

Sets the z-height variance bounds min/max. Entities will not placed lower than z_min and not higher than z_max, in absolute Doom units. Can be overriden per entity class with lode_z_min and lode_z_max.

See also z_invert to place units only outside the z_min/z_max band.


Spawnargs on the Inhibitors (atdm:no_lode)

At the moment you cannot set spawnargs on inhibitors. This will be added later.

Spawnargs on Targets

These spawnargs can be set on the entities that the LODE targets:

lode_color_min/lode_color_max

Sets the random color variance bounds min/max for all entities from this class. The final entity color is between "lode_color_min" and "lode_color_max". Works only on light entities or entities that use a skin with a colorable material.

Example:

 "lode_color_min"   "0.7 0 0.2"
 "lode_color_base"  "0.8 0.5 0.7"

This will result in entities ranging from dark plum to a light purple.

lode_combine

Default: 1 (true). If set to 0, this LODE will never try to combine rendermodels of entities of this class together, this will result in much slower rendering.

lode_cull_range

Default: To whatever the LODE specifies, which defaults to 150 units. Entities further away from the player than hide_distance (as defined on each LOD entity) + lode_cull_range will be removed from the game world. When they come closer to hide_distance + (lode_cull_range / 2), they will respawn automatically.

To disable culling of entities set to 0.

lode_density

Default: 1.0. A factor multiplied with the density of the LODE itself, used to calculate the number of entities generated if max_entities is 0.

Note: The density is slightly influenced by the menu setting "Object Detail". Make sure you test your map with the "Normal" setting. If you can, test as well as the "Lowest" and "Highest" to get a feeling for the extremes that can appear.

lode_watch_brethren

Boolean, default: 0 (false).

If set, instead of taking this entity as a template to create new entities, this tells the LODE entity that all entities inside the LODE and of the same entityDefName as this one should be "watched" over by the LODE.

That means it will add these entities to its entity watch list, and do the LOD changes as well as cull/respawn them if nec.

The other "lode_*" spawnargs (like lode_floor, lode_spacing etc.) are ignored on the target entity. The only relevant spawnargs are lod_* and hide_distance - these cause the LOD system to kick in. Also, do not forget to put a hide_distance on the target entity, or the LODE will never cull the entities it watches.

lode_falloff

Default: Whatever the LODE specifies, or none. Defines a function that influences the probability that an entity will be generated. If set to none, all positions are equally likely, resulting in a square shape. The other values (except "func") create a ellipe defined by the corners of the LODE and distribute the entities inside that shape.

Possible values:

  • none - entities all over the square, none outside
  • cutoff - no falloff, but entities restricted inside ellipse formed by LODE corners
  • square - elliptical like cutoff, but square falloff from the center
  • exp - elliptical like cutoff, but exponential falloff from the center
  • func - a function calculated from parameters, see LODE - Falloff function for details and images.
The falloff spawnarg controls the distribution of the entities.

lode_floor

Default: 0 (Off). If set to 1, all entities of this class will be floored, that is their position will be adjusted so that they touch whatever is under them. This works with dynamically created terrain or terrain consisting of irregular heights like when it was made from patches. See also lode_collide and lode_stack.

lode_max_entities

Default: 0. The maximum number of entities generated. If 0 (the default), then the number will be computed from the accordingly to the lode_score of this class and the max_entities from the LODE. If greater than zero, only so many entities will be generated and the spawnarg lode_score will be ignored for this class.

Note that the LODE might generate less entities, f.i. when entities do not all fit into the LODE area, or the inhibitors inhibit too many entities.

lode_score

Sets the score for this entity class. All scores will be summed together, and the score for each class will be the percentage of entities of this class to create. Some examples:

  • Entity A: 4, Entity B: 5: Sum: 9, 4/9 of all entities will be of class A, and 5/9 will be class B
  • Entity A: 1, Entity B: 2: Entity C: 7, Sum: 10, 1/10 of all entities will be of class A, 2/10 will be class B and 7/10 will be of class C

lode_spacing

Defines a minimum distance between placed entities of this class. Overrides the default setting from "spacing" on the LODE. If set to > 0, implies collision check at creation time between all entities of this class.

lode_rotate_min/lode_rotate_max

Default: Same as the LODE specifies (which defaults to 0 0 0 and 5 360 5).

The range for each axis on how much the entity will be randomly rotated around it. I the order "Ymin Zmin Xmin" and "Ymax Zmax Xmax" (or pitch, yaw, roll (yzx), where the actual rotation order will be yaw, pitch, roll, e.g. "zyx").

The default makes entities rotate randomly between 0 and 360 degress around Z (turn), and tilt between 0 and 5 degrees on the other two axes. Use 0 0 0 and 0 360 0 for entities that should be perfectly upright.

lode_bunching

Default: What the LODE specifies with bunching. Number from 0.0 to 1.0, giving the probability that a randomly created entities "bunches" up with an already existing entity. Can be override per entity class with lode_bunching.

lode_noinhibit

Default: 0 (false). Boolean.

If set to 1 (true), entities of this class will not be inhibited by any inhibitor linked to this LODE. Can be used f.i. to add grass and trees to an area, but make it so that trees are inhibited in certain areas, but grass never is.

For more control over non-inhibition of entities, see the section #Spawnargs on the Inhibitors (atdm:no_lode).

lode_sink_min/lode_sink_max

Default: Both to what the LODE specifies with sink_min and sink_max. In Units.

Define the range (minimum/maximum) of how much entities randomly sink into the floor. This is in addition to the "base line floor" of the entity, which is either determined by the placement of the template entity in DR (if "lode_floor" is false), or by the point where the entity origin touches the ground (if "lode_floor" is true).

This can f.i. be used to let all floored entities sink 1 or 2 units into the ground, to avoid that the entity, if placed on a step incline, sinks at one side into the ground, but stands "on air" on the other side.

Note: If lode_sink_max is smaller than lode_sink_min, it will be set to lode_sink_min.

Usages:

  • lode_sink_min = 0, lode_sink_max = 0 - all entities are at the same "height"
  • lode_sink_min = 5, lode_sink_max = 5 - all entities sink 5 units "down"
  • lode_sink_min = 1, lode_sink_max = 15 - all entities sink between 1 and 15 units "down"
  • lode_sink_min = -10, lode_sink_max = -5 - all entities raise between 5 and 10 units "up" (note seemingly reversed numbers to make min smaller than max)

"Down" here refers to the gravity normal of the Lode, e.g. at the moment just down the z-axis.

lode_material_xyz

Defines the probability that an entity will spawn on the given material. If used, the "lode_probability" spawnarg will also be queried and used. Example:

 "lode_material_grass" "1.0"
 "lode_material_dirt" "0.5"
 "lode_probability" "0"

This would spawn the entity always on grass, only half the time on dirt, and never on anything else (the "lode_probability" "0").

The other way round is also possible:

 "lode_material_stone" "0"
 "lode_material_metal" "0"
 "lode_probability" "1.0"

Meaning: Never spawn on metal or stone, but always on anything else.

lode_probability

Default 1.0. Is used as default probability for entities to spawn on certain surface types, but only when you define material_xyz spawnargs. See there for an explanation on how this lets you spawn entities only on some surfaces but not on others.

lode_scale_min/lode_scale_max

Default: Both 1.0 1.0 1.0. Floats, one per axis in the order X Y Z.

Scales the rendermodel of the entity randomly with a factor between the minimum and maximum values. For instance:

 "lode_scale_min" "1.0 1.0 0.5"
 "lode_scale_min" "2.0 2.0 1.0"

would scale the model in z-direction between 0.5 (half as big) and 1.0 (original size), and in both X and Y between 1.0 (original size) and 2.0 (twice as big).

Note: Clipmodels cannot be scaled, so this only works properly for non-solid ("solid" "0") entities.

lode_stack

Section not done yet.

lode_collide

Section not done yet.

skin

Lily model with original plus two other skins

Setting a skin on the entity will use this skin on all entities created from this template. If this entity has lode_watch_brethren set, then the individual skin spawnarg is ignored, instead the skins of all entities being watched over will be preserved.

To get multiple, random skins, use one of the following methods:

  • add multiple skin spawnargs with suffixes like skin, skin_1, skin_2 etc. Note that the final skin will be randomly chosen, but distributed equally. E.g. if you have three skin spawnargs, roughly 1/3 of all entities will get the first skin, 1/3 the second and 1/3 the third.
  • OR use the random_skin spawnarg on the entities targeted by the LODE (skins will be distributed evenly with this method, too)
  • OR add multiple copies of the same entities and link them from the LODE. Each copy can have a different (or possible more, see above) skin spawnarg. You can then use lode_score to influence the distribution of the different skins.

Note: If you want random skins plus the original, unskinned model, simply omit the skin spawnarg and just set the skin_X spawnargs, the original skin will then be added automatically.

lode_z_invert

Boolean, default: false (0). If this is true, units will be placed only lower than lode_z_min and only higher than lode_z_max, but not in between.

lode_z_min/lodez_max

Float. Default -1000000 and +100000 (e.g basically off)

Sets the z-height variance bounds min/max. Entities will not placed lower than lode_z_min and not higher than lode_z_max, in absolute Doom units.

See also z_invert to place units only outside the lode_z_min/lode_z_max band.

Other LOD spawnargs

You can of course use other LOD spawnargs on the entities that the LODE creates. See LOD for a list.

See also