HandyHands - Automatic handcrafting

by Qon

Automatically start handcrafting an item that is quickbar filtered (or in logistics requests) that you don't have enough of whenever your crafting queue is empty. Prioritises items in your cursor and what you need the most. It's like having logistics deliveries for early game!

Utilities
3 years ago
0.13 - 1.1
10.1K

b Sometimes stops crafting for a while

4 years ago
(updated 4 years ago)

Lately I have noticed the mod acting oddly. At seemingly random times it just stops crafting anything even when I have completely run out of an item in a stack on my bar and it only starts back up when I toggle it on and off with the shortcut. I looked through the other discussions and this issue seems to correspond with the recent change to triggers vs ticks. As far as I can tell the issue appears both when I or my bots are building from my inventory.

The other bug I now seem to have while on my Krastorio 2 save is it obsessively crafts pistol ammo even when I only have a rifle ammo in my bar and I don't even have a pistol equipped, thankfully it only seems to want to craft 5 of them.

I can provide complete mod lists if you need them.

EDIT: Not sure what happened to the subject line, oops lol.

4 years ago

The mod by default starts with a setting to craft 5 yellow ammo (pistol/rifle ammo doesn't exist in vanilla). This is to limit it so it doesn't craft the default amount which would take all your starting iron and make ammo out of it, preventing you from getting your first burner drills. You can simply delete the yellow ammo request with the hotkeys. Did this ammo problem start to happen suddenly in a save where you have been running HandyHands for a long time without issues or is it a new world (not a bug)?

Any info on when it stops crafting and what you are doing then would be appreciated if possible.

4 years ago

So oddly enough the issue seems to have stopped for me and other people I am playing with and we have not changed anything that we know of so if it comes back I will try to gather more information.

As for the ammo issue, I am unsure what you mean with deleting the ammo request with hotkeys. I don't have a visible request for it anywhere I know of and I don't see a hotkey for disabling a default ammo crafting. As for the crafting itself the save is new and I only just installed Krastorio 2 for that specific save. The crafting randomly stopping was happening on a non-Krastorio 2 save BTW.

I am now encountering a new and even more drastic issue, hosting a multiplayer we are about mid run with a big Bob's mods session and we are losing huge amount of UPS to Handy Hands. Every time any of us starts crafting quickly performance falls through the floor. I also have issues when I enter a logistics network and large numbers of bots are bringing me materials I can dip as low as 30 UPS from a normal smooth 60. Under "show-time-usage" Script Updates shows Handy Hands using more time than all of my other mods combined during peaks like that. I am also noticing this happening "a little less drastic since I am alone" on single player maps as well. Any time rapid changes happen it's almost like all the triggers are causing Handy Hands to want to recheck everything with every item I receive from a bot and every time it crafts something. I never once had an issue with the script using any noticeable amount of time before you switched to trigger based and not tick based. At this point I am going to have to go back to 1.11.0 for it to even be playable.

A side note; I am running an i9-9900K and a 2080 Super with 64GB RAM so my system is normally pretty idle while running Factorio lol.

4 years ago

Ok, thanks for the update on your situation!

As for the ammo issue, I am unsure what you mean with deleting the ammo request with hotkeys. I don't have a visible request for it anywhere I know of and I don't see a hotkey for disabling a default ammo crafting.

Hold the ammo and press HandyHands decrease hotkey (default J) until the setting is removed ( happens when you try to set craft request amount below 0). Hold nothing and default crafting limits are changed, default below 0 will remove all crafting limit settings. Read mod description for more details or ask again. If the mod description page is unclear then if there's something specific I can improve I'll try to do that :)

Any time rapid changes happen it's almost like all the triggers are causing Handy Hands to want to recheck everything with every item I receive from a bot and every time it crafts something.

There's a timer that limits how often the checks are performed, but they are shorter (which means the checks will run more often) than before. I thought that since it wasn't going to check all the time for all players I could shorten the timers down a bit without really affecting performance since it is unlikely that all players trigger the checks at the same time anyways. But I probably made the timers too short. That should be easy to fix.

The purpose of the timers is to NOT do a full check for every triggering event, but instead do it once every Nth tick (similar to how it was before). The difference is that the Nth tick timers don't run at all (which means the mod is completely idle) if inventory (and other things) haven't changed which would mean that a retry to find something to craft will fail again. So if I just set the timer values to the previous ones then that should resolve the performance issues.

4 years ago
(updated 4 years ago)

Sounds good! I switched back to v1.11.0 since my last message and things were noticeably smoother with no real major slowdowns like before.

That also made me see another cause of some load which is every time an autocraft finishes it feels like I basically loose a whole frame. I suspect it is because the script is searching for the next craft. I only really see this happen late game with a big map when I am running crazy stuff like Bob's and have Rampant on at max evo where I don't have a whole lot of sleep time left. The real issue with this is mostly on the current release in situations like when I get back into logistics range and bots start piling me with materials and then autocrafting kicks back in so now triggers are going off as well as rapid crafting and the HH script update time shows upwards of 5.0 for me alone which is more than all my other mods combined generally. Then it compounds if another player does the same and things come to a crawl XD

4 years ago

That also made me see another cause of some load which is every time an autocraft finishes it feels like I basically loose a whole frame.

In what version of the mod?

I changed the timer from 7 ticks to 200 like it was in 1.11.0. All players are still handled in the same time (in 1.11.0 multiple players were spread out over a few ticks to reduce noticable spikes)

I only really see this happen late game with a big map when I am running crazy stuff like Bob's and have Rampant on at max evo where I don't have a whole lot of sleep time left.

Lots lots of things to craft means more things to check if they are craftable. I'm thinking of ways to save computations by trying to do "the same thing as previous time" without really checking the current priority all the things all the time. It would require quite a bit of work and be a bit tricky to do without making new bugs could improve performance a lot if it can work as I'm hoping it will.

Hopefully this new update works a bit better for you in the meantime:

Version: 1.12.2
Date: 2020-10-11 21:00
Optimisations:
- Changed update nth_tick timer to run less frequently in hope of better performance.
Thanks CaseyFox for reporting on the issues
Some more optimisations are planned for future updates.

4 years ago

I just realised that the last update might have a new annoying issue D:
I'm going to have to revert that for now...

4 years ago

hi,
first a big thanks for creating and maintaining this mod @Qon.
is there a version which works without lagspikes for the current factorio version?
1.12.3 and 1.11.0 both cause big lagspikes (ups dropping below 30) when autocrafting many small items (like pipes or repair kits) in short succession (e.g. with increased crafting speed from qol mod). also picking up stuff from belts or logistic seems to cause stutter.

4 years ago
(updated 4 years ago)

I don't get lag spikes, so it might be a problem only when you have lot of requests or mods that increase crafting speed etc.

I have thought of how to improve performane and I came up with an idea that I think might work. But it is quite a bit complicated so it will take some time. Also I'm busy atm, I hope I can get started on it soon though.

New response