请选择 进入手机版 | 继续访问电脑版

NoahFrame

 找回密码
 Register Now
搜索
热搜: redis mysql tutorial
查看: 566|回复: 5

Proxy Server Error on ReqAckPlayerMove

[复制链接]

1

主题

3

帖子

23

积分

Newbie

Rank: 1

积分
23
发表于 2017-10-19 10:01:23 | 显示全部楼层 |阅读模式
With the Unity SDK. I get an error upon testing. Seems the protobuf message sent to the server is not correct.

NFCPlayerLogic.cs - Ln 94
  1. <div><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
  2. </font></font></font></font></div><div><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">public void RequireMove (UnityEngine.Vector3 pos)</font></font></font></font></font></font></font></font></div>
复制代码



Sent to server gives the error:
  1. <div><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
  2. </font></font></font></font></div><div><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><div><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[libprotobuf ERROR .. \ src \ google \ protobuf \ message_lite.cc: 123] Can not parse message of type "NFMsg.ReqAckPlayerMove" because it is missing required fields: speed, time</font></font></font></font></div><div><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[ERROR | 2017-10-18 18: 09: 32,497] | 13 | 6 | Indent [0-0] Parse msg error NFCGameServerNet_ServerModule :: OnClientReqMoveProcess 1315</font></font></font></font></div></font></font></font></font></div>
复制代码




Image

How do I solve this? How should the protobuf format be?

Thanks.


回复

使用道具 举报

30

主题

111

帖子

650

积分

Administrator

Rank: 9Rank: 9Rank: 9

积分
650
发表于 2017-10-19 15:47:20 | 显示全部楼层
The log shows that the message body you sent lack of two fields: speed and time.

I will fix this problem soon in github(last month I have changed the back-end code but forgot to change the front-end).

You can fix it with the code below:
NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
xData.mover = NFToPB(mRoleID);
xData.moveType = 0;
xData.speed = 2f;
xData.time = 0;
回复 支持 反对

使用道具 举报

30

主题

111

帖子

650

积分

Administrator

Rank: 9Rank: 9Rank: 9

积分
650
发表于 2017-10-19 18:18:02 | 显示全部楼层
回复 支持 反对

使用道具 举报

1

主题

3

帖子

23

积分

Newbie

Rank: 1

积分
23
 楼主| 发表于 2017-10-19 19:45:18 | 显示全部楼层
Thanks!!

I also had to add to NFMsgShare.cs:

    private float _speed = default(float);
    [global:rotoBuf.ProtoMember(5, IsRequired = true, Name = @"speed", DataFormat = global:rotoBuf.DataFormat.FixedSize)]
    [global::System.ComponentModel.DefaultValue(default(float))]
    public float speed
    {
        get { return _speed; }
        set { _speed = value; }
    }

    private float _time = default(float);
    [global:rotoBuf.ProtoMember(6, IsRequired = true, Name = @"time", DataFormat = global:rotoBuf.DataFormat.FixedSize)]
    [global::System.ComponentModel.DefaultValue(default(float))]
    public float time
    {
        get { return _time; }
        set { _time = value; }
    }

(sorry, seems using CODE tags messes up formatting)

That code may be wrong, I am not so familiar with Protobuf serialization.

Problem is, I am still getting the error, maybe something else is wrong or missing?
回复 支持 反对

使用道具 举报

30

主题

111

帖子

650

积分

Administrator

Rank: 9Rank: 9Rank: 9

积分
650
发表于 2017-10-20 09:57:12 | 显示全部楼层
D3K17 发表于 2017-10-19 19:45
Thanks!!

I also had to add to NFMsgShare.cs:

The file NFMsgShare.cs is be created by the tool.

Actually, these two fields (time, speed) has been added to the Protocol buf file as below:

message ReqAckPlayerMove
{
        required Ident         mover = 1;
        required int32  moveType = 2;//future_state
        required float speed = 3;
        required int32 time = 4;
        repeated Vector3 target_pos = 5;
        repeated Vector3 source_pos = 6;
        repeated Vector3 move_direction = 7;
}

The meaning that the file NFMsgShare.cs has included these two fields, so you can use these tow fields without adding any code, just to copy the *.cs files from NoahGameFrame/NFComm/NFMessageDefine to the folder UnitySDK/Assets/NFSDK/NFMessageDefine  or  Unity3D/Assets/_NF/NFMsg (It depends on the which one you have chosen).



回复 支持 反对

使用道具 举报

1

主题

3

帖子

23

积分

Newbie

Rank: 1

积分
23
 楼主| 发表于 2017-10-21 06:32:08 | 显示全部楼层
Ah, thank you. I included these files into my UnitySDK folder. There are still errors though in NF/Logic/NFPlayerLogic.cs  - I changed the line in RequireMove()

NFMsg.Position xTargetPos = new NFMsg.Position();

to:

NFMsg.Vector3 xTargetPos = new NFMsg.Vector3();

The error is gone now. But the objects do not sync. There are also errors upon player leaving world. So communication is happening as least with joining / leaving world. But the objects do not sync up. This line must be wrong in fixing the issue, as with replacing the files from NoahGameFrame/NFComm/NFMessageDefine removed the NFMsg.Position
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | Register Now

本版积分规则

 

GMT+8, 2018-10-19 02:15 , Processed in 0.075886 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表