View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0003962 | Spring engine | General | public | 2013-08-25 00:43 | 2013-10-09 02:48 | ||||
Reporter | silentwings | ||||||||
Assigned To | Kloot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 94.1.1+git | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0003962: loadscreen is not picked randomly | ||||||||
Description | in 94.1.1-996, using the new loadscreens, the random number generator is not initialized properly and it always picks the same loadscreen. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
jK (developer) 2013-08-25 01:18 |
call math.randomseed |
silentwings (reporter) 2013-08-26 11:56 |
I can't see what's the cause, but in 94.1.1-1014 this bug is still present (even though it has math.randomseed). |
abma (administrator) 2013-08-27 04:14 Last edited: 2013-08-27 04:26 |
math.randomseed(os.time()) doesn't work for me, but this does: for i = 1, tonumber(os.date("%S")) do math.random() end not sure whats the cause. related to https://github.com/spring/spring/blob/develop/rts/lib/lua/include/luaconf.h#L513 ? in cont/base/springcontent/LuaIntro/Addons/bg_texture.lua does always return 6 for me: math.randomseed(os.time()) Spring.Echo(math.random(10)) |
abma (administrator) 2013-08-27 04:24 |
also, os.time() shouldn't be used it seems: http://www.lua.org/manual/5.1/manual.html#pdf-os.time " The returned value is a number, whose meaning depends on your system. In POSIX, Windows, and some other systems, this number counts the number of seconds since some given start time (the "epoch"). In other systems, the meaning is not specified, and the number returned by time can be used only as an argument to date and difftime. " |
jK (developer) 2013-08-27 05:29 |
does math.randomseed(os.clock()) work? |
silentwings (reporter) 2013-08-27 11:48 Last edited: 2013-08-27 11:52 |
Not for me - to me it looks a though os.time() and os.clock() work correctly byt math.randomseed(..) has no effect, regardless of what it's argument is. (I don't know why but each time a non-developer makes a comment on a thread that's set to 'feedback', mantis automatically changes to 'assigned'.) |
abma (administrator) 2013-08-27 12:10 Last edited: 2013-08-27 12:12 |
output of this: function widget:GameFrame(n) if (n % 400) == 0 then Spring.Echo(os.time()) end end seems to change every 2 minutes. (128 seconds?!) [f=0025200] 1377598080 [f=0025600] 1377598208 [f=0026000] 1377598208 [f=0026400] 1377598208 [f=0026800] 1377598208 [f=0027200] 1377598208 [f=0027600] 1377598208 [f=0028000] 1377598208 [f=0028400] 1377598208 [f=0028800] 1377598208 [f=0029200] 1377598336 ... is a float to small for time? |
silentwings (reporter) 2013-08-27 14:44 |
Not sure, I think what os.time() returns is dependent on the system, but there must also be more to it because I tried math.randomseed(..) with some randomly typed seeds and still got the same loadscreen. |
abma (administrator) 2013-10-08 15:05 |
@silentwings: did https://github.com/spring/spring/commit/4f102cd934eaa9c8ba77522844f106efffe6194f fix it for you? (this seems to have fixed some time issues) |
silentwings (reporter) 2013-10-09 02:15 |
yes it works fine for me now |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2013-08-25 00:43 | silentwings | New Issue | |
2013-08-25 01:18 | jK | Note Added: 0011373 | |
2013-08-25 01:18 | jK | Status | new => resolved |
2013-08-25 01:18 | jK | Resolution | open => no change required |
2013-08-25 01:18 | jK | Assigned To | => jK |
2013-08-25 01:21 | jK | Changeset attached | => spring develop 3cb085fa |
2013-08-25 01:21 | jK | Resolution | no change required => fixed |
2013-08-26 11:56 | silentwings | Note Added: 0011407 | |
2013-08-26 11:56 | silentwings | Status | resolved => feedback |
2013-08-26 11:56 | silentwings | Resolution | fixed => reopened |
2013-08-27 04:14 | abma | Note Added: 0011434 | |
2013-08-27 04:20 | abma | Note Edited: 0011434 | View Revisions |
2013-08-27 04:24 | abma | Note Added: 0011435 | |
2013-08-27 04:26 | abma | Note Edited: 0011434 | View Revisions |
2013-08-27 05:29 | jK | Note Added: 0011437 | |
2013-08-27 11:48 | silentwings | Note Added: 0011440 | |
2013-08-27 11:48 | silentwings | Status | feedback => assigned |
2013-08-27 11:52 | silentwings | Note Edited: 0011440 | View Revisions |
2013-08-27 12:10 | abma | Note Added: 0011441 | |
2013-08-27 12:10 | abma | Note Edited: 0011441 | View Revisions |
2013-08-27 12:11 | abma | Note Edited: 0011441 | View Revisions |
2013-08-27 12:11 | abma | Note Edited: 0011441 | View Revisions |
2013-08-27 12:12 | abma | Note Edited: 0011441 | View Revisions |
2013-08-27 14:44 | silentwings | Note Added: 0011442 | |
2013-10-08 15:05 | abma | Note Added: 0011727 | |
2013-10-08 22:10 | abma | Status | assigned => feedback |
2013-10-08 22:11 | abma | Relationship added | related to 0004040 |
2013-10-09 02:15 | silentwings | Note Added: 0011730 | |
2013-10-09 02:15 | silentwings | Status | feedback => assigned |
2013-10-09 02:48 | abma | Status | assigned => resolved |
2013-10-09 02:48 | abma | Resolution | reopened => fixed |
2013-10-09 02:48 | Kloot | Assigned To | jK => Kloot |
2013-10-09 02:48 | Kloot | Status | resolved => assigned |
2013-10-09 02:48 | Kloot | Status | assigned => resolved |