Man projects
From LSWiki
Revision as of 17:59, 11 June 2007 (edit) Laine (Talk | contribs) ← Previous diff |
Current revision (17:59, 11 June 2007) (edit) Laine (Talk | contribs) |
Current revision
Description
The following is a standard for directory organization and master header file use in MUD projects, a term inclusive of areas, affiliations, and any other content. Its use is required for all new projects. Its primary goals are increased project maintainability and interoperability.
The top directory name of the project is its name, capitalized, with spaces replaced by underscores. Examples: /d/Tenochlan/Shadow_Tower, /d/Almeria/Lem, /d/Affiliations/Guilds/Justicars_of_Tyr.
The project has a corresponding .h header file (Shadow_Tower.h, Lem.h, Justicars_of_Tyr.h) that contains standard macros for project files; this is placed in the domain's lib directory (/d/Tenochlan/lib, /d/Almeria/lib, /d/Affiliations/lib) so that it may be included with a simple #include <Project.h> statement. Examine examples of these files.
Each file contains a list of standard macros which may vary slightly by the type of project. The names of these macros are detailed below. The file may also contain project-specific macros for ease of coding. These macros must stay within the "project namespace"; i.e. they must be of the form Project_Macro, not merely Macro. For some projects an "abbreviated namespace" is also appropriate; Justicars_of_Tyr.h may contain macros of the form Justicar_Macro in addition of Justicars_of_Tyr_Macro.
If the project name contains a character which cannot be used in a macro, such as an apostrophe or hyphen, replace the unusable character with an underscore in the macros only, not the files or directories. For example, the file R'lyeh.h, controlling an area located in /d/Almeria/R'lyeh, contains macros of the form R_lyeh_Macro.
The name of the project is a macro defining its top directory; this macro is placed in the relevant "master" file, normally the domain's header file. So the macro Lem is defined in Almeria.h. Sub-projects of other projects are defined in their parent project's header file; the area Terrace, located in /d/Exoma/Barsaive/Terrace, is a sub-area of Barsaive, so the macro Terrace is defined in Barsaive.h, while Barsaive is defined in the Exoma.h.
Individual files should be placed as follows:
Type Directory Macro
Armour /d/Domain/Project/arm Project_Armour() Comestibles /d/Domain/Project/f&d Project_Comestible() Daemons /d/Domain/Project/dmn Project_Daemon() The project control daemon, control.c, is expected to be found in this directory. All objects in this directory will automatically be preloaded. Data files /d/Domain/Project/dat Project_Data() Object save files, map configuration files, other data files. Definitions /d/Domain/Project/def Project_Definition() Definition objects (set, show, start, stop, and channel definitions). All objects in this directory will automatically be preloaded. Extensions /d/Domain/Project/ext Project_Extension() Extension objects (c.f. 'man extensions'). Help files /d/Domain/Project/hlp Project_Help() Help files; primarily used for affiliations to explain the philosophy, benefits, drawbacks and powers of the group. Miscellany /d/Domain/Project/etc Project_Misc() Objects which do not fall under these categories. Items commonly found here include doors, /std/quest objects, treasures, and so on. Modules /d/Domain/Project/mod Project_Module() Code modules intended to be inherited into disparate locations and not necessarily suitable for placement in a true base class. Monsters /d/Domain/Project/mon Project_Monster() "Monster" is defined as autonomon.c inheritors which are cloned, i.e. of which more than one exists. NPCs /d/Domain/Project/npc Project_NPC() "NPC" is defined as autonomon.c inheritors which are loaded rather than cloned, i.e. of which only one exists. Rooms /d/Domain/Project/rms Project_Room() Areas should have a base room file, Base.c, which all rooms in the area inherit; it should in turn inherit your domain's base file. The use of additional base-class room files for specific terrains and so forth within the area is common. Text /d/Domain/Project/txt Project_Text() General text files: some log files (more often logging is done to /txt/log/dev), QC comments, area history files containing background, reason for being and basic map, and quest walk-through files that sufficiently explain how to complete the quest. Weapons /d/Domain/Project/wpn Project_Weapon()
A three-letter directory naming method is maintained for aesthetic reasons and to keep filenames shorter.