GizmoTheMoonPig / luggage

Recreation of OpenBlocks luggage for modern MC versions
MIT License
3 stars 2 forks source link

Luggage AI does weird stuff? #14

Closed BrainSlugs83 closed 1 year ago

BrainSlugs83 commented 2 years ago
  1. Already mentioned in another bug, that sometimes when you're trying to manage it's inventory, it runs off and tries to do other things. -- Would be good if it would hold still while you had it's inventory screen open (or at least didn't wander off so far that the window closed).
  2. If there are items on the ground on the other side of a wall, it really goes nuts.. it will run up to that wall and just sit there, or maybe it will run around all crazy for a bit... and it's like not using any path finding (as far as I can tell), and not taking into account that no path to the item may even exist from it's current location (i.e. if something is walled off).
  3. Sometimes it appears to be bound by doors and fences... but then other times it just walks right through them (not talking about whistling... that appears to just ignore all obstacles when it works... -- but when it's just sitting there, doing it's thing, it might just decide to walk through a door or fence... or it might decide to be bound by them...)
  4. Sometimes whistling doesn't call the chest to you. -- Like you can spam the whistle and it still won't come. -- But wander around somewhere else for a while, and whistle and then it will come to you.
  5. Also when you whistle, and/or place down the box after crafting it can you put a timer on it (like maybe 3 seconds?) before it decides to wander off again... like if item 2 from above is happening (items on the other side of a walled off area exist), it immediately runs away, and it's hard to use the chest at all... -- you can see this happening at the end of the gif I posted on bug #15.
BrainSlugs83 commented 2 years ago
  1. It tries to sit on your head while you sleep. -- It's not a big deal, but it's definitely weird... maybe keep it off of beds... or off of beds when players are sleeping?
GizmoTheMoonPig commented 2 years ago

figured I would give a bit of an update on my pathfinding updates, since I've been racking my brain for a few hours working on it. Luggage will now only pathfind to items it can see and reach. I'm still trying to finalize this, as there still couple cases where it'll try to grab items it can't reach (like having an item on a tree for example) but it works pretty damn well for the most part. I do have a catch case for this, however. If Luggage detects it reached where it was supposed to go and didn't grab the item, it'll run back to you. This does occasionally create a loop of it running back and forth between you and the item. I'm still trying to figure that bit out. If you get far enough away from where it's trying to run though it won't run back however. Whistling will now put Luggage on a cooldown for fetching items. It sets a 10 second cooldown before it will attempt to seek out items again. This should also fix your 4th and 5th point, as it shouldn't run off immediately. (I would also like to say that if your Luggage is in unloaded chunks and you whistle it won't come to you. This is unfortunately out of my control, as I can't fetch unloaded entities. Sorry!) Placing the item will also create a 3 second cooldown. I added a second keybind command to make Luggage sit still until the key is pressed again. This will affect all Luggages you own in an 8 block radius around you. I'm still trying to figure out a good sound to use for this. I'll do something about the bed thing as well lol

BrainSlugs83 commented 2 years ago

One time when it wasn't responding to whistles, it found an old boat to sit in and got stuck there as well... -- Like nothing I did could make it leave the boat or respond to whistles... it just saw a boat and was like, "I live here now".

I feel like... if the player isn't in the boat... maybe it should be able to respond to whistles at least... if not just flat out leave the boat... (I never sat in the boat while it was spawned, it just found it and that's where it lived until I chopped down the boat).

image

BrainSlugs83 commented 2 years ago

This does occasionally create a loop of it running back and forth between you and the item. I'm still trying to figure that bit out.

Is it picking the exact same X,Y,Z location to go to each time? -- You could make an heat map of recent locations it visited and put minor cooldowns / priorities on them (like with an LRU cache, or a dictionary object?) -- i.e. once a location is visited push it to the bottom of the priority list / or put a decaying weight on it (if a dictionary is used).

It would still eventually loop back there (once it moves up the priority list or the dictionary weight decays)... but less often... kind of like when you go to the fridge, and then you remember there's still no food... so maybe you wait 5 minutes before forgetting and trying the fridge again...

Edit: I suppose you could just do this with object Ids too, instead of X,Y,Z locations... basically once an attempt is given up on, move it to the bottom of the priority list.

GizmoTheMoonPig commented 2 years ago

One time when it wasn't responding to whistles, it found an old boat to sit in and got stuck there as well

This is fixable in 2 ways. I can either make it so Luggage can't sit in vehicles, or I can make it dismount vehicles when called. Up to you, both are easy to implement

About the loop thing, ideally, I want to figure out how to make it not even consider objects it can't reach. I'm still toying around with some stuff, but I may ask some people I know for advice if it drives me a little too crazy

GizmoTheMoonPig commented 2 years ago

good news, figured out the issue where it was trying to grab items it couldn't reach. Thanks to all the feedback I've received this feels like a much more tolerable companion to have around. Gonna test this for a little bit and hopefully I'll have an update out soon!

BrainSlugs83 commented 2 years ago

This is fixable in 2 ways. I can either make it so Luggage can't sit in vehicles, or I can make it dismount vehicles when called. Up to you, both are easy to implement.

I was thinking... you could have it dismount when called...?

Like maybe just look at what the players state is...? if the player mounted in a vehicle when calling, have it mount... but when a player is dismounted and calling have it dismount?

GizmoTheMoonPig commented 1 year ago

Fabric update was pushed today. Hope this fixes all of your problems with Luggage and makes it a better companion to be around. Enjoy, and I really appreciate the feedback!