Open FaceDeer opened 5 years ago
I think it's a valid issue but I'd rephrase it and just require a hard dep on moreores.
Until reading this issue and going to check, I had always assumed this was already the case.
Technic already has a large number of hard dependencies that I find offputting, surely there's some other material already in Technic that could be used as a substitute for mithril when that mod isn't installed? My modding philosophy is that hard dependencies should only be for requirements that cannot be worked around with optional alternatives.
I agree with FaceDeer that deps are often bad. Code reuse is good but random dep networks become nightmares.
However technic makes little sense without a large number of special materials. One way or another, their availability (however rare) must be ensured.
Perhaps technic could use some refactoring to try compartmentalizing it a bit more, which could help with managing dependencies and making it easier to pick and choose which bits of technic to install. It seems a bit odd that if I want to add nuclear reactors using excruciatingly-detailed uranium formulations (I count 306 recipes created by the technic mod solely dedicated to mixing different kinds of uranium dust together) I also have to have magical metal from Tolkein's Middle Earth installed.
I've been working on a mod lately (simplecrafting_lib) that incidentally allows me to do large-scale analysis of a Minetest game's crafting recipes, which is how I noticed the unsatisfied mithril dependency (I just threw a bunch of mods together into a test world to give myself a lot of diverse recipes to work with). Out of curiousity, I just now tried installing the minimum hard dependency requirements for technic (just default
, basic_materials
, pipeworks
, mesecons
, and mesecons_mvps
) and found a few more recipes that depend on things that are only registered by optional dependencies:
technic:solar_panel
requires mesecons_materials:glue
technic:lv_compressor' requires
mesecons:piston`technic:tool_workshop
requires mesecons_pistons:piston_sticky_off
technic:sonic_screwdriver
requires mesecons_materials:fiber
(as well as the previously mentioned mithril ingot)Then I tried each of the technic modules separately. When just concrete
and its hard dependencies are installed:
technic:blast_resistant_concrete
requires technic:composite_plate
When just extranodes
and its hard dependencies are installed:
technic:insulator_clip
requires technic:raw_latex
technic:insulator_clip_fencepost
requires technic:raw_latex
There were also some pipeworks recipes that depended on moreores and on mesecon modules that aren't listed as hard dependencies, so this isn't just a technic problem. And my code currenly only just checks whether the required materials exist, not whether they're themselves craftable, so there could be other things that aren't tripping my error checks but that a player would be unable to craft in an actual game due to broken precursor recipes. Would it be helpful if I did some work trying to graph out these recipe networks and maybe write up a more detailed issue report?
This doesn't solve your concerns, but to shave off a few errant recipes: items that use glue should get it from basic_materials, and the insulator clips should be changed to use basic_materials' plastic sheet instead of raw_latex (since they're modeled after cheapie's plastic boxes).
Incremental improvements are still improvements, I'll never be unhappy with them. :)
I implemented a basic mod filter on simplecrafting_lib's graph output last night, so I figured since it was now trivial to produce a graph of technic's recipes I'd dump one here in case anyone was interested in taking a look:
This was made using the yEd graph editor, but graphml is a standard supported by other graph programs as well so though it may not look as pretty in those it should be possible to analyze with other tools.
A quick summary of how simplecrafting_lib digests and stores recipes: all recipes are shapeless, item counts are reduced to their least common factor (eg a recipe that went "2 stone + 4 sticks -> 2 stonesticks" would reduce to 1 stone + 2 sticks -> 1 stonestick), and item replacements are put into a different class of output called "returns" (there's a couple of default:bucket returns in technic's recipes). Furnace and fuel recipes are handled using an intermediate craftitem called "simplecrafting_lib:heat" - fuel recipes produce heat as output, furnace recipes require heat as input.
In yEd, items are represented by rectangles and recipes are diamonds. Normal recipes are called "table" recipes in this case because the test mod I'm using with simplecrafting_lib puts them into a crafting table. Group items have a grey background. Groups might be a good way to deal with some of these issues, perhaps.
The recipes in the graph are grouped into a couple of distinct sections. The furnace recipes are in that big radial wheel to the right, with the four fuel recipes below (an opportunity for enhancement there, surely more than just four things in this mod can be burned?). Along the bottom are all the uranium ingot <-> uranium block recipes as well as the uranium dust mixture recipes. I take it the "grinder" recipes that produce that dust in the first place aren't actually managed by Minetest's built in crafting system?
I'd be very interested to see a decently hi-res PNG of this. I have not found an Android app that will render it.
Here it is rendered as a PNG:
Probably not as useful as the graphml version, in yEd you can click around and see what connects to what in a "Neighborhood" window and search for specific nodes in a list. But it gives an overview, at least. I'll fiddle around a bit with the layout of the main group of recipes (the ones that don't have uranium in them) and see if I can find one that's a bit less visually tangled.
I've been manually disentangling the non-uranium section of the graph and it's starting to come together a little:
I take it this mod's recipes have grown somewhat organically over time? I'm seeing some patterns and natural groupings, but also a few oddities. The chainsaw is the only item that requires an on/off button, for example, which seems like something a lot of other tools could use too. The lava can requires zinc, which I find a bit odd since zinc is a low-melting-point metal, and I assume it's because the lava can was added at the same time as the water can which also requires it. Glue is only used to make solar panels, but glass is not - glass is only used to make cnc. Grinders have the peculiar requirement of default:desert_stone, I'm not sure what the motivation behind that is. There's an "island" of chest recipes made from various types of metals that don't seem connected to the rest of technic either thematically or as dependencies, and I see they've already been extracted into their own sub-mod, are they part of this modpack due to historical happenstance?
This is straying a bit far afield from just the mithril dependency, feel free to kick me into a different issue or to rename this one. I have to admit that I don't actually use technic, so the significance of some of these patterns is probably lost on me. But that might also give me a useful outside perspective, so if you like I could go on poking around and asking questions about some of these.
I appreciate the PNG; it supports the overall contention that the graph is complex.
But perhaps what's most needed is less detail. So long as a craft remains within a single mod, there's no issue in getting it to run. Intermod deps are critical. Unclear to me when (A deps on B) requires B loads before A but I smell trouble with mutual or circular dependency. Which... is likely only a matter of time.
My understanding is that crafting recipes don't get finalized until after the mod initialization step is finished, which means that circular dependencies will work fine. That's how I handle it in my own crafting system mod, anyway.
I was thinking of adding the option of colouring the item nodes of the graph according to the mod they come from, that would make it easy to tell at a glance where there are external dependencies. I'll see if I can get to that tonight.
Edit: here's the same graph as above but with random mod colours assigned. Unfortunately I had to regenerate it, so the layout is messy again:
There's a number of crafting recipes in this mod that depend on inputs from the moreores mod, but there aren't
minetest.get_modpath("moreores")
guards around them or alternative crafting recipes in the event that moreores is not installed (rendering these items uncraftable).namely: blue_energy_crystal, red_energy_crystal, mithril and silver dust, prospector, and sonic_screwdriver.