java游戏房间匹配_游戏匹配和结算实现

匹配

827e04ecd71c?tdsourcetag=s_pcqq_aiomsg

匹配.png

//请求匹配

message CM_Match {

int type; //匹配房间类型

String name; //玩家名称

long targetPlayerId; //加入他人比赛,目标玩家id

}

//匹配成功

message L2RM_MatchSucc {

int roomId;

int roomType;

boolean createRoomIfNotExist; //场景中的第一个玩家为true

RoomPlayerEnt ent; //房间服需要的玩家信息

}

//业务服收到此消息创建房间

message R2LM_AddRoom {

int id;

int sign; //房间签名

int type;

Date createTime;

}

//业务服收到此消息,在房间销毁前(R2LM_RemoveRoom),玩家都可以断线重连房间服

message R2LM_AddPlayer {

long playerId;

int roomId;

int roomSign;

int roomType;

int token; //登录令牌,断线重连时下发给客户端

}

//客户端收到此消息后连接房间服

message SM_RoomServerPermission {

String host;

int port;

String token; //本次登录的令牌

}

业务服房间管理

业务服维护了房间服的Room。房间服创建Room,业务服创建对应Room,房间服销毁Room,业务服销毁对应Room。其变化通过处理房间服的R2LM_AddRoom࿰

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值