Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 10-10-2003, 03:16 AM   #1
markizs
Member
 
Join Date: Jan 2003
Location: Riga, Latvia
Posts: 36
markizs is on a distinguished road
Send a message via ICQ to markizs
How you have made room counting code in lpmud. like when player can see howm many rooms he have explored from total. i mean, without making every room to inherit one standard object or somthing, as that would limit builders from making different virtual and maze areas and stuff.
markizs is offline   Reply With Quote
Old 10-10-2003, 04:43 AM   #2
JilesDM
Member
 
Join Date: Nov 2002
Posts: 66
JilesDM is on a distinguished road
Quote:
Originally Posted by
i mean, without making every room to inherit one standard object or somthing, as that would limit builders from making different virtual and maze areas and stuff.
Please explain.
JilesDM is offline   Reply With Quote
Old 10-10-2003, 04:46 AM   #3
Ogma
Member
 
Ogma's Avatar
 
Join Date: Apr 2002
Home MUD: DartMUD
Posts: 86
Ogma is on a distinguished road
Let me get this straight...you want your builders to make their very own implementations of a base room? If they want a different kind of room, why not inherit /std/room.c and override functions in it? The whole philosophy of LPMUDs is based on reusing code and layers of inheritance. Each layer adds flexibility, it doesn't take it away.

We've suffered no lack of flexibility in our design by having a single base room object that all rooms have at the root of their inheritance tree, and we do some pretty funky things with it, such as our Underdark area, which creates rooms on the fly and our hex grid system for wilderness travel.
Ogma is offline   Reply With Quote
Old 10-10-2003, 05:02 AM   #4
markizs
Member
 
Join Date: Jan 2003
Location: Riga, Latvia
Posts: 36
markizs is on a distinguished road
Send a message via ICQ to markizs
well ok then. lets forget virtual areas where there is only one object actualy but players think they see huge many rooms area. and forget different mazes where rooms are created on the fly. imagine allr oms are derived from standard room obj. how you make counting ?
markizs is offline   Reply With Quote
Old 10-11-2003, 05:58 AM   #5
JilesDM
Member
 
Join Date: Nov 2002
Posts: 66
JilesDM is on a distinguished road
Quote:
Originally Posted by
lets forget virtual areas where there is only one object actualy but players think they see huge many rooms area.
Yes, let's. That is almost always a very poor design decision.

Quote:
Originally Posted by
and forget different mazes where rooms are created on the fly.
This is easily accomplished when using a base room class.

As for counting, here's what you need to do:

1) Design a robust system of assigning unique IDs to rooms
2) Design a scheme for storing the necessary information.

That's it.

Necessary UID characteristics:

Addition of new rooms must not alter the UIDs of existing rooms.

The UIDs of deleted of rooms must be removed and invalidated. The former is trivial, the latter less so. Failure to ensure the latter may result in players with exploration "scores" of greater than 100%.

The details will vary based on the design of the specific mudlib in question. A relatively efficient generalized implementation of this sort of system is actually fairly hard to design, though the problem can be simplified greatly if you can guarantee certain extra restrictions (e.g., no room will ever be deleted once it has been seen by a player).
JilesDM is offline   Reply With Quote
Old 10-11-2003, 04:39 PM   #6
shadowfyr
Senior Member
 
Join Date: Oct 2002
Posts: 310
shadowfyr will become famous soon enough
Umm.. While I don't know a whole lot about LPC... A while back I was asking a wiz on the mud I play at how you would go about finding out the names or other information about say each existing piece of equipment in the game. According to what I was told you can get a list of loaded objects that are derived from a based class. All you would then need to do is count the total number of objects returned. Using an UID system seems like overkill if this works...

Note - This wouldn't work for rooms that do not load until some event or the like references them (like the ones created on the fly), which is essencially what the virtual rooms do, since they pull up the data for the room and insert it into the standard room object. However, I am not sure if such virtual rooms necessarilly get removed when they go inactive. If they stay in memory, then they would be in the list of derived objects as well.

I tried looking at the virtual code once for an LPC library that I tried using to play with (and was broken), but it confused the #### out of me at the time, so I don't know if they are created and destroyed as needed or if they just check to see if they exist already and create the room if needed. This would imho make more sense speed wise, but you never know.

Anyway, there should be a way to generate such a list. If the mud driver also has some sort of means to return the upper bound of the array generated (I assume it should), then you may not even need to count them, just get the bounds for the array. Now if you where counting unique objects of some sort...
shadowfyr is offline   Reply With Quote
Old 10-11-2003, 08:07 PM   #7
JilesDM
Member
 
Join Date: Nov 2002
Posts: 66
JilesDM is on a distinguished road
Quote:
Originally Posted by
Using an UID system seems like overkill if this works...
That does not work. UIDs are necessary.

It also will not work correctly on DIKU unless all rooms are always loaded when the MUD boots up.
JilesDM is offline   Reply With Quote
Old 10-12-2003, 04:27 PM   #8
shadowfyr
Senior Member
 
Join Date: Oct 2002
Posts: 310
shadowfyr will become famous soon enough
Well. That is the one drawback. It only returns instances of loaded objects. But your method isn't any better, since it assigns each UID as the room loads (apparently) then removes it later when it is unloaded. Or I don't understand what you actually mean. In any case it wouldn't work if each new room got a premanent UID, either since removing room 3962-3965 out of a 10000 room mud leaves a gap. You would have to literally reassign everything above the start of the gap and adjust the number or the count would never be right anyway. Short of storing all rooms in a database and executing something like 'FROM Rooms COUNT ALL' or whatever the SQL would be for it, there is no way to do better than giveing a rough (and inaccurate) guess or counting the existing loaded rooms.
shadowfyr is offline   Reply With Quote
Old 10-12-2003, 05:51 PM   #9
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
Quote:
Originally Posted by
shadowfyr:  Umm.. While I don't know a whole lot about LPC... A while back I was asking a wiz on the mud I play at how you would go about finding out the names or other information about say each existing piece of equipment in the game. According to what I was told you can get a list of loaded objects that are derived from a based class. All you would then need to do is count the total number of objects returned. Using an UID system seems like overkill if this works...
I think you are answering the wrong question.

The original poster wanted to count the number of rooms visited by the player, not the number of rooms currently loaded.

Therefore the method, as JilesDM outlined, is to keep (for each player) some form of "list" of rooms visited, and count the number of items in that list.

The UID could be based on the filename, or the coordinates, or an integer similar to the vnum in dikurivatives, but it needs to be there to uniquely identify rooms for adding to the list (or ignoring, if already visited).
Loriel is offline   Reply With Quote
Old 10-13-2003, 02:57 AM   #10
markizs
Member
 
Join Date: Jan 2003
Location: Riga, Latvia
Posts: 36
markizs is on a distinguished road
Send a message via ICQ to markizs
hmm. well UID for each room ... that would mean that each playerfile would store like 5000 room numbers player has visited? sounds like lot of resources needed. Wont there be too long evalution errors etc with so high ammount of data?

well i just wanted to know if there are anyone who have actualy made it? becouse there are lots of muds out there who do have that sort of feature. i guess in rom based muds its easier to implement though.
markizs is offline   Reply With Quote
Old 10-17-2003, 03:31 AM   #11
Avelan
New Member
 
Join Date: Apr 2003
Posts: 2
Avelan is on a distinguished road
I have implemented this feature on my mud, though i'm sure there's a better way to do it(there always is)

I have a separate handler which keeps track of rooms a player has visited. The data for each player is saved separately and only loaded when a person is logged on.
My system doesn't include any virtual rooms as i think there's no point in including for example rooms in a wilderness.
The rooms that are included into the system are added "by hand", for example, you create a new area in /d/whatever, you can have the system include all rooms in that dir and the subdirectories.

Also, you have to make sure that the data structure doesn't get too big to handle, ie. don't store all the rooms in a single huge array that you have to check each time a player enters a room.
I have the rooms organized by their directories so the size of the array to check isn't very large usually.

The reason i didn't make it automatically search all room files in the mud and include them in the system was that not all rooms in a mud are accessible by players, for example when areas are still under construction.

Also, you will have to make sure that when/if a room that is in the system is removed/renamed it will also be removed from the system itself, as JilesDM pointed out earlier.

Plus, when a player gets removed, also remove their "explore" information or next time someone creates a character with the same name they'll already have explored the rooms

-Avelan
Avelan is offline   Reply With Quote
Reply


Thread Tools


Room count in LPmuds - Similar Threads
Thread Thread Starter Forum Replies Last Post
Someting must be wrong with the vote count Anitra Bugs and Suggestions 29 11-12-2006 02:33 PM
LPmuds.net Forums Alexander Tau MUD Announcements 2 09-19-2006 02:18 PM
Coordinate AND Room Based Codebase? Mabus MUD Coding 4 08-22-2006 05:49 PM
Repeating Room Descs Estarra MUD Builders and Areas 19 10-08-2003 02:31 AM
Room for Love SolViLune Tavern of the Blue Hand 4 10-06-2003 10:05 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 12:34 PM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014