[2.0.28] IconData default size depends on other IconData objects in the array

Bugs that are actually features.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 390
Joined: Tue Jul 08, 2014 10:06 am
Contact:

[2.0.28] IconData default size depends on other IconData objects in the array

Post by LuziferSenpai »

Hey,

so Semenar and me did some testing to find the problem in my mod.
We found then out when the first icon inside a icons array has no icon_size set and then another icon in that array has a bigger icon_size then the default value, it will produce a error. But when I then set the icon_size to the default value it will work.

Code: Select all

2.498 Error ParallelSpriteLoader.cpp:67: Parallel sprite loading failed, falling back to normal sprite loading. The given sprite rectangle (left_top=0x0, right_bottom=256x256) is outside the actual sprite size (left_top=0x0, right_bottom=64x64).
2.501 Error AtlasBuilder.cpp:1266: The given sprite rectangle (left_top=0x0, right_bottom=256x256) is outside the actual sprite size (left_top=0x0, right_bottom=64x64).
If this is not a bug, then there needs to be a improvement to the documentation.
But with it beeing fixed, when setting a value it seems like a bug to me.

Mods used:
  1. Enemy Race Manager Libraries
  2. Enemy Race Manager
  3. Enemy Race Manager Asset Pack
  4. Enemy Race Manager - Post Process
  5. ERM - Terran HD Graphic Assets
  6. ERM - Terran Units for Players
  7. More Casting
Update: More Casting needs to be a version before 0.0.10. (I added a temp fix)

Greetz,

Luzifer
Last edited by LuziferSenpai on Thu Jan 02, 2025 2:31 pm, edited 4 times in total.
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 390
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: [2.0.28] Parallel sprite loading failed / IconData default size depends on other IconData objects in the array

Post by LuziferSenpai »

Loewchen wrote: Fri Dec 20, 2024 9:04 pm Post the complete log please, see 3638.
raiguard told me to post it and he was fine with the message above.
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 706
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by raiguard »

When posting to the forums, always post the full log. We have some tooling that allows us to sync mods from a log file.
Don't forget, you're here forever.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 390
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by LuziferSenpai »

raiguard wrote: Sun Dec 22, 2024 8:56 pm When posting to the forums, always post the full log. We have some tooling that allows us to sync mods from a log file.
Ah I didnt know that.
Here you go.
factorio-current.log
(12.61 KiB) Downloaded 19 times
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

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

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by Rseding91 »

Looking into this, "defines.default_icon_size" is simply wrong and is not the default for all prototype types and as such isn't a viable value for all icon definitions. These prototypes use different defaults:

AchievementPrototype: 128
ShortcutPrototype: 32
ItemGroup: 128
TechnologyPrototype: 256
If you want to get ahold of me I'm almost always on Discord.
Bilka
Factorio Staff
Factorio Staff
Posts: 3357
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by Bilka »

Rseding91 wrote: Wed Feb 19, 2025 1:38 pm Looking into this, "defines.default_icon_size" is simply wrong and is not the default for all prototype types and as such isn't a viable value for all icon definitions. These prototypes use different defaults:

AchievementPrototype: 128
ShortcutPrototype: 32
ItemGroup: 128
TechnologyPrototype: 256
That is not correct. Those numbers are the expected icon size. The expected size affects some things about icons (such as scale), but icon_size itself defaults to 64 even for those prototypes. This is documented here: https://lua-api.factorio.com/latest/types/IconData.html
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15232
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by Rseding91 »

Bilka wrote: Wed Feb 19, 2025 2:22 pm That is not correct. Those numbers are the expected icon size. The expected size affects some things about icons (such as scale), but icon_size itself defaults to 64 even for those prototypes. This is documented here: https://lua-api.factorio.com/latest/types/IconData.html
Right, I missed that. But that makes this report even more confusing because the default is then fully always 64, so having it there (as 64) or not changes nothing on the engine side. That makes me lean even more towards this being a mod Lua definition error.

Is there some save I can sync mods with to reproduce this? Or some minimal mod that reproduces it so I can verify if it's a mod logic error or not?
If you want to get ahold of me I'm almost always on Discord.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 390
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by LuziferSenpai »

Rseding91 wrote: Wed Feb 19, 2025 2:33 pm
Bilka wrote: Wed Feb 19, 2025 2:22 pm That is not correct. Those numbers are the expected icon size. The expected size affects some things about icons (such as scale), but icon_size itself defaults to 64 even for those prototypes. This is documented here: https://lua-api.factorio.com/latest/types/IconData.html
Right, I missed that. But that makes this report even more confusing because the default is then fully always 64, so having it there (as 64) or not changes nothing on the engine side. That makes me lean even more towards this being a mod Lua definition error.

Is there some save I can sync mods with to reproduce this? Or some minimal mod that reproduces it so I can verify if it's a mod logic error or not?
more-casting_0.0.11.zip
(232.31 KiB) Downloaded 11 times
graphic_test_mod_0.0.1.zip
(109.64 KiB) Downloaded 10 times
These two mods together will break it.
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

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

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by Rseding91 »

You're melding the existing icon definition of:

Code: Select all

icons =
{
  {
    icon = "__graphic_test_mod__/advisor256.png",
    icon_size = 256,
  }
}
With a new icon definition that starts as:

Code: Select all

icons = {
  {
    icon = modName .. "/graphics/64x64-empty.png"
  }
}
Melding those two tables will result in:

Code: Select all

icons = {
  {
    icon = modName .. "/graphics/64x64-empty.png"
    icon_size = 256,
  }
}
Which will produce the exact error you're seeing. By specifying that the 64x64-empty.png icon_size is 64, meld uses the value from that and overwrites the 256 from the to-be-melded-into table.
If you want to get ahold of me I'm almost always on Discord.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 390
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by LuziferSenpai »

Rseding91 wrote: Thu Feb 20, 2025 3:58 pm You're melding the existing icon definition of:

Code: Select all

icons =
{
  {
    icon = "__graphic_test_mod__/advisor256.png",
    icon_size = 256,
  }
}
With a new icon definition that starts as:

Code: Select all

icons = {
  {
    icon = modName .. "/graphics/64x64-empty.png"
  }
}
Melding those two tables will result in:

Code: Select all

icons = {
  {
    icon = modName .. "/graphics/64x64-empty.png"
    icon_size = 256,
  }
}
Which will produce the exact error you're seeing. By specifying that the 64x64-empty.png icon_size is 64, meld uses the value from that and overwrites the 256 from the to-be-melded-into table.
That doesnt make sense that it would meld the first icon with the icon_size of the second.
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 390
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by LuziferSenpai »

Okay, after boskid's comment I now understand I made a error myself.
Sry.
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

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

Re: [2.0.28] IconData default size depends on other IconData objects in the array

Post by Rseding91 »

LuziferSenpai wrote: Thu Feb 20, 2025 4:41 pm That doesnt make sense that it would meld the first icon with the icon_size of the second.
That's what meld does.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”