Page 1 of 2

[0.17+] Randotorio

Posted: Fri Nov 08, 2019 12:46 pm
by PyroFire
Randotorio

Factorio but every recipe has its ingredients shuffled.

Set a custom seed in the settings.

This mod is based on the concept of Zelda Link To The Past Randomizer https://alttpr.com/en and contains internal randomization logic to ensure every seed is completible.

As an example of the randomization logic behavior, you cannot research anything until you have a lab with power and are able to craft the first science pack. To get power, you need resources from the offshore pump that produces water to feed the boilers which need burnable fuel that produces the fluid the generators need to operate. Plus you need power poles.

Randotorio takes all of this into account, meaning it is compatible with most other mods on the mod portal, inclusive of and not limited to Sea Block, Space Exploration, Industrial Revolution, DyWorld, Angels & Bobs, and many many more!


Image

Image

Image

Image

Image

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 1:52 am
by Impatient
hi pyrofire!

For a long time I was dreaming about a mod like this. 'Even thinking about making it myself. When I tried yours with the standard "Randotorio" seed, I immediately was confused about the recipes, which is a great thing. It hooked me. It is almost like playing a new game. But soon after I noticed that with that standard seed, the first steam engine costs 2000+ iron ore!!! And that is not fun! It is not fun to be stuck without the possibility to reasearch for so long. And the lab, i just notice costs ~2500 iron ore!!! Jeses! :D
What? And a red science pack costs 84 iron ore?!?! Holly fuck! That means I have to get ~5500 iron ore out of the ground to research asembling machine 1!!!!!! And I did not even check all the other recipes. ...

This immediately shows that the mod is lacking some sort of "normalizer". An algorithm which keeps the ratios within some boundaries, where the game is still fun to play. Using another seed is not an option, because I don't have the time to sanity check the whole tech tree at the start of a new game. And I don't want to invest hours in a factory just to encounter later on, that eg one speed module 1 costs one billion crude oil. I am exaggerating here, to make my point. Or, ... I am not even sure if I am exaggerating, or if the mod wouldn't really generate such insane numbers. :shock:

I really want your mod to generate random tech trees and recipes, which are fun to play with. So I dump you some ideas which I had when I thought about a mod like this and new ones I have now. :idea:

More to come. :ugeek: ...

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 2:37 am
by Impatient
Some random thoughts:

Currently I judge the mod as unplayable. The risk to get stuck at some point in the tech tree for too long or forever is there.

An angle to look at the balancing would be, to look at what for resources are spent. I can think of these main sinks:
  • to build the factory
  • to power the factory
  • to make science (including the rocket) for advancing the tech
  • and then there are one time use items like ammo
The mod should keep the recipe ratios for items used in these areas within some sane boundaries. Let's just say as an example between 0.5 and 2 times of the vanilla costs.

The mod should take into account what resources are on the map and in what ratios to each other. Making everything out of wood, would be possible but ... I think this example speaks for itself again. Manually chopping millions of trees? If there are reasonable quantities at all (desert map). It would be unfun.

I am trying to think of more details. :ugeek: :lol: ...

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 2:56 am
by Impatient
Btw, something I noticed is, that the mod does not generate a strict dependdency tree for the technologies. At least it does not with additional mods installed. I think, what I saw was that a tanker from mod cargo ships had a tier 1 miniloader from mod miniloader as ingredient in its recipe. But the tech for the tier 1 miniloader was not a dependency of the tech of the tanker.

I don't know exactly why, but this itches me in the back of my brain. I suspect this can lead to some problems somewhen. I presume you thought about it well enough and made sure the recipes have a strict dependency tree, so that when a miniloader is needed to build a tanker, it can not be that a tanker is needed to build a miniloader. But apart from that, I am pretty sure, it can be very usefull later on, if the tech tree mirrors the recipes dependency tree.

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 3:38 am
by Impatient
A case which shows how important it is to take into account what resources are available on the map and in what ratios to each other is, if all the recipes depend let's say 80% on stone. Suddenly a vanilla map becomes a railworld map, but even more outstretched.

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 3:54 am
by Impatient
Another idea on how to approach the balancing is to divide the game into eras. An era would be delimited by eg researchable technologies. Or maybe by buildable things. Let's take researchable techs. There would be the pre-science era, the red era, the red-green era and so on. The resources needed to advance from one era to the next should also be within some set boundaries.

The example with the seed "Randotorio" shows well, that the player can be stuck in an era for quit-inducing long time. In that particular case it is for 4500+ iron ore mined. In vanilla Factorio it is 100 iron ore mined I think. That is a difference of 44 times. ;) Next, the cost to advance within the red era in this case is 85 iron ore (per red science pack) vs 2 iron ore + 1 copper ore in vanilla. That is almost 30 times higher. And talking like this, we did not yet talk about the other areas (building the base, powering it and wageing war).

The only way I can think of to use the mod right now, is to install helmod alongside and then make a sanity check at the beginning. But even with helmod it would take a very long time to check every recipe and it's dependencies. And when encounterig an unplayable value it is "Quit, use another random seed and repeat the check". Unfunny.

Looking at it like that, in my opinion the proper name for the current randomizer should be hardtorio, slowtorio, masotorio, crazeoutorio or quitorio. :lol:

No, sarcasm aside, it properly should be Toorandotorio. :mrgreen:

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 2:56 pm
by Impatient
Another thing I just noticed is, that Randotorio is creating perpetum mobile recipes. With the standard seed eg it is possible to make one empty barrel and 50 light oil from one empty barrel. This is a circular dependency. Using this recipe and one initial empty barrel, I can make unlimited light oil out of some energy used in the production.

I think in general this should be avoided. Although there can be interesting applications. I am thinking of production of an item type, that can not be made anyhow else when at the same time the energy needed for that recipe (which also is an ingredient for that recipe) is high enough to remove it's perpetum mobile properties.

The empty barrel/light oil recipe is a one recipe circular dependency. But the mod would also need to check for multi recipe circular dependencies. Eg
recipe 1: item A -> items B, C
recipe 2: item B -> items A
the net production for zero resource cost would be items of type C

Circular dependencies are bad. Very bad. They can make items unobtainable. Eg when one tanker needs a miniloader as ingredient and one miniloader needs a tanker as ingredient.

Like in this case, circular dependencies can also lead to perpetum mobile recipes. Or perpetum mobile recipe groups.

I think perpetum mobiles can be avoided if the mod breaks all production costs (ingredients and power) down to basic resources (stone, ore, crude oil, ... ). If the net cost in basic resources is negative, this recipe or group of recipes should be removed and re-rolled.

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 4:34 pm
by Impatient
ok pyrofire,

I went through the chore of sanity checking the standard seed "Randotorio" for how much resources are needed to make 0.5 science/s of each type. I used helmod to do this.

The results are funny.

400 mio iron ore/s (smelted in 1.5 BILLION stone furnaces :lol: )
32 mio coal/s
Copper ore with a necessary rate of 27k/s is not even worth mentioning compared to the above.

Maybe I should use the emtpy barrel/light oil perpetum mobile to build and maintain all that? Ah sorry, nothing meaningful can be made out of light oil.

It took me 1.5 hours to do that sanity check on the science production.

A polite question pyrofire: Did you playtest your own mod? :roll:

I am out of here. Adios.

Re: [0.17+] Randotorio

Posted: Sun Dec 01, 2019 5:51 pm
by MEOWMI
This is funny, last month I attempted to create a similar randomizer mod myself, based on Kenira's Random Recipes mod.

I'm glad to see there's a mod that does it correctly. I'll give it a try.

In making my mod, the two major issues are separating tech tiers and ensuring that you don't get circular dependencies. For the former, you check which researches are available at a given time, and what items become available once you research all those. Each of those level is a tier, and you end up with about 7 in total (unrelated to the science packs btw):
  1. Items acquirable without crafting.
  2. Items acquirable without any research.
  3. Items acquirable after researching all of the research available at the previous step.
  4. Repeat the above step (you'll get to 6 or 7 before you're at the infinite techs).
I attempted to automate this in LUA and the API, but it's really finicky. For example, liquids, initially available recipes, and many of the researches which do not by themselves make a recipe explicitly available (off the top of my head, some of the nuclear recipes, oil-related recipes, barreling of liquids). You have to specify a bunch of things manually or make a lot of exceptions, and it's probably easier to specify everything manually instead.

The issue I had at the end was the fact that avoiding circular dependencies requires just as much effort, and at that point I'd already sated much of my curiosity. Without creating checks for circular dependencies you end up with them about 99% of the time or more. There was never a time when I didn't have such a situation.

Of course, the whole concept of randomizing the order of all (available) recipes does create gameplay that has massive variation in difficulty, but that's the whole nature of it, you just have to accept it.

Edit:
Some slight feedback: It seems indeed to be true that, on average, items become considerably more expensive to craft, even with difficulty turned down - I used 1, 2 for the min max values. One thing you can do to alleviate it is to randomize output item counts as well (Kenira's mod does this and thus my mod also does).

Also, for players: you could maybe even add Kenira's mod to this to randomize entity stats since it has options for what to randomize. I found myself missing the random madness from those a bit when I was testing.

Re: [0.17+] Randotorio

Posted: Mon Dec 02, 2019 8:27 am
by PyroFire
Hey, wow a lot to respond to.
Let's try this.
Impatient wrote:
Sun Dec 01, 2019 1:52 am
This immediately shows that the mod is lacking some sort of "normalizer". An algorithm which keeps the ratios within some boundaries
...
one speed module 1 costs one billion crude oil.
...
I really want your mod to generate random tech trees and recipes,
From what i could tell, the latest version of the mod should produce more "sane" recipe trees now because it relies less on transmutation (changing the item of an ingredient to something else).
The one billion crude oil shouldn't really happen, but true, it still can because there is little control over how long a recipe chain can get. This is where the 1000+ recipes come from.

This may make for a good difficulty setting if there was some way i could measure and control how long a chain gets, or rather, how fast a chain can be built like that.

Also, this mod only does recipes.
I think it would be possible to randomize the technology tree, but i also think it would produce results that are even more insane than it is currently producing.
Maybe something for down the line, but for now it'll just be recipes.


Impatient wrote:
Sun Dec 01, 2019 2:37 am
Currently I judge the mod as unplayable. The risk to get stuck at some point in the tech tree for too long or forever is there.
Of course this risk exists.
But i don't think you'd get stuck anywhere for too long as long as the recipes don't rely on non-automatable resources (e.g. wood).
This is the only real problem i see in the mod so far.

Impatient wrote:
Sun Dec 01, 2019 2:37 am

An angle to look at the balancing would be, to look at what for resources are spent. I can think of these main sinks:
  • to build the factory
  • to power the factory
  • to make science (including the rocket) for advancing the tech
  • and then there are one time use items like ammo
This is not how the recipes are measured.
The logic assumes once you have access to something that generates power (even if its just a solar panel), you are able to power literally everything no issue.
I didn't want to get into the details of figuring out how much of a thing can be powered by the power-generating recipes you have access to because it just don't work like that.
Example: if solar panels cost 1 iron ore each, then you're not going to have any issue powering your base regardless of what the logic thinks.

As for building the factory, these recipes are randomized along with everything else.
There is some logic in place to check if you can "automatically" craft a recipe (e.g. assembling machine), but these values are currently not really used for anything.
Though it doesn't measure how long the recipes would take in terms of crafting time.
As for science, because of how the stepper works you're unlikely to get a seed that has jumped deep into the tech tree before it gives you something to automate it e.g. assembling-machine-1.
However this used to (and should be again) something that is checked before researching too far.

Impatient wrote:
Sun Dec 01, 2019 2:37 am
The mod should keep the recipe ratios for items used in these areas within some sane boundaries.
Let's just say as an example between 0.5 and 2 times of the vanilla costs.
There's no simple way to measure that.
If anything the ratios don't actually matter, what really matters is how long the recipe chains are.
This is a lot easier to measure, but at the same time, making the logic act on that is challenging at best.

Impatient wrote:
Sun Dec 01, 2019 2:37 am
The mod should take into account what resources are on the map and in what ratios to each other.
This is literally impossible to do because the logic runs during the data stage.
It cannot detect and respond to what your resource settings will be because that happens during the control stage.

Furthermore - resources are accounted for (and most ratios are) by way of simply trying not to transmute the ingredients.
By not transmuting, "vanilla ratios" are maintained, e.g. there will only be one recipe that uses copper ore, and whatever that recipe result is, is technically equivalent to your copper plate for example.
Because of this, ratios are maintained pretty much by default.

Impatient wrote:
Sun Dec 01, 2019 2:37 am
Making everything out of wood, would be possible but ...
Possible yes, but i'd like to make it impossible.
Resources that cannot be automated should be transmuted out of the ingredients pool as soon as it is scanned, to avoid scenarios like this: https://gyazo.com/92ca47114f6106873250f087cdb5a0f9

Impatient wrote:
Sun Dec 01, 2019 2:56 am
Btw, something I noticed is, that the mod does not generate a strict dependdency tree for the technologies.
At least it does not with additional mods installed.
The randomization logic strictly depends on and follows the technology tree, particularly when additional mods are installed.
If it didn't, then it would produce impossible seeds on seablock.
Impatient wrote:
Sun Dec 01, 2019 2:56 am
I think, what I saw was that a tanker from mod cargo ships had a tier 1 miniloader from mod miniloader as ingredient in its recipe.
But the tech for the tier 1 miniloader was not a dependency of the tech of the tanker.
The logic won't generate a recipe that makes use of an ingredient that you haven't unlocked yet.
e.g. if your tanker requires a miniloader, then the miniloader definitely won't need a tanker in its recipe chain.
The only exceptions to this rule is if there are multiple recipes that produce the same item, but even in those cases, there will always be one recipe to produce it that does not itself require the result.
This is because, if such recipes existed, then the seed would be technically impossible.
Impatient wrote:
Sun Dec 01, 2019 2:56 am
I presume you thought about it well enough and made sure the recipes have a strict dependency tree.
What you may have been seeing is how the logical stepper will scan a few technologies and then randomize a few recipes.
This means that some recipes will have ingredients that are "closer" on the tech tree, but it can occasionally produce recipes that have ingredients very "far away" from eachother on the tech tree.
Really, it's completely randotorio!

Impatient wrote:
Sun Dec 01, 2019 3:38 am
A case which shows how important it is to take into account what resources are available on the map and in what ratios to each other is, if all the recipes depend let's say 80% on stone. Suddenly a vanilla map becomes a railworld map, but even more outstretched.
See above - this is literally impossible to do because the logic runs during the data stage.
It cannot detect and respond to what your resource settings will be because that happens during the control stage.
Instead, see above notes on transmutations - ratios are reasonably maintained by avoiding transmuting ingredients as much as possible, and this particularly applies to resource distributions.

Impatient wrote:
Sun Dec 01, 2019 3:54 am
Another idea on how to approach the balancing is to divide the game into eras. An era would be delimited by eg researchable technologies. Or maybe by buildable things. Let's take researchable techs. There would be the pre-science era, the red era, the red-green era and so on. The resources needed to advance from one era to the next should also be within some set boundaries.
How can this "red science green science eras" be applied to seablock? or pymods? or god knows what else?

The thing you've got to remember is literally nothing is hardcoded.

The mod doesn't actually test ratios, it doesn't test resources, and really, it doesn't need to.
What if you had omnimatter installed, which removes all the base game resources?
What about seablock?

Any randomization rules or ideas put forward for the randomizer must work in every environment.
E.g. what if there is a mod that puts automation far into the tech tree and you have to handcraft up to it?
Such a mod would throw a serious wrench into pretty much every idea you have suggested so far.
Impatient wrote:
Sun Dec 01, 2019 3:54 am
Looking at it like that, in my opinion the proper name for the current randomizer should be hardtorio, slowtorio, masotorio, crazeoutorio or quitorio. :lol:
Factorio is balanced to have "reasonable" recipes at all stage of the game.
If you start to shuffle the recipes around, you are definitely going to end up giving yourself some insane recipes.
But well, that's what i made the mod for!

This is not a vanilla remix.
This is randotorio.

RNJesus is your god now, and if he wants 1000 iron ore per automation science pack, then that's what it's going to be.

All glory to RNJesus.


Impatient wrote:
Sun Dec 01, 2019 2:56 pm
Another thing I just noticed is, that Randotorio is creating perpetum mobile recipes.
With the standard seed eg it is possible to make one empty barrel and 50 light oil from one empty barrel.
This is a circular dependency.
Using this recipe and one initial empty barrel, I can make unlimited light oil out of some energy used in the production.
There is not really anything wrong with circular dependencies.
I thought the barrels being randomized was absolutely hilarious, and i did see how you could technically get "infinite" resources from them if they end up with the right ingredients, e.g. unbarreling oil itself costs an empty barrel, which can happen.
If i were to add catalyst checks (e.g. so a recipe can't require an ingredient that is in its results) then you conflict with the uranium enrichment recipe.
What i'm saying is those circular recipes already exist in vanilla, it's just a very short one spanning a single recipe.
It's little things like this that make rando logic very hard to write.
And although you can perhaps make the oil cheaply, what're you going to do with all those empty barrels? :D
Personally i just liked seeing how the barreled fluids actually had some uses in the recipes, e.g. you must barrel some fluids in order to craft something, so making these recipes part of a chain is pretty unique and interesting.

However, because of the niche unique behavior of the barreling/unbarreling recipes (and specifically the barreling recipes), i can probably add a setting to make the randomizer ignore them.
They're a bit like the angelbobs converter and void recipes anyway and can be more or less ignored without impacting the randomization logic in any meaningful way.
If you have access to the fluid that makes the barrel, adding/removing the barreling recipes would not really impact what you can craft.
Leaving barrels as, at most, a possible transmutation target for ingredients, and this is quite desirable.

Impatient wrote:
Sun Dec 01, 2019 2:56 pm
I think in general this should be avoided.
If this was avoided, then the logic wouldn't be able to finish with seablock installed.
Seablock makes heavy use of circular recipes.
Impatient wrote:
Sun Dec 01, 2019 2:56 pm
Circular dependencies are bad. Very bad. They can make items unobtainable. Eg when one tanker needs a miniloader as ingredient and one miniloader needs a tanker as ingredient.
Like in this case, circular dependencies can also lead to perpetum mobile recipes. Or perpetum mobile recipe groups.
False.
Circular recipes must be started from somewhere.
There will never be a situation where you need an ingredient which is the result of something in the recipe loop that you didn't already have access to.
On top of that there is transmuation, so it is literally impossible for impossible recipes to happen, no matter how convoluted it is.
The only exception to this issue is if a mod, like seablock, gives you special items to start with (starting / initial conditions)
That's the only time i need to manually add specific items to the randomizer to make the logic work.

I'm not sure what you mean by perpetum mobile recipes, but at a guess it's about duplication recipes. i'll come back to that.
Impatient wrote:
Sun Dec 01, 2019 2:56 pm
I think perpetum mobiles can be avoided if the mod breaks all production costs (ingredients and power) down to basic resources (stone, ore, crude oil, ... ).
If the net cost in basic resources is negative, this recipe or group of recipes should be removed and re-rolled.
Impatient wrote:
Sun Dec 01, 2019 4:34 pm
I went through the chore of sanity checking the standard seed "Randotorio" for how much resources are needed to make 0.5 science/s of each type. I used helmod to do this.
The results are funny.

400 mio iron ore/s (smelted in 1.5 BILLION stone furnaces :lol: )
32 mio coal/s
Copper ore with a necessary rate of 27k/s is not even worth mentioning compared to the above.
That's some pretty useful imperical data.
Aint gonna deny, i agree more work needs to happen.
But i also must again stress that this mod is very complicated, and changes like a "maximum recipe chain length" is not a simple thing to engineer.
We'll see how it goes over the next few iterations.
Always spiralling closer and closer towards that perfect version.
Impatient wrote:
Sun Dec 01, 2019 4:34 pm
A polite question pyrofire: Did you playtest your own mod? :roll:
Even if i "playtested" it, well, do you have any idea what goes into this mod actually function?
This isn't some mod that i can tweak a few settings and it works right, or that it's a matter of a few numbers being in the wrong place.
Logic is very hard to write, and very complicated.
Often it can take entire code blocks to account for a single little thing, e.g. "can i currently automate this science pack i'm about to unlock? If not go find it if it exists".
And even then, i'm not really ever directly controlling the randomizer logic (with that being the only exception).
I'm more like "guiding" it through the technologies and recipes lists at certain rates.

In fact, just to illustrate the point, heres what that code looks like to forcibly search and "select" automation for a science pack (that is unlocked by said science pack) (and assuming you can actually perform research e.g. you have labs with that science pack slot and can power said lab)

Code: Select all

function rando.ScanTechAutomation(pack) -- Search for automation for a newly unlocked science pack & forcibly randomize it.
	if(rando.hand.categories[pack.crafting_category or "crafting"]==1)then return true end
	for k,rcp in pairs(data.raw.technology)do
		local packs=proto.GetTechnologyPacks(rcp)
		local can=true
		local ispack=rando.packs[v]
		if(ispack)then if(not rando.hand.labpacks[v])then can=false end elseif(not rando.hand.items[v])then can=false end
		if(can)then
			local fx=proto.GetTechnologyEffects(rcp)
			if(fx)then
				for k,v in pairs(fx.recipes)do
					local rx=data.raw.recipe[v]
					local rx_results=proto.GetResults(rx)
					for i,e in pairs(rx)do
						local rxitem=proto.RawItem(e.name)
						if(rxitem and rxitem.place_result)then
							local ent=proto.PlaceResultEntity(rxitem.place_result)
							if(ent)then
								local cats=proto.CraftingCategories(ent.crafting_categories)
								if(cats)then
									for a,b in pairs(cats)do
										if(b==pack.crafting_category)then
											rando.PushTechnology(rcp)
											rando.PushRecipe(rx)
											rando.ShuffleRecipe(rx)
											return true
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
end
So i answer your question with a counter question, Impatient: Did you read my code? :roll:

It's one thing to be a critic, it's another to be the person who actually made this concept a reality.
That's no simple feat or it would have already existed before i started writing it.

Which, ironically, looking at the final post here..
MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
This is funny, last month I attempted to create a similar randomizer mod myself, based on Kenira's Random Recipes mod.

I'm glad to see there's a mod that does it correctly. I'll give it a try.
Woo!
Yeah this mod was (and still is) a pretty tough one to write for! :D

Also, very important: This mod randomizes recipes, whereas Kenira's Random Recipes mod only changes the cost of those recipes.
E.g. smelting iron-ore to iron uses 2 ore instead of 1, or whatever.
Randotorio changes it so you might need to smelt a transport belt to get iron plates.
Big difference (for anyone else reading this thread).

MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
In making my mod, the two major issues are separating tech tiers and ensuring that you don't get circular dependencies.
Not an issue and both situations are already accounted for.
That's what the entity logic is for - e.g. can a lab be given power and do you have a power pole?
If not - you shouldn't unlock further technologies because you can't actually physically research anything!
The current logic already takes that into account.
MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
  1. Items acquirable without crafting.
  2. Items acquirable without any research.
  3. Items acquirable after researching all of the research available at the previous step.
  4. Repeat the above step (you'll get to 6 or 7 before you're at the infinite techs).
Those first two points are actually only used when setting up the initial conditions.
Don't forget there may also be technologies that are a technology, unlocks recipes etc, and are actually enabled in the data stage which means you start with those technologies researched.
There's also a few things about hidden recipes, hidden technologies, and worst of all, recipes that are not hidden, are not enabled, and are not unlocked by any technology e.g. "small-plane" (yes this is actually a real recipe in vanilla it's just "hidden") that i've already taken care of.

Steps 3 and 4 is how you scan for the science packs relative to what stage you unlock them.
And is basically how https://mods.factorio.com/mod/scientorio does it, e.g. utility science packs requires both chemical and military, and space science packs would need both utility and production.
Each science pack is sort of its own step, and scientorio is very explicit about that.

Funfact: Randotorio and scientorio are based on the same logic system / backend.
And so is Spaceblock (moreso for the initial conditions like what is and is not a minable resource (versus uranium ore for example which needs a fluid) and the "first science pack").

MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
I attempted to automate this in LUA and the API, but it's really finicky.
Believe me, i know exactly how finicky we're talkin' here ;)

MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
For example, liquids, initially available recipes,
Some fun facts about liquids:
There are zero liquids available at the start of the game.
Liquids cannot be hand-mined or hand-collected.
And same goes for resources that require liquid input to be mined e.g. uranium.

This is because water, seemingly endless and abundant, is inaccessible until after you can access and craft the offshore pump.
And for vanilla, the offshore pump makes water, which is used by the boiler to make steam, which steam goes into the steam engine to make power.
And because the ingredients are randomized, that means you may not be able to get the pump until after a few intermediates are randomized.
It's little things like this that make rando logic very hard to write, because consider that for a moment.
You may have the recipe for the boiler, it may already be randomized, but you won't neccessarily be able to fuel it (e.g. if it used something that had to be made from an assembler for example instead of just hand-minable coal).
MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
You have to specify a bunch of things manually or make a lot of exceptions, and it's probably easier to specify everything manually instead.
Easier yes, but also about the same amount of work with far less payout.
I want this thing to work with literally anything on the mod portal.
Aint going to do that with hardcoded item names or mods doing weird things like, having a technology require an item as its ingredient, but that item isn't actually obtainable and there is no lab that can work with it (No seriously, the first 3-4 reasearches in Seablock are exactly this and i had to add special checks for it)
And what if one of those mods is updated? :shudder:

The only exception to this, at least for rando logic, is the starting conditions, like how in seablock you start with some power and a few ingredients - but at the same time, again because ingredient randomizations, you don't actually have access to water until the pump is randomized.
Finicky is an understatement :D

Currently as it stands, randotorio is 99% procedurally generated with the only exception being the seablock starting conditions.
MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
Without creating checks for circular dependencies you end up with them about 99% of the time or more.
I realize rando code is very complicated and hard to read, but if you were to read it, you'll find zero checks for circular recipes/dependencies.
"Impossible" recipes are avoided naturally because of how the logic is written to behave - it will never add ingredients to a recipe that it does not yet have access to.
MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
There was never a time when I didn't have such a situation.
I can see there may be two ideals here.
When you say circular recipes i'm assuming you're talking about recipes that require itself and becoming impossible.
As explained earlier this is a non-issue.

On the other hand, you may also be talking about infinite self-replication recipes.
E.g. what if a mod adds two iron-gear recipes, and they're intended to just be different ratios of the same recipe.
Because there are now essentially two ways to make iron gears (even though the mod made it exactly the same way), it is possible for the second recipe to itself cost some iron gears (and possibly even at a loss), even without transmutations.
I don't see it as an issue, mostly because anything you do about circular recipes would completely break seablock which relies on circular recipes, but i agree it needs more thought.


MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
Of course, the whole concept of randomizing the order of all (available) recipes does create gameplay that has massive variation in difficulty, but that's the whole nature of it, you just have to accept it.
That's basically what i'm looking at.
I can see the difficulty is high particularly towards the endgame, but that is not something i can directly control because everything is randomized.
I don't even know when you'll get access to water via the offshore pump, but also consider this: i can be 100% certain it is before you can power a research lab for example.
Perhaps i should explain more about the logic system, how it's structured and how it works so others can better understand what it's doing so anyone interested has a chance to consider these things first before entering discussions with it.

The objective here is to come up with ways to describe a "logical rule" which will guide the logical stepper in the direction we want it to go.


MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
Some slight feedback: It seems indeed to be true that, on average, items become considerably more expensive to craft, even with difficulty turned down - I used 1, 2 for the min max values. One thing you can do to alleviate it is to randomize output item counts as well
The difficulty settings are a bit of a strange way to control it.
I'd like to add more options in the future.
MEOWMI wrote:
Sun Dec 01, 2019 5:51 pm
(Kenira's mod does this and thus my mod also does).
I'll have to double check that.
I recall it not being very useful last time i looked at it, but that was only a skim.


-----------------------------------------------------------------------------------------------------------------------------------


Whew that's a lot!
Some wall of text amirite?

the TL;DR of all this comes down to a few things.

Q: Recipes that are circular in nature, e.g. requiring the result of eachother as an ingredient, can be impossible to start. Is this an issue with Randotorio?
A: The randomization logic ensures that this never happens - you will always be able to logically "enter" a circular recipe chain.

Q: What about recursive recipes which can result in an infinite surplus or deficit of something?
A: Between the nature of randomizing ingredients, and how mods like Seablock explicitly rely on circular recipes, nothing is currently done about recursive recipes.

Now the difficult part.

Difficulty.
- Particularly of end-game recipes
- Examples given such as a single item costing in the 1000's of a resource or needing 1.5 billion furnaces to produce one science pack every second.

Rando Example: Say, red science needs 5 gears and 5 copper plates. 1 Gear needs 5 iron plates. 1 Iron Plate needs 5 electronic circuits. 1 electronic circuit needs 4 iron pipes. 1 iron pipe needs 5 stone brick. 1 stone brick needs 2 copper ore. 1 copper plate needs 5 copper wire. 1 copper wire needs 5 coal.
The sum of this example is: 5gear *5iron-plate *5electronic-circuit *4iron-pipe *5stone-brick *2copper-ore = 5000 copper ore. 5copper-plate *5copper-wire *5coal = 125 coal.
And that's just one science pack.
There is nothing stopping the logic from producing an outcome like this.

I believe this issue is a mix of factors.

And starting with the obvious, the length.
Most recipes aren't that long, even in the end-game.
Though part of randotorio is making this intentionally happen.
In the example, if we avoid a longer chains we can remove the 5 iron plates step before gears and immediately reduce the cost from 5000 copper ore to 1000.
Removing a step also makes it take less time to craft the entire chain in sequence.

The second issue is the cost of each step.
In the example, if even a single of the 5's is reduced to a 2, we immediately reduce the cost from 1000 (after previous step) to 400.

So that's basically what needs to happen, but how to do it?

Notes:
- I was thinking something about checking for "endpoints", e.g. a recipe that makes an item that is placeable, versus an intermediate, but that doesn't work because seablock uses endpoints as ingredients normally.
- Recipe lengths can be calculated, even with recursive loops. And because i'm reconfiguring the recipes from the ground up, "distance from mineable resource" can be built as it goes, with mineable resource referring to anything that can be infinitely reproduced (e.g. mineable, or by recursive recipes). This gives us an easy way to score the recipe (e.g. marketplace if i wanted to), but i dont see this as useful for logic purposes. Nothing wrong with loops, in fact it's somewhat cool. Maybe that's how you get that 5,000 copper? I can probably turn this into a setting or something to have more control over it.
- Desired score: One way to calculate this is just how deep into the technology tree it is compared to the longest existing tree, inclusive of the science pack cost of the technology and the recursive science pack cost of its ingredients (recursively). This also means having many small technology trees that are available at the start of the game but require science packs from later on have their distances calculated correctly. Example: Satellite is 99% of the largest chain size, but landfill is 5% and blue science at about 50%.

Solving for this problem reactively is easy, you just randomly change ingredients and counts until it meets some desired score.
But i would prefer to do it proactively (the logic knows beforehand, not after).

Watch this space for more maybe?
Join us on discord? https://discord.gg/a9CNarA
because laying all this out has taken quite a while as it is and it's not an easy problem to solve (if i haven't made that clear enough yet).
I'll add some stuff to the FAQ about how the logic works

Re: [0.17+] Randotorio

Posted: Mon Dec 02, 2019 5:44 pm
by Impatient
cool :)

Keniras randomizer ensures that rolls are playable, but it also is boring because just the numbers are different, not the recipes. I like your approach with Randotorio a lot more.

Maybe we should find a common ground. The question is, do you want, that the result is playable, after Randotorio rolled the dices, or are you merely interested in the theoretical exercise? I, as a sort of tester, say the results are unplayable. Unplayable, because they can not be trusted to have sane numbers. Performing a sanity check at the start of a new game takes forever. Like I wrote, I did a check for the science production and it took me 1.5 hours to check the recipe chain for 8 products (6 science packs, light density structure, rocket fuel, rocket control unit and satellite). If you are interested in playable results, then you have to - by whatever means - ensure sane numbers. The reenforcment of a fellow coder does not count for me as a player. I want playable results.

I had a brief look at the code snippet, you posted. I think what it does, is to ensure, that an item or a resource is obtainable. Great! I did not chekc it in detail, because I don't know aht the called functions do and what the properties stand for. So I just throw in my thoughts on this part of the algorithm (as pseudocode):
Pseudocode


Reiterating on the sane numbers issue. The first and most basic question here might be what actually are "sane numbers"? I try to approach this question by asking another question: How did vanilla get it's sane numbers? The answer for me is: By playtesting hours, months, years and decades cumulatively. And balancing, based on the fun testers had playing the game. Playtesting is out of the question for the randomizer. But to measure "fun" might not be. Next question is, how can "fun" be measured? It is subject to personal taste of course. But what values and numbers did and does the "fun" consist of, measured over all the players and all the time played cumulatively?
Personally I have some very precise ideas and opinions regarding this. They can be poured into numbers, which could be used by the randomizer to generate sane numbers for recipes. Basically, sparing you the details, it all comes down to this: How challenging is it to be able to produce an item x at a given rate and how long does it take me to get there.

Viewing it like this, it is two values: Complexity and time.

How the randomizer is going to calculate them is a different question ;-D

Re: [0.17+] Randotorio

Posted: Mon Dec 02, 2019 5:49 pm
by Impatient
As an example for the complexity and time values I point to the issue with the standard seed. The complexity to be able to research red technologies at a given rate is very low, but the time to get there (remember 4500+ iron ore just for the machines?) is very high. The ratio of complexity to time is out of order by magnitudes. "Insane" as I always call it.

Re: [0.17+] Randotorio

Posted: Mon Dec 02, 2019 6:06 pm
by Impatient
Pondering over this issue, I have the feeling, that, too measure the "fun" (there might be other values, but let's take complexity vs time as an example now), the randomizer would need to be able to basically "solve" the game. From a give goal (let's take science production at a certain rate, as it also basically is the driver in vanilla) it needs to iterate backwards and estimate how long it takes to be able to produce an item at a given rate. This includes science, building the factory, powering the factory and making onetimeusables (ammo). That is the time component. Measuring the complexity in comparison I think you would agree is easy. As I see it, it is the complexity of the cain of recipes, over which you have direct control.

Re: [0.17+] Randotorio

Posted: Mon Dec 02, 2019 6:11 pm
by Impatient
I think this can be solved, but it would take a lot of time, wit and code. :lol:

Maybe Keniras approach is the better one. Starting from vanilla, randomizing aspects of the game, but at the same time ensure the numbers stay sane. Then randomize more while ensuring sane numbers. Then randomize even more. Increase complexity here, remove complexity there to counterweigh. Etc ...

There might be some values that can help to establish restrictions to ensure sane numbers, while giving total freedom for randomization within those restrictions: Total resources consumed to build base, power base, research at given rate and make onetimeusables. If the randomizer creates a tech and recipe tree where the resources are the same as in vanilla, then I guess, it very likely will be a playable result.

Re: [0.17+] Randotorio

Posted: Mon Dec 02, 2019 6:24 pm
by Impatient
Uuuuuh, ... I just had an idea how sane numbers can be ensured easily. Let me think a bit to articulate the idea. ...

Re: [0.17+] Randotorio

Posted: Tue Dec 03, 2019 11:44 am
by PyroFire
In keeping with sane numbers, did you need to post 10 times for two responses?
Don't forget there's an edit button there.
Impatient wrote:
Mon Dec 02, 2019 5:44 pm
Unplayable, because they can not be trusted to have sane numbers.
A reasonable assessment, particularly given the wood situation and how numbers can go into the 1000's too easily.

To date my priority has been getting the logic to function correctly, such as resources unlocking when you get access to fluid drills, the satellite unlocking when you have (1) access to a rocket silo, (2) can fuel the rocket silo, and (3) be able to craft either the fixed recipe, or at least one of any recipe in its crafting category.

Most of that is done now.

Impatient wrote:
Mon Dec 02, 2019 5:44 pm
I think what it does, is to ensure that an item or a resource is obtainable.
Obtainability of a resources, entities and items happens passively / in the background.
The code posted is to search the technologies at your current level for a recipe that results in something (e.g. assembler) that can automate that science pack if you don't already have it.
This was to force automation to happen before it expects you to do large scale research.

Impatient wrote:
Mon Dec 02, 2019 5:44 pm
Viewing it like this, it is two values: Complexity and time.
How the randomizer is going to calculate them is a different question ;-D
With a lot a math is usually how.

Impatient wrote:
Mon Dec 02, 2019 6:06 pm
the randomizer would need to be able to basically "solve" the game.
That's what the logic is for.
Impatient wrote:
Mon Dec 02, 2019 6:11 pm
Maybe Keniras approach is the better one. Starting from vanilla, randomizing aspects of the game, but at the same time ensure the numbers stay sane.
First, according to Kenira, his randomizer is 100% hard coded.

Second, i've started this with a final picture in mind. I already know what the mod will look like in its final state. And well, hence all the references to ALTTPR. Same thing but in factorio where you would need to take different routes through the crafting trees to get to launching a rocket.
The idea is practically flawless, it now comes down to the execution and physically writing all the code and sorting out all the technical problems.
I would say i'm about half way through it, as we're currently talking about methods of balancing the seeds, rather than some part of the logic not working.
Personally, i believe this is the more effective approach and curiously - it wouldn't take much to replicate what Kenira is doing in randotorio and turn the ingredients shuffling into a setting (default-on), consequently obsoleting that mod entirely. Followed by things like tech tree randomization with science pack costs, position in tech tree, and resulting effects. All following some level of logic. E.g. green science and space science could be swapped almost seamlessly assuming the rocket silo and satellite was swapped into the early game, along with the fixed rocket parts recipe.
Chaos shuffling basically, but it needs to be finished before it can become an option.
Impatient wrote:
Mon Dec 02, 2019 6:11 pm
There might be some values that can help to establish restrictions to ensure sane numbers, while giving total freedom for randomization within those restrictions: Total resources consumed to build base, power base, research at given rate and make onetimeusables. If the randomizer creates a tech and recipe tree where the resources are the same as in vanilla, then I guess, it very likely will be a playable result.
I suggest waiting until i've had a chance to write the FAQ, as it should answer most of your question about what the logic is and how it works.

Re: [0.17+] Randotorio

Posted: Tue Dec 03, 2019 9:09 pm
by MEOWMI
It is true, Kenira's mod has the specific entities hardcoded. I looked at it a lot while extending it and modifying it for my purposes.

On another note, I tested Randotorio + Kenira's Random Recipes and the two seem to play well together out of the box.

Re: [0.17+] Randotorio

Posted: Wed Dec 04, 2019 4:17 am
by Impatient
from my perspective the current problem is not to find the right seed, but to turn every seed into a playable result.

Re: [0.17+] Randotorio

Posted: Wed Dec 04, 2019 4:19 am
by Impatient
yeh about the frequent posts. I am writing them on the road, as soon as a thought or several are finished.

Re: [0.17+] Randotorio

Posted: Wed Dec 04, 2019 10:40 am
by PyroFire
MEOWMI wrote:
Tue Dec 03, 2019 9:09 pm
On another note, I tested Randotorio + Kenira's Random Recipes and the two seem to play well together out of the box.
How're the results though?
Impatient wrote:
Wed Dec 04, 2019 4:17 am
from my perspective the current problem is not to find the right seed, but to turn every seed into a playable result.
That's what i've been trying to tell you.
Every seed being a reasonable and playable result is the goal.
But getting there is very challenging -- if it were easy, this mod would have already existed.
Impatient wrote:
Wed Dec 04, 2019 4:19 am
yeh about the frequent posts. I am writing them on the road, as soon as a thought or several are finished.
I guess you could say... you're impatient.

Image

please use the edit button.