connect ( server , login , pass )
disconnect ()
rpc_get ( string func , flags, params ) // blocking as it waits for the result
rpc_set ( string func , flags, params ) // non-blocking
rpc_set_register ( callback , string func , params ) // variable number of parameters as in printf
rpc_get_register ( callback , string func , params ) // variable number of parameters as in printf
perhaps also some basic functions all games need might be helpful:
get_ping()
join_game()
leave_game()
create_game()
...
Examples for the usage (roughly)
rpc_get ( "num_players" , &num_players )
rpc_set ( "set_player_pos" , FLAG_UNRELIABLE | FLAG_PREDICT , "player id", x,y,z );
rpc_set ( "gun_shot" , FLAG_RELIABLE , "player id", x,y,z , direction x, y, z);
I am now considering to also have the list of game entities stored in the lib - but that might end up complex as entities might have items stored within (for example RPG) that need to be handled too. Another consideration was to include protocol buffers / flat buffers / cereal or another lib for serialization in this case