UnofficialCrusaderPatch / UnofficialCrusaderPatch2

Unofficial balancing patch installer for Stronghold Crusader 1
MIT License
430 stars 59 forks source link

Range bonuses due to towers and walls #807

Open ghost opened 3 years ago

ghost commented 3 years ago

The range of ranged fighters is increased by towers and walls. But the ranged fighters do not automatically attack when enemy units come within this increased range. Ranged fighters only attack automatically when enemy units come into their normal (base) range.

However, when attacking manually, the range bonus works.

GRhin commented 3 years ago

This is a statement, not an issue... Where you going somewhere with this?

ghost commented 3 years ago

The bug is that the automatic attacking of the ranged fighters does not work properly.

For example, an archer on flat terrain has a (base) range of 50 hexes. As soon as an enemy is only 50 hexes away, the archer automatically attacks. A (middle) tower increases the range of the archer by 3 hexes. The archer now has a range of 53 hexes. As soon as an enemy is only 53 (or 52, 51) hexes away, the archer should automatically attack the enemy. But the archer does not do that. This is the error. The archer automatically attacks an enemy only within his base range (50), even though he has a bonus range due to the tower (50+3 = 53).

The automatic attack within the bonus range does not work, only the manual attack works within the bonus range.

By the way, different towers give a different bonus on the range.

If you can speak German, here is a good video on the subject: https://www.youtube.com/watch?v=CaBwmkFAQBg

GRhin commented 3 years ago

Ok, you didn't give any new info, just repeated your first message. This is a known game mechanic (not a bug). I made my own video describing the situation. I will assume that the purpose of this issue is to request that UCP make ranged units start shooting when units are within effective range rather than the default average possible range (e.g. 50 tiles for archers). This is not actually simple. Being on a tower does indeed allow an Archer to hit units on ground at 53 tiles, assuming that ground is the same height as the ground that the tower is on. If the tower is built on low ground, and the units are on high plateau, then the effective range is 50 or 51 tiles. Also, if you weren't aware, shooting higher units actually reduces your range, so that unit on the ground shooting the guy in the tower has 47 tiles range. This all means that the game engine would need to calculate the effective range for every unit-unit combination every time it checks for units in range. Rather than simply scan for units within 50 tiles, you need to scan for all units within 54 tiles, then for each one calculate the relative height difference, figure out the effective range, then check if the unit is within that effective range, then add them to the list of available targets, or however the game progresses from there. I'm sure this is possible, but it's not necessarily simple.

ghost commented 3 years ago

"I will assume that the purpose of this issue is to request that UCP make ranged units start shooting when units are within effective range rather than the default average possible range"

Yes, that's exactly what I meant.

Oh, I was hoping it was just a number error in the code.

GRhin commented 3 years ago

yea, it was more likely lazy programming on fireflys end. Remember they didnt expect SHC to be a strategy game, they thought they were making a castle simulator game, so most efficient troops werent important to them. They therefore went with a "good enough" solution of just firing at the "average" maximum range, that which would be in range assuming both units are at same height. There may even have been some concern about the computing overheads of doing that many checks so often when there are large battles going in, remember that computers in 2002 werent all that powerful. I dont know how easy it would be to add the logic for this, however I know that it is complex enough that only one or two of the current developers would be able to even consider trying. Once they do it might be a simple addition, or it might be alot of work.

ilosevsrat commented 3 years ago

i didnt knew that...holy shit..