[MUD-Dev] Text Parsing
Katrina McClelan
kitkat at marcus.pants.nu
Thu Jun 10 13:43:01 CEST 1999
On Thu, 10 Jun 1999, Adam Wiggins wrote:
> Then at the top of act(), which is the routine which get called to turn the
> markup language into text that everyone in the room can see, I simply checked
> to see if num_pcs_in_room was greater than zero. If not, I just returned without
> doing any processing. This made quite a difference; up until then it had been
> constructing the "You leave north" and "A hobbit arrives from the south" strings
> every time a mobile moved, whether a PC was present or not.
>
This works, except that you then don't get full information when you snoop
a mob... oh yeah... can't do that in standard diku ;) (not that you
couldn't code around this limitation and still "blind" the mobs in
the general case anyway)
> I also staggered the way that things happened; at the time, most all of the game
> updating happened on the "tick" mark (every 60 seconds), which caused a slowdown
> right then. I made an "object tick", a "character tick", and so forth.
> By the same token, mobiles, which previous updated every 3 seconds (all of them),
> I changed to update every second. However, not *all* of them would update, only
> about 1/3rd. I'd just save the linked list pointer until the next second, and
> pick up where I left off. When it got to the end it would loop around again.
>
An informative note that this works because the standard game look checks
start time, and end time, and the last thing it does is sleep for the
remainder of 1/4 second. If your one loop takes longer than 1/4 second,
then you get server side lag. However if you distribute the computing
over multiple loops that use less than 1/4 second you don't notice the
high load on the client side. Only adding this because I had a mud once
reject this optimization arguing that it didn't save any CPU time.
Truthfully it doesn't save any computing time. It does help with
server lag however.
-Katrina
_______________________________________________
MUD-Dev maillist - MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list