Page 1 of 1
[0.13.18] [closed] take_screenshot crash
Posted: Sun Aug 21, 2016 11:07 pm
by Qon
I used the screenshot_tool here, but all it does is call take_screenshot so that is where the issues are.
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
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 4:22 am
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).
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 12:16 pm
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 12:52 pm
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
Would be nice if take_screenshot would support large images.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 1:54 pm
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
You can solve that in an image editor.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 3:50 pm
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
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 4:07 pm
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 4:33 pm
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?
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 4:43 pm
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 4:50 pm
by Qon
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 4:52 pm
by orzelek
Qon wrote:
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Mon Aug 22, 2016 5:38 pm
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.
Re: [0.13.17] take_screenshot crash on large areas and slowdowns
Posted: Thu Aug 25, 2016 5:54 pm
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?
Re: [0.13.18] [closed] take_screenshot crash
Posted: Thu Aug 25, 2016 7:08 pm
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.
Re: [0.13.18] [closed] take_screenshot crash
Posted: Thu Aug 25, 2016 9:07 pm
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