Topic: Improving Fennec's random plant generator  (Read 408 times)


Signatus

« on: January 22, 2019, 04:15:39 PM »
I was thinking about this and I think that Fennec's plant generator has a lot of extra potential in it. I'd like to share with you all my ideas pn how to improve it.

I don't really know how they did it do, since there's no source. @fennecfoxx , would you mind sharing it? I can program in java so surely something I'd be able to use.

As far as I see it, it's just creating a certain number of plants with the herbs getting special traits. Berries and crops get none. They do have random names and get semi-random values for nutrition and whatnot.

However, this can be a bit chaotic and create combinations of plants that make no sense or don't cover the range of possibilities so well. So a good idea might be creating some procedural or hardcoded "plant types". These could be things like medicinal, threadable, grindable, shamanic, poisonous, etc. A certain minimum number of plants with these traits must be available. So you'll always get at least one edible plant to make flour wit or to get high, to make threads (even if inedible), etc.

It should also balance the occurrence of plants such that north/south/east/west has a certain minimum of herbs/berries/shrooms/crops while still leaving some space for randomness.

These settings should be editable, to be able to fine tune the results to what you want (almost all berries are poisonous? Go for it!)

There should probably be some berries or mushrooms available throughout winter, even if only in certain areas. At least 2 types seems appropriate but could be slightly randomized.

As for crops, one of the problems is the already usable plants not being included or available. I see a way around this along with the plant types mentioned above. We could have similarly named plants (black-nettle, marsh-flax, etc) which could then be equally soaked or processed by changing the recipe to {*nettle} or even stuff like {Retted *nettle}, which along with names like "Fibre from X" and "Linen from X" could make the material persist through to the clothing name.

Crops could alsk be created along a template (random or not, with random deviations, so that all e.g. "foobars" would have roughly the same properties, with the chance of random changes. Maybe if the base template is edible each new one of that type can have a 5% of being poisonous, 1% deadly. So if you know the plant's base name/type but don't have full knowledge of, say, "spiny foobar", you might be taking a risk by consuming it even if all the other foobars are okay.

Along with this is the possibility of making some dye, which does seem to have existed in iron age finland. One approach is to use a fixed name plant, "dyeplant - red", and create some cooking recipes (plenty of space there) for make dye out of it. This would take one recipe using {Dyeplant - *} input. The other approach involves randomly named plants from which you can extract colored dyes. This would have to procedurally make recipes for each.

Dyes could be called via {Dye - *} and use the last word. Items should probably be dyed at the source recipe to save space though, but I guess the cooking menu could be used for all the clothing dying if necessary. It doesn't require fire nor a pot if you don't boil anything. Kludgy, though.

Some special and rare medicinal/stimulant plants could be sprinkled in to make things more interesting.

Lastly, and with the empty cooking space in mind, perhaps procedurally create recipes that call for specific plants/ingredients but which will have a higher value of nutrition than the sum of its components. This represents the cooking releasing ingredients, and perhaps specific herbs and ingredients complementing each other.

This would make you have to use the specific ingredients in order to benefit, which might not be easy. I guess the recipes could have "regional" dishes with herbs from the area (maybe some archetypes can be used, like "Northern porridge/soup") but also some "global" combinations to spice it up. Perhaps the global ones, being harder to gather, would have an even higher nutrition.

What do you think about these ideas?
« Last Edit: January 22, 2019, 04:18:13 PM by Signatus »

Signatus

« Reply #1 on: January 22, 2019, 05:34:55 PM »
I forgot a coiple of things:

Making of psychoactive mixtures and others could make use of the *shamanic* name tag, or simply specific herbs . The ingredients could be obscured by the description tag so that you'll have to find out the correct mix somehow.

The same vould apply to making medicines.

Themed names might be avoided to prevent detection of effects by association. If all "X's eye" "shamanic X" are always psychedelic or stimulant, you could realize the other plants have similar effects from the name alone.

While plant types could have similar attributes, this seems too much. The idea is for you to use herblore or have to experiment to understand them.

Edit:: as an addendum to the nettle stuff, threadable plants could just be used with {Fibrous *}. That wouldn't really reveal anything about the effects and it can be processed in a single recipe.
« Last Edit: January 22, 2019, 06:42:40 PM by Signatus »

fennecfoxx

« Reply #2 on: May 16, 2019, 03:26:18 AM »
Hey, sorry for the late reply! It's been awhile since I've touched my mod, or even URW.

You can find the source code by extracting the files from the JAR (7-zip will do this if you're on Windows). The formatting's a mess if you open it in Notepad, but it's fine in NetBeans.

Herbal effects can be assigned to any type of plant, except crops. Herbs always have some sort of effect, with a 20% chance of being poisonous and 80% chance of being beneficial. Berries about a 14% chance of being poisonous and 17% chance of being medicinal. Even mushrooms can be medicinal, but the chance is only about 7% (whereas the chance of poison of some sort is 50%). Psychoactive chance is slightly above 2% for any plants which roll for effects, whether medicinal or poisonous, and regardless of plant type. The reason for these odds is that I wanted to roughly mimic the vanilla distribution of effects of plants (hence also why some medicinal effects are more common than others), but I also didn't want to make any effects exclusive to certain types of plants (and I wanted to make berries actually worthwhile... if they don't kill you).

Crops don't have special effects because they are only meant to be used as a food source, not used for healing purposes, but throwing in a small chance of non-poisonous, non-psychoactive effects might be a good idea.

The plant type quotas is a good idea, but that'd take more than a little tweaking to implement. The easiest solution I could see would be to generate semi-randomized plants with certain characteristics first, then make fully-randomized ones after. If this is done without huge overhaul to the mod, though, these would have to be hardcoded to match certain plant types, since the individual flora files are generated entirely separately. So, for instance, instead of a guaranteed shamanic plant (of any type), it'd be a guaranteed magic mushroom, and so on. But it could work.

Flour should never be an issue with this mod. 33% of crops are grains, and all herbs produce seeds. (Making flour from certain roots should be possible, but, looking back over the code, it looks like it isn't possible after all. That was definitely an oversight on my part.) Threads and dyes are outside the scope of this mod -- forcing it by overriding the name generation to contain certain elements is possible (as you suggested), but it's honestly easier to just change the crafting recipes. Just don't mix plant types when crafting, and you're good.

It's theoretically possible for a region to end up devoid of plants, or at least mostly barren, but I'm not sure some minimum number of plant species is necessary to enforce. Each plant has a 1/3 chance of appearing in any given region (except southern, which is 1/2) and can appear in multiple regions (minimum of 1), and the mod generates a minimum of 30 species (not counting crops, as they're distributed differently), so that results in an average of at least ten species per non-southern region (though it'll realistically end up being around 15 per region).

Editable settings is something I've considered, but never got around to implementing because that'd be a ton of extra work. Adjusting the rate of poison by plant type is definitely a good idea, as well as being able to toggle whether or not deadly poison can occur. Maybe you want mushrooms to be more abundant. Maybe you want to go on an endless lsd trip. There's a lot of possibilities here, especially with settings that are highly customizable. (That's a lot of work, of course, but even something simpler like a difficulty setting (higher difficulty = higher chance of poison; lowest difficulty = no deadly) would add more depth.

Some berries and mushrooms can usually be found in winter, although this isn't hardcoded. On average, you'll wind up with 1-4 kinds of berries and 2-4 kinds of mushrooms that don't wither until December (Winter month). Only cranberries and Tellervo's gift mushrooms last this long in vanilla, so personally I think those are decent odds.

Your template idea is interesting, but it would also be difficult to implement, since it involves largely overriding the random generation. I'm also not sure how much point it'd even have -- correct me if I'm wrong, but if you can identify anything about a plant (even with uncertainty), doesn't it always tell you whether it's edible or not?

Stimulant plants do exist, and chances are you'll end up with at least a couple. There's a 1 in 10 chance any given medicinal or poisonous plant (hopefully edible when boiled!) will have a stimulant effect (although realistically the chance is slightly lower -- there's also a 1 in 10 chance for sedative, and the stimulant check is skipped for sedative plants, so it's more like a 10% chance for sedative, 9% for stimulant).

Personally, I don't see the need for mod-related recipes, mainly because the existing recipes in game (minus pea soup) don't call for specific ingredients. Regional dishes are an interesting idea, but seriously complicated to make. Right now, the mod just generates some herbs, dumps them in a text file, generates some crops, dumps them in another text file, and so on. Anything like recipe generation would require either a) overhauling the mod so that it holds onto all generated Plant objects to be referred back to later, instead of overwriting them once they've been dumped to a file, or b) creating a separate mod which takes flora files as input and works things out from there. I'm actually not sure atm which would be more practical.

I'm not sure if you can obscure plant names in cookery descriptions, or if you can create recipes with additional effects besides those of the basic ingredients, so I don't see what advantage recipes for medicines or psychoactive mixtures or medicines would have over simply boiling herbs and drinking them or using them in other recipes.

You've got a lot of interesting ideas, though. Thank you for the feedback!