Opened 11 years ago

Last modified 3 years ago

#2001 new enhancement

Melee units with big maximum range can attack through walls

Reported by: sanderd17 Owned by:
Priority: Must Have Milestone: Backlog
Component: Simulation Keywords:
Cc: Patch:

Description (last modified by elexis)

There are a lot of melee units that can attack throug the Roman siege wall, and even more that can attack through pallisades.

The melee unit with the biggest range (the Spartan champion pikeman) can even attack through the spartan stone wall.

I don't know how to solve this. Maybe add a check if there is an obstruction between the two parties, and don't execute melee attacks if there is an obstruction (units shouldn't even preform the attack animation when there's an obstruction).

Attachments (1)

commands.txt (103.5 KB ) - added by erraunt 8 years ago.
Long replay at the end of which there is the champion spearman attacking through the wall

Download all attachments as: .zip

Change History (11)

comment:1 by sanderd17, 11 years ago

A possible solution for this problem using existing components:

Calculate the path from the attacker to the target via the pathfinder, if the path is longer than the attack range, the unit isn't in range yet. With this patch, it should still be possible to attack over a berry bush or along a tree, as the pathfinder finds a pretty short way around those. But it won't be possible anymore to attack through a bigger structure like a wall.

in reply to:  1 comment:2 by zweigousefen, 11 years ago

Replying to sanderd17:

A possible solution for this problem using existing components:

Calculate the path from the attacker to the target via the pathfinder, if the path is longer than the attack range, the unit isn't in range yet. With this patch, it should still be possible to attack over a berry bush or along a tree, as the pathfinder finds a pretty short way around those. But it won't be possible anymore to attack through a bigger structure like a wall.

What if you have a line of bushes, or barriers ? Wouldn't it be more accurate to look at the height of the obstacle ?

comment:3 by sanderd17, 11 years ago

Obstacles currently have no height information, so that would be very hard to do. In most ways, you can find a path through a line of bushes, so I think it would work quite well.

comment:4 by wraitii, 8 years ago

Milestone: BacklogAlpha 20

New pathfinder has been added, this should be fixed.

comment:5 by elexis, 8 years ago

Milestone: Alpha 20Backlog

Backlogging due to lack of progress.

by erraunt, 8 years ago

Attachment: commands.txt added

Long replay at the end of which there is the champion spearman attacking through the wall

comment:6 by erraunt, 8 years ago

I reproduced the behavior, the replay is quite long as I did it without codes or whatever should be used to get the champion troop faster.

I think getting the range of the pathfinder instead of the straight line would make it strange as the pathfinder's often have problems with choosing decent paths. I would propose leaving the range checking as is, but adding a check whether the pathfinder's path is considerably longer - that would mean there is a big obstacle which we probably can not attack through - what do you guys think? I will try to find how and implement it, at least a prototype.

comment:7 by Stan, 8 years ago

Sounds fair, though this has to exclude any unit that have ranged attack, else it's going to be a bit pointless. Maybe looking at the obstruction type in front of the unit would be faster than computing paths though, if you detect an uncut line of obstruction, there is a lot of chances this is a wall

comment:8 by elexis, 6 years ago

Description: modified (diff)

Computing more short or long paths per unit sounds expensive. It should either only be a direct line obstruction collision test test or an obstruction area test (all points between the center of the attacker and the obstruction area of the attacker).

If a melee unit finds out it can't attack near the wall, it has to compute a path an alternative path to the target that omits the wall. I guess new obstruction grids couldn't help because they afaik don't capture the moving obstructions.

So the number of added collision tests might grow worse than proportional to the number of melee units attempting to attack. So we have to solve it as simply but effective as possible ideally.

comment:9 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:10 by wraitii, 3 years ago

Type: defectenhancement
Note: See TracTickets for help on using tickets.