[MOD 0.16.x] Whistle Stop Factories

Topics and discussion about specific mods
Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

[MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

Mod Portal: Whistle Stop Factories
Github: WhistleStop
Type: Manufacturing
Initial Release: 2018.06.25
Latest Release: 2018.07.20
Version: 0.1.0

Whistle Stop Factories

This mod creates big assembly machines and big furnaces that spawn randomly around the map and provide huge processing throughput with built in belt loaders. The point of this mod is to make the game all about trains by making the objective about linking these randomly distributed factories.

The big assembly machines also act as chemical plants. And in order to provide factories that are 30 times faster (or more with beacons), the mod implements alternative versions of each recipe that are 50 times larger to get around the 1 recipe per tick limit.

Pictures
Version History
Credits
Last edited by Avacado on Fri Jul 20, 2018 9:24 pm, edited 4 times in total.

Peldor1
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed May 31, 2017 3:44 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Peldor1 »

Love the idea of this... But I cant get it to work!
Currently running Version: 0.16.51 (Steam)
It's the only mod enabled and starting a new game I pop around the map and uncover 2k squares. Never see a factory spawn.
Nothing in the logs either.

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

That is odd, I've tested it in 16.51 and don't have that issue and haven't been able to replicate it.

One thing is that it avoids spawning on ore or water, so if you have settings for a lot of little ore patches, it might prevent some spawning. I have an adjustment witten for the next version just to try to address this issue.

Can you try the following command:

Code: Select all

/c game.forces.player.chart(game.player.surface, {lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})
(you have to hit the ` key and then may have to type in the command twice to confirm disabling achievements).

Hopefully you'll see that they still spawn they might just be rarer because of your ore settings.

If you're still having the issue, I can add a logging function to the mod which when you run that version would be able to point me to what was going wrong.

Peldor1
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed May 31, 2017 3:44 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Peldor1 »

Avacado wrote:That is odd, I've tested it in 16.51 and don't have that issue and haven't been able to replicate it.

One thing is that it avoids spawning on ore or water, so if you have settings for a lot of little ore patches, it might prevent some spawning. I have an adjustment witten for the next version just to try to address this issue.

Can you try the following command:

Code: Select all

/c game.forces.player.chart(game.player.surface, {lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})
(you have to hit the ` key and then may have to type in the command twice to confirm disabling achievements).

Hopefully you'll see that they still spawn they might just be rarer because of your ore settings.

If you're still having the issue, I can add a logging function to the mod which when you run that version would be able to point me to what was going wrong.

This worked. I don't know why, but it did.
I even tried it with my big modded game and after deleting the unused chunks they spawned in.
Thank you for this fix! Going to try it out this weekend!

Toll
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Jul 01, 2018 3:39 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Toll »

Hi!

I tried to use a whistlestop factory nearby to make a lot of pumpjacks. However, despite the recipe saying I should get 50 pumpjacks, I only got 20 of them. I'm thinking this has something to do with stack sizes, since I tried chemical plants as well, and only got 10 of them (and the stack size for pump jacks and chemical plants are 20 and 10, respectively).

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

Hi Toll,

Yes, apparently the recipes are capped by stack size. I modified the factor that is applied to each recipe to make sure the stack size is never exceeded. Please update to 0.0.5 to get that fix. Thanks for the report!

Hyratel
Inserter
Inserter
Posts: 34
Joined: Sun May 15, 2016 10:35 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Hyratel »

so when both AAI Industries and the Newest (0.0.5) Whistle Stop Factories are both installed, WSF throws the following error during loading -

Failed to load mods: __WhistleStopFactories__/data-final-fixes.lua:10: __WhistleStopFactories__/scripts/recipeSetup.lua:139: attampe to concatenate local 'product' (a nil value)

this didn't happen in 0.0.4, I can only guess that some order of operations changed subtly

ETA - certain recipes in Vanilla, such as the nuclear reactor can request many times the stack size in the input slots, can that be applied to the output of the Megafactories?

ETA2 - I can't readily remove either WSF or AAI-I without massive disruptions to the save file

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

Hi Hyratel,

Thank you for your report. AAI had some recipes formatted in a way I wasn't accounting for, so I was able to fix the issue. Please upgrade to 0.0.6 to receive the fix. Also, it is unfortunate that I broke the game into a state you couldn't play it, but since you were never able to load your game using 0.0.5, you actually could've downgraded to 0.0.4 (all versions of all mods are available in the mod portal, but you may have to manually download it from the website), just for future reference. Thank you for the report and also identifying which mod was causing the issue since that helped me track it down much quicker!

Hyratel
Inserter
Inserter
Posts: 34
Joined: Sun May 15, 2016 10:35 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Hyratel »

Disable all, and then add them back one at a time with Whistle Stop turned on - it didn't take long because it was at the top of the list :D. glad I could give you exactly the information you needed to solve it

Teleclast
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jun 26, 2018 5:09 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Teleclast »

I knew I saw the solution to the problem with all the recipes somewhere, and it seems it's in Deadlock's Stacking.

https://i.imgur.com/z1iy2kN.png

It removes it from my crafting, I don't need to be able to craft by hand 50x, or unstack things in that case.

I was curious about that as well, because what's the point of finding the whistle stop factories if I can hand-craft at 50x speed? IT's super helpful early game but it also feels almost cheaty at times.

Not sure if this would help you at all, sorry if it didn't, just thought it could help get a few more people to try it out, as it's the main thing keeping me off turning it on in multiplayer with my friends, and I know it's not simple for you to fix. :lol:

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

Hi Teleclast,

Thank you for your comment, but unfortunately, as you said, it isn't that simple and I don't think it can be fixed at this time. There are a few things to unpack in response to your comment:
  • The "hidden" option that deadlock uses would hide the recipes in the character crafting window, yes, but it would ALSO hide them in the big factory machines menus. This would give you no means to select the recipe at all. I think deadlock still works because you don't have to select the recipe anywhere.
  • I'm aware of the clutter, it is my least favorite part about my mod and one of the biggest complaints, so I'm actively hunting for a solution, so I appreciate the concrete suggestion, but don't think this one will work.
  • I have an active request with the factorio developers to add a feature that WOULD allow hiding for only the character menus, so I'm hoping that will make the cut and be included in the 0.17 update.
  • The recipes aren't hand-craftable. Even though they appear in the hand-crafting menu, you can't use them anywhere except big factories.
  • Even if they were hand-craftable, they don't craft 50x the speed. They use 50x the input and give 50x the output... but ALSO take 50x longer. They aren't any better than the normal recipes, just bigger

sOvr9000
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Jun 27, 2016 5:43 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by sOvr9000 »

In 0.0.6, I noticed that many recipes had incorrect ratios, but I quickly realized it was because this mod doesn't support mods which alter stack sizes. I removed ReStack (the mod I was using to change stack sizes), and that fixed the issues... until I found out that copper cables still had an incorrect ratio of inputs to outputs. The input/output ratio for the "big" recipe was 100 cables for 100 copper plates instead of 100 cables for 50 copper plates.

Then, I removed the Reverse Factory mod (I did a lot of testing to find out it was that mod)! That fixed the ratio to be 100 cables for 50 plates. If I may suggest, you should look into why your code considered some other kind of recipe for copper cables instead of the vanilla one. I'm sure many other factors could be involved in messing with the "big" copper cables recipe, but I just wanted to point out that the Reverse Factory mod adds recipes to the game that can produce copper cables, and that mod also happens to screw up the big factory recipe for copper cables.

*EDIT* The problem with Reverse Factory persisted in version 0.0.7.

Kryzeth
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jul 25, 2015 9:07 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Kryzeth »

Does this mod have compatibility with.. anything other than pure vanilla? I have basically the absolute minimum of mods, and it always errors out during loading. Specifically, erroring during the recipeSetup.lua script at line 149 with "attempt to index local 'recipe' (a nil value)".

My minimum mod list consists of only AutoFill, Bottleneck, Factorissimo2, HandyHands, Helmod, More Achievements, Picker Extended, and Side Inserters.

And as the author of Reverse Factory, it's annoying to hear that this mod is incompatible. Reverse Factory is in my tier 2 list of mods I almost always use.

Toll
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Jul 01, 2018 3:39 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Toll »

Out of curiosity, are there any plans to also add big oil refineries? Or would that not work due to the amounts of liquids it would create?

Also, any thoughts about going hi-def on the sprites? The graphics are somewhat... blocky.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5201
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by eradicator »

After a very short peak at the code:
@Kryzeth:
WSF assumes that any recipes that has normal difficulty also has expensive difficulty. That's a wrong assumption and could be causing your error.

Code: Select all

--recipeSetup.lua:183
if recipe.normal then -- Recipe is split into normal/expensive
    setValues(recipe.normal)
    setValues(recipe.expensive)
A better version might be:

Code: Select all

if recipe.normal then setValues(recipe.normal) end
if recipe.expensive then setValues(recipe.expensive) end
if recipe.ingredients or recipe.product or recipe.products or recipe.energy then
  --this list of conditions is NOT complete (also not sure if game prefers normal/expensive over this if mode is different)
  setValues(recipe)
  end
  

Kryzeth
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jul 25, 2015 9:07 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Kryzeth »

@eradicator Wow, that actually did fix the issue and allowed me to load into game. (Aaand I totally forgot that I had downloaded another mod for testing and hadn't disabled it. That was probably causing the issue in the first place. Oops.)

And also, I found that Reverse Factory doesn't actually cause any issues? At least, not with my minimal modlist detailed above (plus my other 2 mods, mini machines and more inserters) and cheat mode. However, both of these mods activate at data-final-fixes, and the mod load order sometimes changes, depending on what other mods you have active. So reverse factory might be loading after whistlestop for me (so whistlestop never sees the reverse recipes), but loads before whistlestop for @sOvr9000 (which may screw things over). I could always add an optional dependency to whistlestop, forcing reverse factory to always load after, or whistlestop could code in a way to ignore all reverse recipes (their internal recipe names are formatted as "rf-[item-name]" so it shouldn't be too hard to ignore them)

Looks like my mini machines don't get added to the list of "big" recipes (due to also loading at data-final-fixes, and apparently loading after whistlestop in my case). I think whistlestop would have to add an optional dependency to mini machines in order to get them on the list. But that's just for consistency, it's honestly unnecessary, just a random thing I noticed.

Also... the loaders appear to be broken? Tried a furnace without the loader redux mod, then tried an assembling machine with it enabled, and neither one would take input from loaders. Could only get it working with inserters, to the tiles that didn't have loaders on them (otherwise it would drop the item on the belt, instead of into the machine)

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

@sOvr9000 and @Kryzeth
I found out that copper cables still had an incorrect ratio of inputs to outputs. The input/output ratio for the "big" recipe was 100 cables for 100 copper plates instead of 100 cables for 50 copper plates.
Thank you for reporting this. This related to reverse factory and was a hard one to track down, but ended up being that two recipes pointed to the same table ID, so the ingredients of one recipe was also a recycling repipe's results, so it was getting scaled twice. I thought my code already attempted to avoid this by using deepcopy(), but it turns out that if there are multiple pointers to a single table in the original, the duplicate will also have that.

So I actually ended up fixing this problem twice over. First, I limited which recipes are manipulated. Only recipes that are used in my machines now get a duplicate, which is something I should've been doing all along. This means the recycler recipes won't get processed. Second, I'm now using deepcopy() on each individual recipe so that two different recipes can no longer share table pointers.

@sOvr9000
I quickly realized it was because this mod doesn't support mods which alter stack sizes.
Can you go into more detail about that? What exactly goes wrong? I've done some testing and ReStack seems to work fine, though I didn't test every option or anything, but just a couple of stacks sizes up to 600 seemed to work even in 0.0.7.

@Kryzeth
Does this mod have compatibility with.. anything other than pure vanilla? I have basically the absolute minimum of mods, and it always errors out during loading.
I'm actually working my way up to what I'm starting to feel is pretty good general mod support. The main factorio version I do my testing in has 125 mods including most of the big modpacks, though most of my testing involves making sure nothing glaring is happening, so I've missed things like they were deconstructable in earlier versions which left loaders behind or some of the recipes got the wrong ratios when mods used repeated table references. Do you have any tips on how you QA'ing a factorio mod? Before each release I mostly just load it up in my giant mod pack, run around making sure spawning is working and poke around the recipes. I tend to spend more time with feature building.

@Kryzeth and @eradicator
Specifically, erroring during the recipeSetup.lua script at line 149 with "attempt to index local 'recipe' (a nil value)".
I tested it with the mods Kryzeth listed and didn't have the issue, but it sounds like Kryzeth figured out which mod it was and sounds like eradicator was able to figure out the exact cause and fix of the issue as well. Yes, my code wasn't accounting for the fact that you could just have an expensive recipe without a normal or vice-versa and I was able to apply the fix that eradicator suggested. This will also be in my next patch.

@Toll
Out of curiosity, are there any plans to also add big oil refineries? Or would that not work due to the amounts of liquids it would create?
Yes, that has been requested enough that I think it'll be worth doing. Currently the feature I'm working on is allowing players to research and place the giant buildings as an option and I think this addition would go well with that.
Also, any thoughts about going hi-def on the sprites? The graphics are somewhat... blocky.
Yeah, it is the same image the normal game uses just scaled up, so it is bound to look bad. It'll look marginally better (like in my screenshots) if you have high-rez sprites enabled. I attempted to set the low-rez images for the giant machines to the high-rez versions so it'll always use high-rez, but that game me an error about maximum resolution exceeded for low-rez sprites yada-yada, or something like that and I didn't really look into it further. Anyway, I'm open to redoing the images, but that is not something really in my expertise, so I'd need assistance from someone who knows what they are doing for graphics.

@Kryzeth
And also, I found that Reverse Factory doesn't actually cause any issues? At least, not with my minimal modlist detailed above (plus my other 2 mods, mini machines and more inserters) and cheat mode. However, both of these mods activate at data-final-fixes, and the mod load order sometimes changes, depending on what other mods you have active. So reverse factory might be loading after whistlestop for me (so whistlestop never sees the reverse recipes), but loads before whistlestop for @sOvr9000 (which may screw things over). I could always add an optional dependency to whistlestop, forcing reverse factory to always load after, or whistlestop could code in a way to ignore all reverse recipes (their internal recipe names are formatted as "rf-[item-name]" so it shouldn't be too hard to ignore them)
I think we might be fine for the moment in terms of neither one of our mods needing to set up a dependency as my mod's new logic now should hopefully avoid all recycling recipes by just only affecting recipes that can be built in a chemical plant, assembly machine, or furnace. How about we agree I don't touch your recipes and you don't touch mine :-). Right now by excluding your recipes it should be fine. Is your mode going to try to make big 50x recycling versions though?

Also... the loaders appear to be broken? Tried a furnace without the loader redux mod, then tried an assembling machine with it enabled, and neither one would take input from loaders. Could only get it working with inserters, to the tiles that didn't have loaders on them (otherwise it would drop the item on the belt, instead of into the machine)
Oh wow, apparently I completely borked 0.0.7 then. Turns out the "player-creation" tag which I removed to avoid biters attacking factories as a distraction in the wild also breaks loaders. Woops!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5201
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by eradicator »

Avacado wrote:Currently the feature I'm working on is allowing players to research and place the giant buildings as an option and I think this addition would go well with that.
Hm, wait. I thought the whole point was to encourage trains by having them spread randomly. If they can be built anywhere...? Not my problem though :D.
Avacado wrote: Yes, my code wasn't accounting for the fact that you could just have an expensive recipe without a normal or vice-versa and I was able to apply the fix that eradicator suggested.
I hope you thorougly read, thought about, and understood the comment i put in there, instead of verbatim copying. Because if you didn't then it will break on something else down the road. The most important part of "QA" is to have a very good understanding of the edge cases you're trying to avoid. And if you don't know the behavior of an edge-case to write tests to determine that behavior.

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Jul 22, 2016 3:17 pm
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by Avacado »

Hm, wait. I thought the whole point was to encourage trains by having them spread randomly. If they can be built anywhere...? Not my problem though :D.
One of the advantages to my mod that I didn't think about when I first built it, is for CPU conscious megabases. Once your base becomes large enough the main speed constraint is only your CPU, so people tend to build designs that would otherwise be inefficient, such as 12-beacon crafting buildings instead of 8-beacon crafting buildings, since each crafting building uses an amount of CPU, so 12-beacons is 50% more production per computational unit.

My mod takes that concept even further by allowing people to have even fewer buildings. But I agree, it would undermine the original intent of the mod and will always be just *an option* that is *disabled by default*.
I hope you thorougly read, thought about, and understood the comment i put in there, instead of verbatim copying. Because if you didn't then it will break on something else down the road. The most important part of "QA" is to have a very good understanding of the edge cases you're trying to avoid. And if you don't know the behavior of an edge-case to write tests to determine that behavior.
Yes, I did. Here is my new code

Code: Select all

            if recipe.normal or recipe.expensive then
                if recipe.normal then setValues(recipe.normal) end
                if recipe.expensive then setValues(recipe.expensive) end
            elseif (recipe.result or recipe.results) and recipe.ingredients then
                setValues(recipe)
            end
I even went to the extent of testing which combinations crashed the game, since it isn't very well documented. If normal and expensive doesn't exist then the game will crash if either ingredients or results/result is missing. With this version there is a way to completely avoid the if statement, but only with a recipe that will otherwise crash the game and I'm still handling it by duplicating it, but applying no factors, but I'd prefer the malformed recipe to crash the game then my code being responsible for crashing based on a malformed recipe.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5201
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.16.x] Whistle Stop Factories

Post by eradicator »

Avacado wrote:but I'd prefer the malformed recipe to crash the game then my code being responsible for crashing based on a malformed recipe.
Most definetly. Never take the blame for something somebody else messed up :). Also lots of bonus points for fixing it properly. I don't know those edge cases myself. And have too often seen people copying my "pseudocode" fixes without thinking about it, so my response might have sounded a bit harsh ;).

Post Reply

Return to “Mods”