.def Files

From OuroDev
Revision as of 16:12, 4 February 2020 by PhiloticKnight (talk | contribs) (Created page with "=.DEF Files= City of Heroes' .def files are [https://docs.microsoft.com/en-us/cpp/build/reference/module-definition-dot-def-files?view=vs-2019 C language module definition] re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

.DEF Files

City of Heroes' .def files are C language module definition resource files that contain object descriptions. These act as a data repository that the game engine uses to look up information to be used in making decisions within the game. They are compiled into .bin files to make them more efficient during runtime. These are the primary method of storing data in the City of Heroes engine outside of the SQL databases.

Structure of a .DEF File


  1. Comment - the parser ignores any lines that start with a double forward slash (//), as well as the remainder of a line that contains these characters
  2. Object Name - The name of the C object
  3. Object Opening Bracket - This denotes the beginning of the C object. Everything between this bracket and the matching closing bracket are considered attributes of the object.
  4. Attribute Name - The name of an attribute. This name has to be the first non-white-space thing on a line.
  5. Attribute Value(s) - One or more values for the attribute named. If there is more than one value, those values would be separated by at least one space. Other whitespace between them is ignored by the compiler. There may also be commas separating them as well as the white-space. It's not known at this time whether or not these commas are interpreted by the compiler.
  6. String Attribute Value - Strings may be also be represented as values within an object. These are denoted by double quotes ("). Spaces are allowed between the double quotes and are considered part of the string attribute.
  7. Sub-Object Name - Objects may contain one or more sub-objects, each with their own attributes. There is (as far as is known) no limit to the number of sub-objects that an object can contain, nor to the depth of the number of object levels that can be found inside of an object, as sub-objects could potentially contain objects of their own.
  8. Sub-Object Opening Bracket - This denotes the beginning of the C sub-object. Everything between this bracket and the matching closing bracket are considered attributes of the sub-object.
  9. Sub-Object Closing Bracket - This denotes the ending of the C sub-object. A new sub-object or attribute of the main object can be declared after this bracket.
  10. Object Closing Bracket - This denotes the ending of the C object. There may be a plethora of C objects inside of the same .DEF file.

Note: The compiler, just as a web browser, ignores extraneous white-space in the code. Thus, you can use whatever spacing you want to make a file human readable, and the compiler won't care, as it will ignore these.