CellSpread: Difference between revisions
EvilRenegade (talk | contribs) m Replacing Template:TTL with Template:F. |
Correcting air unit effects .. screw you, Westwood, and your myriad different ways of doing stuff incorrectly |
||
Line 25: | Line 25: | ||
[[Image:CellSpread_order.png|thumb|right|Order in which potential {{tt|CellSpread}}-affected cells are scanned.]] | [[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: | 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). | * 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]]. | * It then finds all cells associated with that value in the [[CellSpread#CellSpread_Internal_Affected_Cells_Table|CellSpread lookup table]]. | ||
Line 34: | Line 38: | ||
**** 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. | **** 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. | ** 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 objects in the cell, together with their 3D distance in leptons from the detonation point, are | ** 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: | * For each object on that list: | ||
** if it's a BuildingType with {{f|InvisibleInGame|yes|link}}, go to the next item. | ** if it's a BuildingType with {{f|InvisibleInGame|yes|link}}, go to the next item. |
Revision as of 18:11, 11 August 2010
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.
See also
CellSpread Internal Affected Cells Table
Purely for reference, here's the table used for CellSpread.
|
|
|