[DGD] Damage Weapons and Stuff (Math and Code)
Noah Gibbs
noah_gibbs at yahoo.com
Sun Jun 1 22:50:56 CEST 2003
--- Stephen Schmidt <schmidsj at union.edu> wrote:
> It'll be pretty slow if you need to access this
> often.
Sorta. If you're running a MUD with fifty players,
attacking one hundred enemies, swinging every two
seconds, you've got 150 critters swinging, so 75 per
second.
This algorithm is slow, but that's a pretty decent
load for most MUDs, and 75 times per second just isn't
that much. Again, most current desktop computers are
so much beefier than a random MUD needs, it's not even
funny.
> most UNIX random
> number generators are pretty trustworthy, certainly
> for applications like this.
Yeah. This definitely isn't an application where
the quality of the results is significant, at least
compared to most serious statistical work.
> > As far as a quick speed boost goes: you're
> > currently just using a binary search. You could
> > try making an estimate [...]
>
> It will, but since the normal distribution doesn't
> have
> a closed form solution, it doesn't have analytic
> derivatives
> either.
Okay, so you're talking about Newton's Method. I'm
not. What I'm talking about doesn't actually use
derivatives. What I'm saying is that every iteration,
when estimating where the sample between the other two
is, pretend the two outside points define a line, so
your derivative would just be the slope between points
a and c. Lines *do* have analytic derivatives :-)
This way you don't need the derivatives, which is
good -- Gaussians have several points where the
derivatives will steer you *way* wrong. The top and
far ends of the curve are decent examples of
pathologically bad cases for Newton's Method if memory
serves. The line thing is simple, predictable, and
easily fast enough for what he's doing here. Newton's
Method doesn't add much, and it could get much nastier
if you didn't manually tweak the table of derivatives.
But you're right, a closed-form solution, being
guaranteed single-iteration, is still better.
=====
------
noah_gibbs at yahoo.com
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list