question about random() in decorate

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

question about random() in decorate

Post by bagheadspidey »

[wiki=Classes:Demon1]This page[/wiki] in the wiki shows a syntax for random() that I don't understand... It looks like this:

Code: Select all

random[DemonAttack1](1,8) 
...can anyone explain what the [DemonAttack1] is for?

Also, I feel like decorate's random() should be documented somewhere on the wiki. What is the correct name for this type of construct? A decorate function? Since it appears to be the only one of its kind, would it make sense to document it on the [wiki]DECORATE_Variables[/wiki] page, or should it go somewhere else?
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: question about random() in decorate

Post by Gez »

I think it's just an identifier used so that the random number generator for this attack is not interfered with by other RNGs.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Re: question about random() in decorate

Post by Macil »

That'd be kinda odd. Using the same random number generator for everything wouldn't be different than using different random number generators per object (statistically, and assuming it's a good RNG).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: question about random() in decorate

Post by Graf Zahl »

ZDoom uses named RNGs to reduce the risk of demo and netgame desyncs. This specifies the name for the RNG.

The idea of named RNGs was introduced by Boom.
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: question about random() in decorate

Post by bagheadspidey »

Thanks, Graf. I figured it was something like that, but the absence of quotes around the name made me think maybe it was an identifier that had been defined somewhere else.

So, I guess best practice would be to "name" each call to random... good to know.

As far as where to document it, I probably will just stick it on the decorate variables page until someone comes up with a better idea.
Locked

Return to “Editing (Archive)”