[mod] New Pathfinder [wip][pathfinder]

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

[mod] New Pathfinder [wip][pathfinder]

by burli » Tue Apr 18, 2017 12:23

This mod should not replace the default pathfinder. It is a proof of concept how a pathfinder could work in Minetest and if everything works this mod should be ported to C++.

nevertheless this mod can be used as replacement for the current pathfinder and I would appreciate it if a lot of you give it a try and report issues and suggestions. I would really appreciate it if someone can try it (temporarily) on a server with mobs.

The mobs will be much more aggressive and find more ways to chase the player, but the calculation time is higher than by the built-in pathfinder. Average time for find_path is less than 2ms, but can go up to 40ms if find_path fails.

To test the pathfinder in mobs_redo you only need to replace the minetest.find_path() line with this line.

Code: Select all
self.path.way = pathfinder.find_path(s, p1, self, dtime)


I also recommend to set stuck_path_timeout to 2 in the API and to set the view_range of the mobs to something about 25 to 30

Also you need to add "pathfinder" to mobs_redo depends.txt

It is not tested in other mob api's. The pathfinder needs the mob object for the mob size (collision box) and optional jump_height and fear_height attributes.

Known issues:
- only supports mobs with a base size of 1x1. Other mob sizes may work most times, but may stuck in certain situations.
- path can not be found if the player stands on a slab or at the edge of a node
- doesn't work with spider

Github:
https://github.com/MarkuBu/pathfinder
Last edited by burli on Wed Dec 06, 2017 17:09, edited 2 times in total.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Tue Apr 18, 2017 13:03

Important: I fixed a bug in the first release of the mod, that can crash the server. If someone downloaded the pathfinder before this post, please update
 

Byakuren
Member
 
Posts: 813
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [mod] New Pathfinder [wip][pathfinder]

by Byakuren » Wed Apr 19, 2017 01:10

What about returning a path to the closest reachable node to the player? So that it can look like a mob is trying to reach the player.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Wed Apr 19, 2017 06:44

Byakuren wrote:What about returning a path to the closest reachable node to the player? So that it can look like a mob is trying to reach the player.

That would be possible. I put it on my list.
 

User avatar
BrandonReese
Member
 
Posts: 839
Joined: Wed Sep 12, 2012 00:44
Location: USA
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: [mod] New Pathfinder [wip][pathfinder]

by BrandonReese » Sat Apr 22, 2017 17:25

I was going to work on a path finder that would support doors so it could return a path to an object that was behind a closed door that was not locked. Then the mob code would handle the door when the mob got to it. I may modify this to see how that would work out in the end.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Sat Apr 22, 2017 17:39

BrandonReese wrote:I was going to work on a path finder that would support doors so it could return a path to an object that was behind a closed door that was not locked. Then the mob code would handle the door when the mob got to it. I may modify this to see how that would work out in the end.


Doors are walkable and my code looks for walkable node, so doors are currently solid for my pathfinder. Will change this later
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [mod] New Pathfinder [wip][pathfinder]

by ExeterDad » Sat Apr 22, 2017 17:57

burli wrote:
BrandonReese wrote:I was going to work on a path finder that would support doors so it could return a path to an object that was behind a closed door that was not locked. Then the mob code would handle the door when the mob got to it. I may modify this to see how that would work out in the end.


Doors are walkable and my code looks for walkable node, so doors are currently solid for my pathfinder. Will change this later

Mobs opening door might be popular for many people.... but I'd love to see that working. Just craft a better door :P
 

User avatar
azekill_DIABLO
Member
 
Posts: 7459
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Thu Apr 27, 2017 06:52

I think, doors should be ignored by the pathfinder. The path should be generated through the door, even if it is closed. The mob has to handle the door by itself. Anything else doesn't make sense.
 

User avatar
TenPlus1
Member
 
Posts: 2419
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [mod] New Pathfinder [wip][pathfinder]

by TenPlus1 » Thu Apr 27, 2017 08:12

If pathfinding is set to 2 when registering a mob redo entity it has the ability to break through level 1 walls and doors to get to player.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Thu Apr 27, 2017 09:58

Ok, there should be an option to ignore doors. How this is defined in the mob registration is a different story

The job of the pathfinder is to find a path from a to b. It is not it's job to avoid other entities or interact with the environment. The only interesting thing for the pathfinder is, if a node is passable or not.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Tue May 09, 2017 10:27

Because of changes in the entity API I will stop working on my mobs and focus on the pathfinder. Will port it to the client side or make it usable for both sides.

Will optimize the code and add support for doors, trapdoors, ladders and liquids.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Sun May 28, 2017 17:46

burli wrote:The mobs will be much more aggressive and find more ways to chase the player

What I'm looking for is a path finding algorithm for mobs that want to go to certain places inside a house (i.e. go to their bed at night). The target will usually be a position and very seldom another entity. Calculation time is less of a problem. Beds, unlike players, don't tend to move around :-)

burli wrote:only supports mobs with a base size of 1x1. Other mob sizes may work most times, but may stuck in certain situations.

That's a bit of a problem. The mob may walk towards a tree and get stuck there due to leaves hanging one node above the ground. At least that's what stopped the working_villages lumberjack mobs many times. Might be similar here. At least the leaves problem could be solved by making players able to walk and climb through leaves as it is set up in BrandonReeses worlds.

BrandonReese wrote:I was going to work on a path finder that would support doors so it could return a path to an object that was behind a closed door that was not locked. Then the mob code would handle the door when the mob got to it. I may modify this to see how that would work out in the end.

That would be fine. I need something like that for my mg_villages and especially citybuilder. Pathfinding from the engine seems to work sometimes if the doors are all open. Don't forget gates and the like which are similar obstacles as doors.

ExeterDad wrote:Mobs opening door might be popular for many people.... but I'd love to see that working. Just craft a better door :P

How could that be solved by using another door? Besides, it needs to be a general solution for all these door-like things (including gates and other gate-like nodes).

burli wrote:I think, doors should be ignored by the pathfinder. The path should be generated through the door, even if it is closed. The mob has to handle the door by itself. Anything else doesn't make sense.

That's right. Such a pathfinder would be great. A list of door-like nodes could be passed to the pathfinder as an argument. After all animals won't likely be able to open doors in general.

TenPlus1 wrote:If pathfinding is set to 2 when registering a mob redo entity it has the ability to break through level 1 walls and doors to get to player.

Hm. Breaking through walls? So that the mob will destroy the blocks? That wouldn't be good. Ladders and the like ought to be no obstacle though.

burli wrote:The job of the pathfinder is to find a path from a to b. It is not it's job to avoid other entities or interact with the environment. The only interesting thing for the pathfinder is, if a node is passable or not.

Mobs meeting and blocking each other's way is another problem. I guess in most situations - and in open space in particular - they'd just rotate a bit and glitch past each other eventually. The tight corridors in my houses are a bigger problem. Maybe I can only allow one mob walking freely inside the house at each given time.

burli wrote:Will optimize the code and add support for doors, trapdoors, ladders and liquids.

That is very good to hear. I'm looking forward to it.

The pathfinder in the engine seems to be very strange sometimes. It does find a path if doors are open - which is a good start. But it also finds a path if there really isn't one:
Code: Select all
block air
air block

will put a path through the air nodes even though it's not really possible to walk there. Your algorithm does not seem to have that problem, but it still creates a too long path. Perhaps what I expect and need in this case is rather the *shortest* instead of just *a* path. A heuristicly optimized short path will be more than good enough. Mobs trying to attack players have diffrent needs there. Once they've marched some time they need to check the current position of the player and ask for a new path because the player moved to another position in the meantime. Beds, furnaces, farm land etc. don't move. Mobs can ask for a path and follow it through to the end without having to recalculate. Most of this will happen in singleplayer anyway. So there's much more computation time available for the pathfinder I need than for a conventional one which allows a mob to attack. Is such a pathfinding algorithm out there?

Image
This is the path the engine's minetest.find_path(pos1,pos2,10,1,2,nil) function provided. The path goes around the entire building, then jumps through wall and ceiling to the second floor, proceeds on the bed there, jumps through to the top floor, and from there on takes the stairs down to finally arrive at the destination. Tricky to find a longer path. Also impossible to navigate as it glitches through walls.

Image
And this is what burlis algorithm came up with. It still leads around the entire house - but at least it doesn't cover the other floors afterwards. As in the above picture, all nodes which are part of the path and do not contain anything yet are marked with blue rails.
Attachments
path_burli.jpg
(125.78 KiB) Not downloaded yet
path_engine.jpg
(115.17 KiB) Not downloaded yet
A list of my mods can be found here.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [mod] New Pathfinder [wip][pathfinder]

by burli » Sun May 28, 2017 18:12

A pathfinder does not decide where a mob should go. The target decision has to be made by the mob itself. The pathfinder only finds a way from a start point to a target point.

Decisions like "go upstairs", "find the next door", "go to bed"... can't be made by a pathfinder
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Sun May 28, 2017 20:05

burli wrote:A pathfinder does not decide where a mob should go. The target decision has to be made by the mob itself. The pathfinder only finds a way from a start point to a target point.

That's right, and nobody expects the pathfinder to do that. The mob provides its current position and a position where it wants to be - and the pathfinder ought to provide a path that gets the mob to its desired position. What I'm using here for tests is giving the pathfinder two positions (gained from WorldEdits //p set), letting it create a path from pos1 to pos2, and then place those rails ingame so that I can see where the path would go

Decisions like "go upstairs", "find the next door", "go to bed"... can't be made by a pathfinder

Maybe that's a misunderstanding. If following the stairs up is a way for the pathfinder to create a successful path, then "go upstairs" is part of the path - it's just that nobody (neither pathfinder nor mob) is really aware that there's some "going upstairs" involved. As a human observing the plotted path, such terms do come to mind. The position of "door" or "bed" will be provided to the mob. It's still a diffrent situation than "go to that player for attack".
A list of my mods can be found here.
 

alexwbc
New member
 
Posts: 5
Joined: Sun May 21, 2017 07:03

Re: [mod] New Pathfinder [wip][pathfinder]

by alexwbc » Mon May 29, 2017 11:15

What about set the pathfind in two modes: "Walk on ambiguous nodes" false/true

Ambiguos nodes are those nodes that can be set blocking/not blocking (like doors, trap door etc... like when a player protect him/herself from aggressive mobs).
In the first mode, the pathfinder simply ignores ambiguous nodes and alway look for a "clean" path.

The second mode the path is made considering the ambiguous nodes as regular walkable nodes, plus the path finder return an array with all the ambiguos nodes found in meanwhile: in this way it's up to the one who develop the mob IA to write the beaviour of the mob (when collide with ambiguos node)
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Mon May 29, 2017 14:32

alexwbc wrote:The second mode the path is made considering the ambiguous nodes as regular walkable nodes, plus the path finder return an array with all the ambiguos nodes found in meanwhile: in this way it's up to the one who develop the mob IA to write the beaviour of the mob (when collide with ambiguos node)

Sounds good. The acceptable nodes (doors) could be an additional parameter to the pathfinding algorithm. Your idea of providing information about which nodes need special handling is also very good. That could make navigation a lot easier for the mob.
A list of my mods can be found here.
 

ShadMOrdre
Member
 
Posts: 125
Joined: Mon Dec 29, 2014 08:07
Location: USA
In-game: shadmordre

Re: [mod] New Pathfinder [wip][pathfinder]

by ShadMOrdre » Tue May 30, 2017 18:40

Sokomine,

If you've managed to get an NPC to a door, the NPC must be given knowledge that there is a door there to then open. As such, the NPC must scan for usable objects, in this case a door, in order to be able to use said door.

Given your example above, once at the door, scan for usable objects (ie, the door), open the door, go through the door, (ie, walk the two/three blocks to ensure that NPC is on other side of door, then close the door. Once the NPC is inside, a concept that is unknowable to the NPC, then simply limit it's pathfinding to the area in question.

To get your NPC from outside the door, to inside, and then to bed, the only logical method is to limit the NPC's pathfinding to the building in which you are trying to get the NPC to enter. What I mean here, is that the NPC's pathfinding algorithm should not have access to the entirety of the world, but the limited space within which you are trying to get the NPC to navigate. Dijkstra's algorithm does not use an infinite space, but a limited space. My guess, is that by limiting the area to navigate, you could easily get an NPC to navigate any number of random buildings, simply by limiting the NPC's ability to navigate within said building. Stairs become self evident to an NPC in this way, since the only way to get from ground level to any higher level within the building would be to use the stairs, even though the NPC has no concept of "stairs". The stairs only become a path from one level to the next. This also prevents the NPC programmer from having to hard code knowledge of said stairs, or any other concept for which the NPC would not learn.

AITechEye's aliveai could easily then be used. Consider that you create a task/mission/job for the aliveai NPC's that is simply to use any given item, such as a door, chest, or even your own citybuilder constructor objects. NPC's would need to learn how to use any given item/object, especially those item/objects that require more than just a punch to operate, like the simple door. Your citybuilder constructor objects would certainly need a mildly complex line of thinking for an NPC to navigate and understand.

Having played with your mg_villages and citybuilder mods, AITechEye's aliveai mod, and theFox's working_villages mod, this seems to become the only real solution.

My experiences with NPC's and navigating open worlds was to use named locations. Once at a named location, the NPC would scan the area for objects deemed usable for that area, so if inside a pub, the NPC would scan for chairs to sit, but if inside a factory, it would scan for usable machines. The NPC has no concept of, or knowledge of, it's current location, ie, that it is in a pub or factory. The NPC only knows that at a given location, there are only certain objects with which it should interact. In this way, multiple NPC's actually only interact with the objects with which it has knowledge at any given location. So the "customer" NPC uses a chair to sit down at the pub, but the server NPC does not use any of the chairs, instead using only those objects with which it should interact.

This also allows burli to focus on the pathfinding, while others can focus on the NPC's, and still others, on village building.
My other virtual world is an Opensimulator.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Wed May 31, 2017 01:51

It seems that I accidently only used the engine's pathfinding algorithm and not burlis. The result of the engine's pathfinding varied considerably depending on the value of "searchdistance". It worked more or less with 1 as searchdistance, but burlis variant here provided better results.

It is even possible to plot paths through doors and the like by a very simple change:
Code: Select all
local function walkable(node)
             if( string.sub( node.name, 1, 6)=="doors:") then
                      return false;
              end
              return minetest.registered_nodes[node.name].walkable
end

This is a quick and not very clean solution. I'd prefer to pass on a list of nodes that mobs can operate but that would require a bit more work as that parameter would have to be added in multiple places.

It would also be nice to take climbable nodes into consideration. Ladders, rope and scaffolding nodes come to mind.

ShadMOrdre wrote:My experiences with NPC's and navigating open worlds was to use named locations. Once at a named location, the NPC would scan the area for objects deemed usable for that area, so if inside a pub, the NPC would scan for chairs to sit, but if inside a factory, it would scan for usable machines. The NPC has no concept of, or knowledge of, it's current location, ie, that it is in a pub or factory. The NPC only knows that at a given location, there are only certain objects with which it should interact. In this way, multiple NPC's actually only interact with the objects with which it has knowledge at any given location. So the "customer" NPC uses a chair to sit down at the pub, but the server NPC does not use any of the chairs, instead using only those objects with which it should interact.

The concept of "tasks" for mobs and making them able to deal with specific nodes without having to know anything about the entire world might indeed be a good solution. I've already prepared my citybuilder mod so that no knowledge about the structure as such is needed. It's sufficient to call a function and get information about what to do next if you're a mob. Regarding tasks like "sit down on a chair/bench" - the problem might be to check that there's no other mob sitting there already.

ShadMOrdre wrote:This also allows burli to focus on the pathfinding, while others can focus on the NPC's, and still others, on village building.

Definitely!
A list of my mods can be found here.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Thu Jun 01, 2017 22:48

I'm currently testing the pathfinding algorithm here (which really does seem to be quite nice) with the previously mentionned small modification that will allow it to create paths through doors. The movement code in the npcf mod did look promising. I've modified it a bit so that npcf mobs can now go through doors. Unmodified they just tend to think they're stuck and try to jump. Closed doors are opend by the mobs. After the mob went through it tries to close the door. The same applies to gates, though those are tricker to navigate due to the gates collision box. I've made the mob a bit smaller in order to fascilitate gate navigation but they still have to struggle a lot and may be stuck for a while at each gate.

The current version is available at github. I'm not satisified with the code yet (a table instead of string.sub for door identification would be much better), but it does work in my singleplayer world. If you're intrested, give it a try.
A list of my mods can be found here.
 

zorman2000
Member
 
Posts: 83
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [mod] New Pathfinder [wip][pathfinder]

by zorman2000 » Fri Jun 02, 2017 20:07

I haven't tried this pathfinder, although it does looks promising.

My WIP mod advanced_npc (https://github.com/hkzorman/advanced_npc) uses a Lua pathfinder that, for the moment, unfortunately, only works in flat surfaces. They can open doors and find their way inside buildings of mg_villages. The way I solve the issue of NPCs opening doors it is very simple: I run the pathfinding code only once, save the positions and then make the NPC walk to those positions in turn. Doors are walkable for the pathfinder. After I acquire the positions, I check if nodes are openable or not (in other words, doors) and then add steps for the NPC to open and close them before the continue on.

Disadvantages of this method is, of course, that pathfinding is not dynamic. So if there are obstacles on the path the NPC originally calculated, it might get stuck.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Fri Jun 02, 2017 23:01

zorman2000 wrote:I haven't tried this pathfinder, although it does looks promising.

The pathfinder here works very fine. There are still situations where the mob may get stuck, but there's probably no way to avoid that entirely. Sometimes the mob leaves the stairs too early and hits his head on the ceiling. Also gates from the default mod still pose a significant challenge sometimes.

zorman2000 wrote:My WIP mod advanced_npc (https://github.com/hkzorman/advanced_npc) uses a Lua pathfinder that, for the moment, unfortunately, only works in flat surfaces.

Flat surfaces? If I get that right, stairs and the like are not yet supported? This pathfinder here does support them. It is also an implementation in Lua. As pathfinders can be relatively easily exchanged, you might want to give burlis pathfinder here a try :-)

zorman2000 wrote:They can open doors and find their way inside buildings of mg_villages.

All village types or just some? The houses nore and taoki provided are a lot easier to navigate than those of my medieval type. Those tiny medieval houses are extremly crwoded inside. Using the beds will almost certainly require cheating from the npc because there's not enough room to stand on them. And two mobs better do not run around the house at the same time.

zorman2000 wrote:The way I solve the issue of NPCs opening doors it is very simple: I run the pathfinding code only once, save the positions and then make the NPC walk to those positions in turn. Doors are walkable for the pathfinder. After I acquire the positions, I check if nodes are openable or not (in other words, doors) and then add steps for the NPC to open and close them before the continue on.

That's how I've integrated it into the movement code in npcf.

zorman2000 wrote:Disadvantages of this method is, of course, that pathfinding is not dynamic. So if there are obstacles on the path the NPC originally calculated, it might get stuck.

Same here. Happened sometimes when I was blocking the mob's path. The guard from npcf does recalculate its path each time he reaches one of the stored patrol points.

Your mod is extremly intresting. You ought to "advertise" more for it and mention it more often! I wasn't aware of its current state of development. Maybe you can open a thread marked as WIP in the mod section of the forum.

zorman2000 wrote:Giving an NPC their favorite or disliked item will affect positively/negatively their relationship with that player.

Disliked items sounds a bit odd. The mob might not be intrested in some items and refuse to take them, but actual dislike and negative effects on its relationship to the player ought not happen.

zorman2000 wrote:Eventually, an NPC can fall in love with that player and marry him/her

Perhaps...er...for some mods. But..imagine the player throwing hearts around like the mobs in mobs_redo. Better...not. Wifes and husbands and children are for the mobs, not for the player :-)

zorman2000 wrote:support for mg_villages mod by Sokomine
* Identify, on medieval villages, houses that NPC can live on.
* Identify the amount of NPC that the house can support
* Spawn NPCs and assign them a bed. Detect sharable objects (chest, furnace, benches)
* Assign them random schedules based on the type of building they spawn.

If mobf_trader is installed, traders are already assigned to houses and spawned in random places on the plot. Sometimes they end up on the roofs. The lua table that holds information about each building can also be extended so that it includes more helpful information. Currently, only the "inh"(abitants) value is used for that. Positions of beds can be provided in the future.

The chat and trading provided by the advanced mobs seem to work very fine already. When a mob says something in chat it always ought to be prefixed by the mob's name. Sometimes it wasn't. Beeing able to give presents to mobs is also a very nice feature I enjoyed a lot :-) The trade formspecs (buy and sell) look very nice. However, I couldn't get the mobs intrested in beds or benches. They just jumped on their beds and never used them.
A list of my mods can be found here.
 

zorman2000
Member
 
Posts: 83
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [mod] New Pathfinder [wip][pathfinder]

by zorman2000 » Thu Jun 08, 2017 16:48

Sokomine:

Thanks for the thorough reply.
I will indeed test at some point this pathfinder, as it seems to support some features the pathfinding code I use doesn't.

Regarding my mod, thanks a lot for your feedback! Would like to explain more, but I wouldn't like to advertise this on burli's thread! So, feel free to open issues in Github if you feel something shouldn't be there or can improve and we can discuss!

My mod is huge, I will be releasing it soon, but I didn't wanted to open a thread while many of the features where undeveloped. Right now, the mod is close for an alpha release, and I plan to do it within the following week, so wait for a forum thread soon!
 

zorman2000
Member
 
Posts: 83
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [mod] New Pathfinder [wip][pathfinder]

by zorman2000 » Mon Jun 12, 2017 23:00

Hi burli,

I have downloaded the pathfinder mod and currently trying to make it work on my mod. I have entities using the player model and normal size. Everytime I use it, I only get paths with one node, namely the start node. Also happened when I tried to find a path starting from one node to another (note, no entity here. I manually provided collision box).

Any ideas what could be going on?
In all fairness, either the target node or the start node is a node box in all this cases (thickness 2/16, so not technically a slab). Also, when I have an entity, I round the position vector for start position using vector.round()

Thanks!
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] New Pathfinder [wip][pathfinder]

by Sokomine » Tue Jun 13, 2017 00:08

[@uote="zorman2000"]
In all fairness, either the target node or the start node is a node box in all this cases (thickness 2/16, so not technically a slab). Also, when I have an entity, I round the position vector for start position using vector.round()
[/quote]
I don't think that the pathfinder can handle slabs or other nodebox-like nodes. It does seem to have no trouble with stairs, but then it might just consider jumping to be an option. When trying to get paths for the mobs to leave their beds and go outside (dry-run only), snow turned out to be an obstacle which made it impossible to get a path. As the new, higher snow also makes it impossible to enter houses as a player in some situations, I changed the snow node's definition so that it presents no obstacle to anyone:
Code: Select all
minetest.override_item("default:snow", {walkable=false})


Some of my houses contain nodes that are very thin. Depending on param2, the very same node might either be floor, ceiling or a wall. Players can figure out where to walk, but for the pathfinding algorithm it's just a solid node, blocking movement in all directions.
A list of my mods can be found here.
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 4 guests