Page 1 of 1

Screenshot every other tick

Posted: Wed Mar 18, 2020 2:01 am
by Basic
I'm trying to generate a video of a factory that's larger than the max render area. I'd like to capture 30-60 seconds.

It occurs to me that if I can trigger a "capture screenshot" every other tick, I could then stitch them back together at 30 FPS. (Or worst case, every tick and then either discard half or generate a 60FPS vid).

I don't care about wall-clock time for the capture so long as I can get a consistently-spaced set of frames to stitch back together. (Although I'd gladly accept a better approach)

Is there a way I can achieve this from the console? Or do I need to get more advanced?

Re: Screenshot every other tick

Posted: Wed Mar 18, 2020 11:22 am
by DaveMcW

Code: Select all

/c script.on_nth_tick(2, function()
  game.take_screenshot{
    position = {0, 0},
    resolution = {1920, 1280},
    zoom = 1,
    daytime = 0,
    show_entity_info = true,
    path = "movie/" .. game.tick .. ".png",
  }
end)
Note that the screenshot compression is quite slow and will drop frames if it can't keep up, so you might have to slow the game down to get a smooth video. If you have a lot of hard drive space, you could save as .bmp which doesn't use compression.