Skip to content

Conversation

@ScribbleTAS
Copy link
Member

@ScribbleTAS ScribbleTAS commented Nov 27, 2023

Recently I had a discussion with the tasvideos.org folks about external vs. internal tools.
The conversation shifted more towards the fact that I'm patching a lot of RNG instances... They suggested hacking the system time to make RNG possible.
So I thought this might be worth a shot. This also has the advantage of reduced work when switching versions, if the idea actually works.

GlobalRandomnessTimer

The idea used in other games is to hack the system time to be always consistent when using an emulator.
That way you can control the seed of new RNG variables that are created during a playback.

As hacking the system time is impractical, I opted to use a "GlobalRandomnessTimer".
Every tick, the rng is advanced by one. If a new random instance is created during that,
it will use the current seed of the GlobalRandom

In theory this should create predictable RNG as long as I store the current seed of the globalrandomness in the savestates

EntityRandom

Each Entity has their own RNG that is set in the constructor. The plan is to instantiate a custom random class called "RandomBase"
instead of the JavaRandom. This class can reliably read out the seed and we can extend RandomBase into "EntityRandomness".

TODO

  • EntityRandom
    • Display entity randomness above an entities head
    • Overwrite rand in Entity constructor
  • WorldRandom
    • Display block random in F3 or some menu on raycast
    • Overwrite rand in World constructor
  • Math.random()
    • MathRandom is static, so redirect all random calls to a static random?

And here is something I am probably gonna use to make TASmod extra cursed: https://github.com/FlorianMichael/AsmFabricLoader

@ScribbleTAS ScribbleTAS added this to the Beta1 milestone Nov 27, 2023
@ScribbleTAS ScribbleTAS added KillTheRNG Issue is related to RNG-Manipulation/KillTheRNG Core Issue relates to core concepts Refactor labels Nov 27, 2023
@ScribbleTAS ScribbleTAS self-assigned this Nov 27, 2023
@ScribbleTAS
Copy link
Member Author

Great, gh actions uses an outdated gradle version, thats how the pr run fails

@ScribbleTAS ScribbleTAS removed the Core Issue relates to core concepts label Dec 17, 2023
@ScribbleTAS ScribbleTAS closed this Jan 5, 2024
@ScribbleTAS ScribbleTAS reopened this Jan 6, 2024
@ScribbleTAS ScribbleTAS modified the milestones: Beta1.0, Beta1.1 Jan 31, 2024
@ScribbleTAS ScribbleTAS mentioned this pull request Apr 13, 2024
5 tasks
@ScribbleTAS ScribbleTAS changed the title Remake KillTheRNG for Fabric [KillTheRNG] Remake for Fabric Apr 9, 2025
@ScribbleTAS ScribbleTAS modified the milestones: Beta2.0, Beta3.0 Sep 30, 2025
@ScribbleTAS ScribbleTAS moved this from Todo to In Progress in TASmod Oct 28, 2025
@ScribbleTAS ScribbleTAS linked an issue Oct 28, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

KillTheRNG Issue is related to RNG-Manipulation/KillTheRNG

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Only one player should set the initial seed

1 participant