Issue914

Title pathfinding and movement
Priority minor Status open
Assigned To fluzz Keywords
Linked issues Watchers fluzz

Submitted on 2018-04-20 11h35 by flaviojs, last changed by flaviojs.

Messages
Author: flaviojs Date: 2018-04-20   11h35
These issues are being reported together because fixing them will likely affect
the same code.

---

1) Pathfinding is producing weird paths.

Example:
I'm in "Town (35.4:11.4:0)" and click on "Town (34.5:7.8:0)".
I expected Tux to go to the door and then to the target location.
Instead Tux goes to a point near the kitchen wall (in a straight line) and then
to the target location (in a straight line), resulting in a longer path
(Shopowner was behind the counter).

---

2) Pathfinding can't find some paths.

Example:
I'm in "Town (35.4:11.4:0)" and click between "Town (34.5:7.8:0)" and the sofa.
I expected Tux to go there.
Instead Tux does nothing, and after entering the building manually it can go to
the target location without problems.

Related:
When I'm melee fighting multiple droids and have only my "front area"
surrounded, other droids coming from that direction will stop coming towards me
until I make space by killing a droid attacking me.
I expected them to try to fully surround me by attacking my "back area", which
is empty, or to disregard the other bots and keep coming closer.
Pathfinding probably can't find a path to my "back area".

---

3) Pathfinding treats droids as obstacles, but movement doesn't.

I suggest not treating droids as obstacles during pathfinding.

Since I pass through bots during movement, I expected pathfinding to ignore them
too.
The current way just produces confusion, like when I sometimes couldn't cross
the "Maintenance Tunnels (29.3:14.5:6)" section, which I now know is because at
the time there was a droid in there.

Even after adding collision to movement, it is still reasonable to ignore droids
during pathfinding and only try to get around them when you actually collide,
since the droid might not be there by the time you arrive.

Related:
When I try to fight only one droid at a time I retreat a bit after it starts
chasing.
If multiple droids come, they will end up on top of each other (next to me)
because they come from the same direction, which reinforces the belief that they
are not obstacles.
When multiple droids are on the same position, sometimes they get stuck there. I
don't know for how long they are stuck because I usually go kill them soon after
to get a multi-kill. ;D
Author: flaviojs Date: 2018-04-22   23h06
The examples I gave in 1 and 2 are because path finding can't cross that door.

With the level editor I found the door is placed from the middle of a cell to
the middle of the next cell.
Removing the door does nothing, but moving the wall so a cell if free takes care
of the examples.
I think there were other places with the same problem, don't recall which, it
might be the same for them.

So either enforce a grid layout or teach pathfinder.c to generate paths that are
not grid aligned. (maybe use the Theta* algorithm?)
Author: flaviojs Date: 2018-04-23   18h12
4) Pathfinding can't get to a crate/chest if you're very close but not close
enough to smash/open it

You can see it happening easily in the "storage rooms" of Hell Fortress Entrance.

Related:
Sometimes I can't attack an enemy that is already too close, might be the same
problem.

---

Hmm, intead of having pathfinding trying to get to a point, it seems more
natural to target an area (circle or square) or to target the distance (range?)
to a point.
It would probably take care of circling targets by itself.

Note: all of these issues are with the current master, commit
94141d3d63370ad068c92f1c135ccf40900294bf.
Author: flaviojs Date: 2018-04-26   19h55
[continuation] 3) Pathfinding treats droids as obstacles, but movement doesn't.

Also related:
In the "Factory office" of "Hell fortress" I noticed that "Plasma discharge" was
hitting bots on the other side of the wall when they are next to the wall.
And it also propagates through some gaps between panels that are not visible on
screen.

By chance, I once crossed between panels (where "Plasma discharge" propagates)
while fleeing from three 999's to heal myself.
It is probable that the point I clicked on the other side of the panels forms a
direct line through that imperceptible gap.
Having obstacle checks during movement would prevent this.

Again by chance, at a later time I was unexpectedly crossing between panels
after repositioning during battle and cast "Plasma discharge" in the middle of
movement.
The casting started when I was in between the panels and caused me to be stuck
there.
Attacking a bot that was passing by moved me a little bit but then I remained
stuck at x=86.230270, y=36.857243, z=59 (Factory Office).
This is probably what happened to the bots that I saw stuck on the wall,
described in http://bugs.freedroid.org/b/issue915 (they are not the reason of
that issue).
History
Date User Action Args
2018-04-26 19:55:21flaviojssetmessages: + msg3582
2018-04-23 18:12:41flaviojssetmessages: + msg3577
2018-04-22 23:06:33flaviojssetmessages: + msg3576
2018-04-20 13:25:16jesusalvasetnosy: + fluzz
assignedto: fluzz
2018-04-20 11:35:10flaviojscreate