This file contains information on various things that are on the player's starcharts and are archived over a few turns.
New Format [PCC 1.0.8+]
The new starcharts file format is designed to be extensible, and to be parsable by a program which does not fully understand it. So it is divided into chunks, somewhat like UTILx.DAT.
Header: +0 8 BYTEs Signature, "CCchart",26 +8 WORD Turn number +10 WORD Start of first data block (file offset, 0-based) +12 WORD Number of extra planet properties +14 WORD Number of extra starship properties +n n BYTEs Names of extra planet properties +n n BYTEs Names of extra ship properties
By default, there is a planet property `COMMENT' and a ship property `COMMENT' declared. Users may declare more properties.
Blocks: +0 WORD Type 1 Planet History (one per planet) 2 Ship History (one per ship) 3 Ship Track (one per ship; but see below) 4 Mine Field (may be many) 5 Painting (may be many) 6 Auto Build (one) 7 Ship Property (one per ship) 8 Planet Property (one per planet) --- PCC 1.1.6+: --- 9 Ship Score (one per score; but see below) 10 Planet Score (one per score; but see below) 11 Painting Tag Info (see below) --- PCC 1.1.7+: --- 12 Ufo History (one per Ufo) +2 DWORD Size +6 n BYTEs data
After CCMERGE is used, several of the records given here might appear multiple times even if the above says the converse:
- Ship Track
- Ship Score
- Planet Score PCC will merge them when it loads the starchart file.
PCC2 supports CHARTx.CC as well, starting with version 1.99.3.
- 1.99.3: types 1, 4, 5, 6, 11
- 1.99.4 and later: types 1 .. 12
--- Type 1: Planet History (mostly a standard PDATAx.DAT record) --- +0 WORD (b) Owner +2 WORD Id [*] +4 3 BYTEs FCode +7 3 WORDs (b) Mine / factory / defense count If only industry level known ("light" etc.), the factory count is 30000+n (n = PHost industry level 0..5) +13 4 DWORDs (a) Mined N/T/D/M +29 DWORD (b) Clans +33 DWORD (d) Supplies +37 DWORD (d) mc +41 4 DWORDs (a) Ground N/T/D/M +57 4 WORDs (a) Density N/T/D/M +65 2 WORDs colonist / native tax +69 2 WORDs colonist / native happiness +73 WORD (c) native government +75 DWORD (c) Natives +79 WORD (c) Native race +81 WORD Temperature (-1 unknown) +83 WORD Starbase present? (0 or 1) +85 4 WORDs Timestamps: (a) = minerals, (b) = colonists, (c) = Natives, (d) = mc/sup --- PCC2 --- +93 BYTE Known-to-have-natives flag --- Type 2: Ship History --- +0 WORD Id [*] +2 WORD Player id [*] +4 3 BYTEs (b) FCode +7 WORD Speed +9 2 WORDs (b) WaypointDX/DY +13 2 WORDs X/Y +17 WORD (b) Engine +19 WORD Hull +21 2 WORDs (a) Beam, Beam count +25 WORD (a) Bay count +27 WORD (a) Launcher type +29 WORD (a) T/F +31 WORD (a) Launcher count +33 WORD (b) Mission +35 WORD (b) PE +37 WORD (b) Tow id +39 WORD (a) Damage +41 WORD (a) Crew +43 WORD (b) Clans +45 20 BYTEs Name +65 4 WORD (b) N, T, D, M +73 WORD (b) Supplies +75 7 WORDs (b) Unload +89 7 WORDs (b) Transfer +103 WORD (b) Intercept id +105 WORD (b) Money +107 2 WORDs Timestamps: (a) weaponry/combat, (b) rest --- Type 3: Ship Track --- +0 WORD Id +2 WORD Ref. Turn (=turn number of first record) +4 n BYTEs Records of 9 bytes each, newest turn first +0 2 WORDs X, Y +4 BYTE Speed +5 WORD Heading +7 WORD Mass --- Type 4: Mine Field --- +0 n BYTEs Records of 16 bytes each. The number of such records is determined by the size of the whole block. There may be any number of Mine Field blocks, each containing several mine fields. +0 WORD Id +2 WORD X +4 WORD Y +6 WORD Owner +8 DWORD Number of mine units +12 WORD Type 0 Normal Mines 1 Web Mines +14 WORD Turn of last information about this field --- Type 5: Painting --- +0 n BYTEs Records of variable size. The number of records is determined by the size of the whole block. There may be any number of Painting blocks, each containing several elements. +0 BYTE Type of element 0 Line 1 Rectangle 2 Circle 3 Marker Bit 7 1 if comment present +1 BYTE Color +2 WORD X1 +4 WORD Y1 +6 WORD Line, Rectangle: X2 Circles: radius Markers: Type 0 "+" (plus) 1 "!" (exclamation mark) 2 "x" (cross) 3 "<>" (diamond) 4 "p" (flag) 5 (down-up `lock' arrows) 6 "><" (right-left `lock' arrows) 7 [PCC 1.1.11+] (cactus) +8 WORD Line, Rectangle: Y2 others: zero +10 WORD Tag (non-negative for user-defined markers) +12 WORD Turn of expiry (-1=never). If this field is, for example, 17, the marker will be deleted at turn 18. +14 n BYTEs Comment (Pascal string), only if bit 7 in type set. Used only for markers. --- Type 6: Auto Build --- +? & BYTEs 500 Records of 12 BYTEs each +0 WORD Number of Mines +2 WORD Number of Factories +4 WORD Number of Defense Posts +6 WORD Number of SB Defense 0..999 specify the wanted amount, 1000 means "max". +8 BYTE Speed for Mines (1..100) +9 BYTE Speed for Factories (1..100) +10 BYTE Speed for Defense Posts (1..100) +11 BYTE Speed for SB Defense (1..100) --- Type 7: Ship Properties --- --- Type 8: Planet Properties --- +0 WORD Id +2 WORD Number of values +4 n RECORDs of 6 bytes each. These store the type information for each value, as well as scalar values. +0 WORD Type 0100h EMPTY 0200h Integer 0300h Boolean 0400h String 0500h IEEE `single' 0600h Long String 0700h (PCC2 VM) Subroutine reference 0800h (PCC2 VM) Array reference 0900h (PCC2) Blob 0A00h (PCC2) File handle 0B00h (PCC2 VM) Hash reference 0C00h (PCC2 VM) Struct reference 8000h (PCC2 VM) Ship 8100h (PCC2 VM) Planet 8200h (PCC2 VM) Minefield 8300h (PCC2 VM) Ion storm 8400h (PCC2 VM) Hull 8500h (PCC2 VM) Engine 8600h (PCC2 VM) Beam 8700h (PCC2 VM) Torpedo 8800h (PCC2 VM) Torpedo launcher 8900h (PCC2 VM) Stack frame 8A00h (PCC2 VM) Global context 8B00h (PCC2 VM) Lock (mutex) 8C00h (PCC2 VM) Iterator 8D00h (PCC2 VM) Player xx00h reserved others Real +2 DWORD Value + EMPTY: unused + Integer, Bool, File handle: value + String: 0 if empty string, nonzero if non-empty string (actual value follows below) + Real: all 6 bytes form a Turbo Pascal Real + Single: IEEE 32-bit floating point number (read by PCC 1.0.9+) + Long String, Blob: length of string, if non-zero, value follows below (PCC2, read by 1.0.18+) + Ship, planet, etc.: object id + Stack frame: index relative to current function, 0 means top ("static") + Subroutine/array/hash/struct reference: object Id, relative to current file. This is not currently supported in starchart files (CHARTx.CC), only in VM (SCRIPTx.CC) and object files. + Lock: flags; bit 0 set if this lock is associated with the current process +? n BYTEs String values. Non-empty strings follow here, in correct order. A normal string (0400h) is stored as length byte plus actual string data. A long string (0600h) contains just the data; the length is in the header. A lock contains the data for the lock: +0 DWORD Length of name +4 DWORD Length of note +8 n BYTEs Name +? n BYTEs Note
Note: the variable value representation is optimized for size. It uses the fact that each Turbo Pascal Real whose first byte is zero has an effective value of zero, independently of the other bytes. We therefore normalize actual zeroes by setting them to six-bytes-zero, such that the other type tags do not appear in regular real values.
Turbo Pascal Reals are 48 bits, where Bits 0..7 Exponent "e" Bits 8..46 Mantissa "f" Bit 47 Sign "s", 0 means +1, 1 means -1 The actual value is e = 0 0.0 otherwise s * 2^(e-129) * 1.f
PCC 1.0.9 and later will also read files with IEEE 32-bit floating point numbers, but will never write them this way. This feature was originally intended to be used by programs such as PCC 2, which use IEEE floating point internally. However, as of 21/Jan/2009, PCC 2 writes Reals only, which have significantly higher precision. IEEE FP can still be read by both.
IEEE float ("single precision") has 32 bits: Bits 0..22 Mantissa "f" Bits 23..30 Exponent "e" Bit 31 Sign "s" The actual value is e = 0, f = 0 s * 0.0 (signed zero) e = 0, f <> 0 s * 2^-126 * 0.f e = 255, f = 0 s * inf (signed infinity) e = 255, f <> 0 NaN (not a number, error) otherwise s * 2^(e-127) * 1.f
Likewise, 1.0.18 can read Long Strings (although it will truncate them to 255 bytes). PCC 2 writes String or Long String, depending on the size of the string.
Other values with a zero exponent are reserved. PCC up to at least 1.1.17 will read those as Real 0.0. However, if one such value describes a complex value that has data in the String Values area, those would be misparsed. PCC 2 therefore refuses to read Property records containing such values.
Entries marked "PCC2 VM" are only valid in the PCC2 virtual machine state file (SCRIPTx.CC), which uses the same data structure.
--- Type 9: Ship Scores [PCC 1.1.6+] --- --- Type 10: Planet Scores [PCC 1.1.6+] --- +0 WORD Size of the following structure +2 54 BYTEs Header. This is the same header as in a type-49 resp. type-50 UTILx.DAT record. The size is explicitly given above in case we someday enlarge this structure. +0 50 BYTEs Name +50 WORD Score Id +52 WORD Score Limit +x 3N WORDs Score entries. The number is implicitly given by the total block size. +0 WORD Id +2 WORD Score Value +4 WORD Turn number --- Type 11: Painting Tag Info [PCC 1.1.6+] --- +0 WORD Number of entries in this record +2 n WORDs Tag values +2N n BYTEs For each tag value, a Pascal string
If existent, this record precedes a Painting record (type 5). It defines how Tag values corresponded to strings (atoms) when the file was written. Upon loading, PCC will modify the tags in the paintings accordingly.
When CCMerge was used, there will be multiple Painting Tag records. Each of them only applies to the Painting record which follows.
--- Type 12: Ufo History [PCC 1.1.7+] --- +0 WORD Id +2 78 BYTEs Standard Ufo record. See UFO.HST for a detailed description of the fields. +0 WORD Color +2 20 BYTEs Name +22 20 BYTEs Info 1 +42 20 BYTEs Info 2 +62 2 WORDs X, Y +66 WORD Speed +68 WORD Heading +70 WORD Planet visibility range +72 WORD Ship visibility range +74 WORD Radius +76 WORD Type +80 DWORD Real Id number. If the Ufo represents some object which has its own Id number, this Id number is stored here. For PHost wormholes, this is the wormhole Id. +84 WORD Turn when this Ufo was last seen +86 WORD X position where this Ufo was last seen +88 WORD Y position where this Ufo was last seen +90 WORD X movement per turn +92 WORD Y movement per turn PCC uses the last four fields to estimate the wormhole's current position.
Old Format [up to PCC v1.0.7]
The file may end at any --- mark, depending upon which PCC version is used. Programs must detect this and not reject the file. Likewise, the file was extended quite often at the end. Gee, is this an ugly file format... Rest in peace.
+0 n BYTEs 500 records +0 WORD Color of planet (see below) +2 n BYTEs Comment as Pascal string --- Planet history --- +n WORD Number of stored planets. All planets ever seen with a Sensor Sweep Mission or visited by a ship are stored here. +n+2 m BYTEs Records of 67 bytes each +0 WORD Id number of planet +2 WORD Owner, 0=unowned +4 4 DWORDs Minerals on surface (N, T, D, M) +20 4 DWORDs Minerals in ground (N, T, D, M) +36 4 WORDs Mineral density (N, T, D, M) +44 WORD Temperature. Value 0 = unknown, 101-Temp. otherwise. This value is the PDATAx.DAT value plus 1. +46 WORD Native race +48 DWORD Number of natives (Clans) +52 DWORD Number of colonists (Clans) +56 BYTE 1, if starbase exists, 0 otherwise +57 WORD Industrialization 0 unknown 1 light 2 heavy --- PHost only --- 3 minimal 4 moderate 5 substantial This strange order reflects the fact that PCC was not originally designed for PHost. +59 WORD Turn for information at +57 +61 WORD Turn for information at +4..+36 +63 WORD Turn for information at +46..+48 +65 WORD Turn for information at +52 If one of the turn numbers is 0, no information is available. The turn number corresponds to the newest value in each group. --- Mine fields --- +y WORD Number of mine fields. All minefields ever seen are stored here. The original size is saved, PCC always computes the current size itself. +y+2 @ BYTEs Records of 16 bytes each +0 WORD Id +2 WORD X +4 WORD Y +6 WORD Owner +8 DWORD Number of mine units +12 WORD Type 0 Normal Mines 1 Web Mines +14 WORD Turn of last information about this field --- Paintings --- +n WORD Number of user paintings in starcharts +n+2 x BYTEs Records of variable size +0 BYTE Type of element 0 Line 1 Rectangle 2 Circle 3 Marker Bit 6 set if "new fields" at end Bit 7 set if comment exists +1 BYTE Color +2 WORD X1 +4 WORD Y1 +6 WORD Line, Rectangle: X2 Circles: radius Markers: Type 0 "+" (plus) 1 "!" (exclamation mark) 2 "x" (cross) 3 "<>" (diamond) 4 "p" (flag) 5 (down-up `lock' arrows) 6 "><" (right-left `lock' arrows) +8 WORD Line, Rectangle: Y2 others: zero +10 n BYTEs Comment (Pascal string), only if bit 7 in type set. Used only for markers. --- only if bit 6 of type set, v1.0.5+ --- +x WORD Tag (non-negative for user-defined markers) +y WORD Turn of expiry (-1=never). If this field is, for example, 17, the marker will be deleted at turn 18. --- Starship History [v0.98.4+] --- +q WORD Number of starship history entries +q+2 WORD Number of history entries (10) +q+4 WORD Turn number +q+2 r BYTEs Records of 93 bytes each (for 10 history entries) +0 WORD Starship Id +2 BYTE Hull Id (type), 0 = unknown +3 n BYTEs 10 records of 9 BYTEs (History entries). The first record is the turn specified above. The second one is the turn before etc. All values may be -1 for "unknown". +0 WORD X +2 WORD Y +4 BYTE Warp Factor +5 WORD Heading in degrees +7 WORD Mass Mass = -1 means the ship position was "guessed" by PCC. --- Starship History #2 --- +$ 500 BYTEs Starship owners --- Starship Comments [v0.98.5+] --- +X y BYTEs 500 Pascal strings with starship comments --- Auto Build Goals [v0.99.3+] --- +? & BYTEs 500 Records of 12 BYTEs each +0 WORD Number of Mines +2 WORD Number of Factories +4 WORD Number of Defense Posts +6 WORD Number of SB Defense 0..999 specify the wanted amount. To specify "the maximum under the current conditions", PCC up to v1.0.2.1 uses the value -1, v1.0.2.3 and later use 1000. +8 BYTE Speed for Mines (1..100) +9 BYTE Speed for Factories (1..100) +10 BYTE Speed for Defense Posts (1..100) +11 BYTE Speed for SB Defense (1..100) The 7th bit of the speed values is reserved for additional flags which might be introduced in future. PCC initializes all these records with defaults when creating this file.
Colors in PCC
Colors are stored as PCC's internal color numbers, not as the numbers 1..30 exported to scripts.
1 Dark gray 2 Light gray 3 Green 4 Red 5 Dark green 6 Light blue 7 Blue 8 Dark blue 9 Yellow 15 White 128..137 Additional colors in 256 color mode. Displayed as white in 16 color modes.