2.3 Remote Procedures

Remote procedures (Events or Requests) hande communication between server and client. The receiving party executes the code on their side only.

Servers send events using SendEvent(event, targetClient, arg1, arg2) and clients send requests with SendRequest(request, arg1, arg2).

Events and Requests ae handled by each side, in the main update loop.

A server sending a request or a client sending an event is undefined behaviour.

Requests

 

SERVER_NONE

Implemented in Version a2.0

// No implementation

Reserves index 0 for requests (Client => Server).

 

PLAYER_CONNECT

Implemented in Version a2.0

void PlayerConnect(int a, int b)

Sent from the client to the server to announce connection.

 

PLAYER_DISCONNECT

Implemented in Version a2.0

void PlayerDisconnect(int reason, int b)

Sent from the client to the server to announce disconnection with given reason.

Reason does not have any effect yet, but will be used for logging reasons. Non-zero is an unusual disconnect.

Server will receive this request automatically (set by SetDisconnectionRequest) incase the player disconnected without sending a request.

 

ITEM_HOLD

Implemented in Version a2.0

void HoldItem(int key, int b)

Indicates pressing down the given key to use an item:

0: INPUT::PRIMARY (usually LMB)

1: INPUT::SECONDARY (usually RMB)

2: INPUT::TERTIARY (usually R-Key)

 

ITEM_USE

Implemented in Version a2.0

void UseItem(int key, int b)

Indicates releasing down the given key; finalizing the use action

0: INPUT::PRIMARY (usually LMB)

1: INPUT::SECONDARY (usually RMB)

2: INPUT::TERTIARY (usually R-Key)

 

ITEM_SELECT

Implemented in Version a2.0

void SelectItem(int index, int b)

Sets selected item in hotbar to given index. Must be between 0-4.

 

SERVER_END

Implemented in Version a2.0

// No implementation

Reserves last index for requests. (Client => Server).

 

Events

 

CLIENT_NONE

Implemented in Version a2.0

// No implementation

Reserves 0 index for events. (Server => Client).

 

ENTITY_CREATED

Implemented in Version a2.0

void EntityCreated(int type, int size)

Creates an entity after being passed the new ID.

The type parameter should take an ENTITY_TYPE enum value, the size indicates the amount of components.

If an entity does not take a component array size, the value is ignored.

 

ENTITY_ID

Implemented in Version a2.0

void EntityID(int upper, int lower)

Passes the entity id for the next action.

upper contains the upper 32 bits of the id, lower contains the lower 32 bits of the id

 

ENTITY_DESTROYED

Implemented in Version a2.0

void EntityRemoved(int upper, int lower)

Destroys an entity. ENTITY_ID does not need to be called here.

upper contains the upper 32 bits of the id, lower contains the lower 32 bits of the id

 

ENTITY_DESTROYED

Implemented in Version a2.0

void EntityRemoved(int upper, int lower)

Destroys an entity. ENTITY_ID does not need to be called here.

upper contains the upper 32 bits of the id, lower contains the lower 32 bits of the id

 

ITEM_HELD

Implemented in Version a2.0

void ItemHeld(int key, int b)

Displays item model with holding animation set by key on player id passed with ENTITY_ID

0: INPUT::PRIMARY (usually LMB)

1: INPUT::SECONDARY (usually RMB)

2: INPUT::TERTIARY (usually R-Key)

 

ITEM_USED

Implemented in Version a2.0

void ItemUsed(int key, int b)

Displays item model with usage animation set by key on player id passed with ENTITY_ID

0: INPUT::PRIMARY (usually LMB)

1: INPUT::SECONDARY (usually RMB)

2: INPUT::TERTIARY (usually R-Key)

 

ITEM_SELECTED

Implemented in Version a2.0

void ItemSelected(int item, int b)

Displays item model on player id passed with ENTITY_ID

 

DAMAGE_TAKEN

Implemented in Version a2.0

void DamageTaken(int type, int amount)

Indicates to a player, how much damage they received. First parameter takes a DamageType enum type.

 

CLIENT_END

Implemented in Version a2.0

// No implementation

Reserves last index for events. (Server => Client).

 

Go back