synced random seed

synced random seed

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

synced random seed

Post by eronoobos »

I'm trying to find a way of getting a new seed for each game. (This is for a procedural map generator gadget, so that the user doesn't have to input a seed manually to get a new map.) os.time() can't be used because it's synced. Using a file to store the last seed and add one to it won't work, for the same reason. I want to use the GameID callin, but that doesn't happen until after the game is loaded, i.e., not the time to do map generation. Is there some way of getting the GameID before the callin happens, or does the ID not exist before that? Have any other ideas? I even tried Spring.GetWind(), but that appears to be all 0 until gameframes start.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: synced random seed

Post by Silentwings »

User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: synced random seed

Post by eronoobos »

ahh... yes, thank you. that clarifies things.
Post Reply

Return to “Lua Scripts”