Page 1 of 1
Dynamically render item icon based on item data
Posted: Mon Apr 03, 2023 6:30 pm
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
Re: Dynamically render item icon based on item data
Posted: Tue Apr 04, 2023 2:11 am
by Rseding91
What are you trying to do? The fact you need more than 65,000 items seems very .. off.
Re: Dynamically render item icon based on item data
Posted: Tue Apr 04, 2023 2:23 am
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
Re: Dynamically render item icon based on item data
Posted: Tue Apr 04, 2023 2:30 am
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.
Re: Dynamically render item icon based on item data
Posted: Tue Apr 04, 2023 2:39 am
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.
Re: Dynamically render item icon based on item data
Posted: Tue Apr 04, 2023 6:48 am
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.
Re: Dynamically render item icon based on item data
Posted: Thu Apr 06, 2023 3:18 pm
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.
Re: Dynamically render item icon based on item data
Posted: Wed May 03, 2023 6:49 pm
by Neutrality