PneumaticCraft: Repressurized

PneumaticCraft: Repressurized

43M Downloads

Max Distance for Drone Programming Move To Action

MuteTiefling opened this issue ยท 6 comments

commented

Not a problem, just a question. I'm building up a factorio-esque mining operation where drones move around collecting ores from excavators and drop them off at a processing plant. My primary goal is to have the drones moving through the air to make the place look lively.

To that effect, I'm finding it difficult to set up paths for them to travel. It seems like the Move To step doesn't have much of a range before the drone just decides it's better to teleport instead. So my question is simply how is it determined if it will teleport? Is it a max distance sort of thing or a timing (as in it's faster to teleport, so just do that instead)?

commented

There is unfortunately a hard max-distance imposed by vanilla on all path lengths. Had a similar question from someone else regarding this a year or two back, and did a bunch of debugging at the time. Turned out there wasn't much to be done about it short of implementing totally custom pathfinding (which I'm not going to do for the sake of my sanity :) )

Having said that, I'll leave this open since I understand the code better now than then, and there may be ways of increasing the pathfinding range (at the risk of murdering server TPS... pathfinding can be an expensive operation)

commented

That's ok, no need to modify anything (unless you really want to), I figured it was a question of performance and I'm setting up little hops for the drones to run to which works just fine. I'm just wondering how close I need to keep them. Seems right now that it's roughly 32 blocks but I thought you might have a more precise answer.

commented

The code suggests a range of 75, which clearly doesn't agree with your findings. Pathfinding is pretty weird though... think I need to get in there with a debugger and see what's actually getting passed as the max range.

But yeah in general, a waypoint system is better if you want to ensure they'll travel normally, rather than teleport.

commented

My findings weren't really based on much other than very rough testing. I assume that range of 75 is blocks total, so going around a corner is probably more costly than I was eyeballing since I was just kind of doing straight line estimations.

I'll try pushing them out to 75 and see what I get. Thank you!

commented

Yes, it's 75 total (aka Manhattan Distance). Your assumption is correct :)

commented

Awesome, thanks! Really appreciate it :D