Kbengine Communication Protocol

Source: Internet
Author: User

Communication protocol Format

Clients who want to communicate with kbengine need to use the same protocol as Kbengine, Kbengine Communication protocol is divided into the following two types:

Determine the length type:

 |-----------------------------------------------------------------|Packet = |      Len: 2Bytes            |            Len: N                 | |     (Message-ID: uint16)    |   (Message-Body: Binary-stream)   | |-----------------------------------------------------------------|

Non-fixed length type:

 |--------------------------------------------------------------------------------------------|Packet = |      Len: 2Bytes            |       Len: 2Bytes          |           Len: N                | |     (Message-ID: uint16)    |   (Message-Length: uint16) |   (Message-Body: Binary-stream) | |--------------------------------------------------------------------------------------------|

(Note: If the message length exceeds 65534,message-length fixed to 65535, the protocol layer will add 4 additional bytes after the Message-length segment to describe the larger length information) (Note: Test protocol please turn off packet encryption, modify Kbengine.xml or Kbengine_defs.xml->channelcommon->encrypt_type)

To give a list:
void client_funcXX(uint8 p1, int64 p2)     ...     ...void server_funcXXX()packet.newMessage(ClientInterface::client_funcXX);packet.writeUint8(1);packet.writeInt64(1); |--------------------------------------------------------------------------------|Packet = |      Len: 2Bytes                                |            Len: 1, 8         | |     (Message-ID(client_funcXX): uint16)         |       (Message-Body: p1, p2) | |--------------------------------------------------------------------------------|
Give two of the columns:
void client_funcXX(uint8 p1, int64 p2, string p3)     ...     ...void server_funcXXX()packet.newMessage(ClientInterface::client_funcXX);packet.writeUint8(1);packet.writeInt64(1);packet.writeString("123456"); |--------------------------------------------------------------------------------------------|Packet = |      Len: 2Bytes            |       Len: 2Bytes          |           Len: 1, 8, 7          | |     (Message-ID: uint16)    |   (Message-Length: uint16) |   (Message-Body: p1, p2, p3)    | |--------------------------------------------------------------------------------------------|

Docking service-side engine-level protocol

The following protocol is required for the client to provide to the service-side invocation:

Onversionnotmatch engine version mismatch Onscriptversionnotmatch script version mismatch onkicked client kicked out of service end ONIMPORTSERVERERRORSDESCR Import Server error code Description table callback Onimportclie NTENTITYDEF Import Server Entitydef Description Table callback onimportclientmessages Import Client Protocol table callback ONHELLOCB and service side handshake callback onloginfailed login Loginapp failed ONLOGINSUCCESSFU lly Login Loginapp Successful onlogingatewayfailed login Baseapp failed onrelogingatewayfailed login Baseapp failed oncreatedproxies server notifies client to create a proxy that can communicate with the server Entity onupdatepropertysoptimized Update the Entity property (optimized) Onupdatepropertys Update the Entity property (non-optimized) Onremotemethodcalloptimized method of invoking entity on the server (optimized) method of invoking entity on the Onremotemethodcall server (non-optimized) Onentityenterworldentity into the world, entity first on the Cellapp was created onentityleaveworldentity left the world (non-optimized) Onentityleaveworldoptimizedentity left the World (optimized) onentityenterspaceentity into space (into the scene of the Cellapp or the replica room, etc.) Onentityleavespaceentity out of space Oncreateaccountresult create account return results Initspacedata when entity enters a space, The server initializes the spatial data setspacedata the service side sets the spatial data delspacedata the service side deletes the spatial data onentitydestroyed an entity destroys Onupdatebasepos Server update client player base location (x, Y, z) ONUPDATEBASEPOSXZ Server update client player base location (x, z) onsetentityposanddir Server setting client player location and facing Onupdatedata_*** Server Update client player position (x, y, z) or toward (yaw, pitch, roll) onstreamdatastarted stream data start download (streamfiletoclient, Streamstringtoclient) Onstreamdatarecv receiving stream data onstreamdatacompleted stream data Download complete ONREQACCOUNTRESETPASSWORDCB request Reset account password callback ONREQACCOUNTBINDEMAILCB request bind account E-mai L Callback ONREQACCOUNTNEWPASSWORDCB request account new password callback (Forgot password class function)

The following are the protocols that the service side allows clients to invoke:

loginapp:hello客户端请求与loginapp握手onClientActiveTick客户端向服务端发送tick心跳login请求登录loginappimportClientMessages请求从loginapp导入引擎协议importServerErrorsDescr请求导入服务端错误描述表reqAccountResetPassword请求重置账号的密码reqCreateAccount请求创建账号baseapp:hello客户端请求与baseapp握手onClientActiveTick客户端向服务端发送tick心跳loginGateway请求登录网关baseappimportClientMessages请求从baseapp导入引擎级协议importClientEntityDef请求从baseapp导入脚本定义产生的协议reLoginGateway请求重登陆baseapp(断线重连)reqAccountBindEmail请求绑定账号E-MAILreqAccountNewPassword请求账号新密码(忘记密码类功能)onUpdateDataFromClient更新客户端数据到服务端(player的位置,朝向等)onRemoteMethodCall客户端请求调用服务端baseapp-entity方法onRemoteCallCellMethodFromClient客户端请求调用服务端cellapp-entity方法
 

Kbengine Communication Protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.