Opened 12 years ago

Last modified 2 years ago

#1665 assigned enhancement

Citizen soldiers attack gaia animals without provocation

Reported by: historic_bruno Owned by: Grapjas
Priority: Should Have Milestone: Backlog
Component: Simulation Keywords: UnitAI
Cc: Deiz Patch: Phab:D4187

Description

Idle soldiers now attack dangerous gaia animals for no reason. I can understand responding to an attack, but it makes no sense for soldiers to run around the map attacking lions, wolves, etc. especially when a lion can kill a single soldier in its own defense.

Change History (17)

comment:1 by Deiz, 12 years ago

There's also a related issue: "Dangerous" means aggressive or violent. Defensive behaviour for animals is oddly-implemented. Unlike defensive soldiers, they don't attack unprovoked, but once they've been attacked they'll fight back and also attack any other enemies that are nearby, for very small values of nearby because most animals have a vision range of 10m. That said, an African bush elephant can tear through a great many infantry if they're attacked one by one.

My thinking is that there should be a sort of 'help' broadcast when a unit is attacked while not already in a combat state, which nearby allies might respond to by pushing an attack order in front of their current order.

Last edited 12 years ago by Deiz (previous) (diff)

comment:2 by zoot, 12 years ago

Speaking of elephants and 'help' broadcasts, I always thought it was unfair that you can attack a baby elephant with no one helping the little bugger. In reality, its herd or at least its mother would come to its rescue, but in the game other elephants just stand around.

in reply to:  1 comment:3 by historic_bruno, 12 years ago

Replying to Deiz:

My thinking is that there should be a sort of 'help' broadcast when a unit is attacked while not already in a combat state, which nearby allies might respond to by pushing an attack order in front of their current order.

Yes, something like that has been vaguely discussed but the question is how to balance the potential benefit with the drawback of being able to substantially disrupt your opponent with a single ranged "scout". Imagine your opponent has 20 units working on stuff near their CC, attack one and they all rise up and come after you, then you flee, now repeat. Perhaps the response should be proportional to the threat level and how would we determine that?

comment:4 by Deiz, 12 years ago

That's a tricky problem to solve. I'm mostly thinking about Gaia animals here, i.e. slow melee units that never flee. That case, at least, is simple - kill the attacker ASAP because it won't stop attacking until it's dead.

The more general case should probably depend on a number of variables. For melee units, they only ought to try to defend against ranged attackers if they're faster than the attacker or the attacker is very close. Ranged units would defend more readily, but there's still the problem of the attacking unit possibly having longer range and/or being faster.

Stance probably ought to affect how readily units will respond to help requests and how easily they'll give up.

The thing is, UnitAI is already abusable. If you attack a lone gatherer that's in a combative stance, it will chase you, so you could conceivably use a scout to lure lone enemy units into range of a larger force of your own units. Given that a decent player will always be able to make better decisions than UnitAI, I'm in favour of a limited solution where helping units don't give much chase and mostly serve to protect against active attacks.

in reply to:  2 comment:5 by historic_bruno, 12 years ago

Replying to zoot:

Speaking of elephants and 'help' broadcasts, I always thought it was unfair that you can attack a baby elephant with no one helping the little bugger. In reality, its herd or at least its mother would come to its rescue, but in the game other elephants just stand around.

I don't see any benefit from that. Think about it, you send units hunting and target a single animal, but suddenly you're attacked on all sides, so next time you have to send a massive hunting party, and you have to slaughter them all at once or risk your hunters dying. If anyone brings up that point, we should just say our animal herds are groups of individual animals each acting independently :)

comment:6 by Kieran P, 11 years ago

Milestone: Alpha 12Alpha 13

Too risky to do just before a release. Pushing to this the next alpha.

comment:7 by Kieran P, 11 years ago

Milestone: Alpha 13Alpha 14

comment:8 by sanderd17, 11 years ago

Just wondering, can't we say animals "feel" when we want to do harm? So if some units wants to attack an animal of the herd, the entire herd would attack back, or flee (depending on the stance and the strength of the units).

But when the attack command is stopped, animals stop to defend their herd.

Of course, for animals in the "violent" stance, they just keep attacking as long a unit is in vision range (but don't go chasing it). Doesn't look too complicated.

Animal checks all units in their vision range. Get the enemy units attacking the animal itself, or a related animal.

If there is an enemy attacking, react. Reaction can take into calculation the number of attacking units, the number of related animals in the vision range, and their statistics (pierce, hack, crush). And the result can be a flee or an attack.

If there are no more enemies in vision range attacking, stop fighting back (maybe with a small delay).

Animals should always flee when hit by an arrow coming from a building.

For the related animals, I suggest an extra XML tag. In case it's a solitary animal, the tag would not be set. If it's a herd animal, the tag would contain the names of its own kind, min most cases, only one tag, but in case of the elephant, have a tag for the elephant and one for the baby elephant, as they belong to one herd.

And units should never start to attack animals without they're being tasked to do so, or without being attacked by the animal at first.

This could create some interesting hunting tactics. If you can isolate an animal from its herd, it will be easier to catch.

As a last thing, I think enlarging the vision range for animals would help to make the AI better, as they can better estimate the numbers.

comment:9 by Kieran P, 11 years ago

Milestone: Alpha 14Alpha 15

comment:10 by leper, 10 years ago

Keywords: design added
Milestone: Alpha 15Backlog

comment:11 by Imarok, 5 years ago

Component: UI & SimulationSimulation

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

comment:12 by Grapjas, 3 years ago

Owner: set to Grapjas
Status: newassigned

comment:13 by Grapjas, 3 years ago

Patch: D4187

comment:14 by Grapjas, 3 years ago

Patch: D4187Phab:D4187

comment:15 by Grapjas, 3 years ago

Milestone: BacklogWork In Progress

comment:16 by Grapjas, 2 years ago

Keywords: design removed
Milestone: Work In ProgressAlpha 26
Type: defectenhancement

comment:17 by Freagarach, 2 years ago

Milestone: Alpha 26Backlog
Note: See TracTickets for help on using tickets.