match

package
v0.0.0-...-9a57a4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INITMATCH = iota // INITMATCH == 0
	Match_1V1        // Match_1V1 == 1
	Match_2V2        // Match_2V2 == 2
	Match_3V3        // Match_3V3 == 3
)

Variables

View Source
var (
	Match_Chan       chan *player.PlayerSt
	MatchData_Chan   chan map[string]interface{}
	Imax             int = 0
	ChanMax          int = 1000
	MatchSpeed           = time.Millisecond * 500
	PlaterMatchSpeed     = time.Second * 1
	MatchData        map[string]interface{}
	QuitMatchData    map[string]string

	MatchRoomUID int = 1000
	TimeOutCount int = 0
	ConnMatch    *websocket.Conn
)
View Source
var MapMatch map[string]*RoomMatch
View Source
var MapPoolMatch1V1 chan map[int]*PoolMatch // key 是游戏ID
View Source
var PoolMax int // 匹配池的大小
View Source
var TempMatch map[string]string

Functions

func DelMatchQueue

func DelMatchQueue(OpenID string)

func DelQuitMatchList

func DelQuitMatchList(OpenID string)

func DoingMatch

func DoingMatch()

func GetChanLength

func GetChanLength() int

func GetMatchPlayer

func GetMatchPlayer(OpenID string) bool

func GetMatchQueue

func GetMatchQueue(OpenID string) bool

func Putdata

func Putdata(data *player.PlayerSt)

func SetMatchQueue

func SetMatchQueue(OpenID string)

func SetQuitMatch

func SetQuitMatch(OpenID string)

func Sort_timer

func Sort_timer()

Types

type MatchMoudle

type MatchMoudle interface {
	GetMatchResult(string, int) []byte
	PutMatch([]byte)
	GetMatchNum(string) int
	TimerMatch()
	DestroyMatch()
	MatchRecord()
}

type PoolMatch

type PoolMatch struct {
	OpenID      string          // 玩家的UID加密信息
	MatchType   string          // 1V1 2V2 5V5 等
	Connection  *websocket.Conn // global服务器只是和gateway 进行链接的数据,可以忽略
	MatchTime   int             // 玩家匹配的耗时  --- conf配置 数据需要
	PlayerScore int             // 玩家的分数
	PlayerLev   int             // 玩家等级
	MatchGame   int             // 玩家匹配的游戏
}

匹配池

func (*PoolMatch) DestroyMatch

func (this *PoolMatch) DestroyMatch()

func (*PoolMatch) GetMatchResult

func (this *PoolMatch) GetMatchResult(igameid int, imatchtype int)

根据匹配算法进行返回匹配结果 条件:那款游戏匹配,匹配类型(1V1) 定时器:每个秒就要匹配一次所有数据

func (*PoolMatch) MatchRecord

func (this *PoolMatch) MatchRecord()

获取已经匹配的数量;数量需要记录 1 匹配的结果也是需要的发送给DB服务器,玩家登录后返回的数据自带匹配数据 2 对战记录

func (*PoolMatch) PlayerSendMessage

func (this *PoolMatch) PlayerSendMessage()

发送数据给gateway server 1 这里就是并不需要过多处理

func (*PoolMatch) PutMatch

func (this *PoolMatch) PutMatch(data map[int]*PoolMatch)

玩家点机匹配的时候,需要放入连接池中

func (*PoolMatch) TimerMatch

func (this *PoolMatch) TimerMatch()

type RoomMatch

type RoomMatch struct {
	RoomUID       string                      // 房间号
	PlayerAOpenID string                      // A 阵营的OpenID
	PlayerBOpenID string                      // B 阵营的OpenID
	RoomLimTime   uint64                      // 房间的时间限制
	RoomPlayerMap map[string]*player.PlayerSt // 房间玩家的结构信息
}

type RoomST

type RoomST struct {
	RoomID     string
	RoomName   string
	RoomPlayer map[string]*player.PlayerSt // 房间内的玩家
	AllTime    string                      // 时间戳
}

经过算法后的匹配结果 1 根据配置的算法进行匹配的操作

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL