• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Random won't be random (Even on Battle.net)

Status
Not open for further replies.
Level 7
Joined
Apr 27, 2008
Messages
94
Now, before you go off on a long rant about how the random in computers works and is seeded, and how it really isn't random, hold your breath. I KNOW HOW IT WORKS. Now that that is out of the way.

A little context might help. I am triggering a randomly generated terrain (noise and such) for a map that I am making. It works very well and all, but I noticed that the terrain, while being placed randomly, isn't actually being random... it makes the same "randomly" generated map over and over each time I host it or test it. Keep in mind that things are randomized thousands of times.

Yes, I have the fixed random seed unchecked in the world editor. And that shouldn't be a problem when I host it on battle.net. Maybe there is some way to randomize the seed? (And yes, I understand the irony of that statement).

if you have an idea on how to fix it, that would be much appreciated.
Thanks!
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Strange, always worked for me. I even tried
JASS:
native SetRandomSeed (integer seed) returns nothing
with FIXED seed and it still returned different values every time.

Are you sure your algorithm doesn't eliminate the randomness somehow? (try displaying couple random numbers, if they change, there is problem with your script, otherwise the randomizing is really stuck somehow)

Also, maybe try the terrain triggers in a new map, see if that changes anything, or maybe disabling part of the triggers (or post some trigger here)
 
Level 7
Joined
Apr 27, 2008
Messages
94
Mmm, thanks for the ideas. I displayed random numbers and they do not change. I also moved the triggers into a different map, while this changed the specific numbers that the random was stuck on, those numbers remained constant themselves... There shouldn't be a problem with the triggering itself.

This is simply the terrain creation trigger (I ran this trigger by itself and the random was still stuck. There is a trigger that starts at game elapsed time of 0, which does some necessary prep that can't be done at initialization and also calls the creation triggers in sequence.

Could you format the set random seed script for a custom script call so that I can see if that works on my end?
 
Last edited:
Level 12
Joined
Apr 15, 2008
Messages
1,063
Well the seed in GUI would be:
  • Custom script: call SetRandomSeed( udg_Seed )
, using global integer "Seed" as the seed. The problem is, that you need to get some random number as seed. You will need to get the seed from some user input, so it will be random (perfect seed would be system time, but that a) is different on each computer->desync and b) there is no native for it )
 
Level 7
Joined
Apr 27, 2008
Messages
94
Nope, don't usually use that sort of thing, and I certainly haven't in this map. Alright, one last thing if you would, the actual syntax of the custom script. If I count the time elapsed, and store it as a variable, say "time" how would I go around setting the seed to that variable? (do I also need to convert it into an int?)
 
Status
Not open for further replies.
Top