<!-- MHonArc v2.4.4 --> <!--X-Subject: Re: [MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd) --> <!--X-From-R13: X Q Znjerapr <pynjNxnatn.ah> --> <!--X-Date: Sat, 29 Jan 2000 12:46:20 -0800 --> <!--X-Message-Id: E12Eel5-0002fy-00#dingo,kanga.nu --> <!--X-Content-Type: text/plain --> <!--X-Reference: E12BVr7-0003oB-00#dingo,kanga.nu --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, Re: [MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd)</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:claw#kanga,nu"> </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> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00230.html">Previous</a> | <a href="msg00233.html">Next</a> ] Thread: [ <a href="msg00201.html">Previous</a> | <a href="msg00187.html">Next</a> ] Index: [ <A HREF="author.html#00231">Author</A> | <A HREF="#00231">Date</A> | <A HREF="thread.html#00231">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>Re: [MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd)</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] [adv-mud] Spellbound Hierarchy and Keys (fwd) </LI> <LI><em>From</em>: J C Lawrence <<A HREF="mailto:claw#kanga,nu">claw#kanga,nu</A>></LI> <LI><em>Date</em>: Sat, 29 Jan 2000 12:46:15 -0800</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> > From: "phlUID" <phluid#mindless,com> > On Spellbound, every object in the game is given it's own database > number. Help files, races, spells, objects, rooms, mobiles, exits, > worlds, areas, classes, populations, etc. There are generically > two types of database numbers: Pure, which is just a simple unique > number given to every object, and Hybrid, which is used in the > case of Object's and Mobs. For example, a room is object #43, > while the sword in my inventory is #45:1 and the same type of > sword in my friend's inventory is #45:2. The second number is > referred to as an Entity ID because they refer to specific > Entity's instead of Entries. There is an Entry class for #45 > called ObjectEntry, and there is an associated Entity class for > ObjectEntry called Object. This concept is the same as DIKU's use > of OBJ_INDEX_DATA and OBJ_DATA. Translation: You have ObjectIDs which are synonymous with their (single) instance, and you have InstanceIDs which are synonymous with an instance of a referenced ObjectID. An ObjectID may have multiple InstanceIDs referring to it as each one marks a duplicate object. > Currently, Spellbound uses pointers directly to objects like > normal DIKU mud. ...various complaints about pointer tracking... > This is made worse by the object orientness of C++, so I began to > think of alternate ways of storing pointers. My first thought is using either an auto_ptr or some sort of simple reference counting scheme. > The first thing that I wanted to be able to do is validate > pointers. Reference counting with a flag would work fine. Put a reference count on your object class, and add an internal object_deleted flag that is checked on every reference. That way you just delete the object, the flag gets set, and at that point when its reference count falls to zero you call the destructor. There's actually a rather nicely written grim_reaper class floating about the net that handles this elegantly as a base class. > This started my thinking into the idea that it would be possible > to replicate this system to make sure that what I am referencing > is actually there. My database uses a regular array to return > pointer's to DB numbers, so there is no CPU time involved looking > through tables or linked lists. If I want object #43, I just call > Database.getEntry( 43 ) and it returns a pointer to that entry. You might like to hit the archives for discussion of my ObjectID format, and how it supports re-use and collision detection. > This identifier consists of a count of exactly how many nano or > milliseconds from the epoch. Remember that the high resolution timer on non-hard realtime systems (and not even most of those) is _not_ reliable or accurate. Furhter, you are relying on general clock accuracy. Consider the simple case where you have something like an NTP client or a SysAdm resetting the system clock: there is a definite chance for two timer calls to return the same value as the system clock passes the same value twice. > Assuming that no two object's can be created at the exact same > time, this gives each object ever created a unique identifier. Object A created at time X. System clock set back by NTP client to time X-Y. Y time later Object B created at time X. Both get the same ID. > If the database couldn't find #23, entity 0, or the time > identifier was wrong, I would end up with a NULL pointer, which > will just stop my action and inform Fred that Bob is no longer > there. Simple, effecient error control. I tend to be a big fan of exceptions (you might notice that my initial internal language used exceptions for all call returns, with a normal non-error return merely being a flavour of exception that defaulted to always being caught by the caller). Why use exceptions here? With your scheme ever piece of code that has to reference an object has to be prepared to find it non-existent. This is both a lot of duplication of effort and puts the load on the programmer for a task that the system can generally take care of instead (in the general case you just want events to fail that reference deleted objects, not try to manage the error). > The only real question that I had is if anyone can see ways to > improve this process. As above. For what you're doing (runtime checks only with no storage collision requirements) a refernece count etc seems cheaper and simpler. > On the technical side, I need a way of grabbing the time() in an > extremely precise manner... The syscall required tends to vary by OS: setitimer()/getitimer() are typical. -- J C Lawrence Home: claw#kanga,nu ----------(*) Other: coder#kanga,nu --=| A man is as sane as he is dangerous to his environment |=-- _______________________________________________ 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> <!--X-Follow-Ups-End--> <!--X-References--> <UL><LI><STRONG>References</STRONG>: <UL> <LI><STRONG><A NAME="00201" HREF="msg00201.html">[MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd)</A></STRONG> <UL><LI><EM>From:</EM> J C Lawrence <claw#kanga,nu></LI></UL></LI> </UL></LI></UL> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00230.html">RE: [MUD-Dev] Community Relations</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00233.html">RE: [MUD-Dev] Community Relations</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00201.html">[MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd)</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00187.html">[MUD-Dev] [adv-mud] Re: Topic list repost (fwd)</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00231"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00231"><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><A NAME="00202" HREF="msg00202.html">[MUD-Dev] Re: [adv-mud] Better Grammer Detection</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Fri 21 Jan 2000, 04:49 GMT <UL> <LI><strong><A NAME="00206" HREF="msg00206.html">[MUD-Dev] MUD-Dev vs. adv-mud</A></strong>, phlUID <a href="mailto:phluid#mindless,com">phluid#mindless,com</a>, Fri 21 Jan 2000, 06:37 GMT <UL> <LI><strong><A NAME="00204" HREF="msg00204.html">[MUD-Dev] Re: [adv-mud] MUD-Dev vs. adv-mud</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Fri 21 Jan 2000, 06:34 GMT </LI> </UL> </LI> </UL> </LI> <LI><strong><A NAME="00201" HREF="msg00201.html">[MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd)</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Fri 21 Jan 2000, 04:39 GMT <UL> <LI><strong><A NAME="00231" HREF="msg00231.html">Re: [MUD-Dev] [adv-mud] Spellbound Hierarchy and Keys (fwd)</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Sat 29 Jan 2000, 20:46 GMT </LI> </UL> </LI> <LI><strong><A NAME="00187" HREF="msg00187.html">[MUD-Dev] [adv-mud] Re: Topic list repost (fwd)</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Thu 20 Jan 2000, 23:41 GMT <LI><strong><A NAME="00186" HREF="msg00186.html">[MUD-Dev] Re: [adv-mud] What good is a hero when nobody knows?</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Thu 20 Jan 2000, 23:34 GMT <UL> <li><Possible follow-up(s)><br> <LI><strong><A NAME="00207" HREF="msg00207.html">[MUD-Dev] RE: [adv-mud] What good is a hero when nobody knows?</A></strong>, phlUID <a href="mailto:phluid#mindless,com">phluid#mindless,com</a>, Fri 21 Jan 2000, 06:37 GMT <UL> <LI><strong><A NAME="00235" HREF="msg00235.html">Re: [MUD-Dev] RE: [adv-mud] What good is a hero when nobody knows?</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Sun 30 Jan 2000, 05:13 GMT </LI> </UL> </LI> </UL> </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>