Keniras Random Recipes

by Kenira

Randomizes recipes (amount of ingredients and products, crafting time) as well as many other things that can be toggled individually like belt speed, crafting speeds, energy consumption, weapon damage...

23 days ago
0.15 - 2.0
1.20K

g What's been your experience working on this randomizer?

2 years ago

I've been working on my own randomizer to customize some things that always bugged me about yours, and I was wondering what sort of recommendations you'd have as I go about this project. I could also write the code in a compatible way with yours if you'd like to use it, since I'm working on randomizing some things that you haven't gotten around to yet.

2 years ago
(updated 2 years ago)

I might be able to say more if you give some examples for things that have been bugging you about this mod? Or if there are specific things you're looking for advice for?

Generally, one of the big "oh god" parts in this mod is the code for probabilities. That's just, one big mess and there's probably plenty of edge cases where it doesn't work all that well.

The other thing i know isn't great is the overall balancing because the randomization isn't properly normalized. By that i mean, the default setting isn't really mathed out to on average be the same difficulty overall (ie increases in costs balance out with decreases); it's pretty much just with some experimentation and guessing. Which is really a good summary of the mod overall; it's pretty jank. If you can do it better / more elegantly, i'd definitely encourage you to do that in your own mod instead of trying to keep compatibility between the mods. Yes compatibility would be nice, but i don't think it's so important to sacrifice quality for it. If you do make it compatible, i would be happy to include for example more randomizations into this mod as well though.

Generally, some important things to keep in mind is both scaling for your code (if you've looked on the source code for this mod, you'll know how much changes one needs to make; so make sure you have a good workflow and reuse code as much as possible), edge cases (a lot of properties have boundaries defined in the factorio API you'll encounter; i've had a lot of bug reports for things like beacon ranges getting out of bounds for example because i didn't check all those in advance). And to be VERY careful about how the data is organized. If you look at randomization of turrets, you'll see there's a really ugly if-else chain because the data there can be arranged either as a list, or a list of lists - in two places. So you need to catch all 4 different possible cases because mods can do it in different ways because it's not strictly defined by factorio.

Also think carefully about how you want to make it customizable. This mod is a bit of a mess between the different blacklists that exist, and the settings menu. I tried to make it very modular because that's how i personally like my mods and i want to allow people to play the game in the exact way they want, but the more options you provide the more important it is to think about how you're gonna organize it or it becomes an inscrutable mess.

Other than that, i also still would like to randomize more things and i have some specific ideas too but just haven't gotten around to / haven't had the energy to do it, especially since i stopped playing factorio. That's the other thing that does bug me apart from the probability stuff and general jank-ness.

2 years ago
(updated 2 years ago)

Thanks so much! This is exactly the sort of response I was looking for.

As for the specific things that bugged me, the following were the biggest things:

  1. The balancing, as you mentioned is not very much in place. It's not so much for me that the randomization can produce unbalanced games depending heavily on how things are randomized as much as some of the ways things are randomized can produce results biased even on average to certain scenarios (at least according to my understanding of how the mod's randomization works). As a toy example, if we were to randomize recipe times uniformly within the range [0,4], then on average recipes would be randomized to 2x the amount previously. However, if we do [0,2], then we don't get the fun, ridiculous 200 second recipes that sometimes occur. Of course, your mod doesn't do a uniform distribution, but my understanding is that the distribution you have still suffers from this problem (let me know if this is not the case, though).

  2. Not all properties are randomized. You already know this, but I'm working on fixing it. In addition, I'm trying to add an "extreme randomization" mode where even properties that have no business being randomized are randomized, like gate opening speed haha. And even a mode where the properties that are randomized are randomized. Mostly, I'm trying to base this off the Hollow Knight randomizer, which has just a lot of features and is very modular like your mod.

  3. Even with the modularity, as you mentioned, the settings are a bit of a mess. I think some of them could be combined or removed. I definitely like the modularity, but I'm sure there's a better way to do it.

  4. I was going to mess with the number randomization. Maybe add a few different algorithms and see which one is best. Yours works well, but I wonder if it's better to use different distributions for different properties. I'd really like that level of detail.

What do you mean the code for probabilities? Do you mean in the recipes? I've actually been able to deal with that pretty well, so it hasn't been as bad as, for example, navigating factorio's types like TriggerItem.

Also, how does your algorithm work, more specifically? I've been giving it a look, but am not understanding too well. I could probably reverse engineer it, but it would take a while. An explanation would really help.

I'll keep in mind to do some organization cleanup. Thanks for that recommendation.

Finally, what sort of specific ideas do you have? Maybe I could work on that.

Thanks so much again for the response!

2 years ago

By the way, here's a list of things that I've randomized that you seem not to have gotten to (or thought too ridiculous to include), in case you're curious:

  1. Equipment shape. I'm actually hoping to do really wonky shapes in the future since factorio seems to allow this for some reason.

  2. The evolution factors necessary for the tiers of spitters/biters to appear. Gotta keep you on your toes~ The problem I'm facing here, though, is that the game is very sensitive to these values, so I wonder if theres a way to randomize this in a sensitive way.

  3. The mining times of entities... this is definitely an extreme mode thing since it's kinda weird to get randomized but like I said, I'd like to make pretty much everything up for grabs.

  4. I was able to get projectile damages randomized, like grenades. It seems like you didn't get around to this.

  5. Character respawn times are randomized... because why not? I thought the other character properties would be too annoying to randomize even in extreme mode, though. Also, character corpse survival times. (The good thing about these properties is that you can actually see the numbers.

  6. A lot of entity properties, like entity health are randomized (although I like how you randomized the resistances, which I haven't gotten to yet... I love my 100% acid resistance armor :D). Also healing, and in extreme mode, repair speed (because again, why not?). And turret rotation speed.

  7. I have a custom map type that randomizes most of the things in the map right now. Haven't been able to do some of them yet, but it at least provides random resource richness and such for vanilla, which I think is cool.

2 years ago
(updated 2 years ago)
  1. The balancing, as you mentioned is not very much in place. It's not so much for me that the randomization can produce unbalanced games depending heavily on how things are randomized as much as some of the ways things are randomized can produce results biased even on average to certain scenarios (at least according to my understanding of how the mod's randomization works). As a toy example, if we were to randomize recipe times uniformly within the range [0,4], then on average recipes would be randomized to 2x the amount previously. However, if we do [0,2], then we don't get the fun, ridiculous 200 second recipes that sometimes occur. Of course, your mod doesn't do a uniform distribution, but my understanding is that the distribution you have still suffers from this problem (let me know if this is not the case, though).

So, how the randomization works - there are two parts to it:
First, if the costs will increase or decrease gets determined. Then, the ratio gets determined and applied (through multiplying or dividing; depending on increase or decrease). That was my way of trying to fudge it in a way that it's not super unbalanced and the ratio of increase vs decrease is kinda balanced, and by applying a factor you avoid the "0 to 2" issue. It's not a linear randomization in the sense that it's like "equal chance to get any number between 1/4x and 4x".

  1. Not all properties are randomized. You already know this, but I'm working on fixing it. In addition, I'm trying to add an "extreme randomization" mode where even properties that have no business being randomized are randomized, like gate opening speed haha. And even a mode where the properties that are randomized are randomized. Mostly, I'm trying to base this off the Hollow Knight randomizer, which has just a lot of features and is very modular like your mod.

Randomizing the randomization sure would be...interesting lol.

What do you mean the code for probabilities? Do you mean in the recipes? I've actually been able to deal with that pretty well, so it hasn't been as bad as, for example, navigating factorio's types like TriggerItem.

Yeah, basically some recipes feature probabilities for products (like U-235 in vanilla).

Also, to talk more about the specifics of the algorithm, do you have discord? Talking about it on the forums here is kinda cumbersome. You can find me if you search for "Kenira" on the factorio discord server.

2 years ago

I couldn't find you on the discord. I'm exfret#7014 if you want to contact me. Let's discuss all this more there.

New response