8#ifndef GAME2DLAYER_NETWORK_H
9#define GAME2DLAYER_NETWORK_H
16struct Game2DLayerData;
vec2 vec2 struct Entity2DCollection * pCollection
Definition EntityQuadTree.h:38
vec2 vec2 struct Entity2DCollection struct GameFrameworkLayer * pLayer
Definition EntityQuadTree.h:38
void G2D_SendRPC(int client, enum Game2DRPCType type, void *pRPCData)
Send an RPC.
Definition Game2DLayerNetwork.c:362
G2DPacketType
Definition Game2DLayerNetwork.h:21
@ G2DPacket_RequestLevelData
Definition Game2DLayerNetwork.h:22
@ G2DPacket_RPC
Definition Game2DLayerNetwork.h:24
@ G2DPacket_WorldState
Definition Game2DLayerNetwork.h:25
@ G2DPacket_LevelDataResponseData
Definition Game2DLayerNetwork.h:23
enum G2DPacketType G2D_ParsePacket(u8 *pPacket, u8 **pOutBody, int *outHeaderSize)
Definition Game2DLayerNetwork.c:274
void G2D_Enqueue_Worldstate_Packet(struct GameLayer2DData *pData, int clientI)
Enqueue a packet that will cause all entities with bSerializeInNetworkUpdate == true to be saved into...
Definition Game2DLayerNetwork.c:288
struct Entity2D * G2D_FindEntityWithNetID(struct Entity2DCollection *pCollection, int netID)
try to find the entity with a given net ID
Definition Game2DLayerNetwork.c:351
void G2D_Extend_RequestLevelDataMessage(PacketExtensionNoArgsFn fn)
extend the packet that the client sends to request level data from the server. By default tile maps a...
Definition Game2DLayerNetwork.c:256
Game2DRPCType
Definition Game2DLayerNetwork.h:37
@ G2DRPC_AdjustNetworkID
Definition Game2DLayerNetwork.h:40
@ G2DRPC_LastEngineRPC
Definition Game2DLayerNetwork.h:41
@ G2DRPC_CreateEntity
Definition Game2DLayerNetwork.h:38
@ G2DRPC_DestroyEntity
Definition Game2DLayerNetwork.h:39
void G2D_RegisterUserRPC(struct UserGame2DRPC *rpc)
Register a user RPC, call once at startup, call in order your games rpc types appear in the enum.
void(* RPCMessageConstructorFn)(struct BinarySerializer *pBS, void *pRPCStruct)
callback to construct an rpc message of a given type, pRPCStruct is a struct containing relevant data...
Definition Game2DLayerNetwork.h:45
void G2D_PollNetworkQueueClient(struct GameFrameworkLayer *pLayer, float deltaT)
Definition Game2DLayerNetwork.c:184
void(* RPCMessageHandlerFn)(struct BinarySerializer *pBS, struct GameLayer2DData *pData, int client)
callback to handle an RPC message, to be read from the binary serializer, passed Game2DLayerData* so ...
Definition Game2DLayerNetwork.h:48
enum Game2DRPCType G2D_ParseRPCPacket(u8 *packet, u8 **pOutBody)
Definition Game2DLayerNetwork.c:298
void G2D_DoRPC(struct GameFrameworkLayer *pLayer, struct GameLayer2DData *pData, u8 *pRPCData, int client)
do RPCs, call once a packet has been confirmed as a G2DPacket_RPC, call on both client and server
Definition Game2DLayerNetwork.c:412
void G2D_PollNetworkQueueServer(struct GameFrameworkLayer *pLayer, float deltaT)
Definition Game2DLayerNetwork.c:84
void G2D_Enqueue_RequestLevelData()
TODO: should really be static to this file, probably.
Definition Game2DLayerNetwork.c:261
bool G2D_IsClientConnected(int i)
call from the game thread if you're the server to determine if a client is connected
Definition Game2DLayerNetwork.c:546
void(* PacketExtensionNoArgsFn)(struct BinarySerializer *)
Definition Game2DLayerNetwork.h:67
u16 TileIndex
Definition IntTypes.h:18
uint8_t u8
Definition IntTypes.h:6
uint16_t u16
Definition IntTypes.h:9
Definition Game2DLayerNetwork.h:120
int oldNetID
Definition Game2DLayerNetwork.h:121
int newNetID
Definition Game2DLayerNetwork.h:122
Definition BinarySerializer.h:17
char * pData
Definition BinarySerializer.h:19
Definition Game2DLayerNetwork.h:126
struct Game2DLayerData * pData
Definition Game2DLayerNetwork.h:128
struct Entity2D * pEnt
Definition Game2DLayerNetwork.h:127
Definition Game2DLayerNetwork.h:132
int netID
Definition Game2DLayerNetwork.h:133
Definition Entity2DCollection.h:30
Definition Entities.h:199
Definition GameFramework.h:42
Definition Game2DLayer.h:93
Definition Game2DLayerNetwork.h:30
u16 y
Definition Game2DLayerNetwork.h:31
u16 layer
Definition Game2DLayerNetwork.h:32
TileIndex newVal
Definition Game2DLayerNetwork.h:33
u16 x
Definition Game2DLayerNetwork.h:31
An RPC implemented by a users game.
Definition Game2DLayerNetwork.h:52
RPCMessageHandlerFn handler
callback to handle an RPC message, to be read from the binary serializer, passed Game2DLayerData* so ...
Definition Game2DLayerNetwork.h:60
int rpcType
RPC type - implement an RPC enum type for your game with values starting at G2DRPC_LastEngineRPC,...
Definition Game2DLayerNetwork.h:54
RPCMessageConstructorFn ctor
callback to construct an rpc message of a given type, pRPCStruct is a struct containing relevant data...
Definition Game2DLayerNetwork.h:57