1999Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Text Parsing -->
<!--X-From-R13: Oqnz Ivttvaf <nqnzNnatry.pbz> -->
<!--X-Date: Thu, 10 Jun 1999 11:43:20 &#45;0700 -->
<!--X-Message-Id: Pine.SGI.3.96.990610113118.15044C&#45;100000#zazu,angel.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: Pine.BSF.4.10.9906092005590.8930&#45;100000#shell9,ba.best.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Text Parsing</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:adam#angel,com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00708.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00710.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00679.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00715.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00709">Author</A>
&nbsp;|&nbsp;<A HREF="#00709">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00709">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Text Parsing</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Text Parsing</LI>
<LI><em>From</em>: Adam Wiggins &lt;<A HREF="mailto:adam#angel,com">adam#angel,com</A>&gt;</LI>
<LI><em>Date</em>: Thu, 10 Jun 1999 11:42:35 -0700 (PDT)</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Wed, 9 Jun 1999, Matthew Mihaly wrote:
&gt; Machine has k6 400 processor, w/128 megs RAM. The server is written in C,
&gt; I believe, but I didn't write the server (I may not have an exact
&gt; understanding of what constitutes the server, but what I mean by it is the
&gt; thing that handles the low-level connection stuff). 

You need more RAM.

&gt; Yeah, I profiled it all. Mob ai is taking up about 20% of processor time,
&gt; and player movement is quite slow, taking up to .07 seconds when malloc is
&gt; low (our server has an irritating little memory leak, which we're working
&gt; to fix). 

Well, obviously you need to fix that, but in the meantime, give yourself
some breathing room with more memory.  I've got 300 megs in my home machine
now just because it's so damn cheap.  128m DIMMs are selling for about $100
at the store near my house; at that price, get two or three.

Don't have the cash?  Arctic was having serious memory problems, and they ran
a T-Shirt drive to raise money.  I think they charged $20 for the shirts, which
they acknowledge as "well more than they were worth", but the idea was that
you were contributing to the improvement of the game.

They made so much money from it that they bought an entire new machine with
(I believe) 512 or 1024 megs of RAM.  The MUD runs *much* nicer now, no delays
at all, even at its peak of ~250 players online at once.

&gt; Currently, mob AI is broken up into three main tasks. One handles mobiles
&gt; that randomly wander about (quite a few of those. Butterflies to net and
&gt; the like). One handles mobiles that are involved in a fight. The final one
&gt; handles everything else (healing, gathering items, etc). 
&gt; So really, at most, that accounts for, on the high end, say, 35% of
&gt; processor time. The other 65% seems to be reasonably well-distributed
&gt; among everything else.

One thing I found, given the task of optimizing a diku clone years ago to run
more smoothly on a Sparc 10 (not real speedy and only 128M of RAM) was that
there were a lot of simple assumptions that were never accounted for.

For example, the first thing I did was add a room field num_pcs_in_room.
This number started at 0, was incremented when a player entered the room,
and decremented when they left.

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.

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.

Finally, I took the mobile code and made it so that they stored a lot more information
about their current state, rather than recomputing it every pulse.  As a result,
their update was often reduced to just looking at their current task and deciding
that they wanted to keep doing it, rather than, say, recomputing a path to their
target every update.

Finally, hardware is cheap.  If you'd rather spend your time improving the gameplay
rather than optimizing (I know I would), and you have the cash, I'd shell out for
something more powerful, probably SMP.  Go for dual Celerons, or dual PII/PIII's
if you can afford it.  (Personally, I'm waiting for my dual K7-800's, although
I guess I shouldn't hold my breath on that one.)

Adam W.




_______________________________________________
MUD-Dev maillist  -  MUD-Dev#kanga,nu
<A  HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00717" HREF="msg00717.html">Re: [MUD-Dev] Text Parsing</A></strong>
<ul compact><li><em>From:</em> Matthew Mihaly &lt;diablo#best,com&gt;</li></ul>
<li><strong><A NAME="00715" HREF="msg00715.html">Re: [MUD-Dev] Text Parsing</A></strong>
<ul compact><li><em>From:</em> Katrina McClelan &lt;kitkat#marcus,pants.nu&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00679" HREF="msg00679.html">Re: [MUD-Dev] Text Parsing</A></STRONG>
<UL><LI><EM>From:</EM> Matthew Mihaly &lt;diablo#best,com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00708.html">Re: [MUD-Dev] Game Economies</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00710.html">Re: [MUD-Dev] Virtual worlds based on real world history</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00679.html">Re: [MUD-Dev] Text Parsing</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00715.html">Re: [MUD-Dev] Text Parsing</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00709"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00709"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] Text Parsing</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00625" HREF="msg00625.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
David Bennett <a href="mailto:ddt#discworld,imaginary.com">ddt#discworld,imaginary.com</a>, Wed 09 Jun 1999, 01:15 GMT
</LI>
</ul>
</ul>
</ul>
<LI><strong><A NAME="00620" HREF="msg00620.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 08 Jun 1999, 23:58 GMT
</LI>
<LI><strong><A NAME="00654" HREF="msg00654.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 10 Jun 1999, 01:43 GMT
<UL>
<LI><strong><A NAME="00679" HREF="msg00679.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Matthew Mihaly <a href="mailto:diablo#best,com">diablo#best,com</a>, Thu 10 Jun 1999, 06:13 GMT
<UL>
<LI><strong><A NAME="00709" HREF="msg00709.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Thu 10 Jun 1999, 18:43 GMT
<UL>
<LI><strong><A NAME="00715" HREF="msg00715.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Katrina McClelan <a href="mailto:kitkat#marcus,pants.nu">kitkat#marcus,pants.nu</a>, Thu 10 Jun 1999, 21:57 GMT
<UL>
<LI><strong><A NAME="00721" HREF="msg00721.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Thu 10 Jun 1999, 22:41 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00717" HREF="msg00717.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Matthew Mihaly <a href="mailto:diablo#best,com">diablo#best,com</a>, Thu 10 Jun 1999, 22:15 GMT
<UL>
<LI><strong><A NAME="00722" HREF="msg00722.html">Re: [MUD-Dev] Text Parsing</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Thu 10 Jun 1999, 22:55 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>