FullScreenShenanigans / FullScreenPokemon

A free HTML5 remake of the original Pokemon, expanded for modern browsing.
MIT License
214 stars 88 forks source link

Issue with RNG and saves? #739

Open Machinocheese opened 6 years ago

Machinocheese commented 6 years ago

Bug Summary

Note that this doesn't happen every time, but it happens to me > 90%, at the very least. What's happening is that whenever I save a file and walk the exact same way, the exact same Pokemon spawns every single time at the same location. Not sure if this is intended behavior.

Steps to Reproduce

Note: As I've been attempting to reproduce this bug, I've noticed it's also time-dependent. If I take a break between a few of the input commands, the RNG is back to actual randomness.

Start a new game. Get a Pokemon from Prof. OAK (Note I've only confirmed this with Charmander and Squirtle, though this shouldn't matter). Beat Gary, then walk out into Pallet Town, and save the game. Reload the save - you should be spawned into the upper leftmost pillar as shown below: image Then go right one block, then down one block. Then walk all the way right until you meet this block: image Then keep walking up until this block: image Take two steps to the right, and you should almost always encounter a Level 2 Pidgey.

JoshuaKGoldberg commented 6 years ago

...cool.

Did some digging: FSP doesn't override any of the GameStartr settings for createNumberMaker, which by default just passes gameStarter.settings.components.numbers, which is therefore undefined by default. https://github.com/FullScreenShenanigans/GameStartr/blob/8eb1544fd62b035addceeb5675be24fbb2c93d45/src/creators/createNumberMaker.ts#L6

That defaults to new Date().getTime(). https://github.com/FullScreenShenanigans/NumberMakr/blob/3fe7216d29de165fade973d1474b2aa1d18ce133/src/NumberMakr.ts#L139

...so it is in fact randomly seeded with a genuinely different seed each time.

Perhaps the universe is toying with us?