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

Difference between revisions of "CellSpread"

From ModEnc
Jump to: navigation, search
(Reality)
(Removing this for the moment, see here: http://forums.renegadeprojects.com/showthread.php?tid=1399&pid=14985#pid14985)
Line 27: Line 27:
 
*It makes a list of all units found in those cells, regardless of whether they will be affected by the current {{tt|CellSpread}} or not...{{fnl|1}}
 
*It makes a list of all units found in those cells, regardless of whether they will be affected by the current {{tt|CellSpread}} or not...{{fnl|1}}
 
*...and calculates the distance in [[lepton]]s of each unit to the point of impact.
 
*...and calculates the distance in [[lepton]]s 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 {{tt|CellSpread}} * 256 (leptons).
+
*It then runs over the list, and only deals damage to those units whose calculated distance to the point of impact is lower than or equal to {{tt|CellSpread}} * 256 (leptons).
  
 
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 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.)
Line 38: Line 36:
 
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 {{tt|CellSpread}} radius twice as large against airborne aircraft.<br>
 
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 {{tt|CellSpread}} radius twice as large against airborne aircraft.<br>
 
For example, that means an aircraft flying 1536 leptons (6 cells) away from the point of impact of a {{tt|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.
 
For example, that means an aircraft flying 1536 leptons (6 cells) away from the point of impact of a {{tt|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 ==
 
== Bugs ==

Revision as of 02:32, 25 November 2009

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


Cc alert.png
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.

Traditional View

CellSpread.png

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

CellSpread order.png

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 or equal to 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.


See also


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