Skip to content

Sporadic divergence while playing replays with set seed #203

Description

@Gerhard-Wonner

Hello @ondras,

I implemented a replay-mode in my game. Therefore I store the seed of the game into the database together with the sequence of all the keystrokes of the player. The replay works quite well in most cases. :-)

My problem is: It works in most cases, but it does not work in all cases! :-(
Sometimes I realize that the replay diverges from the true game from a certain point (sometimes after thousands of turns). In most cases this results in the player-character eventually running into a wall. In rarer cases the whole level is generated in a different way.

I already separated the random value generation to different instances of the generator to keep the generation clean. E.g. I randomize the music from time to time, which I do with a separate instance of the randomizer. The remaining calls of the main-randomizer should now be time-independent and completely deterministic (with a given seed).

This is a very severe problem to me since I have no idea how to debug it. I tried a lot of things including logging the RNG-state and recording the game while playing and comparing it to the replay afterwards. My problem is, there is just too much information to keep track of. Logging everything is just not possible.

I am just a hobbyist and no professional JavaScript-developer, so I do not know many tricks or tools. Maybe there is a debugging tool out there, that could help me?

How would you approach this thing?

Thank you for your help!

Kind regards
Gerhard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions