View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006379 | Dwarf Fortress | Miscellaneous Crashes | public | 2013-09-30 05:48 | 2014-07-26 14:15 |
Reporter | Quietust | Assigned To | Toady One | ||
Priority | normal | Severity | major | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Product Version | 0.34.11 | ||||
Fixed in Version | 0.40.05 | ||||
Summary | 0006379: Double-seed and triple-seed RNG init functions do not work correctly, causing inconsistent world gen | ||||
Description | g_src/random.cpp contains 3 functions for initializing a particular random number generator (there are 10 total), initializing the first entry of the specified mt_buffer with the specified seed and then using that value to initialize the rest of mt_buffer. However, the double-seed and triple-seed variants are broken - their loops start at i=0, causing the first entry to be overwritten with data calculated from memory before the beginning of the buffer (b[-1]). The uniform-seed variant does not have this problem, since its loop starts at i=1. | ||||
Tags | No tags attached. | ||||
|
Analysis of a disassembly reveals that the triple-seed variant is being used within the game itself, being called 4 times from a single function, while the double-seed variant does not appear to be used at all (and the uniform-seed variant comes up with 26 references). |
|
What are the in-game implications? |
|
Explicit random number seeds, such as those used during worldgen, may not produce consistent results where intended. |
|
I did perform a few worldgen tests on Windows using custom seeds, and while they did appear to have consistent results (and modifying one seed caused only things related to that seed to change), the worlds were not strictly identical (though these differences may be due to randomness which isn't drawn from any of the worldgen seeds). |
|
Also, I would imagine that just adding up the three seed values and storing them into the same unsigned int field would not introduce any more entropy than just one 32-bit integer value. Instead, the values should be stored into 3 independent locations in the array, and the rest filled accordingly - preferrably interleaving 3 pseudo-random sequences starting from the seeds. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-09-30 05:48 | Quietust | New Issue | |
2013-09-30 05:55 | Quietust | Note Added: 0024147 | |
2013-09-30 10:00 |
|
Note Added: 0024148 | |
2013-09-30 11:37 | Quietust | Note Added: 0024149 | |
2013-09-30 12:32 |
|
Relationship added | related to 0005633 |
2013-09-30 12:32 |
|
Summary | Double-seed and triple-seed RNG init functions do not work correctly => Double-seed and triple-seed RNG init functions do not work correctly, resulting in inconsistent world gen |
2013-09-30 12:32 |
|
Summary | Double-seed and triple-seed RNG init functions do not work correctly, resulting in inconsistent world gen => Double-seed and triple-seed RNG init functions do not work correctly, causing inconsistent world gen |
2013-09-30 12:33 |
|
Relationship added | related to 0005974 |
2013-09-30 12:41 | Quietust | Note Added: 0024150 | |
2013-09-30 23:20 | ag | Note Added: 0024151 | |
2014-07-26 14:15 | Toady One | Status | new => resolved |
2014-07-26 14:15 | Toady One | Fixed in Version | => Next Version |
2014-07-26 14:15 | Toady One | Resolution | open => fixed |
2014-07-26 14:15 | Toady One | Assigned To | => Toady One |