场景服sceneserver和功能服functionserver是游戏服务器中两个主要的进程,它们直接传递消息的频率比较高,传统的c++消息的方式声明和定义都比较麻烦,且拖慢编译速度,使用rpc可以克服以上缺点,更加方便和简洁。一般的调用形式例如:
rpc客户端:
auto result = client.call("add", 2, 3).as<int>();
rpc服务端:
srv.bind("add", [](int a, int b) { return a + b; });
参考资料:
https://blog.csdn.net/xxfigo/article/details/77500457?locationNum=1&fps=1
https://developer.51cto.com/art/201906/597963.htm
https://blog.csdn.net/yjp198713/article/details/79410521
https://github.com/rpclib/rpclib