Re: [CODE]Your opinion on new spell method

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 12/08/01


On Sat, 8 Dec 2001, Cyberlord wrote:

> So instead of making a list of possible targets once, I keep track of
> a list of who has been hit already and then compare a new room list of
> people (every time the spell re-fires) to those who have been hit
> already and skip if necessary. Sure it's a little more overhead but I
> get the results I want. :) People can come and go and all I track is
> who has been hit already.

Random thoughts in no particular order without segues:

- It's 8 bytes overhead for each character in the game.  (4 for the
pointer to the head of the list, 4 for the pointer to the next in the
list.  Assuming 32 bit addressing, of course.)  I don't view that as
significant overhead if it's necessary to achieve the desired results.

- You do have to make a decision about what happens with extracted players
in the hit list using your method.  The dangling pointers could cause you
problems.  Players don't like intermittent crashes any more than
implementors do.

- My view is that the spell terminates when there's no more targets, the
caster manually stops the spell, or the caster runs out of mana (since, in
my view, there's more than just an initial mana cost to such a potentially
powerful spell).

- What happens if the same person gets hit by chain lightning from two
different sources?  Is it not possible for two people to call down chain
lightning at the same time in the same vicinity, or is the person spared?
Your scheme doesn't allow for multiple ->next_hit pointers, as far as I
can tell, so a person can only belong to a single hit list at once.
Assuming this compromise is intended or acceptable, there are possibly
better ways to handle this.

- A possibility: couldn't you just set an effect to indicate the person
has been struck?  You could make it internally consistent by simply saying
that being struck increased their electric potential, not allowing a path
for current to flow.  Expire the effect after the chain lightning has
terminated (or maybe leave it on for a while, but the danger here is that
it expires before the spell has completed and the person gets hit again).
The only concern is that for each pulse of the chain lightning, you're
going to be going through the world[ch->in_room].people list from the
beginning until you find a matching target.  Fortunately, the pulses are
some time apart, there usually aren't that many people in a single room,
and the iteration is fast.  This achieves the desired result of people
being able to enter and leave during the spell.

- ...but if people can leave, won't they all just run away before they can
be caught up?  Or will they simply not know what's happening until it's
too late.  (Then again, that only means the first two or three won't know,
but the fourth and beyond would have to be stupid to not connect the dots
and realize chain lightning is heading their way.)


-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/24/03 PDT