[Implemented] Extend status_color to be accessible by CraftingMachines

Things that already exist in the current mod API
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

[Implemented] Extend status_color to be accessible by CraftingMachines

Post by Deadlock989 »

Working visualisations got loads of cool stuff in 0.18. Drills can set apply_tint = "status" in individual layers. This allows you to tint things based on the state of the drill (e.g. disabled by circuit, blocked output, idle, low power, out of resources). The tints themselves are defined per status in a status_color table in a MiningDrillGraphicsSet.

Some of those statuses also apply to CraftingMachines: all of them in fact except "disabled" and "no_minable_resources". The "no input" and "output blocked" statuses might have a different meaning for crafting machines (in drills they only seem to refer to the state of the fluid boxes, not sure).

It would be useful fun (the best kind of fun) to have this for assemblers and furnaces. A side effect would be freeing up mods like Bottleneck from having to eat up runtime with hundreds or thousands of status checks.

It would mean moving all the existing CraftingMachine animations into a "CraftingMachineGraphicsSet", consistent with the new drill and beacon specs, so that you can define the status_color table. I can see why that might be a minor nightmare, but it would be Nice To Have more consistency for all these machines that basically turn on and off when stuff goes in and/or out:

CraftingMachines: animation and working_visualisations
Labs: on_animation and off_animation
Generators: animation and idle_animation
Drills: MiningDrillGraphicsSet (including animations and working_visualisations)
Beacons: BeaconGraphicsSet (including animations and working_visualisations)
Boilers: structure, fire and fire_glow
Last edited by Deadlock989 on Mon Oct 05, 2020 8:13 pm, edited 1 time in total.
Image

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [Request] Extend status_color to be accessible by CraftingMachines

Post by posila »

Crafting machines (= assembling machines and furnaces) do already load status_color property that's at the same level as working_visualisations and apply_tint = "status" should work on them too, iirc. They just have not been changed to encapsulate graphics definitions in graphics_set table, yet.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [Request] Extend status_color to be accessible by CraftingMachines

Post by Deadlock989 »

So they do - how excellent. Thanks.
Image

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [Implemented] Extend status_color to be accessible by CraftingMachines

Post by posila »

Deadlock989 wrote:
Fri Oct 02, 2020 3:16 pm
Got there in the end. This spec is actually lot easier to manage and more powerful than the old way.
I appreciate you saying that. Thanks.

My long term "vision" is to make entity graphics definitions more generic and somewhat unified, at least to some extent. While it would probably be possible to design a system that would be completely universal and allowed to define graphics for any entity, it would be quite slow, too slow for amount of stuff the game potentially needs to render every frame. So my plan is to have "families" of graphics definitions. So far mining drills and crafting machines are in the same family.

Beacon has its own family as it basically has two states of operation - power or unpowered, but then it has different visuals based on content of its module inventory. My goal with beacon definition was again to make it easy to add new stuff (new beacon entities, new module items), and make it possible to define your own graphics if you want to put work into it. On the other hand it has animation_list, which is similar to working visualizations, but is not the same. I did that with "unification of the definitions" in mind, so I hope that was good decision and won't create confusion in the future.

Other entities will be changed too, eventually ... hopefully :D

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [Implemented] Extend status_color to be accessible by CraftingMachines

Post by Deadlock989 »

The module stuff on the beacons is interesting and it would be cool to see more stuff like that moved out of the domain of alt-info icons. I still fantasise about having machines that visually animate the making of the things they're working on. This is a proof of concept - but they pretty much have to be separate machines dedicated to one item type each.



In theory you could shoehorn four visual things like this into a recipe crafting tint deal, where three of them are tinted fully transparent at any one time (e.g. if the machine is making gears, it sets the alpha of the plate, ingot and cable layers to transparent) - but that seems like a big waste of rendering time and if you wanted to use a properly tinted layer as well (like the colour tint in the metals above) you're down to a maximum of two different item animations per machine. What would be awesome is if a recipe could specify an art style for a working visualisation layer, like modules can specify the "module art" for beacons, and none of the other layers were drawn at all while that recipe was active.

Now that all the advanced render order and draw_as_light stuff is available for working visualisations on crafting machines, labs and generators are top of my wish list. Labs in particular could use some love. I get that most people just have a block of them in some part of their base they rarely visit but still. Now that drills have become so powerfully animated (I haven't even looked at that waypoint stuff yet), labs feel pretty primitive. They can't even halt on a specific frame if they stop working, they just jerk back to the off_animation.
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [Implemented] Extend status_color to be accessible by CraftingMachines

Post by Deadlock989 »

Just another note of appreciation to recognise how much better lit-up things can look at night now that we can use draw_as_light in crafting machine working vis, so you don't have to spam everything with huge coloured lights any more. I found a couple of places in vanilla that would benefit from this (e.g. oil refinery flame). Also seeing whole sections of your factory glow red when there's a power outage, or cold blue when starved of ingredients, is extremely satisfying.

Image
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [Implemented] Extend status_color to be accessible by CraftingMachines

Post by Deadlock989 »

A big shout-out for adding the "fadeout" parameter to working vis as well. That's awesome. Vanilla seems only to be using it for mining drill smoke but it makes effects like additive furnace glows so much better (e.g. intermittent starting and stopping due to a partially blocked belt).
Image

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Implemented] Extend status_color to be accessible by CraftingMachines

Post by Klonan »

Deadlock989 wrote:
Thu Oct 15, 2020 5:11 pm
Vanilla seems only to be using it for mining drill smoke
For now :)

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [Implemented] Extend status_color to be accessible by CraftingMachines

Post by posila »

Fadeout was actually added by kovarex for cheminal plant smoke.

The assembling machines with recipe-dependent animation look pretty rad, but I am afraid it is too much for Factorio :/ at least while we still load all the graphics assets at the startup :(. And I feel like beacon graphics definition is quite convoluted and don't really want to put it everywhere. Also I am afraid of entering realm where items just appearing in inserter hands start to look like there is an animation missing :lol:

Post Reply

Return to “Already exists”