Ghost Class

(Redirected from Ghost classes)
Jump to: navigation, search

A Ghost Class is a C++ class object that is instantiated when GOM nodes of certain Archetypes are created or loaded from the database. These classes get events, either when fields on the nodes are modified, or structural changes are made to the nodes. Each ghost class implements behavior that is specific to the archetype, by responding to the events raised.


Editing Support Ghost Classes

Many of the ghost classes are designed to implement the propagation of area geometry edits to the clients. These classes monitor changes to the area server nodes which represent the area geometry. The archetypes AREA, ROOM, ASSET, and INSTANCE are used for this purpose. Any node in the GOM which is of one of these archetypes, has an appropriate Ghost Class created when the node is instantiated.

The most basic task of these ghost classes is to transmit edit commands back to clients. When a client sends an edit command to the server, the edit script makes modifications to fields on nodes on the server. The ghost class receives the field-change event, and constructs an edit command to be sent to the clients to make the same changes on the client side. This edit command is then broadcast to all connected clients and saved in an edit command queue. When a player connects to an area, all the stored up edits are sent to the player. This brings their client up to date with the changes made to the area.

The second task of the ghost classes that handle area editing is to construct DAT files. These files represent areas or rooms in an area and are stored in the repository. Only the edit server is allowed to write these DAT files to the repository. Once a DAT file has been written, the in-memory edit command queue is cleared.

Ghost classes allow for game-specific extensions. Extending the DOM definitions on the server side is required, and described by the Extending Instance Classes page.

Character Control and Visualization Ghost Classes

Two ghost classes are used for characters in HeroEngine, related to the archetypes CHARACTER and CREATURE.

The _CharacterAppearance class is of archetype CHARACTER. This class represents the parameters used to visualize a character or NPC on the client. As the fields on this class change, that change is reflected to the ghost class, which compresses the new information. From there, the information is replicated to any clients which have knowledge of that character.

The second ghost class is for the _NonPlayerCharacter class on NPCs, which is of archetype CREATURE.

GUIControl Ghost Class

Nodes created of classes of archetype GUICONTROL have special behavior on the client only. Each of these nodes has a rendering object created for them. The values of fields on these nodes change the visualization of the GUI control rendering object.

Deprecated Ghost Classes

Several ghost classes were used in the past, but as HeroEngine evolved, they were no longer needed and they became deprecated. The archetypes WORLD, SEGMENT and MAPSET have been deprecated. Nodes created from classes with these archetypes have no special behavior.

Unused Ghost Classes

The ghost class for nodes created from classes of archetype OBJECT is not functional.

Personal tools