ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.
CellSpread
From ModEnc
Revision as of 22:43, 23 November 2009 by Renegade(talk | contribs)(Updated with new information obtained by D from the exe after patric noticed inconsistencies.)
Warning: setting this to values over 11 will cause Internal Errors when the warhead is supposed to detonate.
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.
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 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.
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.