Resource_tree - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

The Resource Tree, sometimes simply referred to as The Tree, is a graphical tree structure for organizing resources similar to other IDEs.

This page makes heavy use of Tree terminology, so please familiarize yourself with Tree Data Structures in order to best understand this.

Nodes

A tree data structure, whether graphical or non-graphical is made up of nodes. LateralGM refers to these as ResNodes. Game Maker and LateralGM break the tree up into three kinds of nodes. The GM Format Documentation refers to this as "Status".

  • Primary - Should be an immediate child of the root node. Primary nodes should only contain Groups and/or Secondary (Resource) nodes, or they may be empty. A Primary node has a #Kind associated with it, so that every resource in it should be of the same kind as the Primary node's kind.
  • Group - Should be a descendant of a Primary node. May contain any number of Groups and/or Secondary (Resource) nodes, or may be empty.
  • Secondary - Essentially a Resource node. Should be a descendant of a Primary node associated with its Kind, or should be an immediate child of the root node (as is the case with Game Information, Game Settings, and Extensions). Should be a leaf node.

Special rules apply to Primary nodes and immediate children of the root node. This behavior is enforced in Game Maker's interface, and is the default behavior (although able to be changed) in LateralGM. Primary nodes cannot be renamed, moved, deleted, or added. This does not apply to their descendants, which may be renamed, moved, deleted, and added almost freely. The only conditions on the descendants is that they cannot be moved outside of their Primary node, and a Secondary (Resource) node cannot be added to a Primary node of a different Kind.

Note the use of the words "should" above. These rules only apply to the interface. The backend structure, and, by extension, the GM file format, allow these rules to be bent freely, if you have a good hex editor or a program capable of doing it for you. For instance, you could rename and re-order the primary nodes, move a secondary resource node into another primary node, or even treat a secondary resource node as a branch node and add children to it. Be warned, though, this is an undocumented feature of Game Maker, and may cause the interface to behave strangely or override it.

Kind

Every Secondary Resource node and Primary node has a Kind or Type associated with it. Older GM Format Documentation referred to this as "Grouping", whereas LGM prefers the term "Kind". Game Maker defines about 13 kinds, and an identification number which must be used in GM files to identify the kind. So far, the identification number only uses 4 bits, but 32 bits are reserved. EGM associates 3-character strings with each kind (a 4th byte is usually included with value 0x20, the space character, so a Sprite could be "SPR "), and encourages use of those in place of the integer identifier because it is more human-friendly while still being machine-friendly and extensibility-friendly. The following table shows known Resource Kinds, their GM identifier, EGM identifier, and what versions of GM they appear in (going back as far as GM 4.3c).

Tree Name GM EGM Version
1 Sprites 2 SPR All
2 Sounds 3 SND All
3 Backgrounds 6 BKG All
4 Paths 8 PTH All
5 Scripts 7 SCR All
6 Data Files 9[1] DAT GM 500 only
6 Fonts 9[2] FNT GM 540+
7 Time Lines[3] 12 TML All
8 Objects 1 OBJ All
9 Rooms 4 RMM All
10 Game Information[4] 10 GMI All
11 Global Game Settings[5][6] 11 GMS All
12 Extension Packages[7] 13 -- GM 700+. Non-node in EGM.

Resource Kinds

Category:Formats

  1. GM recycled the Data Files ID later for Fonts.

  2. LateralGM uses the string "Timelines" instead.

  3. Appears as a Secondary Resource node, rather than a Primary node.

  4. GM 500 used the string "Game Options" instead.