Browse Source

docs: 📝 edit DOCS

tags/0.1.0
shangfengh 2 years ago
parent
commit
d5aa4fe4ed
8 changed files with 31 additions and 13 deletions
  1. +1
    -1
      CAPI/cpp/API/src/AI.cpp
  2. +1
    -1
      CAPI/python/PyAPI/AI.py
  3. +8
    -0
      docs/CAPI接口(cpp).md
  4. +7
    -1
      docs/CAPI接口(python).md
  5. +10
    -6
      docs/QandA.md
  6. +2
    -2
      docs/使用文档.md
  7. +2
    -2
      logic/GameClass/GameObj/Map/Map.cs
  8. BIN
      resource/CompileFaster.png

+ 1
- 1
CAPI/cpp/API/src/AI.cpp View File

@@ -5,7 +5,7 @@
#include "constants.h" #include "constants.h"
// 注意不要使用conio.h,Windows.h等非标准库 // 注意不要使用conio.h,Windows.h等非标准库


// 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新
// 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次
extern const bool asynchronous = false; extern const bool asynchronous = false;


// 选手需要依次将player0到player4的职业在这里定义 // 选手需要依次将player0到player4的职业在这里定义


+ 1
- 1
CAPI/python/PyAPI/AI.py View File

@@ -8,7 +8,7 @@ import time




class Setting: class Setting:
# 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新
# 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次
@staticmethod @staticmethod
def asynchronous() -> bool: def asynchronous() -> bool:
return False return False


+ 8
- 0
docs/CAPI接口(cpp).md View File

@@ -88,6 +88,14 @@
void PrintSelfInfo() const; void PrintSelfInfo() const;
~~~ ~~~


### 部分属性解释 stuctures.h
~~~c++
struct Player
{
std::vector<PropType> props;//大小固定为3,空的位置为NullPropType
}
~~~

## 接口一览 ## 接口一览
~~~c++ ~~~c++
// 指挥本角色进行移动,`timeInMilliseconds` 为移动时间,单位为毫秒;`angleInRadian` 表示移动的方向,单位是弧度,使用极坐标——竖直向下方向为 x 轴,水平向右方向为 y 轴 // 指挥本角色进行移动,`timeInMilliseconds` 为移动时间,单位为毫秒;`angleInRadian` 表示移动的方向,单位是弧度,使用极坐标——竖直向下方向为 x 轴,水平向右方向为 y 轴


+ 7
- 1
docs/CAPI接口(python).md View File

@@ -80,7 +80,6 @@
- `def IsDoorOpen(self, cellX: int, cellY: int) -> bool`:查询特定位置门是否开启,没有门/不在视野内也返回false - `def IsDoorOpen(self, cellX: int, cellY: int) -> bool`:查询特定位置门是否开启,没有门/不在视野内也返回false
- `def GetHiddenGateState(self, cellX: int, cellY: int) -> THUAI6.HiddenGateState`::查询特定位置隐藏校门状态,没有隐藏校门/不在视野内返回THUAI6::HiddenGateState::Null - `def GetHiddenGateState(self, cellX: int, cellY: int) -> THUAI6.HiddenGateState`::查询特定位置隐藏校门状态,没有隐藏校门/不在视野内返回THUAI6::HiddenGateState::Null



#### 其他 #### 其他


- `def GetGameInfo(self) -> THUAI6.GameInfo`:查询当前游戏状态 - `def GetGameInfo(self) -> THUAI6.GameInfo`:查询当前游戏状态
@@ -105,6 +104,13 @@
def PrintSelfInfo(self) -> None: def PrintSelfInfo(self) -> None:
~~~ ~~~


### 部分属性解释 stuctures.h
~~~python
class Player:
def __init__(self, **kwargs) -> None:
self.prop: List[PropType] = []//大小固定为3,空的位置为NullPropType
~~~

## 接口一览 ## 接口一览


~~~python ~~~python


+ 10
- 6
docs/QandA.md View File

@@ -22,11 +22,6 @@ Q:卡死在第一帧不动


A:大概率是你的代码死循环了 A:大概率是你的代码死循环了


Q: 怎么开始游戏?

A:
需要确保学生阵营和捣蛋鬼阵营的人数都达到Server.cmd中设定的值。人数不足也可以打开WPF,参考使用文档,修改RunGUIClient.cmd的参数,然后运行RunGUIClient.cmd,这样可以通过WPF运行部分客户端,来达到人数限制。

## C++ ## C++


Q:显示API项目已卸载 Q:显示API项目已卸载
@@ -54,6 +49,15 @@ Q:CAPI编译不通过(第二种)


A:查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴 A:查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴


Q:编译好慢啊

A:
1. 尽量不要改其他文件,甚至连点下保存都别点
2. 不要点重新生成,要点生成
3. 开启下图选项
![CompileFaster](https://raw.githubusercontent.com/shangfengh/THUAI6/new/resource/CompileFaster.png)

## Python ## Python


### grpc版本更新失败 ### grpc版本更新失败
@@ -76,4 +80,4 @@ A:初赛结束会调数值及机制,增加新角色


Q:初赛后会修改什么呢? Q:初赛后会修改什么呢?


A:技能冷却时间等属性设为不可见;出生点随机性或可选性;增强教师等职业,削弱职业;规范Debug信息
A:技能冷却时间等属性设为不可见;出生点随机性或可选性;增强教师等职业,削弱职业;规范Debug信息;提供不同格式的信息传递;增加职业;优化游戏结束条件

+ 2
- 2
docs/使用文档.md View File

@@ -14,7 +14,7 @@
- Windows:先查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴 - Windows:先查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴
- Linux:首先自行安装`gRPC`,具体方法可以参考官方教程https://grpc.io/docs/languages/cpp/quickstart/。 - Linux:首先自行安装`gRPC`,具体方法可以参考官方教程https://grpc.io/docs/languages/cpp/quickstart/。
- 然后在`CAPI\cpp\API\src\AI.cpp`中编写代码 - 然后在`CAPI\cpp\API\src\AI.cpp`中编写代码
- 选手不应当修改`AI.cpp`中原来有的代码,除了`void AI::play(IStudentAPI& api)`和`void AI::play(ITrickerAPI& api)`
- 选手不应当修改`AI.cpp`中原来有的代码,除了`void AI::play(IStudentAPI& api)`和`void AI::play(ITrickerAPI& api)`,及修改asynchronous的返回值
- 每帧执行一次`AI::play(IStudentAPI& api)`或`AI::play(ITrickerAPI& api)`(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态 - 每帧执行一次`AI::play(IStudentAPI& api)`或`AI::play(ITrickerAPI& api)`(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态
- 选手可以在`AI.cpp`内`void AI::play`外新增函数和变量 - 选手可以在`AI.cpp`内`void AI::play`外新增函数和变量
- Windows:然后用Visual Studio打开`CAPI\cpp\CAPI.sln`编译,注意使用Debug模式 - Windows:然后用Visual Studio打开`CAPI\cpp\CAPI.sln`编译,注意使用Debug模式
@@ -26,7 +26,7 @@


- 首先在Python环境下运行`GeneratePythonProto.cmd`,以安装必要的包、并生成对应的grpc python文件 - 首先在Python环境下运行`GeneratePythonProto.cmd`,以安装必要的包、并生成对应的grpc python文件
- 然后在`CAPI\python\PyAPI\AI.py`中编写代码 - 然后在`CAPI\python\PyAPI\AI.py`中编写代码
- 选手不应当修改`AI.py`中原来有的代码,除了`StudentPlay(self, api: IStudentAPI)`和`TrickerPlay(self, api: ITrickerAPI)`
- 选手不应当修改`AI.py`中原来有的代码,除了`StudentPlay(self, api: IStudentAPI)`和`TrickerPlay(self, api: ITrickerAPI)`,及修改asynchronous的返回值
- 每帧执行一次`AI::play(IStudentAPI& api)`或`AI::play(ITrickerAPI& api)`(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态 - 每帧执行一次`AI::play(IStudentAPI& api)`或`AI::play(ITrickerAPI& api)`(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态
- 选手可以在`AI.py`内新增函数和变量 - 选手可以在`AI.py`内新增函数和变量
- Windows:最后通过运行`RunPython.cmd`执行比赛代码 - Windows:最后通过运行`RunPython.cmd`执行比赛代码


+ 2
- 2
logic/GameClass/GameObj/Map/Map.cs View File

@@ -23,7 +23,7 @@ namespace GameClass.GameObj


if (GameData.numOfStudent - NumOfDeceasedStudent - NumOfEscapedStudent == 1) if (GameData.numOfStudent - NumOfDeceasedStudent - NumOfEscapedStudent == 1)
{ {
GameObjLockDict[GameObjType.EmergencyExit].EnterReadLock();
GameObjLockDict[GameObjType.EmergencyExit].EnterWriteLock();
try try
{ {
foreach (EmergencyExit emergencyExit in GameObjDict[GameObjType.EmergencyExit]) foreach (EmergencyExit emergencyExit in GameObjDict[GameObjType.EmergencyExit])
@@ -35,7 +35,7 @@ namespace GameClass.GameObj
} }
finally finally
{ {
GameObjLockDict[GameObjType.EmergencyExit].ExitReadLock();
GameObjLockDict[GameObjType.EmergencyExit].ExitWriteLock();
} }
} }
} }


BIN
resource/CompileFaster.png View File

Before After
Width: 1182  |  Height: 819  |  Size: 61 kB

Loading…
Cancel
Save