L0laapk3 / FactorioMaps

L0laapk3's FactorioMaps mod
https://mods.factorio.com/mod/L0laapk3_FactorioMaps
Other
121 stars 22 forks source link

No proper confirmation on when factorio is actually done writing the screenshots to disk. #23

Closed IIPoliII closed 5 years ago

IIPoliII commented 5 years ago

Hello, i have founded out after the corp process it stays blocked at 99.9% during a long time i was asking me why here is a print screen : https://i.imgur.com/Gv26fiw.png

L0laapk3 commented 5 years ago

Does it continue after a while? Or is it really stuck? How long have you waited? This generally has to do with the way factorio handles file outs and theres not much I can do about it if it just takes long at the end, if it doesnt output at all that might be a different story.

IIPoliII commented 5 years ago

I waited for about 30 minutes now but maybe i need to wait more what's weird is that factorio "already" got killed. But i think factorio finished the corp but what does this function do? Is it an compressing one? Because right now the folder is 16 Gb but the map isn't that big. It's an update of an map. I already did it with an old version of the map 1 month ago and the folder was only 1 Gb, i didn't added tons of entities to the map too just a few updates.

L0laapk3 commented 5 years ago

Crop does not compress, its normal that the output folder is quite a bit larger than before its finished. Its quite likely that its getting stuck because factorio did not properly output all screenshot images

L0laapk3 commented 5 years ago

I personally never have this problem but I've had at least one other report of factorio actually not outputting every single image properly. Later I can try something to fix this, but it will probably take some iterations to get right as I cannot try the fix myself.

IIPoliII commented 5 years ago

Yes I understand is it maybe possible that I send you any logs about this? And it's weird it gets stuck so long, also it does not use any ressources (CPU, Ram,... ) While it's stuck

L0laapk3 commented 5 years ago

It likely has to do with factorio storing files out of the order that they were made in on some systems. Im not entirely sure how to properly fix this, I'll have to have a chat with the devs when they have some time, I need to somehow get feedback to see when factorio is done saving screenshots. I'll let you know when theres something you can test.

IIPoliII commented 5 years ago

Okay thanks !

L0laapk3 commented 5 years ago

Hey, Ive published a potential fix on my dev branch. Mind giving it a try and letting me know if it still gets stuck at 99% cropping?

IIPoliII commented 5 years ago

Hai, i tried again but i get this error again of writing permissions. It's weird i changed that everyone can write in it and factorio IS somehow able to write to it it's just the script-output folder who is making issues it looks like a link folder. Here is the log and a picture of the folder image

IIPoliII commented 5 years ago

it's weird i get it on multiple pcs and sadly i can't test on my laptop right now, i tried to disable the anti-virus who seemed to be an issue here https://www.reddit.com/r/factorio/comments/76suh2/game_error_create_directories/ but didn't worked too

IIPoliII commented 5 years ago

Okay the issue for writing permissions is not the "writing"problem here i present you the 3 posibility to fix it for the next user :

  1. Run the game once and re-save the game
  2. Create an script-output folder at the factorio root
  3. Change permissions on %appdata%/local/Temp
  4. Start the game for the frist time and open the map
IIPoliII commented 5 years ago

I am trying the new version of the dev branch

L0laapk3 commented 5 years ago

Were you trying to make multiple snapshots at once? I had a really nasty variable name capitalisation error breaking that one.

IIPoliII commented 5 years ago
python auto.py railworld85 --factorio=D:\User\raimu\Téléchargements\Factorio_x64_0.16.51\Factorio_0.16.51\bin\x64\factorio.exe
factorio path: d:\user\raimu\téléchargements\factorio_x64_0.16.51\factorio_0.16.51\bin\x64\factorio.exe
output folder: script-output\FactorioMaps\railworld85
checking for updates
enabling FactorioMaps mod
cleaning up
building autorun.lua
starting factorio
Jonction créée pour C:\Users\raimu\AppData\Local\Temp\FactorioMaps-681651893\script-output <<===>> D:\User\raimu\Téléchargements\Factorio_x64_0.16.51\Factorio_0.16.51\script-output
[GAME]   14.181 Created atlas bitmap 8192x8136 [linear-minification, mipmap, terrain]
[GAME]   15.237 Created atlas bitmap 8192x1216 [linear-minification, mipmap, terrain]
[GAME]   38.202 Warning LuaGameScript.cpp:1545: luaremove_path error: Scripts can only use file space inside of script-output
Processing railworld85/189-2/nauvis/day (1 of 2)
crop 100.0% [=====================================================================================]
disabling FactorioMaps mod
cleaning up
Traceback (most recent call last):
  File "auto.py", line 400, in auto
    refZoom()
  File "auto.py", line 395, in refZoom
    ref(outFolder, otherInputs[0], otherInputs[1], otherInputs[2], basepath, **kwargs)
  File "D:\User\raimu\Téléchargements\Factorio_x64_0.16.51\Factorio_0.16.51\mods\L0laapk3_FactorioMaps_3.1.2\ref.py", line 200, in ref
    treshold = .3 * Image.open(os.path.join(toppath, "Images", *compareList[0]).replace(ext, outext)).size[0] ** 2
  File "D:\Python3\lib\site-packages\PIL\Image.py", line 2634, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '../../script-output\\FactorioMaps\\railworld85\\Images\\189\\nauvis\\day\\20\\-1\\-1.jpg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "auto.py", line 553, in <module>
    auto(*sys.argv[1:])
  File "auto.py", line 540, in auto
    rmtree(tmpDir)
  File "D:\Python3\lib\shutil.py", line 513, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "D:\Python3\lib\shutil.py", line 397, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "D:\Python3\lib\shutil.py", line 395, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 32] Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus: 'C:\\Users\\raimu\\AppData\\Local\\Temp\\FactorioMaps-681651893\\factorio-current.log'

In french it means this proccess cannot acces to the file because it's used by another folder

IIPoliII commented 5 years ago

Were you trying to make multiple snapshots at once? I had a really nasty variable name capitalisation error breaking that one.

i only tried one snap shot of my railworld

L0laapk3 commented 5 years ago

It looks like that error is caused by a "bricked" state left behind in the output folder by a previous crash. I've just pushed a new version to dev that I think is ready for release if it fixes this. Can you try again, but this time --delete the output folder? Thanks!

IIPoliII commented 5 years ago

oh yes it's possible it's this forgot about that i try right now!

IIPoliII commented 5 years ago

For now the script is running and the end of the corp process worked. So now i await the full result but the issue is fixed i close it when it's finished and all is working anyway thanks for your help and time you took in my issue !

IIPoliII commented 5 years ago

Do you see that ? image

This is the absolute beauty ! Thanks Issue Closed.

L0laapk3 commented 5 years ago

Theres still another version of this issue that I haven't yet resolved, its possible that images only start existing after they were scanned for the zoom layer, and thus missing in higher zoom levels. I need dev confirmation on a proper solution for that so I'll leave the issue open for now.

IIPoliII commented 5 years ago

Sure okay for now i gonna focus on bigger maps problems

L0laapk3 commented 5 years ago

https://forums.factorio.com/viewtopic.php?f=65&t=65045

IIPoliII commented 5 years ago

The post was removed?

L0laapk3 commented 5 years ago

What?

IIPoliII commented 5 years ago

@L0laapk3 The link says me the post don't exsists anymore at least the link don't work anymore

IIPoliII commented 5 years ago

Any news c:

L0laapk3 commented 5 years ago

Its on my 0.17 todo list (#28 ), however I've kinda lost interest in this project right now, Sorry.

L0laapk3 commented 5 years ago

I've made some changes that have the potential to fix this in 3c78e907b7b110a0082d788d2bd3e2449bbbd166. If you want to try it, let me know if it still gets stuck on cropping 99% occasionally :)

IIPoliII commented 5 years ago

Sure i check that once i am at home, i forgot my portable pc alimentation so i can't do it here if you want some test maps to check it out you can found some here : https://saves.joinandplaycoop.com/#Home%2FS1%2FEnd%20Map%20Saves You can take a big one like the 180 MB one. The hard part with those maps is that actually spawn are separated so it will need blanks between the bases but it should work last time it did.

Thanks for working on it again and i try tonight !

IIPoliII commented 5 years ago

So it worked really well, the write was fast for such an huge map but now i got trought an error about the map view. So this is the view of the map in factorio : image but if you check on the map view here : http://test.joinandplaycoop.com/maps/20-Mar-19_20/index.html#1/nauvis/16/-8292/-2823/0/24 you can see a part is missing

(image of it) image

L0laapk3 commented 5 years ago

Thats strange lol, you got a save file for that? edit: its on your server, found it

IIPoliII commented 5 years ago

Yes there https://saves.joinandplaycoop.com/Home/S1/End%20Map%20Saves/20-Mar-19:20.zip Didn't saw the edit xD

L0laapk3 commented 5 years ago

That was caused by an entirely different issue related to multiple forces, I've taken care of it with release v3.3.1.

Is the "cropping stuck at 99%" issue completely gone now? :D

IIPoliII commented 5 years ago

Oh nice okay! Yeah I saw that the dev branch is 0.3.3.0 (had to rename the mod folder xD)

But the corping thing is fixed yes I confirm so this issue can be closed I let you the joy of doing it c: !

L0laapk3 commented 5 years ago

After confirming this with some other people who previously had this problem im glad to say that I think I hope its fixed for good now :p