ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

CellSpread: Difference between revisions

From ModEnc
Jump to navigation Jump to search
→‎Reality: Added updated illustration of CellSpread radius, tried to make explanation clearer (checked back with D beforehand)
Testid123 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 14: Line 14:
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}}.
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, {{TTL|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.{{clr}}
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==
==Traditional View==
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]].
* For each cell in that range:
* For each cell in that range:
** The cell's contained Overlay is checked.
** The cell's contained Overlay is checked.
***If it has {{TTL|ChainReaction|yes}} and either the overlay doesn't contain {{TTL|Tiberium|yes}} or the warhead also contains {{TTL|Tiberium|yes}}, the tiberium is reduced. The exact details of this process are still being worked out.
***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 {{TTL|Wall|yes}}:
*** If the cell's Overlay has {{f|Wall|yes|link}}:
**** If the warhead has {{TTL|WallAbsoluteDestroyer|yes}}, it destroys the wall.
**** If the warhead has {{f|WallAbsoluteDestroyer|yes|link}}, it destroys the wall.
**** Otherwise, if the warhead has {{TTL|Wall|yes}} or the warhead has {{TTL|Wood|yes}} and the overlay has {{TTL|Armor|wood}}, 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 put into a list of potential damage recipients.
** 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 {{TTL|InvisibleInGame|yes}}, go to the next item.
** 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 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.)
** 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.
* Special effects such as Rocker, IonCannonWarhead bridge demolition, etc. are applied.
* If the impact cell contains an OverlayType with {{TTL|Explodes|yes}}, special effects happen. See [[Explodes#For_OverlayTypes|Explodes]].
* If the impact cell contains an OverlayType with {{f|Explodes|yes|link}}, special effects happen. See [[Explodes#For_OverlayTypes|Explodes]].




Line 54: Line 58:
**Everything above {{tt|CellSpread{{=}}11}} leads to Internal Errors.
**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 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]].
==See also==
*{{tt|CellSpread}} is not working on tag of [[ElectricAssault]].
*{{TTL|PercentAtMax}}
*{{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 ==
== {{tt|CellSpread}} Internal Affected Cells Table ==
Line 1,223: Line 1,228:


|}
|}
==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

Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
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


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, 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

Areas affected by particular CellSpread values.
Order in which potential CellSpread-affected cells are scanned.

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 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 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.

# of cell Offset from origin cell Minimum
CellSpread
X Y
0 0 0 0
1 1 -1 1
2 0 -1 1
3 -1 -1 1
4 -1 0 1
5 1 0 1
6 -1 1 1
7 0 1 1
8 1 1 1
9 -1 -2 2
10 0 -2 2
11 1 -2 2
12 -2 -1 2
13 2 -1 2
14 -2 0 2
15 2 0 2
16 -2 1 2
17 2 1 2
18 -1 2 2
19 0 2 2
20 1 2 2
21 -1 -3 3
22 0 -3 3
23 1 -3 3
24 -2 -2 3
25 2 -2 3
26 -3 -1 3
27 3 -1 3
28 -3 0 3
29 3 0 3
30 -3 1 3
31 3 1 3
32 -2 2 3
33 2 2 3
34 -1 3 3
35 0 3 3
36 1 3 3
37 -1 -4 4
38 0 -4 4
39 1 -4 4
40 -3 -3 4
41 -2 -3 4
42 2 -3 4
43 3 -3 4
44 -3 -2 4
45 3 -2 4
46 -4 -1 4
47 4 -1 4
48 -4 0 4
49 4 0 4
50 -4 1 4
51 4 1 4
52 -3 2 4
53 3 2 4
54 -3 3 4
55 -2 3 4
56 2 3 4
57 3 3 4
58 -1 4 4
59 0 4 4
60 1 4 4
61 -1 -5 5
62 0 -5 5
63 1 -5 5
64 -3 -4 5
65 -2 -4 5
66 2 -4 5
67 3 -4 5
68 -4 -3 5
69 4 -3 5
70 -4 -2 5
71 4 -2 5
72 -5 -1 5
73 5 -1 5
74 -5 0 5
75 5 0 5
76 -5 1 5
77 5 1 5
78 -4 2 5
79 4 2 5
80 -4 3 5
81 4 3 5
82 -3 4 5
83 -2 4 5
84 2 4 5
85 3 4 5
86 -1 5 5
87 0 5 5
88 1 5 5
89 -1 -6 6
90 0 -6 6
91 1 -6 6
92 -3 -5 6
93 -2 -5 6
94 2 -5 6
95 3 -5 6
96 -4 -4 6
97 4 -4 6
98 -5 -3 6
99 5 -3 6
100 -5 -2 6
101 5 -2 6
102 -6 -1 6
103 6 -1 6
104 -6 0 6
105 6 0 6
106 -6 1 6
107 6 1 6
108 -5 2 6
109 5 2 6
110 -5 3 6
111 5 3 6
112 -4 4 6
113 4 4 6
114 -3 5 6
115 -2 5 6
116 2 5 6
117 3 5 6
118 -1 6 6
119 0 6 6
120 1 6 6
121 -1 -7 7
122 0 -7 7
# of cell X Y Minimum
CellSpread
Offset from origin cell
# of cell Offset from origin cell Minimum
CellSpread
X Y
123 1 -7 7
124 -3 -6 7
125 -2 -6 7
126 2 -6 7
127 3 -6 7
128 -5 -5 7
129 -4 -5 7
130 4 -5 7
131 5 -5 7
132 -5 -4 7
133 5 -4 7
134 -6 -3 7
135 6 -3 7
136 -6 -2 7
137 6 -2 7
138 -7 -1 7
139 7 -1 7
140 -7 0 7
141 7 0 7
142 -7 1 7
143 7 1 7
144 -6 2 7
145 6 2 7
146 -6 3 7
147 6 3 7
148 -5 4 7
149 5 4 7
150 -5 5 7
151 -4 5 7
152 4 5 7
153 5 5 7
154 -3 6 7
155 -2 6 7
156 2 6 7
157 3 6 7
158 -1 7 7
159 0 7 7
160 1 7 7
161 -1 -8 8
162 0 -8 8
163 1 -8 8
164 -3 -7 8
165 -2 -7 8
166 2 -7 8
167 3 -7 8
168 -5 -6 8
169 -4 -6 8
170 4 -6 8
171 5 -6 8
172 -6 -5 8
173 6 -5 8
174 -6 -4 8
175 6 -4 8
176 -7 -3 8
177 7 -3 8
178 -7 -2 8
179 7 -2 8
180 -8 -1 8
181 8 -1 8
182 -8 0 8
183 8 0 8
184 -8 1 8
185 8 1 8
186 -7 2 8
187 7 2 8
188 -7 3 8
189 7 3 8
190 -6 4 8
191 6 4 8
192 -6 5 8
193 6 5 8
194 -5 6 8
195 -4 6 8
196 4 6 8
197 5 6 8
198 -3 7 8
199 -2 7 8
200 2 7 8
201 3 7 8
202 -1 8 8
203 0 8 8
204 1 8 8
205 -1 -9 9
206 0 -9 9
207 1 -9 9
208 -3 -8 9
209 -2 -8 9
210 2 -8 9
211 3 -8 9
212 -5 -7 9
213 -4 -7 9
214 4 -7 9
215 5 -7 9
216 -6 -6 9
217 6 -6 9
218 -7 -5 9
219 7 -5 9
220 -7 -4 9
221 7 -4 9
222 -8 -3 9
223 8 -3 9
224 -8 -2 9
225 8 -2 9
226 -9 -1 9
227 9 -1 9
228 -9 0 9
229 9 0 9
230 -9 1 9
231 9 1 9
232 -8 2 9
233 8 2 9
234 -8 3 9
235 8 3 9
236 -7 4 9
237 7 4 9
238 -7 5 9
239 7 5 9
240 -6 6 9
241 6 6 9
242 -5 7 9
243 -4 7 9
244 4 7 9
245 5 7 9
# of cell X Y Minimum
CellSpread
Offset from origin cell
# of cell Offset from origin cell Minimum
CellSpread
X Y
246 -3 8 9
247 -2 8 9
248 2 8 9
249 3 8 9
250 -1 9 9
251 0 9 9
252 1 9 9
253 -1 -10 10
254 0 -10 10
255 1 -10 10
256 -3 -9 10
257 -2 -9 10
258 2 -9 10
259 3 -9 10
260 -5 -8 10
261 -4 -8 10
262 4 -8 10
263 5 -8 10
264 -7 -7 10
265 -6 -7 10
266 6 -7 10
267 7 -7 10
268 -7 -6 10
269 7 -6 10
270 -8 -5 10
271 8 -5 10
272 -8 -4 10
273 8 -4 10
274 -9 -3 10
275 9 -3 10
276 -9 -2 10
277 9 -2 10
278 -10 -1 10
279 10 -1 10
280 -10 0 10
281 10 0 10
282 -10 1 10
283 10 1 10
284 -9 2 10
285 9 2 10
286 -9 3 10
287 9 3 10
288 -8 4 10
289 8 4 10
290 -8 5 10
291 8 5 10
292 -7 6 10
293 7 6 10
294 -7 7 10
295 -6 7 10
296 6 7 10
297 7 7 10
298 -5 8 10
299 -4 8 10
300 4 8 10
301 5 8 10
302 -3 9 10
303 -2 9 10
304 2 9 10
305 3 9 10
306 -1 10 10
307 0 10 10
308 1 10 10
309 0 11 11
310 0 -11 11
311 -1 11 11
312 1 11 11
313 -1 -11 11
314 1 -11 11
315 -2 11 11
316 2 11 11
317 -2 -11 11
318 2 -11 11
319 -3 11 11
320 3 11 11
321 -3 -11 11
322 -3 11 11
323 -4 9 11
324 4 9 11
325 -4 -9 11
326 4 -9 11
327 -5 9 11
328 5 9 11
329 -5 -9 11
330 5 -9 11
331 -6 8 11
332 6 8 11
333 -6 -8 11
334 6 -8 11
335 -7 8 11
336 7 8 11
337 -7 -8 11
338 7 -8 11
339 -8 7 11
340 8 7 11
341 -8 -7 11
342 8 -7 11
343 -8 6 11
344 8 6 11
345 -8 -6 11
346 8 -6 11
347 -9 5 11
348 9 5 11
349 -9 -5 11
350 9 -5 11
351 -9 4 11
352 9 4 11
353 -9 -4 11
354 9 -4 11
355 -10 3 11
356 10 3 11
357 -10 -3 11
358 10 -3 11
359 -10 2 11
360 10 2 11
361 -10 -2 11
362 10 -2 11
363 -11 1 11
364 11 1 11
365 -11 -1 11
366 11 -1 11
367 11 0 11
368 -11 0 11
# of cell X Y Minimum
CellSpread
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 AttachEffects on Warheads, EMP, IronCurtain on Weapons) have been updated to support this as well.

See also