##目录结构
./
├── README.md
├── config.json
├── seedcupServer # seedcup server
├── bot # baseline model
├── documents
│ ├── 2022种子杯初赛试题.pdf
└── client
├── base.py # commen class/enum
├── config.py # read config file
├── req.py # request packet
├── resp.py # response packet
├── ui.py # ui for debug
└── main.py # main entry
默认工作目录在最外层目录即为上图所示的./
# launch server
./seedcupServer # if run into permission denied problem, run `chmod +x server` first
# launch python client
python client/main.py
# launch bot
./bot # if run into permission denied problem, run `chmod +x server` first
python客户端提供了玩家手玩的功能,两名玩家可以连接同一台机器手玩游戏体验游戏机制。
客户端和服务端通信需要遵循一定的协议,为了便于选手debug,采用json序列化及反序列化。在python客户端中已经实现了通信的协议,理论上选手可以直接按照客户端提供的接口即可。
总的协议体如下:type
字段为1
表示InitReq
,type
字段为2
表示ActionReq
。data
字段则包含具体的请求。
{
"type": 1,
"data": {
}
}
Init
请求告知服务端主武器和特殊武器的类型。
{
"masterWeaponType": 1,
"slaveWeaponType": 2
}
Action
请求告知服务端客户端要进行的具体行动。
{
"characterID": 1,
"actionType": 2,
"actionParam": {}
}
总的协议体如下:type
字段表示resp
类型,data
字段表示对应的具体的值。
{
"type": 1,
"data": {
}
}
ActionResp
会返回击杀数kill
,当前得分score
,以及整个地图信息,选手可以利用这些信息训练模型。
{
"playerID": 0,
"frame": 1,
"color": 1,
"kill": 1,
"score": 20,
"characters": [],
"map":{
"blocks": [
{
"x": 0,
"y": 0,
"frame" : 1,
"valid": true,
"color": 2,
"objs": [
]
}
]
}
}
每个block
可能含有0个或多个obj
, obj
有三种类型:Character
,Item
,SlaveWeapon
。
Character
为玩家操控的角色,有以下属性
{
"x": 0,
"y": 0,
"playerID": 0,
"characterID": 0,
"direction": 1,
"color": 2,
"hp": 2,
"moveCD": 2,
"moveCDLeft": 2,
"isAlive": true,
"isSneaky": true,
"isGod": false,
"rebornTimeLeft": 0,
"godTimeLeft": 0,
"slaveWeapon":{},
"masterWeapon": {}
}
Item
为场上的增益buff
,有以下属性
{
"buffType": 0
}
SlaveWeapon
为特殊武器,有以下属性
{
"weaponType": 1,
"playerID": 1
}
当游戏结束时会发送GameOverResp
,有以下属性
{
"scores": [20,22],
"result": 1
}