game.take_screenshot mapshot and working with headless

Things that we aren't going to implement
Post Reply
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 333
Joined: Tue Jul 08, 2014 10:06 am
Contact:

game.take_screenshot mapshot and working with headless

Post by LuziferSenpai »

Hey,

it would be awesome to have the option to the screenshot the map itself and do that on a headless server, because for Community Events like Red-Circuit's Molten Silicon we would love to beable to just screenshot every x seconds the 2k x 2k map with the custom scenario, that I created.

Greetz,

Luzifer
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by Rseding91 »

This isn't going to happen. The headless version of the game does not ship with any graphics logic enabled and so can't do anything with graphics.
If you want to get ahold of me I'm almost always on Discord.

User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 333
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by LuziferSenpai »

But why then not allow us to give a player_id and then take the screenshot from the player's client? That would go around the graphic problem.
And the map view screenshot option would still be awesome, either way.
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2244
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by boskid »

https://lua-api.factorio.com/1.0.0/LuaG ... screenshot
by_player :: PlayerSpecification (optional): If defined, the screenshot will only be taken for this player.

User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 333
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by LuziferSenpai »

boskid wrote:
Thu Oct 22, 2020 8:44 am
https://lua-api.factorio.com/1.0.0/LuaG ... screenshot
by_player :: PlayerSpecification (optional): If defined, the screenshot will only be taken for this player.
But does that already work on headless?
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2244
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by boskid »

No, it does not work on headless because headless never renders anything. For screenshots you need a fully capable client with graphics. You may solve this for example by having your own delegated client called "i_am_for_screenshots" that is under your control and have a game script that calls take_screenshot with by_player="i_am_for_screenshots". That way headless will host a game and delegated client will render screenshots.

per force charts are rendered by headless on a chunk-base since they are part of game state and are delivered in saves to connecting clients. Even with this in mind i would not let headless to be able to take any screenshots to a file.

User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 333
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by LuziferSenpai »

boskid wrote:
Thu Oct 22, 2020 5:58 pm
No, it does not work on headless because headless never renders anything. For screenshots you need a fully capable client with graphics. You may solve this for example by having your own delegated client called "i_am_for_screenshots" that is under your control and have a game script that calls take_screenshot with by_player="i_am_for_screenshots". That way headless will host a game and delegated client will render screenshots.

per force charts are rendered by headless on a chunk-base since they are part of game state and are delivered in saves to connecting clients. Even with this in mind i would not let headless to be able to take any screenshots to a file.
Yea, the player is not the problem. What I mean is, that the info says it will not work on headless. So in the lua-api
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by eradicator »

LuziferSenpai wrote:
Thu Oct 22, 2020 7:26 pm
that the info says it will not work on headless.
When you join a server with a standard graphical client then that graphical client is not running headless.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

palats
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Sep 23, 2020 7:16 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by palats »

Fwiw, it seems to work to run Factorio through Xvfb - thus in practice allowing to take screenshot from a headless server, as long as it is still a regular install of Factorio (not running Factorio in server mode though, which does not load graphics, headless or not).

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: game.take_screenshot mapshot and working with headless

Post by Rseding91 »

Seems there's some confusion about what "headless" means in Factorio.

* The dedicated headless linux download: compiled with zero graphics - only runs the server.
* Any version of the game run with --start-server/variants: headless mode - no graphics are loaded/enabled.
* Any version of the game with graphics: *not* headless and can do things like take_screenshot.

You can connect any graphics-enabled version of the game to the headless version of the game. "headless" just means "running as a server without graphics". The graphics enabled versions of the game can use take_screenshot while connected to a headless server.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”