[DGD] Speed Up?

Stephen Schmidt schmidsj at union.edu
Mon Apr 7 16:17:44 CEST 2003


On Mon, 7 Apr 2003 Jorn.Bakker at phil.uu.nl wrote:
> The MUD I'm working with is based on the Melville MUD-lib. What I know
> about 'heart' and 'tick', correct me if I'm wrong, is the following: the
> 'heart beat' controls the status of all objects.

It appears as if you may have modified Melville quite extensively.
In unmodified Melville 0.9.1, heart_beat is defined in auto.c, so
every object has it. It is not turned on automatically, so unless
you invoke it, it doesn't do anything. What it does after that
depends on what code you write for the heart_beat function.

> In the MUD-lib there's a class 'Living' which is inherited
> by all living objects in the MUD including the agent.

In unmodified Melville 0.9.1 there is no such class, although
it'd be reasonably easy to create it (and if I ever work on
0.9.2, that's on my list of things to do). Creating it would
involve nothing more than dividing player.c into two files,
one containing the code that is specific to the telnet
connection, the other containing the code generic to all
types of living objects. I presume you did something like
that for your mudlib?

> Then there's the 'tick' function which I use as a control loop
> for non-human living objects.

I presume this is also something you added. Is there a reason
to use a separate function, rather than having this attached
to the heart_beat? I think it would be more efficient to
maintain only one chain of call_outs, and have the heart_beat
in living.c invoke a function for your NPCs. I'm not sure of
that, however.

> I have tried setting it to zero but it didn't work. Maybe I'm already at
> maximum CPU power. But I have a strong feeling that I missed something
> important in my code.

I'm still not sure what you're trying to do, or what your
problem is. Is the problem that your heart() function is
never getting called? Or your tick() function? Your recursive
calls look fine, although they could break if there is an
error in the code above them. But you have to make the first
call to those functions externally to start the chain running,
and you haven't given any indication of how that is done.

I would join in the general warning that you probably want to
set rather long tick times, because of CPU demand, unless you
have a very fast machine with nothing else to do.

Steve Schmidt


_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list