Difference between revisions of "Explanation of the Code Base"
Masaru20100 (talk | contribs) (→pcgen.gui) |
(Update for the new UI) |
||
Line 39: | Line 39: | ||
==pcgen.gui== | ==pcgen.gui== | ||
− | This | + | This was the old GUI logic. It has now been removed and the UI is in the pcgen.gui2 classes. |
− | |||
==pcgen.gui2== | ==pcgen.gui2== | ||
− | This is the NewGUI logic. | + | This is the NewGUI logic, starting from PCGen 6.0. The main window is pcgen.gui2.PCGenFrame, the tabs are in pcgen.gui2.tabs. All interaction between the tabs and the PCGen core is done via facades. This provides a nice separation of controller and view logic from the model code. The facade implementation can be found in the pcgen.gui2.facade package. Other major packages are pcgen.gui2.converter for the LST Converter and pcgen.gui2.sources for the source selection dialog. |
==pcgen.io== | ==pcgen.io== | ||
Line 52: | Line 51: | ||
==pcgen.persistence== | ==pcgen.persistence== | ||
− | This is where the lst files are read in. The class that controls the loading is | + | This is where the lst files are read in. The class that controls the loading of data is SourceFileLoader. |
+ | |||
+ | |||
+ | ==pcgen.system== | ||
+ | |||
+ | This is where the new startup system introduced as part of the new user interface lives. The main class is pcgen.system.main. | ||
+ | |||
==pcgen.util== | ==pcgen.util== |
Latest revision as of 22:46, 30 December 2013
High level overview of PCGen Code Base
src/java/pcgen is where the code tree begins. The directories match the package names — so pcgen.core would be src/java/pcgen/core (or src\java\pcgen\core if you are on Windows).
Packages
pcgen.base.*
These classes are 'base' library elements. None of these should be objects that are dependent upon pcgen.cdom or pcgen.core classes. The intent is that pcgen.base elements are usable in any project, not specifically PCGen. No item which is deeply tied to the concept of a Role-Playing Game or building a Player Character should be present in this package.
pcgen.cdom.*
The pcgen.cdom package contains the core contents of the CDOM structure. There are a number of key subpackages of pcgen.cdom:
- pcgen.cdom.base: This is the "base" package, which has many key components that the entire PCGen code base is dependent upon. It should be expected that the members of this package have few dependencies outside of pcgen.base* and pcgen.cdom.base*, as this is "low" in the package hierarchy.
- pcgen.cdom.choiceset: This package contains Primitive Choice Sets
- pcgen.cdom.content: This package contains the non-CDOM Object content objects that would make up a Player Character. Long term, these objects would be "granted" by CDOM Objects, and thus would appear directly in the CDOM Graph that defines the Player Character (in 5.16, there is very little that distinguishes content from a helper)
- pcgen.cdom.enumeration: This package contains type safe enumerations (such as enums)
- pcgen.cdom.formula: This package contains items related to formula calculations performed by PCGen.
- pcgen.cdom.helper: This package is for "helper" objects of the CDOM Objects found within pcgen.cdom.inst. Generally a "helper" would be contained within the CDOM Object.
- pcgen.cdom.inst: This package is for instances of CDOM Objects. Long term, this will contain many of the objects currently in pcgen.core
- pcgen.cdom.list: This package contains list objects, such as Class Spell List objects. These list objects serve as identifiers for collections of CDOM Objects that are used at runtime.
- pcgen.cdom.reference: This package contains CDOM References
- pcgen.cdom.modifier: This package contains modifiers, a specialized form of content that is designed to alter the behavior of content that is part of a Player Character (The override from a Hit Die Lock is a good example of a modifier)
- pcgen.cdom.util: These are utility packages for classes contained within the pcgen.cdom* packages.
pcgen.rules.*
This package contains the classes related to the "Rules Data Store". The classes here are responsible for loading (and writing) the rules files (PCC, LST), and when combined with the token plugins, this package converts the persistent objects into the instances, lists, content, helpers, references, and other objects of the pcgen.cdom* package.
pcgen.core
This is where the business logic goes. This is the main engine that makes things work. The most important class in here is PObject, many classes are subclassed from this (like PCClass, Race, Feat, Spell, etc.). Another important class is PlayerCharacter which is where the player characters are constructed and manipulated. Globals contains the lists of objects loaded when a user loads their desired sources. Constants holds most of the code constants so you do not need to remember their values.
pcgen.gui
This was the old GUI logic. It has now been removed and the UI is in the pcgen.gui2 classes.
pcgen.gui2
This is the NewGUI logic, starting from PCGen 6.0. The main window is pcgen.gui2.PCGenFrame, the tabs are in pcgen.gui2.tabs. All interaction between the tabs and the PCGen core is done via facades. This provides a nice separation of controller and view logic from the model code. The facade implementation can be found in the pcgen.gui2.facade package. Other major packages are pcgen.gui2.converter for the LST Converter and pcgen.gui2.sources for the source selection dialog.
pcgen.io
This is where the disk writing stuff occurs, like creating/parsing pcg files, and exporting character sheets.
pcgen.persistence
This is where the lst files are read in. The class that controls the loading of data is SourceFileLoader.
pcgen.system
This is where the new startup system introduced as part of the new user interface lives. The main class is pcgen.system.main.
pcgen.util
This is where generally useful classes that are don't fit any of the other categories go.
plugin
This is where the pluggable features go. This includes tools such as Character Sheet, Dicebag, Random Name Generator, Encounter Generator, Network Management, Experience Tracker, Initiative Tracker, GM Notes, Overland Travel and the Character Tracker. It also includes processors for the variety of Lst Tokens and Output Tokens. There is also an Architectural Discussion of the PCGen Persistence Plugin System to help provide additional explanation of how the Lst Tokens work.
See the Javadocs for further details of the PCGen code base.