E2150 - Weather: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 40:
 
===== Finding the random "initial location" =====
The game calculates a random distance (''r1'', within 0-''range'') and a random angle ''alpha'' (0-255, where 256 == 2*PI rad). With the use of ''sin'' and ''cos'' functions of ''alpha'', multiplied by the ''r1'' value, the game calculates offset (''x1'', ''y1'') from the epicenter. After applying the offset to the ''x'' and ''y'' parameters, we will get a point (''x2'', ''y2''). This point is the initial hit location. If the location is outside of the level, the lightning won't spawn. There is no difference for the lightning to spawn in the accessible or the inaccessible area of the map (the level "margin"), so casting rainstorm near the edge of the level will result with fewer lightnings spawned and/or fewer lightnings hitting relevant area. You may also notice that '''lightnings are more likely to hit nearby the epicenter''', rather than on the further distances. The target spawn probability for the default WCC range 30, is as below. Values in cells are the spawn chance *10^-2% (the middle square with value 161 means that there is a 1,61% chance that this square will be the hit target).
[[File:HitProbability.png]]
 
Line 108:
 
===== Finding the random location =====
The procedure is the same as with lightnings - random angle, random distance, calculate offset using trigonometry. The spawn probabilities are the same as in case of thunderstorm, but here, the location isn't altered by nearby high objects, what makes the figure in Thunderstorm section more reliable here.
 
===== Calculating the spawn location =====