Anarchid / zkgbai

Zero-K Graph-Based AI
GNU General Public License v2.0
7 stars 3 forks source link

Picket Pushing: Line of Sight derpiness #19

Open esainane opened 4 years ago

esainane commented 4 years ago

KGB seems to try Picket pushing where the Pickets can't actually fire at their targets: screen00018 It also really, really wants to finish Pickets, even if this costs it their commander: screen00019

KGB apparently calculates line of sight shadows for other attacks. I'm not sure how to add this here, though.

aeonios commented 4 years ago

What version are you using?

esainane commented 4 years ago

This was built from d5bca36, the current master.

aeonios commented 4 years ago

Hm. The line-of-sight thing is more or less untractable. It has no way of predicting whether the porc will actually have a clear shot at anything or not. The suicide thing is problematic because it prefers not to run workers away when building/repairing porc unless it deems the situation hopeless (based on the threat of things it knows are there).

It'll abandon porc if that porc gets killed by enemy porc, but if enemy porc is targeting the worker, and especially if it can't see the porc, then it doesn't know that it needs to run away. Given that it built the defender inside the range of the stardust it obviously didn't know it was there, and unlike a human it can't infer it either, mainly because it has no unit ID to associate with it. Without a unit ID it would end up creating a new dummy porc literally every time a bullet hit a unit if it was out of los. Porc would end up getting counted infinite times for threat not to mention it'd have ridiculously bad performance.

Unfortunately spring is excessively strict about not sharing any information about things that are out of los and radar, which is bad for the reasons above but there's pretty much nothing I can do about it. It's already got workarounds wherever they're possible, but this is a pathological case where it isn't.

DeinFreund commented 4 years ago

CSI handled this by adding a dummy unit if it received damage. If there was an existing dummy unit of the same unitdef nearby, it simply wouldn't add another.

Anarchid commented 4 years ago

Hm. The line-of-sight thing is more or less untractable. It has no way of predicting whether the porc will actually have a clear shot at anything or not. The suicide thing is problematic because it prefers not to run workers away when building/repairing porc unless it deems the situation hopeless (based on the threat of things it knows are there).

It's actually somewhat cheaply computable using the same raycast algorithm that the engine uses to actually calculate LoS in real time.