Has tile been discovered? Is it currently visible?
Has tile been discovered? Is it currently visible?
I'm trying to write a script that can take screenshots on the server-side. I can get the tiles that are at a given location, but I have no idea if they are visible to anyone, or if they have been discovered.
game.surfaces[1].getTile(x,y) will return the tile if it has been generated, but how can I know if the player has visited this tile ever? Or if it's visible to any radar/player?
game.surfaces[1].getTile(x,y) will return the tile if it has been generated, but how can I know if the player has visited this tile ever? Or if it's visible to any radar/player?
Re: Has tile been discovered? Is it currently visible?
Force:rolaca11 wrote: βThu Dec 10, 2020 4:31 pmI'm trying to write a script that can take screenshots on the server-side. I can get the tiles that are at a given location, but I have no idea if they are visible to anyone, or if they have been discovered.
game.surfaces[1].getTile(x,y) will return the tile if it has been generated, but how can I know if the player has visited this tile ever? Or if it's visible to any radar/player?
https://lua-api.factorio.com/latest/Lua ... nk_charted
https://lua-api.factorio.com/latest/Lua ... nk_visible
Surface:
https://lua-api.factorio.com/latest/Lua ... _generated
Last edited by darkfrei on Fri Dec 11, 2020 2:27 pm, edited 1 time in total.
Re: Has tile been discovered? Is it currently visible?
When will this be true? If a chunk is completely visible, or if parts of a chunk are visible?
If I understand the question correctly, @rolaca11 was interested in whether a particular tile within a chunk is on the radar. According to the wiki, radars chart "an area of 7Γ7 chunks (224Γ224 tiles), centered on the chunk the radar occupies". This would mean that chunks are charted completely (3 chunks in each direction from the center). But how about mods that set radar.max_distance_of_sector_revealed to an even number? If I were to set it to 6, the radar would only cover 2.5 chunks in each direction from the center, so the far sides of the most distant chunks shouldn't be in range of the radar. Or is every chunk that's at least partially within the area of a radar scanned completely?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Has tile been discovered? Is it currently visible?
Visibility is only tracked in units of one chunk, you can't have partially visible chunks.
Re: Has tile been discovered? Is it currently visible?
This. That's why moving a radar over a chunk border moves the coverage area, but moving it within the chunk doesn't affect anything.
A position is visible if it is in a chunk that is currently revealed by a radar, player or spidertron. A position is charted if it has ever been revealed at some point.
Re: Has tile been discovered? Is it currently visible?
Interesting. So, radar.max_distance_of_sector_revealed will always be rounded up to the next odd integer? Last time I worked on my Maps mod, I've thought about dropping invisible short-vision radars that constantly keep tabs on a small area, so this would be good to know if I ever get to implementing that.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Has tile been discovered? Is it currently visible?
OK, seems like I'll have to work on the logic for revealing areas in my mod again β¦ in the future. Thanks for the info!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Has tile been discovered? Is it currently visible?
Sidenote: As far as i am aware the api does not allow runtime access to tile variations. Thus by getting just the tile type you won't be able to get a correct representation of the map as the players see it.
All of these are just "grass-1".
- Attachments
-
- debug_tilevar4.png (26.08 KiB) Viewed 3270 times
-
- debug_tilevar3.jpg (9.26 KiB) Viewed 3270 times
-
- debug_tilevariation.png (4.53 KiB) Viewed 3270 times
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: Has tile been discovered? Is it currently visible?
Thank you, really appreciate it. Seems like I completely misunderstood what this class is meant to representdarkfrei wrote: βThu Dec 10, 2020 4:59 pmhttps://lua-api.factorio.com/latest/Lua ... nk_chartedrolaca11 wrote: βThu Dec 10, 2020 4:31 pmI'm trying to write a script that can take screenshots on the server-side. I can get the tiles that are at a given location, but I have no idea if they are visible to anyone, or if they have been discovered.
game.surfaces[1].getTile(x,y) will return the tile if it has been generated, but how can I know if the player has visited this tile ever? Or if it's visible to any radar/player?
https://lua-api.factorio.com/latest/Lua ... nk_visible
Re: Has tile been discovered? Is it currently visible?
thanks, It doesn't matter to me rn though. I think grass-1 is good enough for me in the beginning at leasteradicator wrote: βThu Dec 10, 2020 6:51 pmSidenote: As far as i am aware the api does not allow runtime access to tile variations. Thus by getting just the tile type you won't be able to get a correct representation of the map as the players see it.
All of these are just "grass-1".
Re: Has tile been discovered? Is it currently visible?
This turned out to be not true. in my output I see grass-1,2,3,4, etc and for other types as welleradicator wrote: βThu Dec 10, 2020 6:51 pmSidenote: As far as i am aware the api does not allow runtime access to tile variations. Thus by getting just the tile type you won't be able to get a correct representation of the map as the players see it.
All of these are just "grass-1".
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Has tile been discovered? Is it currently visible?
The existance of variations was never in question. Just look at the graphic files. The only question is if you can access them at runtime, which i said i think you can't.
Those are different prototypes. Each prototype has several dozen variations.
Just to be sure... you do know about take_screenshot but are trying to do it on a per-tile basis because $reasons right?
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: Has tile been discovered? Is it currently visible?
They are trying to build a graphics driver for a headless server.eradicator wrote: βFri Dec 11, 2020 1:15 amJust to be sure... you do know about take_screenshot but are trying to do it on a per-tile basis because $reasons right?
Re: Has tile been discovered? Is it currently visible?
exactly, thanks for the suggestion btwDaveMcW wrote: βFri Dec 11, 2020 1:35 amThey are trying to build a graphics driver for a headless server.eradicator wrote: βFri Dec 11, 2020 1:15 amJust to be sure... you do know about take_screenshot but are trying to do it on a per-tile basis because $reasons right?
I also tried running the non-headless version on a server, but handling virtual displays, without a GPU and all that is shady at best
Re: Has tile been discovered? Is it currently visible?
The good news is, I can calculate how many tiles are in a bunch, the bad news is that it's a grind and not niceeradicator wrote: βFri Dec 11, 2020 1:15 amThe existance of variations was never in question. Just look at the graphic files. The only question is if you can access them at runtime, which i said i think you can't.
Those are different prototypes. Each prototype has several dozen variations.
UPDATE: It doesn't work
Last edited by rolaca11 on Fri Dec 11, 2020 11:14 pm, edited 1 time in total.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Has tile been discovered? Is it currently visible?
As expected then. Just making sure it's not another case of missing the blatantly obvious ;). On further thought you also don't get tile-transitions, thought those at least can probably be generated from prototype data.rolaca11 wrote: βFri Dec 11, 2020 11:32 amexactly, thanks for the suggestion btw :DDaveMcW wrote: βFri Dec 11, 2020 1:35 amThey are trying to build a graphics driver for a headless server.eradicator wrote: βFri Dec 11, 2020 1:15 amJust to be sure... you do know about take_screenshot but are trying to do it on a per-tile basis because $reasons right?
I also tried running the non-headless version on a server, but handling virtual displays, without a GPU and all that is shady at best
Don't know what your setup is. Maybe you can find a hoster with cpus with integrated graphics? Or set up a machine that periodically downloads the map and does the screen-shotting in a seperate singleplayer instance.
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: Has tile been discovered? Is it currently visible?
I'm running servers on Digital Ocean. renting gpus is expensive aferadicator wrote: βFri Dec 11, 2020 10:42 pmAs expected then. Just making sure it's not another case of missing the blatantly obvious . On further thought you also don't get tile-transitions, thought those at least can probably be generated from prototype data.rolaca11 wrote: βFri Dec 11, 2020 11:32 amexactly, thanks for the suggestion btwDaveMcW wrote: βFri Dec 11, 2020 1:35 amThey are trying to build a graphics driver for a headless server.eradicator wrote: βFri Dec 11, 2020 1:15 amJust to be sure... you do know about take_screenshot but are trying to do it on a per-tile basis because $reasons right?
I also tried running the non-headless version on a server, but handling virtual displays, without a GPU and all that is shady at best
Don't know what your setup is. Maybe you can find a hoster with cpus with integrated graphics? Or set up a machine that periodically downloads the map and does the screen-shotting in a seperate singleplayer instance.