Geos, Zones, Areas, and what the heck

Posted by Dralnu on Mon 09 Jan 2006 11:45 AM — 16 posts, 67,745 views.

USA #0
This sounds simple enough, just don't know exactly how to do it:

I would like to link all the areas into Geos, Zones, and then the area itself and maybe subareas, so that A) Areas themselves could be smaller, B) If you give someone an area name, you're not giving them a generality of 100-200 rooms C) You CAN give a new guy an area name and not have to give him directions to exactly where to go.

What I would like to see in where is something like:
Northern Forest, Along the River Contiso, At the mouth of the River

Or something like that (bad example, but I think you can get the idea). A few pointers, added places in the area files, and I know nothing of getting something to save in the system, and then calling it back. Unless I'm wrong, thats all that this will take up prety much, right? I don't want to extend where to cover a zone (at least not right now), so I won't have to mess with that. Could someone point me to some func and give me a short guide to saving (or point me to a walkthrough/faq for it?)
Australia #1
You could add in 2 new fields to the area files, Region and Sub-Region, look at the saving and loading of areas on how to do it.

You would also have to modify the area command to sort and display the data in a suitable way.

You would also need to change the aset commnand to be able to set the 2 new fields and add to the area structure in mud.h.

Basicly then all areas then belong to a region or be a sub-region of a particular zone.

Places of Interest in Dodgey World.

Region of Cows.
   Cow City
      The Barn
      The Hay Shed
   
   Horseville
      The Race Track

Region of the Devil
   Hell
      The Pits of Hell


Its probably not the best or easiest way to do things, but i guess it would work.
USA #2
Ok, thanks. Anyone with any more coments, do please post. I'll see what I can do to get this to work.
USA #3
struct zone_data {
ZONE_DATA *next;
ZONE_DATA *prev;
char *name;
AREA_DATA *first_area;
AREA_DATA *last_area;
ZONE_DATA *first_subzone;
ZONE_DATA *last_subzone;
ZONE_DATA *next_subzone;
ZONE_DATA *prev_subzone;
}

in struct area_data {
AREA_DATA *next_area;
AREA_DATA *prev_area;
}

there is no really perfect way to do this, one way i might suggest is as follows.

in your system folder you create a list zone.lst, in it you save it like follows:
#ZONE
AreaName Region of Cows
Area cowcity.are
SubArea cowcity_barn.are
SubArea cowcity_hayshed.are
Area horseville.are
SubArea horseville_racetrack.are
End

AreaName Region of The Devil
Area hell.are
SubArea hell_pits.are
End
#END

Now you fine tune your loading of zone.lst to read/save it like that, read new zones and add them to the list like follows:
LINK( new_zone, first_zone, last_zone, next, prev );

Link in the areas like follows:
LINK( area, new_zone->first_area, new_zone->last_area, next_area, prev_area );

Link in the zones like follows:
LINK( new_sub_zone, new_zone->first_subzone, new_zone->last_subzone, next_subzone, prev_subzone );

any questions ask away, one thing i might mention is that you need to load the zone list after areas have been loaded.

The reason i suggested this, is because if you mess with the area structure only, then you would need to save/load the zones stuff inside the area files, and i don't know about you but i hate messing with the area loading/saving stuff, plus if you want to fine tune your zone code you would need to redo area files over and over until you got it right. Also this way you don't have to add mutliple sub-area variables into the area_data, and this would allow for as many or as little sub_areas as you would like.
Amended on Fri 13 Jan 2006 04:55 AM by Gohan_TheDragonball
USA #4
Ok, great. Thanks. Only problem is, what the heck? I han't done anything that needed to be saves before (snippets have been what I've done so far, but in the grand scheme of things that does little to help with what half you just said), so I have no experience in this. Files would be a nice thing to know what I need to go through (I'm looking through save.c atm), since alot of this is organized in a way it makes little sense to me.
USA #5
As far as the structs he posted go, they can be found in mud.h
USA #6
/*
 * Area definition.
 */
struct area_data
{
  AREA_DATA *next;
  AREA_DATA *prev;
  AREA_DATA *next_sort;
  AREA_DATA *prev_sort;
  AREA_DATA *next_sort_name;	/* Used for alphanum. sort */
  AREA_DATA *prev_sort_name;	/* Ditto, Fireblade */
  ROOM_INDEX_DATA *first_room;
  ROOM_INDEX_DATA *last_room;
  char *name;
  char *filename;
  int flags;
  short status;			/* h, 8/11 */
  short age;
  short nplayer;
  short reset_frequency;
  int low_r_vnum;
  int hi_r_vnum;
  int low_o_vnum;
  int hi_o_vnum;
  int low_m_vnum;
  int hi_m_vnum;
  int low_soft_range;
  int hi_soft_range;
  int low_hard_range;
  int hi_hard_range;
  int spelllimit;
  int curr_spell_count;
  char *author;			/* Scryn */
  char *resetmsg;		/* Rennard */
  short max_players;
  int mkills;
  int mdeaths;
  int pkills;
  int pdeaths;
  int gold_looted;
  int illegal_pk;
  int high_economy;
  int low_economy;
  WEATHER_DATA *weather;	/* FB */
};


That the struct he ment? I've seen a few that look almost the same to me, and plus I'm not sure exactly what he means to do. Need to add in ZONE_DATA somewhere, grep AREA_DATA, and then try to figure out where everything goes?
USA #7
my bad, didn't realize a generalization of what you would need to do would suffice. let me put together a snippet for you, you will need to modify it of course.

and yes that is what i was talking about. that is the area_data structure, as to the other structures just cut and paste them into mud.h

also while i get the functions together, do the following. in mud.h search for area_data, you should see something like:
typedef struct area_data AREA_DATA;

insert this after that:
typedef struct zone_data ZONE_DATA;

also search for first_area until you find:
extern AREA_DATA *first_area;
extern AREA_DATA *last_area;

and insert:
extern ZONE_DATA *first_zone;
extern ZONE_DATA *last_zone;

also in db.c search for first_area and you find:
AREA_DATA *first_area;
AREA_DATA *last_area;

and insert:
ZONE_DATA *first_zone;
ZONE_DATA *last_zone;
Amended on Sun 15 Jan 2006 12:04 AM by Gohan_TheDragonball
USA #8
Yeah. Consider me a complete n00b for awhile. I'm starting to get the hang of the code, but still don't understand how alot of it works. I've got alot of plans, and little know how (redoing the resist system, armor system, probably most of the fight system), so until I get to where I'm posting just general issues with compile, I need the For Dummies ver.

An explination would be nice as to what is going on would be nice as well, just so I can get an idea on what is going on, but I know that may be a bit time-intensive, so only if you have the time and want to, that would be great

EDIT #1:
Looking through your post Gohan about the way it saves, would putting this in the area folder cause any problems? Keeping area-related things in the area folder would be nice...
Amended on Sun 15 Jan 2006 04:47 PM by Dralnu
USA #9
Well since I am gonna write an entire snippet, I was just gonna post the snippet on mudmagic.com, in the snippet I will be putting the file in the system directory, when i post here telling you where to get it, i will post exactly which part to change in order to have it go to the area directory instead.
USA #10
I appreciate it alot. Hate for you to go through all the trouble (in the end, probably about the same amount, but oh well), but thanks anyways.
USA #11
Actually its not really time out of my schedule, I was planning on doing something like this anyways. I have the auto-quest snippet installed and I hate giving it such general area names. One thing though, which version do you want. The one I am going to post will be slightly different than what I originally posted. I am going to have it so I can create a zone and assign a vnum range for a zone name. Like so:

Zone: Earth
Area Name: Southern Desert ( vnums 40000 - 40150 )
Sub-Areas:
Northern Dunes ( vnums 40000 - 40029 )
Southern Dunes ( vnums 40030 - 40059 )
Eastern Ridge ( vnums 40060 - 40089 )
Nomad Village ( vnums 40090 - 40119 )
Red Mountain ( vnum 40120 - 40145 )

Basically instead of just having to create multiple area files, I can specify a range within the area file as a sub-area and give it its own unique name. If you want it to just point to an area file tell me and i will just email you a seperate copy instead of pointing you to the snippet site.
USA #12
Well, both would be kind of nice, lol. I was originally thinking of using area files, since it may be a bit of an odd job to get something all built and keep the vnum range, like someone builds an area, lets say a town, and they add in a mayor's office, then decide to finish the town, then put in a barn, then you run into a slight problem of 'Ok, I have 100 - 200 for this, then 201-209 for this, then 210-230 for the first place again, then 231-240

See what I'm saying? That is a concern, at least to me. I don't so much mind having to make hundreds of area files as trying to sort out what goes where.
USA #13
its a one or the other kind of thing.
Amended on Wed 18 Jan 2006 07:01 AM by Gohan_TheDragonball
USA #14
Personally, I'd say go ahead and post it and let's see what it turns out looking like... it's starting to sound pretty interesting and I've also got the autoquester snippet installed in my smaugfuss too.. ;)
USA #15
Does, doesn't it? Anyways, it is a trade off on the two, but I'm lazy and I think making them all seperate areas would be the easiest to deal with, then I've got the fun job of rebuilding the Academy, make myself a new town, and all that fun crap before heading to build the rest of the game.