Automatic removal of redundant technology prerequisites

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Pi-C
Smart Inserter
Smart Inserter
Posts: 1788
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Automatic removal of redundant technology prerequisites

Post by Pi-C »

On loading a game with several mods active, I found about 70 lines similar to this in my log:

Code: Select all

  39.107 Difficulty normal: Technology prerequisite 'steel-processing' on 'military-2' is redundant as 'coal-processing-1' already contains it in its prerequisite tree.
Of course, mods should make sure that the tech tree is clean, but that is next to impossible because any mod loaded after yours may wreak havoc again. I wonder if it would make sense to leave cleaning the tree to the game. Obviously, it already checks the entire tree (otherwise, there would be no warnings). It also does so on the final tree, which mods can't do. So why not take it one step further and remove the redundant prerequisites? This would benefit players of heavily modded games because it's easier to read the dependency tree if there are less lines cluttering the screen. Also, it may make loading even faster because their would be no motivation for modders to clean up the tech tree on their own. Just imagine several mods trying to do this, recursively traversing the complete tree … :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Automatic removal of redundant technology prerequisites

Post by ssilk »

In my opinion this is some kind of work, that should be done when uploading the mod to the mod-server. Only in a centralised surrounding this can be checked.
But that's a completly different topic. :) Sorry for sidekick.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Pi-C
Smart Inserter
Smart Inserter
Posts: 1788
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Automatic removal of redundant technology prerequisites

Post by Pi-C »

ssilk wrote: Tue Apr 21, 2020 5:06 pm In my opinion this is some kind of work, that should be done when uploading the mod to the mod-server.
Sorry, but that's not practical, it has to be done on starting Factorio, based on the combination of mods that are used (if mods are used at all -- vanilla should be fine as it is).

For example, my Inlaid UV-Lamp mod uses inlaid lamps (provided by any of 3 mods currently) to replace the UV lamps yet another mod provides (based on the default lamp if my mod isn't active) with an inlaid UV lamp that vehicles can drive over without damaging it. Now, one of the inlaid lamp mods just replaces the default lamp, so once you've researched optics, all lamps will automatically be inlaid lamps. The other mods add inlaid lamps, so once you've researched optics and unlocked the vanilla lamp, you have to research a new technology to unlock inlaid lamps, and their recipe requires a default lamp to make an inlaid lamp. Now, the mod that gives you the UV lamps needs just a vanilla lamp if it's used alone, so it has optics as prerequisite. If my mod is active, it changes the recipe for the UV lamp to require an inlaid lamp. No problem if the first inlaid lamp mod is required -- optics still is necessary as prerequisite in this case. If one of the other mods is used, however, the UV lamp mod requires an inlaid lamp which, in turn, requires optics as prerequisite. So, it now would require optics and inlaid lamps -- but as inlaid lamps already require optics, the UV lamp mod's dependency on optics has become redundant.

In this case, I've cleaned up and taken care that the UV lamps mod won't depend on optics if it's already required by one of the inlaid lamp mods. But my mod is small, providing just one new entity. Now imagine a big mod creating heaps of new items and technologies. Imagine further that it could be used alongside any number of different mods that may or may not modify any of the recipes, technologies etc. of the big mod. It's impossible to think of how adding or removing a random mod may impact the big mod -- so, depending on what mods are active, the technology tree may be quite different each time you start the game.
ssilk wrote: Tue Apr 21, 2020 5:06 pm Only in a centralised surrounding this can be checked.
I agree with that: pruning the technology tree must happen in a central place because each mod doing it's own thing is not error proof. But this central place can't be the mod portal -- it must be the game. So each time Factorio is started, the complete tech tree must be checked for redundancies after all mods are done with changing data.raw (which already happens), and this also is the time when the redundant prerequisites should be removed from the technology tree (which I wish to happen).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Ideas and Suggestions”