[DGD] Heartbeat
Stephen Schmidt
schmidsj at union.edu
Tue Jan 14 17:36:32 CET 2003
On Tue, 14 Jan 2003, Jamin Vander Berg wrote:
> Any recommendations or things I should know about (but apparently can't
> find) about setting up a timer/heartbeat, or anything similar, for
> purposes of combat.
What are you using for your base mudlib? Melville has a heartbeat
function, and I am pretty sure 2.4.5 does also. Other than that,
you're probably looking to code your own. You need one function
to be the heartbeat, which starts the player's attack, and you
need a second one that starts and stops it. The first function
should use call_out to itself to occur regularly, and the second
one should perform a single call_out to the first to start the
ball rolling.
Think very carefully about exactly when the heartbeat should
shut off; NPCs with heartbeats that don't shut off properly
can fully entertain your CPU indefinitely.
> I understand combat is a pretty broad and complicated thing. In
> generally, however, combat does not insue as a series of responses to
> two living objects hitting each other, all happening instantly.
I'm not sure what this means. Are you trying to do the typical
mud combat system, which is that once every two seconds, any
living object with a target in mind takes a swing? Or do you
have something more elaborate in mind? Your reference to
ammunition makes me suspect the latter. If it is the latter,
post back with some additional details about how you want
this to work.
Remember that your combat code is going to run often (typically
once every two seconds) and will do so for every living object
in combat (on a big mud there could be 40 or 50 of those, each
calling it every 2 seconds). It is pretty important that this
code execute real quickly. It is also desirable to keep the
number of objects engaged in combat low. One good way to do
this is to make sure that combats are viciously dangerous so
they will end quickly.
> I'm looking for any general ideas/concepts/suggestions for starting up
> such a system. Any help is greatly appreciated.
The document on the call_out function would be the right place
to start. You could also look at how Melville implements this.
Steve Schmidt
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list