Giter Site home page Giter Site logo

seedcup's Introduction

2022 种子杯赛题

##目录结构

./
├── 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客户端中已经实现了通信的协议,理论上选手可以直接按照客户端提供的接口即可。

Reqeust协议

总协议

总的协议体如下:type字段为1表示InitReqtype字段为2表示ActionReqdata字段则包含具体的请求。

{
  "type": 1,
  "data": {

  }
}

InitReq

Init请求告知服务端主武器和特殊武器的类型。

{
    "masterWeaponType": 1,
    "slaveWeaponType": 2
}

ActionReq

Action请求告知服务端客户端要进行的具体行动。

{
    "characterID": 1,
    "actionType": 2,
    "actionParam": {}
}

Response协议

总的协议体如下:type字段表示resp类型,data字段表示对应的具体的值。

{
  "type": 1,
  "data": {

  }
}

ActionResp

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": [

                ]
            }
        ]
    }
}
Obj

每个block可能含有0个或多个obj, obj有三种类型:CharacterItemSlaveWeaponCharacter为玩家操控的角色,有以下属性

{
    "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

当游戏结束时会发送GameOverResp,有以下属性

{
    "scores": [20,22],
    "result": 1
}

seedcup's People

Contributors

oxeu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.