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

Resort visitors #15

Open
1JackBlack1 opened this issue Sep 11, 2022 · 3 comments
Open

Resort visitors #15

1JackBlack1 opened this issue Sep 11, 2022 · 3 comments

Comments

@1JackBlack1
Copy link

1JackBlack1 commented Sep 11, 2022

I notice that you have resort visitors in the file but aren't displaying it.
I was looking into it and noticed that the code you have doesn't match that produced by ILSpy.
You have:
1.21*save.gameID + 2.5*(day + save.dayAdjust)
As the seed for the random number generator, but the code produced by ILSpy converts these both to integers before combining them, which produces a different result.

Could that be the cause of why it appears so random?

@1JackBlack1
Copy link
Author

1JackBlack1 commented Sep 12, 2022

Some other things I noticed in comparison:
ILSpy excludes the night market as well (Winter 15 to 17)
ILSpy also excludes Pam and Emily on the 15th of Fall.
So the generated list would be wrong on that date.

For Marnie, ILSpy has :
if (npc.Name == "Marnie" && day != "Tue" && day != "Mon")
which just excludes monday and tuesday, but you have
if (who === "Marnie" && (weekDay !== 1 || weekDay !== 2)) {
This would prevent Marnie from ever going to the island and get the list of visitors wrong on Monday and Tuesday, getting their predictions wrong as well.

And Robin should have the hospital visit on day 46, but you had 44.

But even after these fixes it still isn't entirely correct. So I'm investigating more.

@1JackBlack1
Copy link
Author

And I think I may have found the issue, and quickly skimming the code I think this is the only place it will appear, and it directly relates to the first point I found.
This is the only significant location in your predictor that deals with floating point numbers in the seed (the closest you get otherwise is dividing by 2). And one of the numbers involved (the game id) is quite large.

Javascript using 64 bits for these numbers, but c# only uses 32 bits.

This causes rounding errors for the generation of the seed.
So the seed actually needs to be (or equivalent to):
parseInt(Math.fround(1.21*Math.fround(save.gameID))) + parseInt(Math.fround(2.5*(day + save.dayAdjust)))

I'll check to see if this works over the next few days in game

@1JackBlack1
Copy link
Author

And checking, it works for the current day (i.e. the day the save is when it is loaded into the predictor), and it works for groups.
But due to the NPCs getting ordered differently each night, it doesn't work otherwise (although normally it could be narrowed down to a group until it gets to a group with a child).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant