Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weird overlapping behaviour (with low-timestamped saves?) #128

Open
alifeee opened this issue Mar 15, 2024 · 7 comments · May be fixed by #129
Open

weird overlapping behaviour (with low-timestamped saves?) #128

alifeee opened this issue Mar 15, 2024 · 7 comments · May be fixed by #129
Labels
bug Something isn't working frontend issue for the web interface

Comments

@alifeee
Copy link

alifeee commented Mar 15, 2024

Firstly, thanks for this great tool :) it is very neat.

I have three saves

  • start which has 5 minutes on the save
  • 1 (30 minutes)
  • 2 (1h20 minutes)

When I generate them, the start save ends up weirdly on top of the others

image

On the map, the start save is viewable sort of 'on top' of the other save, when selected, resulting in images like this

image

If I add more saves it jumps to always be below the most recent save

image

and now looks like this

actual save (3h)

image

broken 'first' save (1-1h)

image

Here are the saves that this happens with (game version 1.1.104)

multplayer start.zip

multplayer 1.zip

multplayer 3.zip

multplayer 5.zip

I am mainly creating this issue in case anyone else discovers a similar thing. I have no idea what causes it. All I can think of is that the first save only has 5 minutes on the save.

Otherwise, thank you for this great tool. It is very very neat. :)

@L0laapk3 L0laapk3 added bug Something isn't working frontend issue for the web interface labels Mar 15, 2024
@L0laapk3
Copy link
Owner

Has to do with this line ( https://github.com/L0laapk3/FactorioMaps/blob/master/web/index.js#L553 ), which determines the position on the slider of each label. That line is an utter mess.

If you want to experiment, you'll be able to edit that line of your index.js in the exported map folder directly (the tool copies the template from mod/web into your export folder when running it)

Worthy to mention is that some changes to that line have been made in #96.

@alifeee
Copy link
Author

alifeee commented Mar 15, 2024

Ah lovely, thanks for the response!

Thanks for pointing me to the line of code. I may take a look at it. It's only... 245 characters on one line ;)

If you want to experiment, you'll be able to edit that line of your index.js in the exported map folder directly (the tool copies the template from mod/web into your export folder when running it)

I might.

@alifeee alifeee linked a pull request Mar 19, 2024 that will close this issue
@alifeee
Copy link
Author

alifeee commented Mar 20, 2024

I have done some more investigation.

Please see the saves above for context. Their times are

save save time
multplayer start 00:05
multplayer 1 00:30
multplayer 3 01:20
multplayer 5 02:31

Ignoring the slider issues (#129), the map generation is still broken somehow. For example, after running

py auto.py --dayonly --no-tags --build-range=5.2 --connect-range=5.2 --verbose --verbosegame "startand5" "multplayer start" "multplayer 5"

Here is one of the generated images for the multplayer start save

D:\Factorio\Factorio_1.1.104\script-output\FactorioMaps\startand5\Images\1\nauvis\day\18\1\-1.png

-1

You can see that it shows a strange overlay of the multplayer 5 save. Here is that image on the map:

image

image

I think something strange is happening with the order of the images/saves. For example, the generated mapInfo.json for the above is

{
    "options": {
        "ranges": {
            "build": 5.2,
            "connect": 5.2,
            "tag": 5.2
        },
        "HD": false,
        "defaultTimestamp": -1
    },
    "seed": 839333390,
    "mapExchangeString": ">>>eNpjZGBkyGAAgwZ7EOZgSc5PzIHxQJgrOb+gILVIN78oFVmYM7moNCVVNz8TVXFqXmpupW5SYjGKYo7Movw8dBNYi0vy81BFSopSU4uRRbhLixLzMktz0fUyMPKZsRs1tMgxgPD/egaF//9BGMh6APQLCDMwNkBUAsVggDU5JzMtjYFBwRGInUDSjIyM1SLr3B9WTbFnhKjRc4AyPkBFDiTBRDxhDD8HnFIqMIYJkjnGYPAZiQGxtARoBVQVhwOCAZFsAUkyMva+3brg+7ELdox/Vn685JuUYM9o6Cry7oPROjugJDvIn0xwYtZMENgJ8woDzMwH9lCpm/aMZ8+AwBt7RlaQDhEQ4WABJA54MzMwCvABWQt6gISCDAPMaXYwY0QcGNPA4BvMJ49hjMv26P4ABoQNyHA5EHECRIAthLuMEcJ06HdgdJCHyUoilAD1GzEguyEF4cOTMGsPI9mP5hDMiED2B5qIigOWaOACWZgCJ14ww10DDM8L7DCew3wHRmYQA6TqC1AMwgPJwIyC0AIO4OBmZkCAD/YMBe9OnwQAiGehEQ==<<<",
    "maps": [
        {
            "tick": 543977,
            "path": "3",
            "date": "19/03/24",
            "mods": {
                "base": "1.1.104",
                "L0laapk3_FactorioMaps": "4.4.0"
            },
            "surfaces": {
                "nauvis": {
                    "spawn": {
                        "y": 0,
                        "x": 0
                    },
                    "zoom": {
                        "min": 14,
                        "max": 20
                    },
                    "tags": [],
                    "hidden": false,
                    "captured": true,
                    "links": [],
                    "playerPosition": {
                        "y": 42.640625,
                        "x": -107.76171875
                    },
                    "day": true,
                    "chunks": "//v/+vL/vx/vQAw=2/v0/vbAw=1/v0/vbAw=0/v0/vbAw=z/v1/vbAw=y/v1/vbAw=x/v2/vaAw=w/v3/vaAw=v/v3/vZAw=u/v3/vYAw=t/v4/vYAw=+/v/+vL/vx/vQAw=s/v4/vXAw=r/v6/vXAw=9/v/+vL/vx/vQAwTAwYAw=8/v/+vL/vx/vaAw=7/v/+vL/vx/vaAw=6/vA/vK/vy/vbAw=5/vA/vK/vy/vbAw=4/vC/vI/v0/vbAw=3/v0/vbAw=AAwA/vK/vx/vQAw=BAwA/vK/vx/vQAw=KAw1/vDAwFAwPAw=LAw1/vDAwHAwNAw=MAw1/vDAw=NAw1/vDAw=OAw1/vDAw=PAw1/vDAw=QAw1/vDAw=RAwz/vDAw=SAwx/vDAw=TAww/vDAw=CAwC/vI/vx/vQAw=UAww/vDAw=VAwv/vDAw=WAwv/vDAw=XAwv/vDAw=YAwv/vDAw=ZAwv/vDAw=aAwv/vCAw=bAwv/vCAw=cAwv/vAAw=DAwx/vQAw=EAwx/vQAw=FAwx/vQAw=GAwy/vQAw=HAwy/vQAw=IAw0/vQAw=JAw1/vDAwFAwPAw=dAww/v8/v=eAww/v8/v=fAwy/v6/v=m/vb/vm/vCAwVAw=l/va/vm/vCAwVAw=k/va/vm/vDAwWAw=j/va/vm/vDAwWAw=i/va/vm/vEAwWAw=h/va/vm/vFAwWAw=o/vc/vl/vCAwWAw=n/vb/vl/vCAwWAw=g/va/vl/vFAwWAw=f/vb/vl/vFAwVAw=e/vb/vk/vFAwVAw=p/ve/vj/vBAwXAw=d/vd/vi/vGAwUAw=q/vAAwXAw=c/vGAwTAw=b/vIAwRAw"
                }
            }
        },
        {
            "tick": 19433,
            "path": "1",
            "date": "19/03/24",
            "mods": {
                "base": "1.1.104",
                "L0laapk3_FactorioMaps": "4.4.0"
            },
            "surfaces": {
                "nauvis": {
                    "spawn": {
                        "y": 0,
                        "x": 0
                    },
                    "zoom": {
                        "min": 17,
                        "max": 20
                    },
                    "tags": [],
                    "hidden": false,
                    "captured": true,
                    "links": [],
                    "playerPosition": {
                        "y": -76.66015625,
                        "x": 9.359375
                    },
                    "day": true,
                    "chunks": "//v7/vCAwDAwFAw=2/v8/vHAw=1/v9/v+/v//vGAw=0/v9/vFAw=z/v//vEAw=+/v6/vGAw=9/v6/vGAw=8/v6/vHAw=7/v6/vHAw=6/v6/vHAw=5/v6/vHAw=4/v7/vHAw=3/v7/vHAw=AAw7/vCAw=BAw9/vDAw"
                }
            }
        }
    ],
    "defaultSurface": "nauvis"
}

We can see here that the first save is actually last in the list (which is also what caused some of the slider issues as they rely on things being ordered sequentially/chronologically).

If I swap the order of the objects in the json "maps" array, it changes the map from...

...this...

image

...to this...

image

So you see, the problem is with the map generation, as the tiles are generated wrongly (showing underneath images instead of grey), and in the wrong order (json order is wrong).

I am not sure what causes this. It seems like a problem with generation, as the images are broken, so it cannot be fixed by changing the JavaScript.

Perhaps it could be because the saves are from different game versions? (I am not sure exactly which, but I think there may have been a switch from 1.1.102 to 1.1.103 or something similar between some of these saves)

Could you offer any more pointers?

@alifeee
Copy link
Author

alifeee commented Mar 20, 2024

out of interest, I swapped the order of the saves, running

py auto.py --dayonly --no-tags --build-range=5.2 --connect-range=5.2 --verbose --verbosegame "startand5" "multplayer 5" "multplayer start"

i.e.,

- "multplayer start" "multplayer 5"
+ "multplayer 5" "multplayer start"

I get the same result (same overlapping, and contents of mapInfo.json is the same)

@alifeee
Copy link
Author

alifeee commented Mar 31, 2024

I believe the issue is here:

saveGames = naturalSort(list(saveGames))

After it loads the save games it sorts them. If I change the line above to...

+ print(saveGames)
  saveGames = naturalSort(list(saveGames))
+ print(saveGames)
+ exit(0)

...and run the following command to generate a map in the folder multplayer from three of the saves above...

py auto.py "multplayer" "multplayer start" "multplayer 1" "multplayer 3"

...I get the output

{'multplayer 3.zip', 'multplayer start.zip', 'multplayer 1.zip'}
['multplayer 1.zip', 'multplayer 3.zip', 'multplayer start.zip']

multplayer start should be the first save, but it is the last. I believe this is related to #130.

The saves are sorted with this function

FactorioMaps/auto.py

Lines 59 to 62 in 9db1a28

def naturalSort(l):
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum_key = lambda key: [ convert(c) for c in re.split(r'(\d+)', key) ]
return sorted(l, key = alphanum_key)

So, it sorts multplayer start after multplayer 1 due to numbering.

I will rename multplayer start to multplayer 0 and try again

@alifeee
Copy link
Author

alifeee commented Mar 31, 2024

ok, I renamed multplayer start to multplayer 0, and it works now.

I probably should have tried this to begin with.

But also, I feel that order of saves should attempt to be the order entered into the CLI by the user, if possible (i.e., a glob not used)

I may attempt this change

@L0laapk3
Copy link
Owner

Agreed on the ordering by CLI arguments. And also, when using glob, it should probably be ordered by date anyways :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend issue for the web interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants