#Pathfinder
1 messages · Page 1 of 1 (latest)
and since you already went for performance: did you checked at some chance what happens with 1000+ npcs?
not with 1000
200 yes
with just the default pathfinder
Is there a way to specify a max failure rate with pathfinder strategies?
EG if pathfindnig isValid returns false x amount of times in a row instantly complete to pathfinding goal?
not yet since this is handled internally
weird
it must be set to like 2k failure or something
odd
mine will indeiniftly run
indefinitly*
\
ignore the bug it should be able to drop one block distances just need to debug
but when i go to a unreachable path it indefinatly pathfinds
to the point of crashing the server
Though i am logging these points, they returns nearly thousands of lines of logs
lol disc wont let me upload logfile
93mb log file
uploading it now
now ofc its returning false due to user error, but there is times where this pathfind could become infinite with anything other than isPassable
EG if said npc falls into a pit
these paths are less than 20-40 blocks from the player
since im hard forking ill manually change that code to my liking
It appears the code just sets a max points
Im talking about everytime isValid is false, have a set number of max times it can return false in a row and it it fails pathfinding to many times in a row (In any case a specific isValid call on a node shouldnt return false more than 4-12 times)
what i think is happening rn is its allowing as many isValid false calls as the maxDepth variable, ide rather exit the pathfindiner earlier rather than waste processing power trying to isValid a method thats returned false 12 times already
im gonna play with this some more tho and actuall get the pathfinder non bugging before i play with this tho
i almost have the pathfinding right first time through too 
lol i know why it doesnt like one block ledges
im not storing the clones location after use so its always the same block 💀
well it should jump to the next node as it cant validate the current
well the issue is if every next node is false
oh well so it jumps between them?
x is false, so i try y! huh, y false, so i try x!
yeah until it hits max depth
sec
i can kind of show an example
ah ok, well then we probably have to cache failed nodes internally
to fail fast if there is no possible node anymore
but that could fuck up some paths
since what if a failed node is later available from another perspective
just keep a count of conescutivly failed IsValid checks tbf
Need to allow a setting for it somehow maybe allow an argument for it
so if max value is not set, itll run unlimited
so you dont interefere with those issues
i already thought of some kind of PathingSettings or whatever
yeah that would be rly helpful
a value object you can instantiate factorial
then we could also leave the max depth to the user
yeah that would also be pog
i think max depth currently is nice tho
however i think rn its interfering slightly with my current strategy but
well we can leave the current one as default
thats actually one of my ideas i've had at the beginning
some kind of ruleset
agggg
but i started to overengenieer it and quit it
your does same thing mines does
haha
cant seem to get the pathfinding to avoid cliff-lakes
on both your strategy and mine
ill prolly figure this out eventually
probably because water is passable
mine does direct checks for it
what about normal cliffs
lemme try that
weird
yours doesnt like to go here hahaha
hes scared of ledges
wont go a mile within them
hmm
because somehow mine is checking for 4 blocks
it doesnt like mountains either
and redo it at some point
ill see what i can get working i think mine will follow this path
he just cant avoid cliff-lakes
yeah maybe yours will work, then you could PR it
thats current method im trying rn
its ran on the current block
gonna do a few more tests
basically my thinking is, if the under block is water cancel completely (I want him to avoid lakes)
But also if the under block is air allow it 4 times while also checking for air
ohhh you know what i should probably
return true if any of them is solid in between that time
i think thats why hes so fucky
that could also be the issue of mine
because i check if the current isPassable
there i got confused which one is the current
Im doing 2 checks actually for the current after its detected for isCLiff
next check is if the current block has air above
i should check isPassable ngl
ahh
it allows air
well
kinda has to ig
im dum lol
I donnt like entities
oh god
nothing about entities
they always explode or shoot arrows or make weird chicken noises
this would be cracked with entity pathfinding too
like you can get entities while pathfinding
jesus that would be cracked
huh wait
but all the videos you sent used entities
no like
if (entityIsOnCurrentPath) return notValid
so u can like pathfind around entities
but
thats his thing, he just uses the pathfinder
thats a looooot of work
cause getting entities async is a no go
could cache locations but theyde need updating every x ticks for theyre locations
time to test new modifications
is there any javadocs or similar? I currently have no idea how this thing works or where its explained
mmmbruh
Its a static referance library
so you just call a method and go
but pretty much outdated
we need to rebuild those on the next release
^btw @pure holly
maybe im doing something wrong hm
this is not very helpful lmao
visualize the path
access them as html pages silly
yeah how?
all I can do is to click on the file name
Is there an easy way to do it or only on result
yeah you do that
click on any .html page
since you hardforked it, you can just do it inside the pathfinder
so every isValid == true
place block
@wanton pine
cant do it on the site
they need to setup the repo to accept it like that
its ez to do
I won't use that if I have to go through 300 extra steps D:
its rly easy to use i promise
PatheticMapper.newInstance().findPathAsync(start, finish)
findPathAsync is a CompletableFuture
thats the basic usage but you can override the path strategy
^and also the pathfinder api is about to be optimized a lot
to get rid of the static concept but keep the simplyness
kk lemme change
whats the class for uhh
PathLocation to bukkit Location
forgot its name
BukkitMapper
ah i was using PatheticMapper oop
aids code
but itl do
UH
LMFAAAAOOO
BWAHAHA
i cant
bro im dead
can this thing also find paths e.g. through a maze or similar?
yes
nice
easily through mazes
with the default one
well
it avoided cliff-lakes
lmfao
wonder why tf its plotting the points like that
weird af
i think imma do particle instead
less intrusive
hopefully its pathfinding looks like a tentacle wriggling around
xD
im not sure why its pathfinding all its points on the same y axis
its like the pathfindiner cant jump when using a custom strategy
fucking christ
what particle would like
actually be not aids to show
OH CIPHER LOL
THATS YOURS LMFAAAOOO
I WAS CHANGING CODE ON MINE AND STILL USING YOUR STRATEGY LMFAO
bahahaha
what overthinking looks like:
yeah obv. since you make sure that the block on the ground is solid
villager happy or something
just crashed my server oops
i jumped over a gap
and it spawne dlike 20 million particles lol
oh yeah
true
ill remove that check then
that wont do much probably
package index
time to test
@true compass
kk enjoy food
they are deployed, but over http for some reason idk about
i wish i had a laptop - would be coding while on holiday
i did pre order a 12th gen framework, but not here
what am i looking at lol
im trying to make isValid not make npcs run over ledges
but for some reason its fucking with things like this
i mean, surely just checking the type below current should work.
just a small thing - you might wanna use javax annotations instead. the jetbrains annotations produce "double annotations" in javadocs D:
okay tim to retest 
god is lomboksexual
those definitely work fine
lombok has no “NotNull”
laugh at the idiot
lombok has Nonnull
oh yeah because it wouldnt do anything
which i hate
mine is checking that
but the ones above current needs to be passable
seems to work fine now
but
he still walks over ledge 🤔
he did try though
so hes a good boy ig
A for effort
smh im an idiot
my for loop math is off
so value never reaches 4 i think
fucking christ
close much?
for sure
ffs
i wish debugging this didnt crash my server and client
it cant handle all the sysout calls
how are you creating the NPCs? some library or just packets and stuff?
owners even helped me impl this to theyre navigator controls
naaah
im only using citizens tho
cause it makes basic things easy
like spawning npcs in and whatnot
hmmm
interesting
i actually think citizens navigators making the npcs go off course
so conclusion: dont use citiziens navigator, use our pathfinder
lol
no like
the actual navigator
the thing that makes npc take steps
just teleport the npc
Theyre navigators are controlled by a PathfindingStrategy
problem solved

tps go brrt
it sucks mc removed the navigator from HumanEntity
shame
i likely could get rid of citizens completely without it
idk
it had the path right
for one second
then decided to follow a invalid path
i thought he was using both ahaha
both what?
im honestly convinced this is bugged somehow
like it calculated te right path one time then just completely disreguards the ruleset
i think for some reason, the pathfinder its backtracking backwards instead of trying to always go forward
Its weird to me the particle locations start going away from its desti like how they are i nthe video
maybe… weird idk
seems fine when walking directly on the path i want it too
but second i throw and left or right action he just ignored pathfinding strategy
i locked his movement to the center of blocs hes navigating to
wait wtf
why is the location for adding block adding a + sign of nodes
and not just the line
bruh he legit has the path then changes it lmfao
you know what imma do something dirty
big improvement
only issue is...
im having to revalidate locations after pathetic gets them
all those ERRRROOORRR are main thread calls...
what do those hearts even mean lol
current pathfinding location
but why is everything full of hearts
i think its some bug when a path cant be found
doesn't really look like a proper path
and it fulls out all available deeps
yeah
its not cancelling after x consecutive fails
so it just keeps looking
until it reaches deep limit
ah ok
ill prolly add in my own limits here in a bit but the main thing is just getting it working without some jank shit
i may need to get the NPC to jump when near certain locations
i think i got the actual path good now
but
he still can rarely fall off the corners
thats likely just mc thing tho
i may get the block facings and see if any nearby are air
if any are jump
because it examines all neighbours
yes but those are the final points
that are added
ikr
also
the isValid isnt respecting certain checks, certain false values do get through
running this on the Location the NPC is currently pathfinding will occasionally return a false invalid path
this is the method isValid use
essentially the same thing
it’s hard to know for sure, maybe a bug from me, maybe a bug in your strategy.
yeah will likely need more playing around when your off vaca
unless cipher wants to try 
nope
but for rn this is semi working
HAHA
i think im gonna make a method that checks if NPC falls into a pit and or is stuck in a location
and random tp it n*5 blocks away
you only do 0-256 you need to use the new upper and lower limits fyi
and pathfind again
yeah i did 256 for testing
i did value of 5 normally
max + 1
im gonna work on making a stuck finder
he never tests anything - he literally refuses to load a server normally
since the entire api is very abstract from bukkit we dont even need mockbukkit
we can just test the model like this
so, the issue is that sometimes it doesn’t find a valid path? or is it that it’s a cross shape
the issue is sometimes false isValid calls get added to the map
At least thats what seems to be happening
steps:
sir. that cannot happen.
- Async get the path with custom strategy using isValid calls on this method here
then, once paths is cached, while runing through i run the same check via this method
and its will return true on 1-2 blocks
ill get a video
can you loop through a found path and set all the locations to like blue glass. just so i can see for sure that this cross thing is happening as well
its hard to do
it fucks with the NPCs current path cause its a slid block
and it does whack shit
not to mention
just send a blockchange to the player
check this vid
fr?
one sec
almost done
lmfao
cant even walk
it just adds soooo many points
Ignore my add() call i remove the y + 1
cant reliably get to my location to pathfine 
ima try
another way
one sec, doing it on result path
hmm something is fucked up here. hard to tell why it would do that cause it only explores one node at a time and a lot of those would overlap
what bruh
i didn’t look at the code but the callback should be a line
god this is so hard to do lmfao
blocks just keep shoving me everywhere
y - 1 again hard to see
one sec
ok but it is a line
so i’m happy that I didn’t fuck up
now we just gotta fix your fuckup 
so basically the isValid check gets called for the next most optimal node. it has no order other than the one determined by the heuristic
weird, pathfinding freezes 🤔
the parent and parent of that will be the ones before it in the final path
so current is always the most optimal node
cause its the one im checking
packets?
no packets at all for entire project
I just wondered because you wrote "packets" ealier when someone suggested sending block changes
but then I saw that someone already sent the method
yeap xD
it is async so it’s likely the stacktrace is just suppressed
i think ik the issue
might be the weird chunk issue we were having idk
see how hes like halfway on/on the block
i think pathetic thinks hes on the block over the air
and my strategy doesnt like that
wouldnt make sense for a loaded one
so i think thats the issue there, i wont worry about it for now
maybe not sure
here we go
the path looks right tbh
but im not sure
maybe NPC is slightly fucking up the path when walking
but i set his destination to .5 of each block
maybe
i should make him go +1 away from any ledges
somehow
alr
?tryandsee 
OH
SHIT
@rustic socket @pure holly 😮
he doesnt like 1x1 bridges
but that can get added as a check
you know what i gotta do now?
spawn in 50
okay
its rly resource intensive
expected tho (Its not main thread hanging, its just the pathfinding result takes so long to come back the npcs dont have a navigation goal)
path they follow, ignore missing ones its just spigot trying to handle a few hundred block updates a second lol
Seems so randomly they do like to go right next to the ledge as shown by arrows, likely user error
https://paste.md-5.net/pedarubigi.java
Pathfinder class for anyone wanting to test, am off to bed
Code cleanup tmrw dont yell
oh hell yes
ty
ill merge with my fork tmrw thanks a bunch
ill PR my strategy once its decently optimized
i feel i can get it better
take your time, i might change the strategy api a bit as well
shouldnt need much changing
once im chaning the pathfinder stuff
yeah im thinking about removing those
if you want to have the previous blocks just cache them or somewhat
also we currently have internally a strategyregistry which will probably be removed to also make stuff like this possible
if you do that make the Stategy instance based pls
i would much rather
findPathAsync(start, finish, (currentBlock) -> {
});
if it was instance base i could do it like dat :((
but it takes a Class<?> of the FunctionalInterface
yeah that would be possible then
currently this gets hold back by https://github.com/olijeffers0n/PatheticAPI/blob/master/pathetic-model/src/main/java/xyz/ollieee/model/finder/StrategyRegistry.java
so sad
yee i saw that
i was gonna transform it myself but saw that and said nah im good
ill do it class way for now xD
yeah i we wanted to avoid throwaway objects
i mean it works
and probably saves some ns
but for what
in your case it probably saves a bunch of throwaway objects
yeah but prevent me from using thing slike a cache on the class, since its a global class instance and not per pathfind
hence why i felt like i was forced to use statics for some things
initialization of the strategy class shouldnt be much i think
its just the method call that matters
off to bed now
im not sleeping tmrw until this runs with 50 npcs
Pathetic State of development:
and how we fix them
accurate
same
man
not even sure how i can optimize this without transforming then entirety of pathetics impl xD
oli does pathetic mark sand as air 🤔
when its hovering like this
and these ^
i think ik the issue i think pathfinders liquid check only checks for full liquids maybe?
"Im gonna optimize tf out of this today"
ayyy
one fell because he got pushed by the other i beileve
him getting stuck at the end is my fault
even better now
you on a modern version?
wait nvm it doesn’t matter
lemme find where it does the logic
but like afaik they are just solid sand blocks
i think i got them mostly fixed
mostly
im working on redoing all my controller methods to the new one
only thing is i had to modify citizens
Wanna know something funny
pathfinder is fine
its citizens handling of moving player npcs
take the wildest guess on how they move them
yeah this is fine
so
there a mojang property in EntityPlayers called zza
Which is the velocity
so
they face the player at the location
and whoosh
lil shove
i mean, ugh, it works ig
its aids
i had to edit the code to make the path finder stop shoving until it actually reached destination
because this pathfinder is block by block
so it only needs the one shove lmao
citizens shoved on tick
so it led to the npc going cattywhoncus like yesterdays videos lol
i think imma fork citizens and strip it and then change it to use packets to move the entity
i heard that might be better
I think imma do some hacky stuff instead of using citizens
Imma try doing some tricky packet stuff, that makes it so the entity isnt really on the server
but plays to all clients
gonna try and ditch citizens
becoming a headache with the two atm xD
private static void showAll(Npc npc) {
ClientboundPlayerInfoPacket playerInfoAdd = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc);
ClientboundAddPlayerPacket playerSpawn = new ClientboundAddPlayerPacket(npc);
ClientboundRotateHeadPacket headRotation = new ClientboundRotateHeadPacket(npc, (byte) ((npc.getYHeadRot() * 256f) / 360f)); //
ClientboundPlayerInfoPacket playerInfoRemove = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER);
for (Player player : Bukkit.getOnlinePlayers()) {
ServerGamePacketListenerImpl connection = ((ServerPlayer) NMSUtils.getServerPlayer(player)).connection;
connection.send(playerInfoAdd); // Inform client this Entity exists.
connection.send(playerSpawn); // Spawn this entity on the client.
connection.send(headRotation);
connection.send(playerInfoRemove); // Remove from servers tab list
}
}
slapping this here
as tmy peronal pastebin
closes the thread
just a reminder
tmrw
cause
im like 99% sure
i can send packets async
i think?
if i can send packets async, the entire NPC lib can be async
and when the new jdk comes out with virtual threads
mm
yep
pc: explodes
more like contabos data center
so you are the reason my contabo server lags
LMAO
yes its screams 600% on its ptero container most hours of the day
rn it gets a break
no pathfinding running on it rn
so you are the reason my contabo server lags
jokes mine runs like a few things and my school coursework but other than that it’s kinda wasted lmfao
@wanton pine where would you expect the settings you can pass into the pathfinder?
model or api
or both as the current design?
or the actual value object in api and the builder in model? both in api?
Maybe when you create the Pathfinder instance
a builder for it, would expect settings there
like GSON
new GsonBuilder().setPresttyPrinting(true).build();
not exactly what i meant. i mean in what module
in the model or api module
probably api @rustic socket
it seems like something that would need to be accessed easily by everyone
- it controls the usage of the API
but in which way? builder & interface in api and ruleset impl in model? everything in api? no builder at all?
i mean there is realistically just gonna be like a boolean and a few ints or something. just chuck it all in API
^^
Builder methods prolly best way ngl, easily change settings
gonna try a new NPC lib out today, will be back with vids later
@pure holly Im really sorry to like ever consider this but
Would collisions ever, by chance be an option added into the algorithm 
not rn ofc, but in the future
collisions? can you explain
EG make pathetic take in a BoundingBox and test, or have a isValid method for the said bounding box?
Or taking a AABB
that way it can pathfind precise floating points?
ill show you an example
actually not sure if the floating point here is pathetic or not, but the NPCs destination is right on the money for the floating point
Bounding Box? The library finds a blockwise path. can you not test that yourself in the Strategy?
ahh so paths are based on whole ints basically but passed as doubles?
I could but, math 
was about to bitch i also cant pass the AABB to the isValid
but forgot cipher changed that

i mean, it’s not impossible to do, just kinda cringe. I wonder what would happen if you change the vectors to 0.5 rather than 1’s
i think im gonna try looking into calculating the AABB positions instead
and do it properly, i just am horrid at math lmfao
okay
i got another packet based NPC lib to work rly well with this actually
ignore the shakes, hes nervous its his first time
Fully async navigation, pathfinding 
WHO PINED
ME
im gonna try and make a citizens PR 
posting this here as well
Seems shifting the destination to .50 was the answer
now i just need to make isValid lock to the ground when needed
ik i posted like 30 "This is perfect videos"
but, this one is it
ill be able to do absolutely everything async this way 
that’s what i do lol
internally in pathetic iirc
weird, before the locations it was pathfinding to were all fucky
and off to the side
meh idk
nope, it gets set to the floor val
ahh ok
yep, just add a couple of vectors in PathfinderImpl
which move on corners as well
ie
new PathVector(1, 0, 1);
4
@wanton pine
nono
the corners are already added
i need them removed haha xD
basically from default to my own all pathfind diagnoly like this
ok so instead of add, i meant replace
and the corners aren’t already added btw
it’s just connected to the next one
ohh
only thing is, is detecting when the path goes zig zag
ill try and figure smthn out
I wonder if something on isValid can be done
? wadd you talking about lol
actually removing the vector wouldnt be that hard but detecting when the path curves is the tricky part
im not gonna know those vectors tho
if a path is like that for example
i could manually go through the List of vectors and do a bunch of complex cehcks on each iteration
but feels nasty
I literally have no clue what you are on about. the list of vectors is the possible directions the neighbours can be in relative to the current
so change them to the diagonals as well and it will choose them as it will be heuristically cheaper
im talking about actually making the vector remove the extra zig zag lol
its impossible (near impossible) to tell when the zig zag starts and ends
well, you would probably have to override the heuristic to just idealise a path that deviates from the straight line from start to finish the least
iirc i calculate the perpendicular distance from the optimal somewhere
here i think
it’s some cringe vector math i learnt in FM class at school
just rough to do because the first curve is an ideal path, but the zig zags is weird when the npc navigates
okay ill take a look
it shouldnt be relatively doo hard to do
just need to allow it to pathfind without adjacent blocks it all
but still in 1 block distance increments
eg
would still be in 1, 0, 1 increments for pathfinding, and be a more direct path too
btw this is why im saying all of this
ill check src, see what i can do
i imagine there some simple rule for picking the next block where it must be adjacent or within one block
oh
its something i can do in isValid
i just need to make it so if the next block;s x/z have changed relative so i know its a curve, and ignore the neighbors that are adjacent

