Skip to content

Commit c50a404

Browse files
committed
update data
1 parent 3308f85 commit c50a404

File tree

6 files changed

+40
-1
lines changed

6 files changed

+40
-1
lines changed

第一季 从零开始写游戏服务器 第二期/最新课节--课程代码/vender/src/LollipopGo/LollipopGo/match/match.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
package match
22

3+
/*
4+
5+
简单说下实现思路吧:
6+
把参与匹配的玩家都丢入匹配池,每个玩家记录两个属性(分数、开始匹配的时间),每秒
7+
遍历匹配池中所有分数段,找出每个分数上等待时间最长的玩家,用他的范围来进行匹配(因为匹配范围会因为等
8+
待时间边长而增加,等待时间最长的的玩家匹配范围最大,如果连他都匹配不够,那同分数段的其他玩家就更匹配
9+
不够了)。如果匹配到了足够的人,那就把这些人从匹配池中移除,匹配成功;如果匹配人到的人数不够并且没有
10+
达到最大匹配时间,则跳过等待下一秒的匹配;如果达到最大匹配时间,还是没匹配到足够的人,则给这个几个人
11+
凑机器人,提交匹配成功。
12+
13+
14+
*/
15+
316
type MatchMoudle interface {
417
GetMatchResult(string, int) []byte
518
PutMatch([]byte)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package match
2+
3+
// 匹配
4+
type PoolMatch struct {
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package match
2+
3+
import (
4+
"LollipopGo/LollipopGo/player"
5+
)
6+
7+
var MapMatch map[string]*RoomMatch
8+
9+
type RoomMatch struct {
10+
RoomUID string // 房间号
11+
RoomName string // 房间名字
12+
RoomNumPlayer uint8 // 房间人数
13+
RoomLimTime uint64 // 房间的时间限制
14+
RoomPlayerMap map[string]*player.PlayerSt // 房间玩家的结构信息
15+
}
16+
17+
// 新注册匹配
18+
func newMatch() (MapMatch map[string]*RoomMatch) {
19+
20+
return nil
21+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package LollipopGo
22

3-
const version = "1.1.0"
3+
const version = "1.0.20181203"
Loading

0 commit comments

Comments
 (0)