[0.13.18] [closed] take_screenshot crash

This subforum contains all the issues which we already resolved.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

[0.13.18] [closed] take_screenshot crash

Post by Qon »

I used the screenshot_tool here, but all it does is call take_screenshot so that is where the issues are.
error message
Also when using take_screenshot with a command successfully each next screenshot takes longer time until the game crashes, even if the parameteres are the same.
Something like this:

Code: Select all

/c game.take_screenshot{resolution = {x = 1920*4, y = 1080*4*0.65}, zoom = 0.138}
A possible solution would be for take_screenshot to take several screenshots in succession and merge them afterwards to one file when it's not possible to do it in one batch and have the full picture in video memory at once. I want my whole belt balancer in one picture in high enough quality so that you can see what is going on. But it's not really possible when Factorio crashes all the time :s
Last edited by Qon on Thu Aug 25, 2016 5:56 pm, edited 1 time in total.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Rseding91
Factorio Staff
Factorio Staff
Posts: 14631
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Rseding91 »

Please upload your save and steps to reproduce the issue.

Do note: it's not possible for Factorio to make a screenshot that can't fit in VRAM - requesting an image of something like 50,000 x 50,000 since the current implementation can't make that image without enough VRAM to store it and no system I know of today supports texture sizes that large (or loading an image that large into VRAM).
If you want to get ahold of me I'm almost always on Discord.
posila
Factorio Staff
Factorio Staff
Posts: 5409
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by posila »

Goal of take_screenshot is not to be able to take arbitrarly large screenshots, but it shouldn't crash.

Engine limit for screenshot is size 32767, but you GPU has to be able to create render target of that size, so real-life maximum is 16384 or 8196 depending on your GPU. But 8196x8196 is still huge render target, so mods should not attempt to take screenshots larger then 4096x4096, imho.
So we should definitely limit size of screenshot to 16384.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Qon »

Rseding91 wrote:Please upload your save and steps to reproduce the issue.
Save here: viewtopic.php?f=8&t=31230#p197503 (That post also contains a screenhot of the blueprint view of the balancer with some strange coloring. I think it's an aliasing issue but take a look in case it isn't.)
Steps for the crash and error in the picture in OP:
  • Go to the top left corner of the 512 belt balancer
  • Use the screenshot_tool there, keep holding
  • Go to the bottom right of the belt balancer and release your mouse button to take the screennshot
I use the 20x20 PAMKII armor mod with 30 exoskeleton legs + Creative Mode mod that speeds up your character to be able to walk from one side to the other. I guess you should at east use a command to speed up your character a bit.

Steps for the slowdown and eventual crash:
  • (1) Stand in the center of the 512 balancer.
  • (2) Take a screenshot of it with the command

    Code: Select all

    /c game.take_screenshot{resolution = {x = 1920*4, y = 1080*4*0.65}, zoom = 0.138}
  • (3) Repeat step (2). Each time it takes noticably longer time to take the screenshot until it eventually crashes. The crash message is different from the other message.
Rseding91 wrote:Do note: it's not possible for Factorio to make a screenshot that can't fit in VRAM - requesting an image of something like 50,000 x 50,000 since the current implementation can't make that image without enough VRAM to store it and no system I know of today supports texture sizes that large (or loading an image that large into VRAM).
posila wrote:Goal of take_screenshot is not to be able to take arbitrarly large screenshots, but it shouldn't crash.

Engine limit for screenshot is size 32767, but you GPU has to be able to create render target of that size, so real-life maximum is 16384 or 8196 depending on your GPU.
So we should definitely limit size of screenshot to 16384.
Well then I can't fit a single belt balancer in one screenshot in high quality :x
Would be nice if take_screenshot would support large images.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
posila
Factorio Staff
Factorio Staff
Posts: 5409
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by posila »

Fixed the crash when you try to take too large screenshot.
I could not reporduce slowdown nor crash when you call take_screenshot multiple times (I tried 30 times), please post the Factorio log.
Qon wrote:Well then I can't fit a single belt balancer in one screenshot in high quality :x
You can solve that in an image editor. ;)
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Qon »

posila wrote:I could not reporduce slowdown nor crash when you call take_screenshot multiple times (I tried 30 times), please post the Factorio log.
Here it is:
factorio-current.log
Produced according to the steps written before.
(13.83 KiB) Downloaded 97 times
posila wrote:
Qon wrote:Well then I can't fit a single belt balancer in one screenshot in high quality :x
You can solve that in an image editor. ;)
I guess I'll have to do it that way. If I mod screenshot_tool to recursivly split the region when take_screenshot returns false (I assume that is what is going to happen in 0.13.18 instead of the crash) and learn to use image magick for splicing the images then I could get a relativly pain free screenshot process.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
posila
Factorio Staff
Factorio Staff
Posts: 5409
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by posila »

Qon wrote:I guess I'll have to do it that way. If I mod screenshot_tool to recursivly split the region when take_screenshot returns false (I assume that is what is going to happen in 0.13.18 instead of the crash) and learn to use image magick for splicing the images then I could get a relativly pain free screenshot process.
take_screenshot either throws an error if parameters are invalid or out of bounds, or it will return nothing. If some internal error (like failure to allocate render target) prevents screenshot to be taken, you won't be able to detect it in Lua. There are two reasons for this:
1) It is to prevent possible desync when take_screenshot would succeed for some players and failed for others.
2) take_screenshot() actually only queues command to take screenshot which is processed after game update is finished and just before game view is rendered.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Qon »

posila wrote: take_screenshot either throws an error if parameters are invalid or out of bounds, or it will return nothing.
So I should run take_screenshot with pcall() and base splitting logic on return value of pcall() instead?
posila wrote:If some internal error (like failure to allocate render target) prevents screenshot to be taken, you won't be able to detect it in Lua. There are two reasons for this:
1) It is to prevent possible desync when take_screenshot would succeed for some players and failed for others.
2) take_screenshot() actually only queues command to take screenshot which is processed after game update is finished and just before game view is rendered.
But that should never happen if your bounds checking is correct? take_screenshot will just throw an error if the area is too big, right?
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by orzelek »

If you want screenshot from above command is here:
http://www96.zippyshare.com/v/iLSWU8FL/file.html

I can create one that is 4x size - will add a link after it uploads.
Last edited by orzelek on Mon Aug 22, 2016 4:52 pm, edited 1 time in total.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Qon »

orzelek wrote:If you want screenshot from above command is here:
http://www96.zippyshare.com/v/iLSWU8FL/file.html
Thanks but I already have it. That command is successful the first few times, as I wrote above. Thanks for trying though. My picture has other colors though.

I'm just trying to improve the screenshot process for future builds at the moment.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by orzelek »

Qon wrote:
orzelek wrote:If you want screenshot from above command is here:
http://www96.zippyshare.com/v/iLSWU8FL/file.html
Thanks but I already have it. That command is successful the first few times, as I wrote above. Thanks for trying though. My picture has other colors though.

I'm just trying to improve the screenshot process for future builds at the moment.
Heh my edit was to late - want the big one? I changed multipliers to 8. With multipliers 16x it gave up.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Qon »

Yes please. You can link it in my thread about the 512 balancer.

I have modified screenshot_tool to be able to take arbitrary sized areas (as long as Factorio can handle calling take_screenshot several times) at 100% zoom now but I can't splice them yet automatically and 100% is way too high quality. Also I split the image in 2 when the tile length is larger than 100, so it works on my machine but not guaranteed on all machines. Need the next release for that juicy bug fix to be able to handle that automatically.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.13.17] take_screenshot crash on large areas and slowdowns

Post by Qon »

This bug is not resolved. Tried 0.13.18. Crash log submitted.

And now the take_screenshot command sometimes silently just fails to take pictures when I try to take large pictures < 512*32 side length. I need to know if it took a picture so that I can try again with a smaller size if it fails.
posila wrote:
Qon wrote:I guess I'll have to do it that way. If I mod screenshot_tool to recursivly split the region when take_screenshot returns false (I assume that is what is going to happen in 0.13.18 instead of the crash) and learn to use image magick for splicing the images then I could get a relativly pain free screenshot process.
take_screenshot either throws an error if parameters are invalid or out of bounds, or it will return nothing. If some internal error (like failure to allocate render target) prevents screenshot to be taken, you won't be able to detect it in Lua. There are two reasons for this:
1) It is to prevent possible desync when take_screenshot would succeed for some players and failed for others.
2) take_screenshot() actually only queues command to take screenshot which is processed after game update is finished and just before game view is rendered.
Is there anything I can do to solve this except taking small screenshots and hope for the best and then maybe get a screenshot?
Attachments
factorio-current.log
(10.72 KiB) Downloaded 97 times
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
posila
Factorio Staff
Factorio Staff
Posts: 5409
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.13.18] [closed] take_screenshot crash

Post by posila »

EDIT: The goal you want to achieve is perfectly solvable with tools you have already available. 4096x4096 should work fine on most configurations ... but some people may be playing with GPU that can handle only 2048x2048 ... but screenshot would probably fail on such system anyway. You can search for Factorio Google Map mod and see how that worked.

You previously asked if you can queue up multiple screenshots in single tick. Yes, you can.

As for crash: the resolution limit for screenshots with antialiasing enabled should have been 8196x8196 that is an oversight on my part.
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.13.18] [closed] take_screenshot crash

Post by orzelek »

That big 15k by 11k screen I did was with mutli-sampling set to 4 so it should work up to 16k by 16k?
That could also explain why I was unable to make a bigger one :D
Post Reply

Return to “Resolved Problems and Bugs”