CellSpread: Difference between revisions
mNo edit summary |
|||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Flag | {{Flag | ||
|name=CellSpread | |name={{tt|CellSpread}} | ||
|files={{Categ|ini=rules}} | |files={{Categ|ini=rules}} | ||
|values=float | |values={{values|float}}(in practice, {{tt|CellSpread}}s over 11 generate Internal Errors) | ||
|default=0 | |default=0 | ||
|types={{Categ|Warhead|Warheads}} | |types={{Categ|Warhead|Warheads}} | ||
Line 9: | Line 9: | ||
|rp=yes | |rp=yes | ||
}} | }} | ||
{{HorizontalBar|'''Warning:''' setting this to values over 11 ''will'' cause [[Internal Error]]s when the warhead is supposed to detonate.|image=Cc_alert.png}}{{tocright}} | |||
'''{{tt|CellSpread}}''' defines the blast radius of a [[warhead]]. | |||
Without {{tt|CellSpread}}, a warhead only affects the [[cell]] it impacts on. With {{tt|CellSpread}}, the [[damage]] extends beyond the current cell (it ''spreads''), to the distance set through {{tt|CellSpread}}. | |||
As the damage progresses outwards from the point of impact, {{f|PercentAtMax|link}} determines how quickly the blast wave loses power, that is, how much of the initial damage a unit at a certain distance from the point of impact receives.{{clr}} | |||
== | ==Traditional View== | ||
CellSpread= | [[Image:CellSpread.png|thumb|right]] | ||
For a quick, simple understanding of {{tt|CellSpread}}, simply view it as follows: The damage will extend beyond the impact cell for as many cells as {{tt|CellSpread}} is set to. e.g. if you set {{tt|CellSpread}} to 3, the warhead will damage the current cell, and 3 cells further into all directions. A circle around the impact cell with a radius of 3, for a diameter of 6.<br> | |||
The image to the right reflects which cells are affected by which {{tt|CellSpread}} under this simple model of {{tt|CellSpread}}.{{clr}} | |||
==Reality== | |||
[[Image:CellSpread updated.png|thumb|right|Areas affected by particular {{tt|CellSpread}} values.]] | |||
[[Image:CellSpread_order.png|thumb|right|Order in which potential {{tt|CellSpread}}-affected cells are scanned.]] | |||
In reality, the game's parsing of {{tt|CellSpread}} is performed slightly differently: | |||
* If the warhead was detonated at least 1 lepton ''above'' the cell surface, air units get affected: | |||
** The game divides the map area into a 20x20 grid at map load, and each unit using the Fly, Jumpjet or Rocket {{f|Locomotor|link}}s is tracked all through its lifetime to know which "sector" of the grid it's in. | |||
** When it's time to deliver damage, the game consults the grid to find such units within range (the exact rules for what counts as "within range" in this case are still being determined, but this appears to use the rough cell-based distance model rather than the precise lepton based one). | |||
** For each found unit, the unit and its distance to the epicenter are added to the ''list of potential damage recipients''. | |||
* The game adds 0.99 to the CellSpread and drops the fractional part (in other words, it gets rounded to the next-highest integer, e.g. CellSpread=3.25 is turned into 3.25 + 0.99 = 4.24 = 4). | |||
* It then finds all cells associated with that value in the [[CellSpread#CellSpread_Internal_Affected_Cells_Table|CellSpread lookup table]]. | |||
* For each cell in that range: | |||
** The cell's contained Overlay is checked. | |||
***If it has {{f|ChainReaction|yes|link}} and either the overlay doesn't contain {{f|Tiberium|yes|link}} or the warhead also contains {{f|Tiberium|yes|link}}, the tiberium is reduced. The exact details of this process are still being worked out. | |||
*** If the cell's Overlay has {{f|Wall|yes|link}}: | |||
**** If the warhead has {{f|WallAbsoluteDestroyer|yes|link}}, it destroys the wall. | |||
**** Otherwise, if the warhead has {{f|Wall|yes|link}} or the warhead has {{f|Wood|yes|link}} and the overlay has {{f|Armor|wood|link}}, the wall is damaged. | |||
** If the cell did contain Overlay but no longer does, all objects and AI teams targeting that overlay are instructed to lose the target. | |||
** All non-airborne objects in the cell, together with their 3D distance in leptons from the detonation point, are added to the ''list of potential damage recipients''. | |||
* For each object on that list: | |||
** if it's a BuildingType with {{f|InvisibleInGame|yes|link}}, go to the next item. | |||
** if it's an AircraftType that's in the air right now ("in the air" is defined as a moving V3 Rocket, moving Dred missile, or an object that's > 208 leptons above ground), its calculated distance from the det. point is halved. | |||
** If the final distance is less or equal to exact CellSpread * 256, the object gets damaged. (256 is the number of leptons per cell, and this calculation uses the original, set CellSpread, not the rounded value.) | |||
* Special effects such as Rocker, IonCannonWarhead bridge demolition, etc. are applied. | |||
* If the impact cell contains an OverlayType with {{f|Explodes|yes|link}}, special effects happen. See [[Explodes#For_OverlayTypes|Explodes]]. | |||
The practical difference to the traditional view of {{tt|CellSpread}} is mostly the handling of "diagonal" damage. As visible in the image in the section above, the traditional model assumes the corner cells to belong to the next-higher cell spread, when, in reality, the map's cells are irrelevant in the distance calculation. That means that damage does indeed spread in a perfect sphere radius, making working with it a lot easier.<br> | |||
In addition, as visible in the visual representation, since the damage spreads in leptons from the point of impact, rather than in cells from the cell of impact, the cells in the outer-most ring of a given damage area are not affected completely when using integer values; e.g. a CellSpread of 1 does not actually damage the entirety of the first cell next to the target, but only half of it. In order to damage the entire next cell, one would have to choose a value of roughly 1.5.<br> | |||
Furthermore, since InfantryTypes can stand in various places inside a cell, if they are hit by CellSpread-warheads, the point from which the game calculates the distance to determine whether an object is affected by the CellSpread is not necessarily the center of the impacted cell, potentially changing the affected parts of the outer ring again. | |||
CellSpread | The distance itself is calculated in all three dimensions, meaning a flying unit ''can'' be affected by {{tt|CellSpread}} in the same way all other units can. Note that the flying units within the affected cells can be damaged at higher altitudes than one would expect, but that doesn't mean the flyers in the neighbouring cells are affected.{{clr}} | ||
== | == Bugs == | ||
*Due to the fact that {{tt|CellSpread}} works based on a lookup table, its number of possible values is severely restricted: | |||
[[ | **{{tt|CellSpread{{=}}11}} is buggy, it does not extend outwards properly, and it affects one cell twice. | ||
**Everything above {{tt|CellSpread{{=}}11}} leads to Internal Errors. | |||
*{{tt|CellSpread}} is not working on warheads of [[particle]]s. A particle only ever damages the current cell it resides on. | |||
*{{tt|CellSpread}} is not working on tag of [[Temporal]]. | |||
*{{tt|CellSpread}} is not working on tag of [[MindControl]]. | |||
*{{tt|CellSpread}} is not working on tag of [[ElectricAssault]]. | |||
*{{tt|CellSpread}} is not working on tag of [[MakesDisguise]]. | |||
*{{tt|CellSpread}} is not working on tag of [[IsLocomotor]]. | |||
*{{tt|CellSpread}} is not working on tag of [[Parasite]]. | |||
== | == {{tt|CellSpread}} Internal Affected Cells Table == | ||
Purely for reference, here's the table used for {{tt|CellSpread}}. | |||
{|cellspacing="10" align="center" | |||
= | |valign="top"| | ||
{| class="table_descrowdesccol" style="text-align: center;" | {| class="table_descrowdesccol" style="text-align: center;" | ||
! rowspan="2" | # of cell | ! rowspan="2" | # of cell | ||
Line 404: | Line 446: | ||
! 122 | ! 122 | ||
| 0 || -7 || 7 | | 0 || -7 || 7 | ||
|- | |||
! rowspan="2" | # of cell | |||
! X | |||
! Y | |||
! rowspan="2" | Minimum<br>CellSpread | |||
|- | |||
! colspan="2" | Offset from origin cell | |||
|} | |||
|valign="top"| | |||
{| class="table_descrowdesccol" style="text-align: center;" | |||
! rowspan="2" | # of cell | |||
! colspan="2" | Offset from origin cell | |||
! rowspan="2" | Minimum<br>CellSpread | |||
|- | |||
! X | |||
! Y | |||
|- | |- | ||
! 123 | ! 123 | ||
Line 773: | Line 832: | ||
! 245 | ! 245 | ||
| 5 || 7 || 9 | | 5 || 7 || 9 | ||
|- | |||
! rowspan="2" | # of cell | |||
! X | |||
! Y | |||
! rowspan="2" | Minimum<br>CellSpread | |||
|- | |||
! colspan="2" | Offset from origin cell | |||
|} | |||
|valign="top"| | |||
{| class="table_descrowdesccol" style="text-align: center;" | |||
! rowspan="2" | # of cell | |||
! colspan="2" | Offset from origin cell | |||
! rowspan="2" | Minimum<br>CellSpread | |||
|- | |||
! X | |||
! Y | |||
|- | |- | ||
! 246 | ! 246 | ||
Line 1,142: | Line 1,218: | ||
! 368 | ! 368 | ||
| -11 || 0 || 11 | | -11 || 0 || 11 | ||
|- | |||
! rowspan="2" | # of cell | |||
! X | |||
! Y | |||
! rowspan="2" | Minimum<br>CellSpread | |||
|- | |||
! colspan="2" | Offset from origin cell | |||
|} | |||
|} | |} | ||
==Ares Enhancements== | |||
Ares replaces the lookup table and makes it possible to use larger values for CellSpread. All area of effect weapon features Ares added (like [[AttachEffect]]s on Warheads, [[EMP]], [[IronCurtain]] on Weapons) have been updated to support this as well. | |||
==See also== | |||
*{{f|PercentAtMax|link}} | |||
*{{f|CellSpread.MaxAffect|link}} |
Latest revision as of 00:42, 22 July 2024
Flag: | CellSpread |
File(s): | rules(md).ini |
Values: | Floating point values: Any decimal number (clearer range should be added in Template:Values).
(in practice, CellSpreads over 11 generate Internal Errors) |
Default: | 0 |
Applicable to: | Warheads |
CellSpread defines the blast radius of a warhead. Without CellSpread, a warhead only affects the cell it impacts on. With CellSpread, the damage extends beyond the current cell (it spreads), to the distance set through CellSpread.
As the damage progresses outwards from the point of impact, PercentAtMax determines how quickly the blast wave loses power, that is, how much of the initial damage a unit at a certain distance from the point of impact receives.
Traditional View
For a quick, simple understanding of CellSpread, simply view it as follows: The damage will extend beyond the impact cell for as many cells as CellSpread is set to. e.g. if you set CellSpread to 3, the warhead will damage the current cell, and 3 cells further into all directions. A circle around the impact cell with a radius of 3, for a diameter of 6.
The image to the right reflects which cells are affected by which CellSpread under this simple model of CellSpread.
Reality
In reality, the game's parsing of CellSpread is performed slightly differently:
- If the warhead was detonated at least 1 lepton above the cell surface, air units get affected:
- The game divides the map area into a 20x20 grid at map load, and each unit using the Fly, Jumpjet or Rocket Locomotors is tracked all through its lifetime to know which "sector" of the grid it's in.
- When it's time to deliver damage, the game consults the grid to find such units within range (the exact rules for what counts as "within range" in this case are still being determined, but this appears to use the rough cell-based distance model rather than the precise lepton based one).
- For each found unit, the unit and its distance to the epicenter are added to the list of potential damage recipients.
- The game adds 0.99 to the CellSpread and drops the fractional part (in other words, it gets rounded to the next-highest integer, e.g. CellSpread=3.25 is turned into 3.25 + 0.99 = 4.24 = 4).
- It then finds all cells associated with that value in the CellSpread lookup table.
- For each cell in that range:
- The cell's contained Overlay is checked.
- If it has ChainReaction=yes and either the overlay doesn't contain Tiberium=yes or the warhead also contains Tiberium=yes, the tiberium is reduced. The exact details of this process are still being worked out.
- If the cell's Overlay has Wall=yes:
- If the warhead has WallAbsoluteDestroyer=yes, it destroys the wall.
- Otherwise, if the warhead has Wall=yes or the warhead has Wood=yes and the overlay has Armor=wood, the wall is damaged.
- If the cell did contain Overlay but no longer does, all objects and AI teams targeting that overlay are instructed to lose the target.
- All non-airborne objects in the cell, together with their 3D distance in leptons from the detonation point, are added to the list of potential damage recipients.
- The cell's contained Overlay is checked.
- For each object on that list:
- if it's a BuildingType with InvisibleInGame=yes, go to the next item.
- if it's an AircraftType that's in the air right now ("in the air" is defined as a moving V3 Rocket, moving Dred missile, or an object that's > 208 leptons above ground), its calculated distance from the det. point is halved.
- If the final distance is less or equal to exact CellSpread * 256, the object gets damaged. (256 is the number of leptons per cell, and this calculation uses the original, set CellSpread, not the rounded value.)
- Special effects such as Rocker, IonCannonWarhead bridge demolition, etc. are applied.
- If the impact cell contains an OverlayType with Explodes=yes, special effects happen. See Explodes.
The practical difference to the traditional view of CellSpread is mostly the handling of "diagonal" damage. As visible in the image in the section above, the traditional model assumes the corner cells to belong to the next-higher cell spread, when, in reality, the map's cells are irrelevant in the distance calculation. That means that damage does indeed spread in a perfect sphere radius, making working with it a lot easier.
In addition, as visible in the visual representation, since the damage spreads in leptons from the point of impact, rather than in cells from the cell of impact, the cells in the outer-most ring of a given damage area are not affected completely when using integer values; e.g. a CellSpread of 1 does not actually damage the entirety of the first cell next to the target, but only half of it. In order to damage the entire next cell, one would have to choose a value of roughly 1.5.
Furthermore, since InfantryTypes can stand in various places inside a cell, if they are hit by CellSpread-warheads, the point from which the game calculates the distance to determine whether an object is affected by the CellSpread is not necessarily the center of the impacted cell, potentially changing the affected parts of the outer ring again.
The distance itself is calculated in all three dimensions, meaning a flying unit can be affected by CellSpread in the same way all other units can. Note that the flying units within the affected cells can be damaged at higher altitudes than one would expect, but that doesn't mean the flyers in the neighbouring cells are affected.
Bugs
- Due to the fact that CellSpread works based on a lookup table, its number of possible values is severely restricted:
- CellSpread=11 is buggy, it does not extend outwards properly, and it affects one cell twice.
- Everything above CellSpread=11 leads to Internal Errors.
- CellSpread is not working on warheads of particles. A particle only ever damages the current cell it resides on.
- CellSpread is not working on tag of Temporal.
- CellSpread is not working on tag of MindControl.
- CellSpread is not working on tag of ElectricAssault.
- CellSpread is not working on tag of MakesDisguise.
- CellSpread is not working on tag of IsLocomotor.
- CellSpread is not working on tag of Parasite.
CellSpread Internal Affected Cells Table
Purely for reference, here's the table used for CellSpread.
|
|
|
Ares Enhancements
Ares replaces the lookup table and makes it possible to use larger values for CellSpread. All area of effect weapon features Ares added (like AttachEffects on Warheads, EMP, IronCurtain on Weapons) have been updated to support this as well.