Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't tower to correct Y level / Pathing #71

Closed
1BAN opened this issue Nov 16, 2020 · 4 comments
Closed

Won't tower to correct Y level / Pathing #71

1BAN opened this issue Nov 16, 2020 · 4 comments

Comments

@1BAN
Copy link

1BAN commented Nov 16, 2020

When giving the bot a coordinate to get to E.g: 650, 35, 350 (X,Y,Z) It will go to the correct X and Z, then it will tower up 2 blocks or so before stopping (at the incorrect y level). Re running the command the bot will then tower up 1 block at a time for each time the command is run. (Usually worse results when the Y level supplied is much greater than it's current level)

From what I have seen with testing, the bot also does not see towering as a viable pathing strategy. Rather than towering directly up 13 blocks it decided to run 8 or so blocks to higher ground, before towering up 7 and across 8.

Edit:

I forgot to mention the same applies when telling the bot to come / follow. Although I have it set to be at a distance of 1 or 0 each time I test it, the bot either does not take into account the distance of the Y level or fails to create the pathing. If I fly directly above the bot, rather than towering up to me, it will build up a little bit and then just stand still. If I move left or right then it will begin to staircase up.

Edit 2:

The status of the pathfinding is that it's timing out. However I am unsure why, I am still examining the code. I'm sure someone who has actually contributed to this repo would have an idea of why.

@TheDudeFromCI
Copy link
Member

You can turn bot.pathfinder.thinkTimeout to a higher value. The default is 40ms. Higher values will give more stable results but can cause issues since a physics tick is only 50ms. This is usually okay if you aren't running the pathfinder every frame, however.

@1BAN
Copy link
Author

1BAN commented Nov 19, 2020

You can turn bot.pathfinder.thinkTimeout to a higher value. The default is 40ms. Higher values will give more stable results but can cause issues since a physics tick is only 50ms. This is usually okay if you aren't running the pathfinder every frame, however.

I have tested changing this value prior to opening this issue, however, I get the same/similar results each time. Are you not experiencing the same timeouts/incorrect paths when testing what I described above?

@1BAN
Copy link
Author

1BAN commented Nov 20, 2020

Update:

For anyone who may be interested. I have "solved" this, but it's very hacky, and it should be resolved via that actual pathfinding mechanics. Essentially my hotfix is a position checker that is run every physicTick. bot.on calls a checker function I made. The way this function works is checking if the bot has a target player or location variable set. If it does, it checks if the bot is moving. If the bot is moving, then do nothing. If the bot has stopped moving and the absolute value of its position minus the target position x y or z is greater than a threshold (I have 0.6 of a block) then it will reset its goal to be that target players position and or the Vec3 coordinate position variable (that I have made, so that I may tell the bot to go to certain coordinates).

This works wonders and the bot will now tower up until reaching the specified coordinates or player (no longer stops beneath them for no reason).

Issues with this:

  • Even if you set the bot to follow the player and set dynamic to false.. it will still go to the player's updated position because the bot is still essentially "stopping" and recalculating paths, and in the checker function I re-specify the bots goal. (This could be solved quite easily but I doubt I'd bother with such a hacky fix in the first place.

  • The bot really doesn't know how to path downwards, it will either run in circles or will break and place a block continuously for no reason (even if there is a way to get down via breaking their tower). However, I don't believe this is a bug that my code introduced as I have experienced this earlier on when just playing with the pathfinding methods and the lot.

Comments:

I am sure my way of doing this is incredibly inefficient, however, at this stage it's not my intention for it to be clean, I was just messing around with it and seeing what I could do. To be honest I am just learning JS as I go and this is the first API I've ever worked with.

@Karang
Copy link
Collaborator

Karang commented Dec 5, 2020

This was not a timeout issue this time but a legitimate bug in the move generation logic preventing it to plan towers of more than 1 block high. Should be fixed now.

Thanks for reporting it!

@Karang Karang closed this as completed Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants