Re: Saving Room & Zone Data To PLR Files

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 11/04/00


Lord Kyu wrote:
>
>    Playing around in another realm, there has been a lot of talk about
> where players have been, if they have done it all, and things along
> those lines.  Being a non-pk realm, players at the max level have little
> else to do than explore.  But it runs dry after awhile as well.  Saving
> zone vnum's that a player has been in, I believe, is already something
> this realm does.  What about taking it a step further?  What about
> rooms?
>
>    The first problem I see with this is the space issue of player
> files.  So as not to add a ton of information to every player file, one
> could code it so that it only saved this info after reaching max level.
> Then comes the second part.  The time taken, the system push, to go
> through a player file, searching for every room, adding rooms they have
> been in.  This I think, is the killer of the idea.

Well, all you really need to store is a single bit (1 or 0) for each
room.  Since the higest possible zone is 326 you'd end up with something
like this...

unisgned long seen_rooms[1019]; /* 32600 / 32 rounded up */

Add that to struct player_special_data_saved and yes, it WILL mess up
your pfiles.

you can access it like so...

#define GET_SEEN_ROOM(ch,vnum) \

(CHECK_PLAYER_SPECIAL((ch),((ch)->player_specials->saved.seen_rooms)[(vnum)/32]&((vnum)%32))

#define SET_SEEN_ROOM(ch,vnum) \

(CHECK_PLAYER_SPECIAL((ch),((ch)->player_specials->saved.seen_rooms)[(vnum)/32]|=(1<<((vnum)%32)))

#define CLEAR_SEEN_ROOM(ch,vnum) \

(CHECK_PLAYER_SPECIAL((ch),((ch)->player_specials->saved.seen_rooms)[(vnum)/32]&=~(1<<((vnum)%32)))

/* and just in case you really want it (for completeness sake)... */
#define TOGGLE_SEEN_ROOM(ch,vnum) \

(CHECK_PLAYER_SPECIAL((ch),((ch)->player_specials->saved.seen_rooms)[(vnum)/32]^((vnum)%32))

After that you're looking at an increase in pfile size of about 4k per
player and the same for memory usage.  So if you have approx. 1000
players in your pfile and approx 100 of them play at any given time then
you'd be looking at increasing the pfile size by approximately 4 megs
and your memory usage by approx. 400k, a lot, but do-able.

Regards, Peter


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT