SEED: Difference between revisions
describe some spawnargs |
more ideas and work |
||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
The new and improved [[LOD|LOD System]] for TDM v1.03 lets you place entities in your map that reduce their own complexity when being far away from the player. However, there are still | The new and improved [[LOD|LOD System]] for TDM v1.03 lets you place entities in your map that reduce their own complexity when being far away from the player. However, there are still some huge drawbacks to this technique: | ||
* manually placing thousands of entities is very tedious and error prone | * manually placing thousands of entities is very tedious and error prone | ||
Line 7: | Line 7: | ||
* The overall entity limit of 8192 entities - even if only ever 100 entities are visible to the player, you would not be able to create a forest with 10000 objects (trees, treestumps, flower patches and rocks etc.) | * The overall entity limit of 8192 entities - even if only ever 100 entities are visible to the player, you would not be able to create a forest with 10000 objects (trees, treestumps, flower patches and rocks etc.) | ||
So there needs to be a way to dynamically only create the needed entities - and remove any no longer entities completely from the gameworld. Of course, if nec., the formerly existing entities need to be recreated. In addition, we want some way to randomly place entities without having to specify their position/rotation for each entity. | So there needs to be a way to dynamically only create the needed entities - and remove any no longer needed entities temporarily (but completely) from the gameworld. Of course, if nec., the formerly existing entities need to be recreated. In addition, we want some way to randomly place entities without having to specify their position/rotation for each entity. | ||
The new '''LODE''' provides exactly this. | The new '''LODE''' provides exactly this. | ||
== How to use == | == How to use == | ||
Line 25: | Line 26: | ||
{{clear}} | {{clear}} | ||
== Spawnargs on the LODE == | |||
These spawnargs can be set on the LODE itself and set defaults or influence overall strategies: | |||
=== 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 generated different results everytime you load the map). | |||
If set, the random number generator will always generate the same sequence, so you get still randomly distributed results, but they are always the same. | |||
=== spacing === | |||
Default: '''0'''. Defines a minimum distance between placed entities. If set to > 0, implies collision check at creation time between all entities. | |||
== Spawnargs on Targets == | == Spawnargs on Targets == | ||
Line 32: | Line 49: | ||
=== lode_floor === | === lode_floor === | ||
If set to ''' | 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_score === | === lode_score === | ||
Line 40: | Line 57: | ||
* 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: '''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/9 of all entities will be of class A, 2/10 will be class B and 7/10 will be of class C | * Entity A: '''1''', Entity B: '''2''': Entity C: '''7''', Sum: '''10''', 1/9 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_stack === | === lode_stack === | ||
Line 48: | Line 69: | ||
{{red|Section not done yet.}} | {{red|Section not done yet.}} | ||
== Script events == | == Script events == | ||
Line 64: | Line 86: | ||
Removes all entities under control of this LODE from the game. Only useful if either the player is very far away, or if you have called '''Deactivate()''' before - otherwise the entities might be spawned again in the next frame. | Removes all entities under control of this LODE from the game. Only useful if either the player is very far away, or if you have called '''Deactivate()''' before - otherwise the entities might be spawned again in the next frame. | ||
== Ideas == | |||
Not implemented yet, but worth considering: | |||
=== lode_strategy === | |||
How the entities will be placed. Default: "random", but can be "grid" (needs a way to specifiy grid-size, grid spacing, and random-offset from grid position). | |||
=== lode_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. Other related settings: "lode_max_bunched" (limit number of entities per bunch), and "lode_bunch_spacing_min" and "lode_bunch_spacing_max" (how much space leave between bunched-up entities). | |||
Implementation details: For each entity created, track the "bunchmaster". If "where we bunch to" has no bunchmaster, it becomes the new bunchmaster - second entity uses first as bunchmaster- This allows us to query "how many entities bunch up together at this spot"- | |||
== See also == | == See also == |
Revision as of 07:59, 30 June 2010
Introduction
The new and improved LOD System for TDM v1.03 lets you place entities in your map that reduce their own complexity when being far away from the player. However, there are still some huge drawbacks to this technique:
- manually placing thousands of entities is very tedious and error prone
- 3000 entities "thinking" (deciding what LOD they have) takes about 7% of performance, even when they are not visible
- The overall entity limit of 8192 entities - even if only ever 100 entities are visible to the player, you would not be able to create a forest with 10000 objects (trees, treestumps, flower patches and rocks etc.)
So there needs to be a way to dynamically only create the needed entities - and remove any no longer needed entities temporarily (but completely) from the gameworld. Of course, if nec., the formerly existing entities need to be recreated. In addition, we want some way to randomly place entities without having to specify their position/rotation for each entity.
The new LODE provides exactly this.
How to use
- In DarkRadiant, create a brush the size of the area you want to cover
- With that brush still selected, and select Create entity and select Darkmod/Info/atdm:lode
- Note:
If you want to resize the LODE entity after creating it, select it with SHIFT + and press TAB to select the brush, then resize it normally.
- Now create the entities that you want to appear. Entities that use the LOD system should be prefered.
- Link each entity from the LODE entity by selecting first the LODE, then the entity, and then press CTRL+K.
- Put the entities at the hight you want them to appear. Alternatively, use the spawnarg "lode_floor" on the entity (see below for more spawnargs).
Spawnargs on the LODE
These spawnargs can be set on the LODE itself and set defaults or influence overall strategies:
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 generated different results everytime you load the map).
If set, the random number generator will always generate the same sequence, so you get still randomly distributed results, but they are always the same.
spacing
Default: 0. Defines a minimum distance between placed entities. If set to > 0, implies collision check at creation time between all entities.
Spawnargs on Targets
These spawnargs can be set on the entities that the LODE targets:
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_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/9 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_stack
Section not done yet.
lode_collide
Section not done yet.
Script events
There exist a few script events that can be used either from scripts, or by setting up a trigger that links to an atdm:target_callobjectfunction with the spawnarg call set to one of the script functions below:
Deactivate()
Deactivates the thinking of this LODE. Spawned entities stay where they are.
Activate()
Activates the LODE (e.g. it starts to think) again. If nec., the LODE will also spawn and unhide any entities that it needs.
CullAll()
Removes all entities under control of this LODE from the game. Only useful if either the player is very far away, or if you have called Deactivate() before - otherwise the entities might be spawned again in the next frame.
Ideas
Not implemented yet, but worth considering:
lode_strategy
How the entities will be placed. Default: "random", but can be "grid" (needs a way to specifiy grid-size, grid spacing, and random-offset from grid position).
lode_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. Other related settings: "lode_max_bunched" (limit number of entities per bunch), and "lode_bunch_spacing_min" and "lode_bunch_spacing_max" (how much space leave between bunched-up entities).
Implementation details: For each entity created, track the "bunchmaster". If "where we bunch to" has no bunchmaster, it becomes the new bunchmaster - second entity uses first as bunchmaster- This allows us to query "how many entities bunch up together at this spot"-