[MUD-Dev] The grass is always greener in the other field
Ola Fosheim Grøstad <olag@ifi.uio.no>
Ola Fosheim Grøstad <olag@ifi.uio.no>
Tue Dec 21 21:55:12 CET 1999
Travis Casey wrote:
> > Sellers, Michael <MSellers at maxis.com> wrote:
>
> >> seed = location seed + (obj ID | activity ID) + your skill level
> >> randNum = rand(seed)
> >> if (your skill > randNum) success = TRUE;
>
> >> Is that essentially what you were talking about?
> It should be noted, though, that making the skill value be used as
> part of the random number seed can lead to an undesirable result --
> namely, that a character who is currently able to pick a certain lock
> may go up in skill and find that he/she is no longer able to pick that
> lock, even though nothing else has changed!
You're not the only person in the pedantic mood! The same thing goes for the
location. Move the lock one picometer and it has become impossible to pick!
:*)
You strictly don't need a pseudo random generator either, because you don't
need the "one large cycle" property, or rather, it is acceptable with many
disjoint cycles. So a silly hash is sufficient, but use xor to avoid
saturation of yer bits.
My suggestion:
hash(ulong LockID,ulong UserID) =
( (LockID<<(ULONG_BITS-MAX_OBJ_ID_BITS)) ^ UserID ) % SOME_PRIME
K.I.S.S.
--
Ola Fosheim Groestad,Norway http://www.notam.uio.no/~olagr/
_______________________________________________
MUD-Dev maillist - MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list