DRL > Requests For Features
More music?
shark20061:
The code looks good, so I guess really the only thing to try would be to set the seed.
--- Code: ---math.randomseed(some_number)
--- End code ---
Speaking of which, what does DoomRL use for the random seed? Since I can't seem to get a time function...
Brewtal Legend:
--- Quote from: shark20061 on April 18, 2012, 18:53 ---The code looks good, so I guess really the only thing to try would be to set the seed.
--- Code: ---math.randomseed(some_number)
--- End code ---
Speaking of which, what does DoomRL use for the random seed? Since I can't seem to get a time function...
--- End quote ---
Not sure how exactly or where to use the random seed in the code.
shark20061:
It would be one of the first lines.
some_number is the Seed number: The random number generator uses that to get the first random number, and thus create the random nature. Problem is, there's no way to access a constantly changing number (like the current time), so Game Hunter (or any other dev) will need to shed a little light as to what could be done.
tehtmi:
I don't think there's currently any way to get any random/varying data in lua from the config file. We are seeding the random number generator that the rest of DoomRL uses, but not the random number generator accessible from the config file.
Here's a work-around for you: seed the random number generator from a batch file!
Many of us already run DoomRL from a batch file. Try using this instead:
--- Code: ---mode con lines=25 cols=80
mode con cp select=437
ECHO math.randomseed(tonumber((string.gsub("%TIME%", "%%D+", ""))) or error("Random seed failed!")) > random.lua
doomrl -console
--- End code ---
(Modify as appropriate for graphics mode.)
Then add this one line to the top of your config.lua:
--- Code: ---dofile "random.lua"
--- End code ---
Then you should be good to go. math.random will be seeded by your system time. (And yes, crappy seed + crappy RNG will lead to crappy random numbers, but it should be fine for our purposes. You could also use %RANDOM%, but that's too crappy even for me.)
(Non-windows users should be able to use a similar approach in the shell script, etc)
Brewtal Legend:
I tried out the batch file work around. And though I did get different song results when starting it up different times, They wouldn't change while playing. As in unless I exited the program after every death, then the songs would be the same for every level when I started a new game without exiting.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version