Hello, Mike. First off, thanks for a great book.
I'm using the RNG provided in GCC2 in my game engine and it works fine...but now I'm putting in multiplayer and I need to be able to save the state of the RNG and restore it. You actually mention in the book that the source code includes this ability, but I don't see it in the actual source files.
Saving the current seed and the current index into the table doesn't work, because the initial numbers are quickly generated by a simple "multiply and mask" method, and then the numbers after that are twisted. I supposed that I could keep a cumulative count of how many numbers have been generated since the birth of the object and then restore it by reseeding with the same seed and generating that many numbers again, but that seems kind of hacky.
If you know of a better way, I'd love to hear it. Again, thank you for the book, it's been incredibly helpful to me.
I'm using the RNG provided in GCC2 in my game engine and it works fine...but now I'm putting in multiplayer and I need to be able to save the state of the RNG and restore it. You actually mention in the book that the source code includes this ability, but I don't see it in the actual source files.
Saving the current seed and the current index into the table doesn't work, because the initial numbers are quickly generated by a simple "multiply and mask" method, and then the numbers after that are twisted. I supposed that I could keep a cumulative count of how many numbers have been generated since the birth of the object and then restore it by reseeding with the same seed and generating that many numbers again, but that seems kind of hacky.
If you know of a better way, I'd love to hear it. Again, thank you for the book, it's been incredibly helpful to me.
"It's often uncomfortable, but in the long run it makes more sense to deal with reality."
- Michael Abrash
- Michael Abrash