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
game.take_screenshot mapshot and working with headless
- LuziferSenpai
- Filter Inserter
- Posts: 345
- Joined: Tue Jul 08, 2014 10:06 am
- Contact:
Re: game.take_screenshot mapshot and working with headless
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.
- LuziferSenpai
- Filter Inserter
- Posts: 345
- Joined: Tue Jul 08, 2014 10:06 am
- Contact:
Re: game.take_screenshot mapshot and working with headless
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.
And the map view screenshot option would still be awesome, either way.
Re: game.take_screenshot mapshot and working with headless
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.
- LuziferSenpai
- Filter Inserter
- Posts: 345
- Joined: Tue Jul 08, 2014 10:06 am
- Contact:
Re: game.take_screenshot mapshot and working with headless
But does that already work on headless?boskid wrote: ↑Thu Oct 22, 2020 8:44 amhttps://lua-api.factorio.com/1.0.0/LuaG ... screenshotby_player :: PlayerSpecification (optional): If defined, the screenshot will only be taken for this player.
Re: game.take_screenshot mapshot and working with headless
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.
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.
- LuziferSenpai
- Filter Inserter
- Posts: 345
- Joined: Tue Jul 08, 2014 10:06 am
- Contact:
Re: game.take_screenshot mapshot and working with headless
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-apiboskid wrote: ↑Thu Oct 22, 2020 5:58 pmNo, 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.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: game.take_screenshot mapshot and working with 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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: game.take_screenshot mapshot and working with headless
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).
Re: game.take_screenshot mapshot and working with headless
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.
* 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.