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

DMax Adventure SEED Searching??? #59

Closed
Th3Alic3 opened this issue Nov 8, 2020 · 5 comments
Closed

DMax Adventure SEED Searching??? #59

Th3Alic3 opened this issue Nov 8, 2020 · 5 comments

Comments

@Th3Alic3
Copy link

Th3Alic3 commented Nov 8, 2020

Hey Zak'sBeast!!

A few weeks ago you posted this tweet on Twitter:
https://twitter.com/zaksabeast/status/1320413720892276736

The included photo clearly demonstrated a feature of viewing future SEED advancements:
image

Is this feature not coming back?

There are 8 Pokémon (excluding Legendary bosses) which can ONLY be encountered via the Dynamax Adventures:

  • Regional Evolutional Variants (Alolan Raichu, Kantonian Exeguttor, Alolan Marowak, & Kantonian Weezing)
  • Hoenn Starters (in their Stage 1 & Stage 2 forms)
  • Porygon

So, the ability to search for this Pokémon via the SEED is huge.

(The new features are a fantastic addition! Keep up the AMAZING WORK!!)

@zaksabeast
Copy link
Owner

This is a good question. What happened to the feature in the tweet?

I'm going to break your question into 3 parts:

  • What mechanics drive dmax adventures in Sword and Shield?
  • Why doesn't CaptureSight allow viewing more than the next dmax adventure?
  • Why was the feature in the tweet not added to CaptureSight?

What mechanics drive dmax adventures in Sword and Shield?

There are 3 prng mechanics that drive dmax adventures:

  1. A crypto secure prng: this determines things like shininess after battles and backpacker inventories
  2. A save-seeded xoroshiro that seeds mersenne twisters: this determines which Pokemon templates (species, moves, etc.) will be used for rental, encounter, and boss Pokemon
  3. A crypro secure-seeded xoroshiro that seeds other xoroshiros: this generates the actual Pokemon (EC, PID, IVs, etc.)

Why doesn't CaptureSight allow viewing more than the next dmax adventure?

The tweet you linked was looking at the third mechanic and showing how Pokemon IVs can be determined without starting every battle.

The xoroshiro driving this mechanic is seeded:

  • When the dmax adventure starts in single player mode
  • When a second player joins in multiplayer mode

Since it's seeded by a crypto secure prng, we cannot predict what Pokemon will be generated until after a dmax adventure has started. Said differently, that screenshot shows seeds to generate Pokemon for a single dmax adventure run, not future runs.

However your question seems to be asking about the second mechanic, not the third shown in the screenshot, since the question involves species. The second mechanic is seeded from a value in the save file. This is how CaptureSight's current dmax adventure feature works. It reads the seed to see what rental and encounter Pokemon will appear if the dmax adventure is played with 0, 1, 2, or 3 NPCs.

I haven't looked at the disassembly, but based on simple tests it looks like the save value is created by a csprng after a dmax adventure has been completed (this means the player has to go through the same adventure if they stop half way). Because future adventures are seeded with a csprng, only the next adventure with the seed in the save file can be predicted.

Why was the feature in the tweet not added to CaptureSight?

The tweet shows seeds that are used to generate dmax adventure Pokemon (EC, PID, IVs, etc.). Since shininess is determined with the first mechanic and species by the second, the seeds in this screenshot primarily determine IVs.

When I asked people in the Max Raids discord, most people weren't interested in IVs. Instead, they were more interested in knowing the Pokemon species so strategies could be made to win dmax adventures easier and faster. As a result, I added the second mechanic instead of the third.

@Th3Alic3
Copy link
Author

Th3Alic3 commented Dec 9, 2020

Hey ZaksBeast,

In terms of the stats (EC, PID, IVs, etc.), you stated in the above:
"A crypro secure-seeded xoroshiro that seeds other xoroshiros: this generates the actual Pokemon (EC, PID, IVs, etc.)".

I would like to first clarify if I am understanding this correct:
The game produces a "crypro secure-seeded xoroshiro" which it uses to SEED multiple "xoroshiro" SEEDs.

To produce the stats (EC, PID, IVs, etc.) in the Raid viewer of Capture Sight, what value is used to display those stats on screen:

  1. crypro secure-seeded xoroshiro?
  2. multiple "xoroshiro"?
  3. A combination of the two?

Since you stated the game "seeds other xoroshiros", would I be safe to assume that all 4 Pokémon (Round 1, 2, 3, & Boss Legendary) have their stats (EC, PID, IVs, etc.) determined by their own individual "xoroshiro" value?

(TLDR: I am trying to find the HEAP location of said SEEDs and you are no where that I can PM this.)

@zaksabeast
Copy link
Owner

Yeah, it sounds like you have the right idea.

It works something like this:

  1. The csprng returns a number: 0xAA
  2. 0xAA is used to seed a xoroshiro
  3. The xoroshiro returns 4 random numbers: 0xBB, 0xCC, 0xDD, 0xEE
  4. Each of those 4 numbers is used to seed a new xoroshiro
  5. Each xoroshiro is used to help create a Pokemon for the dmax adventure

(TLDR: I am trying to find the HEAP location of said SEEDs and you are no where that I can PM this.)

Sadly the game doesn't store the seeds in memory for long - it tosses them once they're used (which is too short of a time to do anything meaningful).

The csprng isn't predictable and is used right when a user clicks the button to start a dmax adventure or if a second player joins a hosted adventure, so we only know what the result will be after a dmax adventure has started.

That said, there are at least two ways to get what you're looking for:

  • The rental Pokemon stats are created using the same seed as the raid Pokemon, so you might be able to calculate the initial seed from the rental Pokemon, then generate the rental Pokemon, regular raids, and boss raid from the initial seed
  • Every PRNG has an internal state to help calculate the next random number. Raid Pokemon are generated after all players (including npcs) have finished choosing their rental Pokemon, so you have at least several seconds (longer if you stall) to read the internal state of the xoroshiro and calculate what all future numbers will be. Those numbers will seed the xoroshiros used to create the raid Pokemon's stats

@zaksabeast
Copy link
Owner

GitHub discussions is in beta, and I turned it on for this repository (Welcome post!).

If you have more questions or would like help accomplishing your goal, it may be a good idea to open a discussion.

@Th3Alic3
Copy link
Author

Here you are: #69

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

2 participants