Please check out Thorns Of War !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. Generate vnum Sun May 30, 2004 [6:37 AM]
Wuzzbent
Email not supplied
member since: Nov 14, 2002
Reply
Can anyone tell me the best way to generate vnum's? I'm working on a mud from scratch and I was looking for the best way to keep tabs on objects. My search have resulted in most muds using vnums, I was wondering what the pseudo way of generating these numbers would be with non-duplication insurance. Are they generated by a static variable counter or what? I thought about using a GUID but that's a bit of overkill. Any thoughts?


2. RE: Generate vnum Sun May 30, 2004 [7:57 AM]
a_htw
Email not supplied
member since: Jul 18, 2003
In Reply To
Reply
Well... In most systems I know, the builder sets the object's vnum. It's like:

addobj 5

And it creates a blank object with the vnum 5.
If the vnum already exists, of course, the builder gets an error message.


3. RE: Generate vnum Sun May 30, 2004 [9:06 AM]
Ghasatta
Email not supplied
member since: Jun 17, 2002
In Reply To
Reply
I think this depends largely on just what you want these 'vnums' to do.
At a rudimentary level you could just use a static variable counter to tick
off numbers in serial. However, it might make sense to have the tag
follow some sort of structure, for the sake of everyone's sanity. Diku-ish
muds assign blocks of numbers according to zones, which is an
arbitrary amalgam of rooms, objects, and npcs. The benefit to this, of
course, is that one can know which 'area' a given object belongs to by
simply looking at the vnum. As the previous poster alluded to, while
blocks of vnums are associated with a given 'area,' the assignment of
vnums within that block is arbitrary.

My mud project is going with a hybrid system; our C++/OOP-based
Object system blurs the distinctions between objects of all sorts, so a
division according to 'type' is impractical. Instead, each object's id
contains discrete data (e.g., prototype id, instance number, etc) that can
be used to trace its origins. Each of the sections is separated by a
delimeter, with the idea being that people can use abbreviations to refer
to 'local' objects.

Not sure if that's what you are looking for, but good luck in any case :)




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]