#Pathfinding Lag Fix | Pathfinding Lib | Smart Enemy Pathfinding
1 messages ยท Page 5 of 1
boy maybe I ought to be decompiling the release build
there's a lot of useless crap here
and not that many useful asserts
yeahhh the inlining might not be so nice
but I'll see if I get anything more out of looking at this corners stuff in release at least
after it finishes analyzing
i'm very confused about this ๐
true true
hmm in which function? I'll have to look at that in a bit
I'm about to shower while I wait for it to decomp everything
still in the non-internal one
i've created a custom structure to name things properly but that weird pointer operation is confusing
yeah it really is
unfortunate that it's there for you too
that parameter does look really odd though I'll try and look after I'm back
the integer values in my debug print I sent earlier are the results from that parameter though so it does seem to track since the IDs match up to the inputs
I wonder if it's allocating space for both refs and flags into one buffer?
it seems that is to make sure the pointer is 8-bit aligned
not sure how much we should care about that
well anyways i'm about to go to bed too. from the look of things the only difference from what we are doing is the size of the arrays ๐ค
wow the amount of inlined crap in these functions in release is insane
I thought the debug stuff was excessive but 90% of these functions is inlined memory stuff
back to debug I go
oh is it more readable in debug? all the memory stuff is really confusing in release yeah
looks like NavMeshPath::CalculateCorners is getting a different destination from the one that gets passed to CalculatePath:
CalculatePath:
[Info :PathfindingLib] FindStraightPath from float3(-19.05093f, -219.5336f, 86.91694f) to float3(-28.71834f, -212.8252f, 63.75082f):
path:
0: 562954802036800
1: 562954802036805
2: 562954802036803
3: 562954802036794
4: 562954802036838
5: 562954802036837
6: 562954802036839
7: 562954802036796
8: 562954802036783
9: 562954802036782
10: 562954802036786
11: 562954802036776
12: 562954802036773
13: 562954802036774
14: 562954802036772
15: 562954802036758
16: 562954802036757
17: 562954802036756
18: 562954802036755
19: 562954802036740
20: 281479821131788
straightPath:
0: pos = float3(-19.05093f, -219.5336f, 86.91694f), flags = Start, ref = 562954802036800
1: pos = float3(-25.335f, -219.5336f, 84.71749f), flags = 0, ref = 562954802036794
2: pos = float3(-26.91203f, -219.5336f, 84.02847f), flags = 0, ref = 562954802036837
3: pos = float3(-28.71834f, -212.8252f, 63.75082f), flags = End, ref = 281479821131788
ours:
[Info :PathfindingLib] FindStraightPath from float3(-19.05093f, -219.5336f, 86.91694f) to float3(-28.21279f, -182.1419f, 73.91283f):
path:
0: 562954802036800
1: 562954802036805
2: 562954802036803
3: 562954802036794
4: 562954802036838
5: 562954802036837
6: 562954802036839
7: 562954802036796
8: 562954802036783
9: 562954802036782
10: 562954802036786
11: 562954802036776
12: 562954802036773
13: 562954802036774
14: 562954802036772
15: 562954802036758
16: 562954802036757
17: 562954802036756
18: 562954802036755
19: 562954802036740
20: 281479821131788
straightPath:
0: pos = float3(-19.05093f, -219.5336f, 86.91694f), flags = Start, ref = 562954802036800
1: pos = float3(-25.335f, -219.5336f, 84.71749f), flags = 0, ref = 562954802036794
2: pos = float3(-26.91203f, -219.5336f, 84.02847f), flags = 0, ref = 562954802036837
3: pos = float3(-28.71834f, -216.0919f, 69.90083f), flags = 0, ref = 281479821131788
4: pos = float3(-28.21279f, -182.1419f, 73.91283f), flags = End, ref = 281479821131788
now to figure out where that new destination comes from...
maybe it's mapping the destination position onto the final polygon 
ah yes it does

I actually had the variable renamed where it does that but I forgor
quick fix
Yeah I know what's happening there, good job
lmao we don't talk about how long it took me to find this
Would've taken me about as long if it was me.
I would've just asked you to figure it out if I was the one dealing with the problem
the important parts are
NavMeshQuery::ClosestPointOnPoly(query, path->m_Polygons[pathSize - 1], &targetPositionOnNavMesh, &closestPointToDestination)
and the reassignment of m_TargetPosition
true
Mmm icic
it's a good thing NavMeshQuery is a struct or I would have to map another function address from native land
I would cry
don't say it too loud. i bet, by the end of the API project, we'll have to map at least two other native functions ๐
that actually makes a lot of sense
oh boy
yeah, I find it interesting that it's necessary here but not in the reimplementation from GitHub
I wonder if the API they exposed remaps all the locations automatically
seems likely that that would cause a lot of unnecessary overhead, so I'm glad if all this reduces that
looks like the bug is fixed though 
I also discovered that I forgot to make StraightPathFlags be byte-sized, so I was printing bogus flags from the CalculatePath call
i mean unless that implementation was really based on leaked code it probably was mostly guess work/outaded code instead of being reverse engineered from the engine
from what I remember reading when I initially found it, it was written by a Unity engineer
O.o
it's very close to the go translation that we were looking at as well, which I believe to be based on the Unity source
maybe then a recode based on what he wished was ๐คฃ
๐คท
have you just detoured the native function to check? ๐คฃ
who needs sources to do "print debugging"? ๐
wait... why did you use the smart-pathfinding branch instead of a new one from master?
Kinda funny that the person to immediately notice was the person who practically only plays vanilla so it was immediately obvious to them the bracken was freaking out
uh? was it returning valid paths to all teleports?
you mean June? I noticed it before her teehee
Uhuh
I was testing roaming on Mineshaft after adding the elevator wrapper into PathfindingLib and noticed the masked was stutter stepping constantly
it thought it could get to the main entrance while no players were inside, despite the fact that the elevator links didn't exist yet
it was generating a path to the closest position to the main entrance and then a final node at the main entrance as the last corner so the path was succeeding always
uh? doesn't FindStraightPath return if the path is partial or not? do we never check the result?
no it doesn't
not afaik anyway
that's the job of A* not the retracing
it doesn't know whether the path polygons reach the destination
not the way that it calls it from CalculatePath
NavMeshPath.status comes from FinalizedSlicedFindPath or whatever
uh i tought we were reporting infinity as the distance if the path was partial ๐ค
I've never checked the detail flags from EndFindPath, only the result, so no
the way it checks if it's partial is if the last corner is too far from the destination, which wasn't happening because the last corner was always the destination
wow then it's intresting that the pathfinding was still working correctly
I mean it wasn't working correctly in a lot of cases
but in cases where the length of the paths was more important, it tended to work okay
i.e. roaming
Version 0.1.1
- Fixed an issue that would cause partial paths passed to
NavMeshQueryUtils.FindStraightPathto result in a final corner at the destination. - Changed the new overloads of
NavMeshQueryUtils.FindStraightPathto useVector3instead offloat3, as the Unity runtime assumes the memory layout matchesVector3internally.

point two makes sense.. i was unsure when you converted all to float3, but you were so sure that i just tought you knew ๐
it made sense to me at the time 
as I was looking for the cause of this bug I saw where it does a direct memmove from the native buffer to the managed array so
why not treat ours the same
it probably doesn't matter in practice but hey, at least we're consistent now
i mean they supposedly are the same struct with different methods attached
that's true
I didn't want to risk there being any hidden behavior there but given that I can see it using Vector3 as equivalent to Vector3f it's totally fine to use that
do you know if this mod causes masks to "stutter" when moving without a target?
sometimes i notice that masks take 1 step, top, and repeat unless they have LOS with a player and are chasing them
i don't really know what would be causing it but this was my best guess
weird
i am using 0.1.1
i could check 1 more time
pathfinding stuff is all updated, it still happens
they also pathfind into corners but idk if thats what was specifically targeted in the fix
@hexed moon does downgrading to pre-0.1.0 work instead?
it does still happen on 0.0.14
then it's probably caused by something else
how about disabling the mod completely? is there any difference?
i'll try
it is still happening with pathfinding lib and pathfinding lag fix disabled
so ig its something else
Iirc isn't this just a vanilla thing they do sometimes?
Yeah no it's not a constant thing but I've definitely seen them do it in vanilla
if its just for a few sec or something thats fine
what im getting is masks doing it constantly when theyre not locked onto someone
and it's not this mod or maskfixes causing it
Is it everywhere or on/in a specific moon/interior?
not 100% sure i tested it on Rampart because it has guaranteed mask spawns
and i didnt feel like adding imperium to spawn them
Ah iirc I've seen them do it on Rampart frequently. I think they have some pathing issues on there
if its just that moon thats ok
theyre spawned by JLL spawners there anyway so i guess that would be a contributing factor
I think it's primarily where they're set to spawn and how the navmesh works, JLL spawns them but they should just be the same as a naturally spawned masked
eh i guess its something to tell to luna
Emphasis on should lol
Btw @keen ruin I'm not sure if the ragdoll fix mod actually works or not, we had a player body be in a desynced position for a client earlier and the client revived them in said desynced position with the defib from usual scrap and it caused an extra body to get left behind cus the rest of us didn't see the body there ๐ค
isnt that just to ensure the grabbable object is interactable
for all players
the desync is on defib's fault for the revive stuff
for 999 i use the host's position of the deadbody
it's not totally clear what this means, but the mod's purpose isn't to synchronize the position of the ragdoll over the network, it's simply to fix a bug that causes clients' bodies to not be interactable on other clients if they are spawned after the host's body spawned
if you mean that the client saw the body in a different position than everyone else, that doesn't surprise me at all
the body staying behind... that may be because the revive mod doesn't synchronize the disabling of the body, idk
revives are not in the base game, so almost every mod that makes players able to be revived has bugs
the only one I've found particularly reliable is the bunkbed one
the only reason I could think that it could be spawned in a way that causes pathing issues is if the flag for inside/outside is not set correctly
Ahhhhh
@surreal veldt You think this could be an easy update for UsualScrap?
Sure, Iโll give it a try.

@keen ruin Out of curiousity since I know we spoke about the issue of how the NymphBracken's animation gets messed with, is there a setting that could be changed so her animation isn't overriden?
by what?
I don't override any animations
unless they are doing something silly with transpilers
I mean didn't you look at the code before and mention why it gets messed with? I can't remember exactly what you said the issue was anymore lol
Oh right you mentioned it was cus it uses animancer I believe
oh uh
yeah I don't remember lol
I mean I remember mentioning that, but I don't remember why that was bad
probably a skill issue in how it syncs I guess
the only way I can think to fix that is to ask them to fix it
unless it's confirmed a conflict between PathfindingLagFix and that mod
Yeah and unfortunately I believe the dev doesn't plan to mod Lethal anymore anytime soon so maybe a patch for it could be made
I mean iirc it is, the walking animations only became weird when you updated to all the new stuff but it could be synchronization stuff lol since with legacy PathfindingLagFix it was fine but that implementation barely touched anything in comparison
hmm
well if it gets confirmed, I could look into whether there's anything I can do
but I would suspect it wouldn't be easy
my patches are very precise
if they are causing issues it would make me think that some transpiler's matching isn't flexible enough and I can't fix that
she normally is supposed to do a skipping animation when roaming around, but with PathfindingLagFix her animation sorta derps out and I think it tries to mimic the way the bracken roams around lol
If it happens to be transpiler related wouldn't making the NymphBracken mods a soft dependency fix it?
There'd be a lot more involved, and I really don't see how pathfinding lag fix is breaking nymph bracken animations but if you can reproduce it then ig it does
You'd have to reproduce with only pathfinding lag fix though
^
without confirmation I don't want to spend time debugging this
but yeah, soft dep might help if it is that
I also need to keep in mind you merged some things into PathfindingLib since we last talked about this so I will need to test with that off too if it repros
you mean test with only PathfindingLib and that replacement?
sure
but you can't run PathfindingLagFix without PathfindingLib if that's what you mean
I figured but I wasn't sure what you meant
Okay so it seems the animation only bugs out with natural spawns ๐ค been trying to repro it by spawning her with Imperium and she doesn't break
That would have to be transpiler related then right?
no
when was the last time you produced her bugging out by spawning naturally
use devtools to spawn her, that's as vanilla as you'll get
I can also test using SimpleCommands
Okay well I got her just t pose walking this time, this was when readding LobbyImprovements and testing spawning her with SimpleCommands
It might be LobbyImprovements causing issues
Def not reprod animation bugs with LobbyImprovements off so SimpleCommands is spawning her in the vanilla way prob
yeah and her weird movement also happens when spawning with SimpleCommands just not with Imperium progress
@keen ruin and ba ba bing repro, with PathfindingLagFix on her animations bugged out but with it off they all went back to normal
hmm okay could you link that mod again?
https://thunderstore.io/c/lethal-company/p/AntlerShed/NymphBracken/
https://thunderstore.io/c/lethal-company/p/AntlerShed/NymphBrackenSFW/
There's both versions lol
I used a combo of SimpleCommands to spawn her and Imperium to watch her path around
lol
Not sure why animancer dies from natural spawns with PathfindingLagFix though, has to be a weird transpiler thing since Imperium spawns fix it
imperium breaks it in vanilla so I wouldn't put much stock in that
I don't know why that's the case though
i think you can fix it if you jump in place
or just exit/re-enter the building
it's been a known issue for months i just dont think imperium has been updated in forever
Getting her to actually path around felt like it took much longer without PathfindingLagFix btw, I never realized how long the Bracken can just stop and stare for a while before it backs off in Vanilla lol
But yeah her animations would work fine if spawned with Imperium ((Maybe cus like you said it breaks some things)) where as a Natural Spawn with SimpleCommands would repro the animations being weird
in terms of speed im pretty sure it'd be faster in vanilla, but the speed would also be negligble
I just know I had to jump down to the floor below me in the Manor before she finally eventually backed away after getting scared lol
Cus she just kept standing there staring at me
XD
even though my back was turned
yeah that isn't surprising necessarily, since PathfindingLagFix doesn't have to slice up the work like vanilla does
I wouldn't tend to think it would matter normally though, unless it's a really really huge map
generally I would expect the behavior with PathfindingLagFix to be the same as or faster than vanilla
not that I've tested that theory scientifically
unless the map has a ton of AI nodes, though, I would generally expect both to finish in one AI interval
yeee I know, I just suspect that may be related to the reason the animation works with imperium
as long as this was tested with a non-invasive debug mod though, then I am satisfied that I will probably be able to repro
preferably LethalDevMode
you don't really need more than that imo
sorry for the delay in looking into that issue, I'm mainly focusing my time on finding work at the moment so I haven't had a good time to dig into this yet
hopefully I can remember to take a look sometime this weekend
@ashen harbor not sure if I'm doing something silly but the sfw version doesn't appear to replace the bracken model at all
It does it on certain tagged moons, I used Seichi in my testing
Yeah by default she's on forest moons
So should spawn on Vow, March, and Adamance
also Rend, Dine, Titan
cus Winter outfit
probably EnemySkinKit or EnemySkinRegistry
I didn't see anything related to the replacer in that config
why can't it be in the normal config file
this ui 
it's so big
also @ashen harbor when you said this happens while she is roaming, you mean when you're not inside and she is going to the farthest position from main entrance?
it looks like she's kinda doing a two legged gallop with her hands behind her back
Yeah that's how she should animate yeah, as well as when tracking a player but with PathfindingLagFix her anims kept getting overriden
is there something specific you do to get them to be overridden? or does it happen immediately upon spawning her?
and are you sure this wasn't caused by having imperium installed?
I was assuming you meant you reproed without it, but I'm not seeing the issue when spawning the bracken with LethalDevMode with PathfindingLagFix installed
Weird, is it only the other version that breaks?
I'll see if that's the case later, cus I wonder if the extra letters in the SFW version fix the run order
hmm I wouldn't think that would change the order, but I suppose I don't actually know
I mean when I spawn her in and she paths away she literally T Poses
Going inside then outside fixed it
Well whatever is going on her animations fix after leaving and reentering the interior
@keen ruin It's definitely something with the NSFW version, I just tested the SFW one and the bugs don't happen
So that isolates it, idk why there's only the weird interaction with that version lol
My guess is some weird thing with the run order since the GUID between both is different
I just noticed this too with the NSFW one lmao, dunno why yinigma never updated the modversion in the dll after 1.1.1 for that one since they did with the SFW one
busy day unfortunately so I didn't get to it after all 
Lol all good
@ashen harbor bad news, I switched to the nsfw one and it still looks like it works fine lol
no t pose, walking with arms behind her back
I think I need you to send a minimal profile code to reproduce this
also any extra information you can provide, like which moon, seed, etc the issue occurred on
A video of reproducing it would be nice too
I am once again wondering if somehow Biodiversity got cached and she was trying to use Aloe's anims lmfao, gonna do another test
Yeah it may have been that
She is fine for me now too
LOL
and I did just remove Biodiversity from my main pack
I just wonder if the stalking animation works properly, is there a good tool to freecam that isn't Imperium?
unity explorer
but i'd use imperium
and I doubt biodiversity will break another enemy's animations
i think nymph bracken's animation stuff is just not consistently working due to issues with its own code 
Possible
It could probably use an update at some point anyways, Animancer is now V8
I would recommend just using UnityExplorer, it doesn't change any behavior
This was happening to me a fwe months ago. I have zero clue what caused it
hi,
im thinking this doesnt originate within pathfindinglagfix, but, pathfindinglagfix is breaking because of the issue.
this is from lines 137763 in that log
Stack trace:
EnemyAI+<CurrentSearchCoroutine>d__94.MoveNext () (at <31f0351006d541aeb5ae92a12fc7161b>:IL_04A8)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
[00:28:33.8000994] [Error : Unity Log] NullReferenceException
Stack trace:
PathfindingLagFix.Utilities.AsyncRoamingPathfinding+EnemyRoamingPathfindingStatus.StartJobs (EnemyAI enemy) (at ./Utilities/AsyncRoamingPathfinding.cs:58)
PathfindingLagFix.Patches.PatchEnemyAI.StopPreviousJobAndStartNewOne (EnemyAI enemy) (at ./Patches/PatchEnemyAI.cs:37)
EnemyAI+<ChooseNextNodeInSearchRoutine>d__96.MoveNext () (at <31f0351006d541aeb5ae92a12fc7161b>:IL_0022)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
EnemyAI:StartCalculatingNextTargetNode()
<CurrentSearchCoroutine>d__94:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)```
the game is stuck going from landed on the moon -> taking off to orbit (never reaches orbit), with the error for your mod spamming constantly.
from memory (as it was 2 hours ago now), there were beehives(with bees) or a masked, on the balcony of the ship outside as we took off, forget which, but neither were present after we took off.
in the past, we have had a dog on the balcony, unable to move, but its there in orbit (happened once), but we could reach orbit, and kill it without it moving, and game continued fine, this seemed different, and today we havent seen anything in orbit on the balcony.
the profile code
0197b426-2103-8925-ae6b-5e6e71442c54
just figured at the least, you might want to stop it breaking your mod, i would look into it further, but there was a tonne of log spam just before, and i dont know if that was breaking your mod.
only happened once. ive not had it before either.
the log provides a mod list at the top (thank you gale), and i provided the profile code. ๐
I think Rats is broken right now iirc
There's a lot of questionable mods I see tbh
DoorFix for example
well rip, cause i was quite enjoying that, thought it was working.
I think ImmortalSnail also has issues
well, i installed it a long time ago, its a shame there isnt a list of "fix" mods that shouldent be used ;o
VoiceHud could be replaced with LethalFixes tbh
not seen any personally
eh?
does it? must be added after i installed both.
It's even on by default
Coroner has been quite broken for a long time now and never got fixed, the dev went MIA after pushing the update in a bit of a broken state and never came back
Idk if GhostGirlFearReset is still needed/works
OpenMonitors I recall breaking for lots of people on V70
KeepEnemyPower I also dunno if it works anymore
Terbium causes some performance problems and Bongo has no plans to update it
You have WeatherRegistry so MeteoMultiplier is redundant
well, it sounds like some of them i need to review, but i can say open monitors + keep enemy power seem to work for me.. we use keep enemy power to supress respawning of entities after we kill them, or we would be getting 5k scrap every moon just from killing things, once things are dead, they stay dead, might not work as intended though, i just know stuff isnt respawning.
I have no idea what BetterDoorWarning is but I think LethalFixes also has something for that
BetterSpectator is quite old, I might suggest replacing that with Poltergeist
already use poltergeist.
CustomDeathPenalty could be replaced with NoCompanyPenalties depending on what you're using it for
VanillaMoonsLagFix is not needed
thanks for the suggestions.
you have ReverbTriggerFix
you should really make a list of mods that are not needed, you probably repeat this to many people xD easier to point to a list, lmao
i use it for more than the company otherwise id have used that.
from what i can tell this isnt in lethal fixes (at least i didnt see it when i glanced over the readme), it changes the "enemy inside" warning to say if its alive or dead, because dead enemies register as "enemy inside" when its harmless.
only thing ive seen broken regarding coroner is it sometimes reports the wrong death, maybe the broken part is in relation to mimics? which i dont use.
hmm, worrying :/
this has been fixed in vanilla for a while
since at least v56 im pretty sure
entrance doors no longer detect dead enemies
it was fixed in lethalfixes before that, then the fix was removed because it got fixed in vanilla
The error seems to indicate that either someone destroyed an AI node (would cause errors without PathfindingLagFix), or some AI that is using the roaming routine has a null in its list of AI nodes
However, that error shouldn't cause the ship to have any trouble landing or taking off
dunno what would cause destroyed or null AI nodes, other than perhaps some enemy not being set up properly and surviving the unloading of the moon scene
[00:28:33.1565023] [Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
RoundManager.UnloadSceneObjectsEarly () (at <31f0351006d541aeb5ae92a12fc7161b>:IL_0045)
RoundManager+<DetectElevatorRunning>d__152.MoveNext () (at <31f0351006d541aeb5ae92a12fc7161b>:IL_004F)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
as I suspected
not exactly what I described, but enemies aren't being destroyed properly
the IL offset in the UnloadSceneObjectsEarly() method doesn't line up to any vanilla instructions though, so I'm assuming you have some mod that transpiles that method, alongside the mod to make transpiled methods still print IL offsets
closest line is if (array[i].thisNetworkObject.IsSpawned), so the best guess I have is that someone created an enemy that has a null thisNetworkObject for some reason (non networked enemy??)
it's probably more of null enemy in the list
the list comes from a call to FindObjectsOfType, so I wanna say that should be ruled out, barring some optimization mod
ah didnt know, thanks for letting me know
ive seen a dog in orbit, i dont know why a dog would survive to orbit last week, i have nothing modifying dogs, and as i say, the only potential culprits last night were bees/a masked reaching orbit, no reason why they should survive it (at least enough to prevent reaching orbit) suddenly either.
only enemies i added/updated in the last few weeks are
Rats - Lunxara suggested its broken so maybe thats the cause
Scopophobia - i swapped from the old version, to the new one recently released
SCP939 - havent heard anything bad about this, yet.
guess ill remove Rats and see if this never occurs again.
I'll need help implementing compatibility for the library. I want to use it to find closest enemy by path distance. So far I seem to do something wrong because it doesn't want to work.
if you'd like i migrated my pathfindinglib code onto coderebirthlib under Utils/Pathfinding
You could either copy a lot of the code there or just use it, either way works
Or wait for zaggy to go through it with ya as well if he has time to help
feel free to hit me with any questions you may have, but yeah, Xu's code is probably the best reference at the moment (since PathfindingLagFix itself uses a mostly custom solution)
I gotta see about looking at a crash in the new and improved APIs with Matty sometime too, those should be much nicer to use for your needs
if needed, we could debug things together in vc here too, just lemme know if you wanna do that and I'll see if I'm free
oh, we got a new crash report?
last time i remember we paused the api on masked riding elevators in a loop ๐ค
public static bool Execute(NavMeshAgent agent, Vector3 targetDestination, ref bool validpath, out float PathLength)
{
NaturalSelectionLib.LibraryLogger.LogMessage("PathfindingLib present. Switching to using PathfindingLib");
var pooledJob = JobPools.GetFindPathJob();
pooledJob.Job.Initialize(agent.GetPathOrigin(), targetDestination, agent);
JobHandle previousJobHandle = pooledJob.Job.ScheduleByRef();
if (pooledJob.Job.GetStatus().GetResult() != PathQueryStatus.InProgress)
{
NaturalSelectionLib.LibraryLogger.LogMessage("Calculated path.");
if (pooledJob.Job.GetStatus().GetResult() == PathQueryStatus.Success)
{
PathLength = pooledJob.Job.GetPathLength();
validpath = true;
}
NaturalSelectionLib.LibraryLogger.LogMessage("Released PathfindingLib job.");
JobPools.ReleaseFindPathJob(pooledJob);
}
else
{
NaturalSelectionLib.LibraryLogger.LogError("PathfindingLib calculations is in progress");
PathLength = -777.77f;
return false;
}
PathLength = -777.77f;
return true;
}
This is what the code I wrote looks like so far. What ends up hapenning is constant spam of inProgress logs but not once I saw the log of releasing the job.
well you are creating a new job pool and job handle every cycle.
you're supposed to create them only once and keep polling the status untill it finished, then you can reschedule it
I see
I am also looking to implement the method as an Enumerable.
The issue with that is I need to wait for it to end and output the result and doing so would either halt the rest of the method with while or the result would not be final.
the pathfinding api is an async api. so it requires you to store the main components for polling/reuse in class/static variables
als also requires you to write your implementations with that in mind. aka poll if the result is ready and if not either do nothing this cycle or return the previous valid value until the api finishes
I'll do the latter but I'll implement it as a separate a method separate from FindClosestEnemy.
I've had some crash dumps from xu for a while but I've been somewhat stumped and also demotivated on it
they appeared to be another memory corruption thing, but I did manage to get repro on my machine last I looked at it, I just wasn't able to find any obvious oob writes
I wanna have a look with you if I can still repro it, I'm sure it'll go quicker with two sets of eyes
sure we can find an evening, we're both available.
Got somewhat working version. It looks like it does something but it's not behaving how as expected. Enemies doesn't seem to want to switch enemies by distance. I get the logs of enemies receiving delegates but I get no logs whatsoever from the library itself.
Mine
if you have your code on a public repo somewhere I can have a look and see if I spot any mistakes
theres 1 mistake
theres naother mistake
3rd mistake
i can keep scrolling up and finding more mistakes if you'd like
go to sleep bozo
The library: https://github.com/Fandovec03/NaturalSelectionLib/tree/PathfindingLib
Natural selection: https://github.com/Fandovec03/LC-NaturalSelection/tree/PathfindingLib/ExperimentalEnemyInteractions
I was basically following CodeRebirthLib implementation and based it off that.
Roger, banning Zaggy immediatelly
looks like me and Matty may have solved the crash with the experimental API for this
looking at your code, it seems like it could be significantly simplified, but I'll have to take a closer look
it's honestly hard for me to track all the pieces
once we know that the experimental API is stable though, your code can likely use that and be only a few lines
surprise!
PathfindingLib Version 1.0.0
- New APIs:
SmartPathfinding: A static class with methods to register smart agents, elevators, and teleporters for the smart pathfinding system.IElevator: An interface that can be implemented to allow enemies to navigate through them if they useSmartPathTask.SmartPathTask: A class to calculate paths to multiple destinations either directly or through entrance teleports and elevators.SmartRoaming: A static class that reimplements the vanilla AI search routine usingSmartPathTaskto allow enemies that choose to use it to roam through elevators.
- Wiki pages will be added to the GitHub for usage instructions later!
@wanton salmon if you wanted to, I could go over the new API in voice while I figure out what to write into the wiki tutorials
Peak update Zaggy, glad to see you finally got the issues fixed and got it out
me too! really the thanks go to matty again for pointing out that the crash we were stuck on could be a use-after-free instead of an out-of-bounds write
currently this feature doesn't do anything until mods use it, and all the existing functionality used by PathfindingLagFix and others should be totally unaffected
I'm gonna have to do some testing for my masked patch mod that makes use of SmartPathTask to determine if I'm happy enough with it to release it
oh hey Jacob, I was about to ping you lol
is this related to my shrimp problem out of curiosity?
(not that I'vetouched him in ages but still)
Lmao I may or may not have dmed him about it XD
if it was a crash when the shrimp was trying to use SmartPathTask, then I believe so actually
oo
i don't quite recall rn but i think it may have
i may have to revisit the little guy again
I shall add this to my elevator immediately 

Readin through API 
I can send you my wip dll for the masked pathing so you can try it
Oh can they not path into it at the moment?
yeah not without an additional (unreleased) mod
the purpose of PathfindingLib is solely to implement the functionality, other mods have to make use of it
Ah fair, yeah
so installing PathfindingLib alone will change no behavior in the game at all
DMed you the masked mod so you can try it
I am up for it but currently I have to figure out first if my current method of calculating and finding closest enemies by path length actually works or not.
oh, have you not tested it with a synchronous path yet?
or do you mean the new method through PathfindingLib? if it worked with a synchronous path it will definitely work with an asynchronous one
I tested both with PathfindingLib and using vanilla agents but it doesn't behave as I expected. For some reason it doesn't want to switch to closer enemies
Seems to work now.
There was an error unrelated to the pathfinding calculation that caused to share single data containers and broke enemy behaviors.
Ooh so Natural Selection update soon?
Only EEI is affected. I used NetworkBehaviorID instead of NetworkObjectID for getting the data containers
Ah so EEI is gonna be updated then
yeah. I only found it because sandworms broke if more than one existed
I look forward to you making use of PathfindingLib anyways
Vanilla method seems to work as expected but the PathfindingLib returns default distance values.
I haven't switched to API yet so ig I could look into that
๐ it's out 
i have a feeling the fix for the weird masked behavior has to be made in the SmartPathfinding itself :/
definitely yeah
smartRoaming*
I was testing masked pathing yesterday to see if that feels like a big problem still, and I figured out that the global roaming wasn't working quite right because of the search width on the masked
I gotta do a bit more testing to see if changing that helps
problem is that making it so that the elevator can't be used soon after riding it will make it so that some ai nodes will be removed from the search
at least I believe so
๐ค .
Pushed out a little fix for an issue that Fandovec encountered with allowing SmartPathTask to be garbage collected
I wanna say it shouldn't affect anything that's currently out there though
@wanton salmon I'm hoping this will fix the lag when having EEI present, I didn't enable the experimental features earlier and we kept getting mad hitches
I had to pull it
hello! should i use beta or full version? a while back it was reccommended for me to use the beta version, but rn it seems full version was updated last so im not sure anymore 
the stable version is the most up-to-date, yeah
I guess I forgot to deprecate the beta, whoops
actually, I guess the beta and the stable are the same at the moment, just updated at different times
but stable will be where bug fixes/minor features will go, beta is only updated when I need to test big changes
oki!! ty zagsterrr
zaggy did you ever post your masked mod implementing the new elevator stuff?
if you mean the elevator itself. that's in PathfindingLib
if you mean an enemy using the elevator then the masked mod is still unreleased as there are still a couple of things to iron out
yeah, I want to test it a bit more
I'm probably not gonna be working on stuff for the next week or so, though
I'll be away from my PC tuesday through saturday
@keen ruin
Zeranos?
Yeah
It errored when I stopped the Elevator instead of letting it stop on it's own lol for some reason
this only occurs when the elevator is told to stop right? not when it actually stops?
its probably some thing from the regeneration process
pathfindinglib would make me assume it doesn't take kindly to the navmesh being deleted and regenerated
Yeah probably, if you start the elevator and let it stop naturally I've never seen the error happen but it occured the second I pressed the button to stop it
๐ why would you need to delete and regenerate the mesh??
I think because it needs to delete the previous generated interior everytime you go down
from a quick look at the code i belive it's having troubles because the entrance teleports ( main/ fire escapes ) do not have an exit
Fire Exits shouldn't generate tbh, when they do generate you just walk out and drop below the map
do not recommend exiting via fire exits
XD
main has to exist tho
and main is also an entrance teleport
Ye
so i guess this moon deletes and regenerates the interior every time the elevator is used?
Yeah everytime you descend
so the interior main door gets deleted
It restores the gameplay of V4 essentially
and the external main remains hanging
Wonder if there's an easy solution Kite can do to prevent the Pathfindinglib errors
keep internal main in place? tho i guess any entity pathing into main while there is no interior would be quite broken anyways
anyways Zaggy we should add code to handle runtime entrance teleport modification. there are already a lot of mods that re-link fires at runtime sadly ๐ฉ
are there?
oh boy
Zeranos at least doesn't have usable entrance teleports, I don't know which mods would be modifying them during a round
Possibly mapimprovements or entrance blocker, though idk exactly what time they modify entrances at
@green gust @swift token
PathfindingLib Version 2.0.0
- Added the
IElevator.IsInsideElevator(Vector3)to determine if a point is inside the physical bounds of the elevator, which is required to be implemented for all registered elevators. - Added the
SmartPathDestination.CanActivateDestination(Vector3)method which determines whether an agent at that position can activate/use the destination. This is intended to prevent agents from pressing the button to send an elevator to a floor without being inside first, preventing AI from getting stuck repeatedly hitting elevator buttons. - Allowed users of the
SmartRoamingAPI to customize the distance that an agent is allowed to spend navigating to a node.
we version 2 already 
solely because of the first bullet point
I'm being a good boy and holding myself to semantic versioning
Semantic schemantic
I'll just never update crlib to v1.0.0 and that totally means I can fuck shit up all I like
i think (hopefully) office should already implement this and shouldn't throw errors but please lmk if it does
gotta get v3 ready for next week then ๐
who knows
https://www.twitch.tv/lunxara/clip/SaltyJazzyHerdKippa-vx9pHnTxnlzrrz-E Was this a funny from PathfindingLib or just a funny ofmesh link scenario?
lol
is that with snatchinbracken or whatever?
No ๐
erm
well nothing I do should make the bracken able to grab you and move you if that's what the unexpected part is 
PathfindingLib Version 2.1.0
- Fixed a crash on Bozoros caused by moving NavMeshLinks.
Changelog looks small but there were a fair number of changes to the native hooks I'm using, so if you encounter a crash, please grab the crash logs/dumps and profile code so I can have a look
Happy yall were able to find the issue 
i see more ghidra was needed ๐
a lot more lmao
I mistakenly pushed out a debug build last night, 2.1.1 is going out now to reduce the log spam ๐
you'll have so much data in the next bug reports ๐คฃ
PathfindingLib Version 2.1.2
- Fixed a crash with off-mesh links that are missing one or both endpoint transforms. This was causing a crash upon landing on Black Mesa.
Pathfinding Lag Fix | Pathfinding Lib | Smart Enemy Pathfinding
also,
PathfindingLib Version 2.2.0
- Added patches to prevent auto-updating OffMeshLinks and NavMeshLinks from causing stutter stepping when they move.
- Made waiting for/in elevators not count towards the time spent walking towards a node in the smart search routine.
Please let me know if you encounter crashes, these new patches may cause issues with links, but they can be toggled off in the config if that happens
I'll crash out if it crashes too
thank you so much i was about to pull my hair out if i couldnt figure out what caused the stutter stepping ๐ญ
er, I would doubt this affects the case you had mentioned
unless you suspect that there are links nearby to wherever the enemies were stutter stepping
it's a common symptom
Will it work for synthesis elevator?
(once it's powered ofc)
Me when CR meteor shower smh
well it worked for a moon and back to the same insane stutter stepping
it seems all ai/enemies and the player all dont register until a second or a few frames later
im just gonna have to remake my entire pack from scratch and bring over configs after i try mods one by one
????
Kite has to implement support for the API for it to work there, and I don't have a clue how that would work on their elevator setup
I wouldn't figure it would make a whole lot of sense to allow masked to use those elevators, since the only place they could go is to the surface
Fr fr
Fym ????
It stutters every time the meteor falls
Fair
So im not the only one having that same issue!!

doesnt for me
get good
yeah so why randomly bringing this up in a different thread, stoopid
I'm bringing this up here because of
it's stutter stepping, not stuttering lol
would the new mod fix masked using the main entrance on art gallery
in what way is it broken
they just cant use it lol
that might be cuz wesley has it too far from any walkable surface for enemies, so it wouldnt fix it in that instance
they could use fire exits with zaggy's thing though
iirc
they need to pathfind there, meaning there'd need to be nodes at the other end that they pick up
so i doubt it too
if global roaming yeah
They ain't real EntranceTeleports so they shouldn't be trying to interact with them at all 
To them it's just a decorative door
also I eep hopefully nothing explodes
I saw a nutcracker struggling to walk near a pillar of pool tile mansion interior. Maybe this update fix that?
seems doubtful, vanilla content doesn't have any moving links I know of except for the elevator and ship
ship doesnt have any moving link afaik
idk if elevator does
lol
i just spawned my enemy to test smthn, thats fun
when it's landing it should no? although they perhaps don't need to be marked as auto updating since they're attached to a moving surface
It could be smthn on my end, this is the dev version of crlib I was testing with
Nah the links are on the ground remember?
No moving surfaces because zeekerssโข probably didn't know he could do that
Well, he did it with elevator and truck, but not ship
ohh jeez yeah
I guess that's true
wait the truck though
that probably is so bad for enemy pathing in vanilla
Truck would be reasonably to having a moving link
I ought to compare, that would be interesting
based on my testing I think it would be good if zeekerss made those non auto updating, but they probably have that flag set currently
Don't they need to be auto updating or nah
if they're attaching to a moving surface rather than moving across the navmesh, it kiiiinda updates without that flag
I think that it doesn't quite get the endpoint positions right though
so it's better to have them auto update with my patch than not
Icic
Ig not something I'll have to worry about since I just depend on pathfindinglib
Don't find a reason to make it a soft dependency even if I technically can anytime soon
wait can you? I would have figured your enemies would need a fair amount of work to make them directly use unity pathfinding
As in to crlib I mean lol
ah
Since its just part of crlib now
Error might also be the result of it being in the test room
I was getting food so ill test it more when I'm back
whatever the cause, I don't think it makes sense for that method to ever give you a meaningless error like that so I'll take a look
oh this indicates you instantiated the task but didn't start it
I should definitely handle that though, that's a silly little oversight
icic
do you think it makes sense to throw an exception in this case? I'm not sure if I should do that or just return false 
I do return false for IsResultReady in that case, so I suppose in that way it would be consistent, but maybe less obvious
wait im a lil confused
then again, jobData can also be null if you pass in an empty list
see my last message 
oh lol
it just occurred to me
I think I'm not totally consistent in what I do for 0 paths unfortunately
if you had to decide whether exception or return false for this type of thing i'd probably prefer an exception
cuz otherwise my code would be stuck here forever and i'd have no clue about it lol
technically it seems like based on my index checks, IsResultReady should throw an exception for this since there is no index that would exist if there are zero paths
right
thas tru
I will do that
it makes sense with regard to the indices as well
ye
PathfindingLib Version 2.2.1
- Made
SmartPathTask.StartPathTask()throw an exception if it is called with zero destinations. All path results will also throw exceptions if the task has not been started. This should help to avoid situations whereIsResultReady()could always return false, blocking further navigation logic from ever running.
Anyone that makes use of SmartPathTask, please verify that this change won't affect your code that relies on either overload of StartPathTask() that takes in multiple destinations. If you have the possibility of starting a task with zero destinations, make sure that can no longer occur.
Do you know what could cause to the kidnapper fox not being able to attack the player on modded moons? It has a log with beggin attack but it stay still.
no clue
it's not in the game anymore so I haven't looked at the code at all really
if it only occurs with PathfindingLagFix installed, then it could be related to my player targeting patch, but that's about it
I going to test it
I tested this mod with LC office
And the masked didn't use the elevator or ignored it.
But I think it's due to me using imperium to test it actually. (Not sure it's imperium, the interior or the mod itself-)
But I'll check if the fire exit tweak works for the masked.
I spawned it in and spawned it on the lower level of the office interior so I'm gonna try it on natural spawning
were you outside?
no I entered the free cam mode and spawned it in
and it did chase after me. But once I left the area it entered roaming mode
never leaving
didn't produce errors also
ah, well, it doesn't immediately use the elevator even if it's near it
it has to choose a node on another floor to use it
if you go outside, it should immediately bee-line it for the main exit
that will make it use the elevator
Ah okay I'll try that again
if you wanna see it roaming through the elevator, you'll probably want to increase the simulation rate
I think Imperium has a control for that, but I use UnityExplorer so I'm not sure where it is
yea I think it might not have it or just the masked refuse to go up the LC office elevator I'm not sure-
or just the mod isn't working for me
hmm, which version of PathfindingLib are you running?
I discovered I made an oversight in 2.2.1 that would cause the masked not to roam properly, but I assume you would have noticed if the masked was walking to one place and standing still
PathfindingLib Version 2.2.2
- Fixed an exception that would occur when
SmartRoamingis sending an enemy to a search node. - Added
SmartPathTask.IsStartedto determine whetherStartPathTask()has been called. - Ensured that
SmartRoamingwill not throw an exception if it runs out of nodes to search.
I'm on a streak yippeee
oh I just legit manually imported 2.2.1 TwT
cause I thoguth it would fix it-
ah lol
nah 2.2.0 would've worked
should be good now on my side, I just got done testing it on 4x for a minute
Jacob still needs to fix the top link though, since the masked will just get stuck going up and down and up and down repeatedly if it tries to exit on the top floor in the current LC_Office release
I might see if I can try to detect that failure, print an error to the console and then disable the floor, but that's a fair amount of work
just curious...
- how do you patch the masked? did you just prefix cancel and replace with new logic? or did you decide to go with a transpiler after all?
- how do you detect when players are outside? wondering mainly if your patch would exhibit the issue from vanilla where masked go inside and outside every 3s if players lock themselves in the ship
it's a transpiler
i would peek at the code but im away from my computer right this second
ok i see
that probably also answers my second question?
it looks like this:
// if (Time.realtimeSinceStartup - timeAtLastUsingEntrance > 3) {
// - [...]
// + if (!CheckIfPlayersAreTargetable(this))
// + return;
// }
// if (!searchForPlayers.inProgress)
// StartSearch(base.transform.position, searchForPlayers);
// - StartSearch([...])
// + PatchMaskedPlayerEnemy.StartSearch(this, [...])
// - SetMovingTowardsTargetPlayer(player)
// + PatchMaskedPlayerEnemy.PathToPlayer(this, player)
where CheckIfPlayersAreTargetable:
- If no player is in the masked's area (inside/outside, not paths):
- Stops roaming, send the masked to the main entrance
- Else:
- Lets the mask roam
vanilla code does not check "if the player is outside" it only checks "if there is a player where the masked is". from what i remember neither PathfindingLagFix nor the Masked mod patch that logic
yeah
i need to double check where the problem was in vanilla, i forget what function is called
it's within that first if statement in my patch comments
it's not a problem the logic is working as intended
i think the function that checks if players are targetable returns false if:
- the masked is outside
- all outside players are "unreachable" by pathing (usually means closed inside ship)
if theres also nobody to target inside it gets stuck in a loop constantly entering and exiting the building
idk if that is desirable but in maskfixes i opted to make them default to outdoors roaming when no targetable players exist on "either side"
GetClosestPlayer() doesn't check paths, but maybe further down that block does? I didn't think so though
OH I have masked fixes
So-
I think it might be that actually I'm unsure
if you have mask fixes disable my roaming patch
very possible that would prevent my patches yeah
i prefix cancel state 0 and completely rewrote it
Ah k
I'll test it when I get free as RN I'm watching my neice and nephew atm
mine works ok for vanilla but you should def use zaggy's patch if you wanted modded elevator support or fire exit support
but basically what my mod does by default is
- if players not in area, go to other area
- if players in area, roam
very simple and easy
Ye that makes sense and easy to understand why they would conflict with each other
it matches vanilla behavior but uses smart pathing so that it can always (if the interior is set up correctly) find its way
you could ( just for shit and gigles ) turn on global roaming is no player is targetable at all ๐คฃ
oh like toggle it on only if players aren't in the masked's area?
lol that would probably be "the most fair" option
interesting thought, although I would have to reset the search routine then
currently they have clairvoyance as to player's general zone which is a bit silly
yeah
sounds like a bit of a headache though
global roaming is the "realistic" option
but it also means that the masked may take quite a bit longer to find players, so idk
people can try it out
global roaming looked really good in testing imo. it def is not vanilla so makes sense why it's default off
yee
since SmartEnemyPathfinding is meant to be act as a dependency for content mods that rely on the elevator APIs
are these stutter stepping happening on generic's moons?
hello! it happens on every moon, not the surface itself but only in the dungeons and including the ship, but not until the ship has landed somewhere first
both player and enemies are affected
but i DO have genericโs moons as well, are they currently broken?
I don't think generic's moons are the problem. They used to have an issue but I believe it was fixed
both player and enemies are affected
then this wouldn't even be pathfinding-relatedif looking around feels responsive, while movement feels stuttery, that sounds like you might need to turn off vsync
really? i have it off too, but i can double check! im pretty advanced when it comes to this stuff and i put an insane effort into my current pack with configs and all sorts but the problem happened originally when updating a couple mods but they were unrelated and i hadnโt messed with any settings either prior but ill check in a moment otherwise ill remake the whole thing and let you know if it works again
both players and enemies are affected
am i understanding wrong or both enemies and other players stutter on your client?
in either multiplayer or singleplayer, both the host or players and enemies seem to jitter around while moving forward, but can look around as normal, and sometimes in multiplayer and im not sure if it's due to the randommoonfx mod but the host of the lobby can not scan anymore nor can they interact with the ship's lever
also, vsync is off ๐ค
but it's so damn weird! just now i remade the pack i was having issues with, ran it twice to make sure configs load, and brought over my configs and now everything is normal again...what the hell
this happened a while ago too where for some reason the host's ship doors wouldnt open when landing on a moon, but other players can exit as normal onto the surface and even enter the dungeon
but if it works for now i guess nothing else might be needed. i was really confused
if you see players stuttering but it's fine on their end then that's a connection issue tbh
i see... i really do wonder what caused this strange issue where it vanished after remaking my pack again, i made sure every little thing was compatible as well
for the friends that mentioned the stutter/jitter besides myself, we all have high-end pcs and great connection too so i wonder if something possibly just broke when updating and it didnt save a config or some kind of value
i do appreciate your guys' help though, it does help me to understand a lot so when someone might need help too, i could try and assist!
this one is normal?
that does sound like something that I thought DiFFoZ had mentioned at one point which he described as an issue with how Unity handles frame delta times with vsync on, so if it's off that definitely seems very strange
you're sure it's not force-enabled in something like nvidia control panel?
the way you describe it, it sounds like you as the local player are experiencing this jittery movement, correct me if I'm wrong
I've experienced that type of thing at kinda random times over the course of a lot of different testing, so not sure what causes it if it's not the vsync thing
wha?
that has nothing to do with pathfinding, it's likely just the nutcracker look direction being desynced
that's not uncommon
Yeah enemy rotation and stuff desyncs are pretty common
I've seen the masked just have insanely different positions between host and client before
for the nutcracker it's got a separate rotation for the head/gun as well
yeah! i made sure everything was configured properly, even more so since i just rebuilt my pc and i know things might change to default but it seems like remaking the pack just completely fixed it so maybe something was left behind from the last pack
sounda like about my experience with that bug too lol
this still happens even without the pathfindinglagfix
Hi! I've seemed to narrow down an issue I've been having with https://discord.com/channels/1168655651455639582/1355711298796523823
It seems like the Soul Devourer and PathfindingLagFix don't like each other very much after the most recent updates to PLF. With just the bare minimum installed for PLF and the Soul Devourer, the enemy will just make a straight walk to the side of the ship and stay there unless provoked.
Not sure which mod needed to do the fixing, but wanted to report it here as well. ๐
I'll try to take a look into that today or monday
I would suspect that if it's a regression in PathfindingLagFix, it'll need a fix on my side
what is the intended behavior?
I'm not familiar with this enemy
Sort of a mix between a forest keeper and thumper. It seems to be just the wandering phase that's bugged, chases just fine when it spots a player.
Can enter and exit the facility like a masked too if you have the config set for it.
okay, that's curious
roaming has worked fine in my testing, I wonder what's being done differently there
I assume there wasn't a fire exit on the ship for it to path to in your reduced test case?
would you say its the right side of the ship?
Standing inside facing the door, yes. (So the side without the magnet)
If need be I can drop my profile code in here in the morning.
Might be something less simple than I expected.
it could very well be pathing to 0, 0, 0, especially if an exception occurred in the roaming code
Profile Code with the issue: 0198dcc6-1b75-9458-4a9a-4e070cc4d9e7
Maybe the masked can't go to the second floor?
[Error : Unity Log] InvalidOperationException: An RPC called on a NetworkObject that is not in the spawned objects list. Please make sure the NetworkObject is spawned before calling RPCs.
Stack trace:
Unity.Netcode.RpcMessageHelpers.Handle (Unity.Netcode.NetworkContext& context, Unity.Netcode.RpcMetadata& metadata, Unity.Netcode.FastBufferReader& payload, Unity.Netcode.__RpcParams& rpcParams) (at <895801699cfc4b4ab52267f31e2a4998>:IL_0026)
Unity.Netcode.ServerRpcMessage.Handle (Unity.Netcode.NetworkContext& context) (at <895801699cfc4b4ab52267f31e2a4998>:IL_0037)
Unity.Netcode.NetworkBehaviour.__endSendServerRpc (Unity.Netcode.FastBufferWriter& bufferWriter, System.UInt32 rpcMethodId, Unity.Netcode.ServerRpcParams serverRpcParams, Unity.Netcode.RpcDelivery rpcDelivery) (at <895801699cfc4b4ab52267f31e2a4998>:IL_00FE)
LCOffice.Components.ElevatorSystem.ElevatorTriggerServerRpc (System.Int32 floor) (at <4a5c653978914626baaa6f3fdbf411d3>:IL_007F)
LCOffice.Components.ElevatorSystem.GoToFloor (PathfindingLib.API.SmartPathfinding.ElevatorFloor floor) (at <4a5c653978914626baaa6f3fdbf411d3>:IL_001C)
PathfindingLib.API.SmartPathfinding.ElevatorFloor.CallElevator () (at E:/Development/Lethal Company/Projects/PathfindingLib/PathfindingLib/API/SmartPathfinding/ElevatorFloor.cs:13)
SmartEnemyPathfinding.Patches.PatchMaskedPlayerEnemy.GoToSmartPathDestination (MaskedPlayerEnemy masked, PathfindingLib.API.SmartPathfinding.SmartPathDestination& destination) (at E:/Development/Lethal Company/Projects/SmartEnemyPathfinding/SmartEnemyPathfinding/Patches/PatchMaskedPlayerEnemy.cs:87)
SmartEnemyPathfinding.Patches.PatchMaskedPlayerEnemy.RoamToSmartPathDestination (EnemyAI maskedAI, PathfindingLib.API.SmartPathfinding.SmartPathDestination& destination) (at E:/Development/Lethal Company/Projects/SmartEnemyPathfinding/SmartEnemyPathfinding/Patches/PatchMaskedPlayerEnemy.cs:103)
PathfindingLib.API.SmartPathfinding.SmartRoaming+<>c__DisplayClass9_0.<CurrentSmartSearchCoroutine>g__GoToCurrentDestination|1 (PathfindingLib.API.SmartPathfinding.SmartRoaming+<>c__DisplayClass9_1& ) (at E:/Development/Lethal Company/Projects/PathfindingLib/PathfindingLib/API/SmartPathfinding/SmartRoaming.cs:132)
PathfindingLib.API.SmartPathfinding.SmartRoaming+<CurrentSmartSearchCoroutine>d__9.MoveNext () (at E:/Development/Lethal Company/Projects/PathfindingLib/PathfindingLib/API/SmartPathfinding/SmartRoaming.cs:194)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
I used the Imperium to test that and spawned a masked on the first floor while my character was outside, and the masked managed to go to the second floor and get out. Then, I enter through the fire exit and the masked goes back to the main entrance and starts going to the first floor, third floor, first floor...
this is so strange, that exception should happen every time if it can ever happen
it's not related to the PathfindingLib side though
yeah, this is a known issue that I reported to Jacob, unfortunately there's not a lot I can do on my side
Ah so is it a problem with LC office?
yeah, for some reason the navmesh on the top floor doesn't reach close enough to the elevator for the link to connect
With global roaming enabled, if a masked sees me using a fire exit, will he chase me?
I do feel something deeper is wrong with this profile though, as SmartEnemyPathfinding is installed too, and I've yet to have masked properly use the Office elevator by themselves.
Might be one of those instances where a new profile with fresh installs of mods might fix things.
he should be able to if he's following close enough, but he may lose track of you if you're too far ahead
I thought it was my modpack, but it seems the masked will never chase me down the fire exit
hmm, I'll have to give it a test, it's currently a lot less tested than the default mode
@agile plover I think I found the issue, but it'll take me a bit to make a correct fix since Unity doesn't expose good enough API for something I want to incorporate into the path calculations
probably can have the fix out tomorrow
possibly longer depending on how much I have to reverse engineer here
No worries! Thanks for looking into the issue. 
oh baby a triple
PathfindingLib Version 2.3.0
- Changed
AgentExtensions.GetPathOrigin()to get the path origin forNavMeshAgents more accurately. This will avoid issues with pathfinding on agents with a non-zerobaseOffset, such as the Soul Devourer enemy. - Added the
AgentExtensions.GetQueryFilter()method to retrieve an agent's type ID, area mask, and cost overrides in one call. Previously, the cost overrides were largely unusable due to requiring 32 individual calls toNavMeshAgent.GetAreaCost().
SmartEnemyPathfinding Version 0.0.2
- Allowed the masked to continue following the player after losing line of sight. This will allow masked to follow players through entrance teleports correctly.
PathfindingLagFix Version 2.2.4 (now requires PathfindingLib 2.3.0)
- Use PathfindingLib's
AgentExtensions.GetQueryFilter()to get cost overrides and produce paths that matchNavMeshAgent.CalculatePath()more closely.
@agile plover @vivid dock both your reported issues should be fixed now 
Thanks again for the bugfix!
Would it be possible to add a debug/config in SmartEnemyPathfinding to set the Masked vision/aggro radius to 0? Not sure if another mod already covers this (besides setting yourself as non-target in Imperium), or if values like this can even be modified?
this isnt a proactive issue with the mod afaik, its just something funny that happened to me
for some reason, my gale client had the updates earlier than it should have
the updates happened
and then like 8 seconds later gale had a complete stroke and i had to uninstall the mods because gale couldnt find the updates existed on my end anymore
like they literally just disappeared from the client
this was like an hour ago btw
that's not something that it currently has a hook for, so it would take some work that I'm not really inclined to think is worth it vs using imperium, is there a reason you don't want to use that instead?
usually I just stick myself in a corner somewhere and then use UnityExplorer to free cam and watch the masked lol
oh weird, not sure why they'd appear early, but I wonder if it didn't like that PathfindingLagFix had a dependency on the version of PathfindingLib that had just been released
no big deal, i just have to waste like a minute and a half of my life reorganizing their placements in my mod pack list lol
Was hoping to try out some games in multiplayer with a couple friends with a setting like that and Imperium is pretty bulky for just casual play
Thank you for clarifying though! I wasnโt sure if that kind of value was even exposed or easy to modify. Appreciate the quick response
it definitely wouldn't be super difficult to patch, but I think it might require patching in multiple places
I would just consider it out of scope since I would assume you mean for them to be no danger (unless they walk into you by accident I suppose?)
Might be a better suggestion for Lethal Intelligence then. If the Masked didn't even react to players, they might be convincing enough for people to run into or, like you say, walk into by accident. Sorry for the bother!
ahh I see, that's what you mean
yeah, you would probably need to have other mods to make them convincing enough visually for that to work, I would think
so it does kinda make sense to me for it to be part of another mod
unsure how those interact with SmartEnemyPathfinding at the moment, though, I would imagine some of them cancel the vanilla code that I patch
does smart enemy pathfinding work with mirage
?
it should
mirage doesnt change mask ai
And neither do the dependencies??
not sure what the defaults are for it, but MaskFixes could override SmartEnemyPathfinding, I believe
:0
what parts of these would be good to turn off for smartpathfinding
sounds like the 2nd option would be the most probably to override
yep 2nd option needs to be off
I'm hoping that Buttery can make it auto-disable if SmartEnemyPathfinding is detected at some point
assuming that SmartEnemyPathfinding covers everything that patch exists to fix, which I believe it does
it is kind of a weird spot because the config setting exists to let you decide which you want
like, if you use another mod for masked, the idea is you recognize that and turn it off
i could make it default to false if you have smartenemypathfinding installed first, and maybe make it print a warning in console or something
if you have it on still
in the event somebody has smartenemypathfinding but disables the masked setting, then if i force disable mine, masked wont work right
etc
the two reasons i patch the roaming state are:
- making masked default to outdoor roaming if it can't find any targetable players inside or outside (fixes them using entrance teleport every 3s if you lock yourself inside the ship, as a bonus it highlights their ship hiding behavior a bit better)
- better logic for handling the mineshaft elevator (smartenemypathfinding definitely covers this)
i can take a peek and see if smartenemypathfinding covers the first case
maybe i could try to get maskfixes to read your SEF config and adapt to that
that might be the best automatic solution
I'm still a little confused about where it checks paths to the ship, I don't see any calls in the entrance teleport code that check paths or whether the ship doors are shut
GetClosestPlayer() just checks the area, not paths, nor door unless you explicitly tell it to
I mirror that in the replacement logic in my patch, so it shouldn't have issue #1 there
right sorry, i said i would do that
GetClosestPlayer calls PlayerIsTargetable which includes this excerpt in the boolean return:
&& (!this.isOutside || !StartOfRound.Instance.hangarDoorsClosed || playerScript.isInHangarShipRoom == this.isInsidePlayerShip)
also, currently (and probably for the forseeable future), SmartEnemyPathfinding doesn't have a toggle for the masked patch, but I am totally fine with the default being off with a warning when on if my patches are present
so if the mask is outside, the ship doors are closed, and the player is on the other side of the ship doors from the masked enemy, the entire function returns false
ahhh
and if the function returns targetable==false, the mask will ignore that player when checking where it shoudl be
I see, I made the mistake of thinking cannotBeInShip related to that but I didn't check
yes
i made the exact same mistake until trying it out in game and realizing there was an issue
so i dont blame you
Lol
i might've just misread your mod description
i thought it mentioned your mask fix was toggleable
maybe you're thinking of the global roaming toggle?
if it's not toggleable, and you dont intend to make it toggleable, im totally good to add an auto-killswitch
yeah I don't have any plans to, since I also don't currently have any plans to add patches for any other enemies
Jacob mentioned he might be interested in patching more vanilla enemies but the masked was the only one in vanilla that could use entrance teleports/elevators
๐ซก sounds good
I'll look into the ship door thing
it might be worth implementing for the jester and maneater, since they're super easy to trap at the top of the elevator
shrug
i do like that elevator usage is mostly a "special case" for certain enemies though, it would be a bit silly if everybody could use the elevator
i think it's a cool "oh shit" moment when you realize masked are smart enough to use the elevator!
yeah the trapping enemies thing feels all right to me since it cuts off main, but I definitely can see another mod adding that feature
yeah
starlancerenemyescape might also be a good candidate, since it lets enemies exit the building
it might want to look into comprehensively patching the vanilla enemy set to improve the effect on mineshaft maps
yeah, I think that at this point it would probably be good if that was rewritten or replaced with a mod that fully utilizes PathfindingLib
that way, enemies can path in/out of the interior based on actual objectives instead of just randomly rolling to do it
it's always been a little silly to me how that works, but there wasn't really an alternative till now
that's true yeah
I guess one other barrier is that that requires a lot of transpiler work to be done "properly" imo
and if global roaming is supported (or will be supported soon) that could probably replicate some of the randomness
oh, global roaming is provided through PathfindingLib, so anyone can use it if they want to
really what "global roaming" means is just setting link flags to include fire exits and main entrance in a roaming algorithm that uses the smart pathfinding API
PathfindingLib has a replication of the vanilla roaming code that uses it, so you can just call that
i think i realize what my confusion was
i think your config setting just lets masked use fire exit and wander inside/outside using entrances as pseudo-links
right?
but the fixed elevator behavior, etc. is non-optional
yep
ok i understand now
i just misunderstood what the setting was for
yours should definitely have priority
it also has to swap a few parameters for the search to make it so it can find paths to outside nodes
like the search area
@crimson jolt this should do right?
private static bool AllPlayersAreShutInShip()
{
if (!StartOfRound.Instance.hangarDoorsClosed)
return false;
foreach (var player in StartOfRound.Instance.allPlayerScripts)
{
if (!player.isPlayerControlled)
continue;
if (player.isPlayerDead)
continue;
if (player.inAnimationWithEnemy)
continue;
if (!player.isInHangarShipRoom)
return false;
}
return true;
}
private static bool CheckIfPlayersAreTargetable(MaskedPlayerEnemy masked)
{
if (Plugin.GlobalRoaming.Value)
return true;
if (masked.GetClosestPlayer() == null)
{
if (masked.isOutside && AllPlayersAreShutInShip())
return true;
var result = GoToDestination(masked, RoundManager.FindMainEntrancePosition(getTeleportPosition: true, getOutsideEntrance: !masked.isOutside));
if (result == GoToDestinationResult.InProgress)
return false;
if (result == GoToDestinationResult.Success)
{
masked.StopSearch(masked.searchForPlayers);
return false;
}
}
return true;
}
kinda depends how you wanna do it
with mask fixes i opted to make them prefer outdoor roaming unless they were already inside the building with another targetable player
for context, CheckIfPlayersAreTargetable returning true results in the masked roaming in whatever zone it's currently in
since masked were originally outdoor enemies, and have some unique ship behavior that's not seen very often
this looks like it should fix the ship doors issue
hmm, does that mean you don't send them back inside if there's no players outside?
as far as I understand, that's the intended behavior in vanilla
but if everybody is standing in an inaccessible outdoor area (like jetpacking to the top of a hill or something) then it would still make them re-enter the building in a loop, i think?
i forget if GetClosestPlayer checks for a valid path along the chain-of-custody
assuming it does, the question is "are you ok with that"
then i'd warrant a guess that your solution should be fine
also yes, sorry
i kinda misspoke
they roam inside if:
- there are targetable players inside
- they are already inside the building OR there are no players anywhere outside
this probably works about the same way as what i've got going
ah, so if no !player.isInsideFactory then they go inside?
yeah in that case I believe it does
// default to wandering outside, since we can hide on the ship
// only go inside if:
// - there is a player inside, and...
// - we are already inside, or there are no players to target outside
bool wantsToBeInside = closestInsidePlayer != null && (!maskedAI.isOutside || closestOutsidePlayer == null);
closestInsidePlayer and closestOutsidePlayer are both assigned if !isPlayerDead && isPlayerControlled based on the value of isInsideFactory
and then it compares distances
oh wait, distances?
the distance comparison is just so i can check whether the masked wants to use the elevator later
ah
if the closest inside player is on the opposite end of the elevator from the masked
it opts to use the elevator to reach them
as long as there's a player at any distance, "closest player" will be non-null
it's another instance of masked clairvoyance
oh yeah speaking of your elevator logic, do you limit it to only mineshaft interior? I'm wondering how it interacts with custom elevators using the vanilla controller
(e.g. black mesa elevators as they stand currently)
yeah all of my elevator stuff is limited to mineshaft
which is why i need to make sure it passes the buck to your mod
the only thing i do related to elevators that "might" be a problem is transpiling out the object.findobjectoftype call
and replacing it with RoundManager.Instance.currentMineshaftElevator
but i assume that shouldn't get in your way
lol cool
I thought you prefix canceled that code though?
the rest of the stuff is all under the roaming patch option
which can be completely killswitched
i transpiled the elevator thing
because it needs to apply all the time
otherwise you get lag spikes
yeeep
the prefix cancel is done like this
only if you have the roaming patch enabled, and the mask is in behavior state 0, it runs my new roaming state instead of the vanilla one
you can kinda visualize it as me just replacing the contents of the switch case 0
yee
if im being honest you make transpiling it look easy
it was just so much easier for me to conceptualize rewriting the behavior from scratch and covering "all" the use cases
in my case "all" is just vanilla stuff though
well it helps that I have a utility class for it lol
it took a good while for me to get to that point
I wanna say for this patch that CodeMatcher would probably work too though, but I barely use that so idk for sure
SmartEnemyPathfinding Version 0.0.3
- Fixed the masked repeatedly using the main entrance when all players lock themselves in ship.
it is done
Yippeee!!
๐ซก
I remember when a masked used the mineshaft elevator with a Jester inside
oh like the masked took the elevator down after someone trapped the jester?
love that lol
@keen ruin
send the whole log
hmm looks like this is just a lil oversight
interestingly, this also kinda reveals an oversight on zeekerss part
it prioritizes the lowest path length when choosing the next roaming node, but if the search start has no path, then the path length ends up being zero
seems like it should probably be float.PositiveInfinity instead
now I gotta decide if my reimplementation should also have that bug
while in doubt. config it up ๐
oh god
PathfindingLib has no config so far, I think it would be nice to keep it that way lol
maybe I can expose that as an option in the roaming config though
if needed
it would be a config in pathfindinglib and not smart enemy pathfinding?
it's an oversight in the pathing logic itself not in whatever enemy uses it
at best it could be a setting in PathfindingLagFix
but the fix has to be implemented in PathfindingLib so i understand what Zaggy is pondering on
Hooray we over here finding Vanilla issues that weren't discovered yet
Gaming
yea, PathfindingLib provides the smart roaming
in the vanilla case it would be a patch in PathfindingLagFix
PathfindingLib Version 2.3.1
- Made SmartRoaming use
AgentExtensions.GetPathOrigin()to determine the start point of its paths. - Fixed an exception that could occur in
SmartRoamingif a path from an agent succeeds, while a path from the search start point fails. - Set the non-smart agent navmesh area type name so that
NavMesh.GetAreaFromName("NonSmartAgent")returns 25.
the thing is supposed to explicitly always follow me and teleport when there's no path and it has no current path to go off of
spawned a manorlord too and it just would not follow me at all and struggled a bit
i've only tested on this interior though so could be an interior thing? dunno
01992d48-201b-152c-b71e-3dfb422ef1f9
i tested with these + coderebirth, ill have to send a google drive link for latest coderebirth since its 200mb and i dont got nitro ๐
though firsti ll test with the current thunderstore release of coderebirth, might also exist there (i imagine it does)
seed: 62682703
oh and the moon was repress
nvm doesnt happen with thunderstore coderebirthlib and coderebirth, guess i gotta figure out what i changed lol
now that i tested again this doesnt happen :/
Classic modding experience
uh oh
presumably an issue on your side then? but I can send you a debug build of PathfindingLib to get more info out of it if you need
Ye that would be nice, no idea what I could've possibly done to make a direct path just not work anymore though, cuz navmesh just generate differently sometimes?
When global roaming is enabled in SmartEnemyPathfinding, can the masked enter or exit the facility regardless of whether all other players are inside or not?
indeed
they move purely based on search routine and line of sight, they know nothing about any players' positions
This is an issue with LC Office from what Zaggy has said in the past I believe
@swift token you gotta fix this sometime lol
yeah hard to say if it's for sure that issue if it hasn't been fixed yet, but it seems likely
the top floor doesn't connect to the elevator
I believe it is, he hasn't updated it since before your comment on this a month ago lol
last update for Office was a couple months ago so before you stated it needed fixed
PathfindingLib is crashing LC in the new version (on my modpack, idk if it happens with others)
Also happening with me
Was about to mention it but beat me to the punch by about 3 hours lol (tbf I was asleep)
yeeerp
Unity version change broke my native hooks, looking into it now
well, not looking into it, preparing to update all the offsets
Matty was (maybe still is?) looking at integrating a pdb lookup instead of using fixed offsets, which should prevent this problem in future (and also make us backwards compatible)
well, as long as data structures don't change...
those are not in the pdbs
uh oh
I think Unity hasn't published the pdbs to their symbol server yet
I suspect the pdbs are available when installing the editor locally though, trying that now
bit of a pain for what Matty is working on though
they will publish them eventually no?
or somebody will have to spin up a third-party pdb server
surely they will lol
I was wondering about this ๐ we might have to, that or ship the library with the pdb lol
(if you decide to go for that pdb lookup library mod anyway)
oop
WinDbg got it this time, maybe we're good
Took me a bit longer than I had hoped, but:
PathfindingLib Version 2.4.0
- Updated native hooks to support Unity 2022.3.62f2 (Lethal Company v73). This breaks compatibility with previous versions.
lemme know if you get any crashes, but I think I covered all the functionality
Honestly @keen ruin You guys were in vc working hard on this earlier, proud of you for getting it out so swiftly tbh
PathfindingLagFix theoretically shouldn't need any update, though I've only made a cursory check thus far

if looking around feels responsive, while movement feels stuttery, that sounds like you might need to turn off vsync