Dynamically render item icon based on item data

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Neutrality
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jan 31, 2020 5:10 am
Contact:

Dynamically render item icon based on item data

Post by Neutrality »

I'd like to be able to
1) render multiple different images over an item icon based on data in that item, whether this feature uses an ItemWithInventory or ItemWithEntityData or something else, and
2) be able to read and write that data

For my use case, currently I'm just generating a very very large number of different items that each define their composed icon via the icon prototype icons layers (currently up to 18 layers), but the prototype limit means I can't generate more than 65536 different composed item icons. Instead I'd like to have one item prototype that just renders internal components individually

What I know so far:
- item prototypes can have static icon layers
- ItemWithInventory and BlueprintBook render their contents over their icons, even on a transport belt, and the icon changes dynamically when adding or removing from their inventories, even on a transport belt

Rseding91
Factorio Staff
Factorio Staff
Posts: 13231
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Dynamically render item icon based on item data

Post by Rseding91 »

What are you trying to do? The fact you need more than 65,000 items seems very .. off.
If you want to get ahold of me I'm almost always on Discord.

Neutrality
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jan 31, 2020 5:10 am
Contact:

Re: Dynamically render item icon based on item data

Post by Neutrality »

The idea I'm working on has items that are themselves dynamic 3x3 grids of smaller items. Each of the 9 cells can be one of many different smaller sub-items, which means that for X different sub-items that can go in the grid, there are X^9 different resulting grids. The actual math for the number of items is different but the original number of distinct item possibilities was in the -illions, don't know the exact magnitude right now

Rseding91
Factorio Staff
Factorio Staff
Posts: 13231
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Dynamically render item icon based on item data

Post by Rseding91 »

You may need to re-think your idea because even if that would work item count wise; the memory usage to have them all defined would be non-viable.
If you want to get ahold of me I'm almost always on Discord.

Neutrality
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jan 31, 2020 5:10 am
Contact:

Re: Dynamically render item icon based on item data

Post by Neutrality »

Currently what I have defines 57934 of the items I had planned, which is good enough for the mod experience to still work. It takes a little while to load, and it only seems to add about 200MB RAM or so (loaded a test world using ~700MB without items vs ~900MB with items). Most item selections don't have any slowdown, unless you switch to the tab with the giant items list defined.

Overall it works fine enough as it is, it would just be nice to be able to do dynamic items.

curiosity
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Dynamically render item icon based on item data

Post by curiosity »

Rseding91 wrote:
Tue Apr 04, 2023 2:30 am
You may need to re-think your idea because even if that would work item count wise; the memory usage to have them all defined would be non-viable.
This request is the rethinking.

Neutrality
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jan 31, 2020 5:10 am
Contact:

Re: Dynamically render item icon based on item data

Post by Neutrality »

I mean, I wouldn't outright abandon what I'm working on, and there isn't really a better way to do the icons currently, that's what this feature request is for.

I could have a smaller number of "grid shape" items where the sub-items are visually indistinguishable in the item icon, but I'd like to have the item icons always render the entire contents of the sub-items. It works well enough as it is with 50k of the quadrillion (68,574,768,928,886,778) possible combinations, but it would be nice to be able to support all of them via one item with dynamic item icons.

I'd understand if there was a technical reason that it'd be too hard or anti-performant to make that happen though.


Post Reply

Return to “Modding interface requests”