max resolution for screenshots

Place to get help with not working mods / modding interface.
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

max resolution for screenshots

Post by semvoz »

Hello,

I experimenting with game.takescreenshot, and I have already crashed the game few times ( :roll: ) trying to apparently take a screenshot which is too big:
1371.019 Error Util.cpp:43: Unable to create sprite (11232X8928) probably not enough of video memory.
1371.806 Goodbye
Is there any way to know what the maximum size could be?
Is it dependent on the computer running the game (cf. 'probably not enough of video memory')?

I will do some trial and error, but if it is host dependent it might be a waste of time.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: max resolution for screenshots

Post by daniel34 »

Seems like it's taking a screenshot on 1:1 zoom, a very interesting function.

On my laptop it worked up to 4096x4096px (22MB png), with 8192x8192px it crashed.
I think it tries to save the image raw before compression and fails at some memory limit.
It could either be a hard limit depending on the engine or a limit set by the available graphics memory.
However, should you write a mod using this functionality, it may be better to use a smaller screenshot size, but call it more often (eg. 16 times for 1024x1024 instead of once for 4096x4096).

Related to mapping a save:
[MOD] Factorio Maps: https://forums.factorio.com/forum/vie ... =14&t=5812

You can also change the player/controller, the current position, zoom, showgui [true/false] and
showentityinfo [true/false], according to Lua/Game#takescreenshot.
quick links: log file | graphical issues | wiki
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

Re: max resolution for screenshots

Post by semvoz »

What I am trying to do is a mod which let you put two markers, and takes a screenshot in between these two markers.

The main goal is to screenshot a specific contraption or a design.
But I would guess some people could use it differently, so I should probably limit the maximum size that can be 'screenshoted'.
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

Re: max resolution for screenshots

Post by semvoz »

Hello again,

I have done a bit of testing by generating custom maps, while changing its size incrementally to try my 'mod'.
After a few tries, I have been able to find out that, at least on my machine (which is more a developer box than a gaming machine), the limit was exactly for a map of 256 * 256, meaning 8192px * 8192 px (256 tiles * 32 px/tile).

I was able to take a screenshot of the whole map, which I would not advice as it generate a PNG file of about 110 Mb.
When I tried with a map of 257 * 257 the game crashed when taking the screenshot, so it looks like the limit is about 8192px * 8192px.

Hope the information can be useful to someone :)
User avatar
Gandalf
Filter Inserter
Filter Inserter
Posts: 294
Joined: Fri Dec 19, 2014 10:15 pm
Contact:

Re: max resolution for screenshots

Post by Gandalf »

I'm pretty sure that the limit depends on your setup. More RAM / VRAM may help, also architecture (32bit/64bit) may have an influence.

If you're planning to create map-like screenshots of large areas I'd suggest splitting them up into manageable sized tiles. You could then either merge those via an external script or patch them together in a HTML page and open that in a browser (similar solutions exist for minecraft).
OS: Linux Mint 19 x64 | desktop: Awesome 4.2  |  Intel Core i5 8600k  |  16GB DDR4  |  NVidia GTX 1050 Ti (driver version: 410.104)    (2019-03)
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

Re: max resolution for screenshots

Post by semvoz »

Thanks Gandalf,

I will do a bit of testing research on that (pretty sure I can find a 32 bit based computer at work :mrgreen: ).

I am not planning to do a map like system, it's only for a small utility mod I'm thinking to publish soon. Just wanted to have a safe limit as going above would crash the game.

In that case I might have to publish two different packages one for 32 bits and one for 64 bits, as I'm guessing there's no way to detect that ingame.

My development box is running on archlinux x86_64 on a development oriented machine so I don't really have a killer gaming machine, actually I am pretty sure my graphic card is totally unused for factorio at the moment. So I would think the architecture might have an effect. Will post my research result :)
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: max resolution for screenshots

Post by daniel34 »

More test results:

Laptop with Windows 8.1 64-bit, Radeon HD 8500M with 1GB DDR3, 6 GB RAM, i7 processor:
4096x4096 works fine, 8192x8192 crashes
Further testing: limit seems to be 6400x6400 (200 tiles), crashes with 6656x6656

Desktop PC with Windows 7 64-bit, GeForce GTX 750 Ti with 2GB SDR, 16 GB RAM, Phenom II x4 processor:
8192x8192 working, 16384x16384 not working
8224x8224 (257 tiles) also working
Further testing with intervals of 8 tiles:
last one working was 11776x11776 (368 tiles), resulting in a 222 MB png file.

First the GPU memory used gets up until almost 2GB from the initial 800MB (capturing part), then the Factorio process goes to 33% cpu usage and the RAM usage goes from 40% to 80-90% (saving part).
If set too high it always fails at the capturing part and the RAM usage never goes up.

All tests done on vanilla factorio with a new game.
quick links: log file | graphical issues | wiki
Post Reply

Return to “Modding help”