Skip to content

Entity blocking itself #11

Open
Open
@Lurler

Description

@Lurler

Hey!

There's a small issue with using the library. I'm not sure how to elegantly solve it without some hacks...

I have a grid (WorldGrid) which stores not just terrain data (e.g. which tiles are walkable/blocked) but also takes into account all entities on the map and block those cells as well, so entities don't walk to top of each other. I think this is pretty normal implementation for most games.

But here's the problem. Since the entity is actually standing in the cell it can't build a patch because the cell it is standing in is also considered blocked... I can obviously add some hacks where the entity first marks the cell it is standing on and the target cell as walkable, but it isn't exactly a good way to address it.

Maybe you can just add two simple options along the lines of:

private static readonly PathFinderOptions PathfinderOptions = new()
{
    IgnoreStartCellBlock = true,
    IgnoreEndCellBlock = true,
};

Or something of this nature. Basically so that:

  1. Entities don't block itself from moving by the virtue of existing in the cell.
  2. and can still build a path to another cell even if that cell is occupied by an entity (e.g. when monster builds a path to the player cell, even though this cell is blocked by the player).

Obviously if there's a better solution that I have missed please let me know :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions