
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
"Björn Bergström" wrote:
> A variable speed system has several advantages, but a disadvantage is, as
> Topi points out, that all actors need to be checked to see if they should
> interrupt the action they are currently performing. This is not a big
> problem unless you have a huge amount of actors on a map though.
>
I never check for interruption on an actor that's not at the top of the
timequeue. But actors can get to the top of the timequeue several times
while they're involved in a long action.
If you check everybody every time anybody does something, your processing
time is proportional to the square of the number of creatures present.
That's unacceptable, it will be too slow. If you just keep track of an
"interruption interval" for them and check them that often when they're
involved in a long action, the interrupts will still happen in a timely
way but it'll be linear in the number of monsters present.
So, if your interruption interval is 3 seconds, and you pick an action
that will take 5 seconds, you'll get to the top of the timequeue 3 seconds
later. The program will check to see if you've been injured in the meantime
or whether any monsters have moved in your vicinity or (whatever interruption
criteria) and, if one of them has happened, offer you the opportunity to
give up your current action and start a different one. If you don't interrupt,
it'll just stick you two seconds down the timequeue (to finish your action).
If you pick an action that's ten seconds (like picking a door lock), this
will happen three times before you're finished, and the last time the end
of your action will be just one second away.
Most actions (swinging a sword, walking a square, casting most spells) are
shorter than the interruption interval, so this doesn't have much effect
on combat.
Bear
| <-- __Chronological__ --> | <-- __Thread__ --> |