Visible Planets in Space

by Nauviax

Render the local planet behind platforms when in orbit. Now with parallax, rotation, and mod support!

Tweaks
a month ago
2.0
82.4K
Factorio: Space Age Icon Space Age Mod
Environment

i resolution switcher

11 days ago
(updated 11 days ago)

Hey there, I'm the author of the YAPR mod with the overhauled planets (https://mods.factorio.com/mod/YAPR)

I recently remastered all the planets and rendered them out in 4K and 1K for computers that are low on VRAM, but I'm not a programmer and have trouble integrating it with your mod, especially while maintaining resolution switching. Any chance you can help me out?

Cheers

10 days ago

It should be just adding a startup setting to your mod, and conditionally loading a sprite based on that. I’ll try to draft up a quick proof of concept later today that you can copy in.

Unless you’re done that and still running into issues? Either way I’ll be able to look properly one at my PC.

10 days ago
(updated 10 days ago)

Right so theoretically, a startup mod setting and a condition in your data.lua.

In settings.lua (In the same folder as data.lua) put this:
data:extend({
{
type = "bool-setting",
name = "yapr-high-res",
setting_type = "startup",
default_value = true,
order = "a-a"
}
})

And in data.lua you'll want this at the top:
local use_4k = settings.startup["yapr-high-res"].value

And this where you update each image:
if use_4k then
prototype.starmap_icon = "__YAPR__/graphics/"..name.."_1k.png"
prototype.starmap_icon_size = 4096
else
prototype.starmap_icon = "__YAPR__/graphics/"..name.."_4k.png"
prototype.starmap_icon_size = 1024
end

Assuming you have images ready named nauvis_1k and nauvis_4k for example, and the sizes are correct. They'll both be in the mod, but pretty sure just one will get loaded at runtime so it should save on performance.

Let me know if you run into issues.


Unrelated, but I saw your mod recommends no planet rotation. You can actually make your mod set this setting's default via a settings-updates.lua if you'd like, and even hide the setting afterwards. See here: https://wiki.factorio.com/Tutorial:Mod_settings#:~:text=Changing%20another%20mod%27s%20settings,-After

10 days ago
(updated 10 days ago)

I tried adding your code but ran into further problems. I've added a github repo here, maybe you can take a look? I'd appreciate it!

Generally, I'd like to have a resolution switcher, which allows selecting between 1K, 2K, and 4K. I just removed the 2K option to reduce the size of the mod (it was 170mb with that, now it's 130mb)

https://github.com/0mega47/factorio-mods/tree/main/YAPR_1.1.1

9 days ago

Had a brief look, here's what I saw initially:

local res_info = RES_INFO[RES] or RES_INFO["1K"]
'RES' is undefined/never created, so this will always use "1k". Looks like your 'use_4k' variable is unused too.

Additionally, your 1K graphics are actually 2K, so the size is wrong and it renders as just 1/4th of the sprite in-game. Because 1K is always used in code, both settings are doing this.

Implement the RES variable, and either up your size to 2K in code or get smaller 1K images.

(Will be off and on this weekend so apologies if I miss a reply around then)

9 days ago

Had a brief look, here's what I saw initially:

local res_info = RES_INFO[RES] or RES_INFO["1K"]
'RES' is undefined/never created, so this will always use "1k". Looks like your 'use_4k' variable is unused too.

Additionally, your 1K graphics are actually 2K, so the size is wrong and it renders as just 1/4th of the sprite in-game. Because 1K is always used in code, both settings are doing this.

Implement the RES variable, and either up your size to 2K in code or get smaller 1K images.

(Will be off and on this weekend so apologies if I miss a reply around then)

New response