CellSpread: Difference between revisions
Patric20878 (talk | contribs) |
Patric20878 (talk | contribs) |
||
Line 31: | Line 31: | ||
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. | 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. | ||
Note that diagonal | Note that diagonal range, as well as cellspread range is, exactly, to the decimal, calculated using the Pythagorean Theorem/Distance Formula. For example, using (8,6) and (7,7): The distance away in cells for (8,6) is 10, and (7,7) is 9.8995. A weapon with cellspread 9.9 will not reach (8,6), but will reach (7,7). Using this, (1,1) would require approximately a 1.415 cell spread/range. Please update the table and graph. ([[User:Patric20878|Patric20878]] 12:12, 24 November 2009 (UTC)) | ||
The distance is calculated in all three dimensions, meaning a flying unit ''can'' be affected by {{tt|CellSpread}} in the same way all other units can. (See [[#Aircraft|note below]], though.) | The distance is calculated in all three dimensions, meaning a flying unit ''can'' be affected by {{tt|CellSpread}} in the same way all other units can. (See [[#Aircraft|note below]], though.) |
Revision as of 12:12, 24 November 2009
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, Template:TTL 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:
- The game runs through all the cells in the image to the right.
- It makes a list of all units found in those cells, regardless of whether they will be affected by the current CellSpread or not...1
- ...and calculates the distance in leptons of each unit to the point of impact.
- It then runs over the list, and only deals damage to those units whose calculated distance to the point of impact is equal to or lower than CellSpread * 256 (leptons).
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.
Note that diagonal range, as well as cellspread range is, exactly, to the decimal, calculated using the Pythagorean Theorem/Distance Formula. For example, using (8,6) and (7,7): The distance away in cells for (8,6) is 10, and (7,7) is 9.8995. A weapon with cellspread 9.9 will not reach (8,6), but will reach (7,7). Using this, (1,1) would require approximately a 1.415 cell spread/range. Please update the table and graph. (Patric20878 12:12, 24 November 2009 (UTC))
The distance is calculated in all three dimensions, meaning a flying unit can be affected by CellSpread in the same way all other units can. (See note below, though.)
Aircraft
When the game calculates the distance of flying AircraftTypes to the point of impact, it cuts the calculated distance value in half, effectively making a given warhead's CellSpread radius twice as large against airborne aircraft.
For example, that means an aircraft flying 1536 leptons (6 cells) away from the point of impact of a CellSpread=4 (1024 leptons) warhead will still get affected by it, because the game only counts the aircraft as being 768 leptons (3 cells) away.
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.
Footnotes
1 ↑ Ambiguous. D later said <DCoder> floor(CellSpread + 0.99) is the radius it uses when looking into the graphic, so it's possible it only looks into a radius of 4 for a CellSpread=3.5 warhead, for example. This will be clarified tomorrow.
See also
CellSpread Internal Affected Cells Table
Purely for reference, here's the table used for CellSpread.
|
|
|