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

Buggy movement on snow #29

Closed
TheDudeFromCI opened this issue Jul 18, 2020 · 16 comments
Closed

Buggy movement on snow #29

TheDudeFromCI opened this issue Jul 18, 2020 · 16 comments

Comments

@TheDudeFromCI
Copy link
Member

This makes a lot of sense. The bot thinks it's stuck in a block, (the snow) so it constantly hops forward instead of walking forward and removes snow layers on ledges before climbing up them.

I would have thought the bot would ignore them because the snow has no collision. However, pathfinder checks the bounding box of the block when handling pathfinding, not the collision shape. So even transparent blocks like snow, torches, and tall grass are seen as obstacles to the bot.

@Karang
Copy link
Collaborator

Karang commented Jul 22, 2020

In mc-data we have a script to make sure that all blocks that have a collision shape is of type 'block' and the others are 'empty'.
Snow has a collision shape so it is considered as a block (the bot can walk on it).

All transparent blocks like torch, tall grass etc.. don't have a collision shape so they have their bounding box set to 'empty'. (ex: https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.16.1/blocks.json#L12990) so its not seen as an obstacle.

What we are missing however is in the movement generation of the pathfinding to consider the real height of the blocks (atm its a post-process). The same bug causes also some issues with the bot trying to jump on fences. I think it would be easier to solve when we have the modular move generation. (if we can add special conditions)

@TheDudeFromCI
Copy link
Member Author

Yeah, that's fair. I imagine the actual block collision shapes could be sampled for that purpose. It would be helpful to eventually provide that information to the movement system to allow for sub-block movements, such as knowing that it could squeeze between two fence posts. But, that's extremely far down the line. xD

@Bottinator22
Copy link

issue still happens, the bots still just jump wildly around on snow

@MrAlexEsisteGia
Copy link
Contributor

a decent-ish workaround would be to count a single snow layer as an empty block

it wouldnt be pretty but its better than having a broken bot when in a snow biome

@TheDudeFromCI
Copy link
Member Author

Would be a solution since normal, single-layer snow has no collision. So It would work in 99% of use cases. Better 99% accurate than 0% accurate.

@Karang
Copy link
Collaborator

Karang commented Dec 5, 2020

maybe this is related to the soulsand bug, can you check if its fixed now @TheDudeFromCI ?

@MrAlexEsisteGia
Copy link
Contributor

maybe this is related to the soulsand bug, can you check if its fixed now @TheDudeFromCI ?

I checked and: nope
video on progress: https://streamable.com/pouvcx

@Karang
Copy link
Collaborator

Karang commented Dec 5, 2020

Found the bug. Should be fixed now.

@Karang Karang closed this as completed Dec 5, 2020
@TheDudeFromCI
Copy link
Member Author

Oh sorry, was asleep. Thanks for testing it for me.

@MrAlexEsisteGia
Copy link
Contributor

MrAlexEsisteGia commented Dec 6, 2020

https://streamable.com/mtpels still buggy but now less buggy
great progress but still glitchy

edit: also no problem thedoodfromci
edit2: *dude

@TheDudeFromCI
Copy link
Member Author

It appears the original bug was fixed, but there are a few other existing bugs with block bounds. For the most part, though, it's a lot better.

@Karang
Copy link
Collaborator

Karang commented Dec 6, 2020

Ok there are 2 bugs in the video, one is reported here #65

The other is it thinks it is 1 block above the snow so it can jump on the slab. Non-blocks are a pain to handle, we need to think of a proper way to to handle them, it is too hacky right now.

@MrAlexEsisteGia
Copy link
Contributor

just throwing out an idea:
a "database(?)" with all the blocks that are a pain to handle and when the bot encounters one, it can check for special procedures to get over it
maybe for a wall, it could "build an imaginary" slab(just for pathing calculations) over the wall so it paths correctly

@TheDudeFromCI
Copy link
Member Author

@MrAlexEsisteGia All block types already contain collision shape data. You could simply retrieve the information by reading the collision shape. Pillaring over walls, for example, if the collision extends above the block.

@MrAlexEsisteGia
Copy link
Contributor

MrAlexEsisteGia commented Dec 7, 2020

@MrAlexEsisteGia All block types already contain collision shape data. You could simply retrieve the information by reading the collision shape. Pillaring over walls, for example, if the collision extends above the block.

what about lilypads or single snow layers?
they have a collision shape that is under the actual block I think

or ladders, those need some entirely different code to work probably

@Karang
Copy link
Collaborator

Karang commented Dec 7, 2020

Single layer of snow don't have a collision shape https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.16.1/blockCollisionShapes.json#L185
Instead it is the collision shape of the block bellow that collide with the player. As it must sit on a full block, it works.
Lilypads do have a collision shape https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.16.1/blockCollisionShapes.json#L249
and it doesnt extend outside the block: https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.16.1/blockCollisionShapes.json#L1171

Ladder and vines should have a special handling code indeed (there is an issue about it), they are actually well handled in prismarine-physics, so code may be reused.

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

4 participants