Vinifera-Developers / Vinifera

Vinifera is a C&C: Tiberian Sun engine extension implementing new logics and fixing bugs.
GNU General Public License v3.0
44 stars 10 forks source link

[Vanilla Bug]/[New Feature] Warhead Spread is capped at a 3x3 square #92

Open Crimsonum opened 3 years ago

Crimsonum commented 3 years ago

Description:

Damage spread is controlled by the Spread key in warheads. However, the effect is limited to an area of 3x3 cells around the impact, sans the corner cell spots (1/4ths of a cell that only infantry can occupy). Damage outside this area is impossible to achieve, except through more or less complex workarounds.

Maximum damage spread can be achieved with Spread=63. This will deal full damage to the entire spread area. Warheads in the rules.ini have Spread values as high as 512. This may suggest that the intended area of effect was supposed to be much larger, although it could as well be an oversight.

For reference, CellSpread, the system that replaces Spread in Red Alert 2, allows for a much larger area of effect, with a maximum radius of 11 cells from the impact site.

Possible Implementation:

Make the area of effect unlimited, or if it has to capped due to technical reasons, then increase the cap by an order of magnitude.

Additional Files:

Ts_warhead_spread_map This graph shows what the spread area looks like, and what approximate percentages of damage different Spread values result in. The spread shape covers an area of 3x3 cells, with the four unaffected corners being individual cell spots, or 1/4ths of a cell.

Rampastring commented 3 years ago

I haven't researched the code in Tiberian Sun, but the Red Alert 1 algorithm for damage simply checks the impact cell and its surrounding cells (resulting in a 3x3) for objects to damage, regardless of the Spread value. I guess the Spread value is just taken into account later on when actually calculating the damage. https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/COMBAT.CPP#L186

Rampastring commented 3 years ago

The related function is multiple times bigger and extremely more complex in Tiberian Sun, but from a quick look on things, the related code and limitation appears to still be there. The loop starts at 0x0045F38F.

4SGX commented 2 years ago

In the case of porting over CellSpread from RA2, know that it also by default has issues hitting multiple cells thus doing much more damage to buildings. Ares fixed most of the problems https://ares-developers.github.io/Ares-docs/new/warheads/cellspread.html.

See https://github.com/Ares-Developers/Ares/blob/master/src/Ext/WarheadType/Hooks.CellSpread.cpp