I implemented 2 NPCs chasing the character using Dijkstra algorithm for pathfinding. Tile map is represented by graph, where a node is basically the tile, and the adjacency list consist of adjacent tiles.
Only walkable way points are added to the graph (tiles which are not empty on walkable layers). All obstacles and their backgrounds are on different layers, that are not used for path finding. However, you can see that entities do intersect obstacles or end up on non-walkable layers).
How would experienced game developer handle this? What strategy should I use? I have tried applying collider which I use for my character to avoid intersection of obstacles to the NPCs, however this results in chaotic velocity changes (AI applies velocity and collider drops it)
UPD:
I noticed that I was comparing entity's top left corner to tile center to check if entity has reached a certain tile.
Now i use tile's center and entity's center to check if the entity reaches certain tile while traversing the path. Diagonal movement to diagonally adjacent tiles is also possible. But it still does not solve the problem even though now movement is more natural.
private fun modifyVelocity(tileIndex: Int) {
val nextPos = tileMap.getTilePosition(tileIndex)
val x = nextPos.x + tileMap.getTileWidth() / 2
val y = nextPos.y + tileMap.getTileHeight() / 2
val centerPoint = params.getCenterPoint()
params.velocityX = when {
isHorizontalDiffInsignificant(x) -> 0f
x > centerPoint.x -> VELOCITY
x < centerPoint.x -> -VELOCITY
else -> 0f
}
params.velocityY = when {
isVerticalDiffInsignificant(y) -> 0f
y > centerPoint.y -> VELOCITY
y < centerPoint.y -> -VELOCITY
else -> 0f
}
}
I also can show the unwalkable layers of the map, which are not added to the path. One layer for obstacles and one layer for their background.

I personally have a feeling, that this is geometrical problem, probably I should use another point to represent entity position