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

Better RNG #432

Open
Entroper opened this issue Aug 29, 2020 · 1 comment
Open

Better RNG #432

Entroper opened this issue Aug 29, 2020 · 1 comment

Comments

@Entroper
Copy link
Member

I want to implement a LCG with 3 or 4 bytes of state. I found a whitepaper with some good parameters we can use.

We need to find 2 or 3 bytes of RAM (the vanilla RNG uses one, which will be replaced). And we can set the initial state randomly, as well.

@Entroper
Copy link
Member Author

Entroper commented Aug 29, 2020

Recommending we "reappropriate" the following variables:

btl8x8spr_x
btl8x8spr_y
btl8x8spr_a
btl8x8spr_t
btl8x8spr_i

These can share space with btl_attacker_strength, btl_attacker_category, and so on, because their use doesn't overlap. That gives us all the space we need for 4 bytes of RNG state.

These btl8x8 variables are only used in a few functions, all in bank 0C, between 0x317E9 and 0x31A2C. It's probably easiest to do a search and replace in the code.

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