Skip to content

Entity: GameObject.hpp

Alanzote edited this page Dec 25, 2018 · 3 revisions

The GameObject class is child of Replica, a class from RakNet's Replica Manager. This is effectively an object that is broadcasted to each client. It can be a player, an npc, an enemy, a destructible, anything. A GameObject is required to have a LWOOBJID identifier, to be broadcasted to the client. A GameObject also has a LOT, which is a number that indicates which object this is (player, destructible, etc), this value can be found on the cdclient database. A name is used to override the name on the cdclient database (used for players and npcs). A GameObject also has a creation timestamp, a spawner game object reference, a spawner node id, a parent game object reference, the children game objects's references, this object's components and finally associated timers.

Methods

All Replica superclass required overrides: SendConstruction, SendDestruction, ReceiveDestruction, SendScopeChange, ReceiveScopeChange, Serialize and Deserialize.

  • Update
    • Return Type: void
    • Comment: Called to update the object.
  • Tick
    • Return Type: void
    • Comment: Called to tick the object.
  • Serialize
    • Return Type: void
    • Input Types: RakNet::BitStream* factory, ReplicaTypes::PacketTypes packetType
    • Comment: A wrapper of the Replica serialize functions.
  • Test
    • Return Type: void
    • Comment: Literally just sets object id, LOT and name for testing.