Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTHER] Refactor the project #16

Open
iceBear67 opened this issue Jan 16, 2021 · 4 comments
Open

[OTHER] Refactor the project #16

iceBear67 opened this issue Jan 16, 2021 · 4 comments
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@iceBear67
Copy link
Collaborator

ManiHunt 在早期开始开发的时候,由于时间紧促,设计上其实有许多问题..
例如:

  • 不完善的事件
  • 一些Magic String
  • Game 本身的设计导致的问题....

我们需要尽快改良这些问题,以便后续的Additions等功能的开发。
这份 issue 将用于收集问题以供开发

@iceBear67 iceBear67 added the help wanted Extra attention is needed label Jan 16, 2021
@iceBear67
Copy link
Collaborator Author

  1. Game
    游戏对象,是主要需要修改的地方
  • 为了支持 Multiverse-Core ,game应该作为多例存在,即世界不应该被写死,可能需要引入大厅世界。
  • 从其他事件处理器中解耦合,例如PlayerJoin,PlayerChat,Radar.
  1. Setting
    将SimpleConfig内部序列化实现换成SnakeYaml

@iceBear67 iceBear67 added this to the Refactor#1 milestone Jan 16, 2021
@iceBear67
Copy link
Collaborator Author

iceBear67 commented Jan 16, 2021

Game

Game是ManiHunt的核心部分,和许多地方耦合。
于是我们重新设计一下Game:

  1. Game 是一个抽象的概念,他代表了一局游戏
  2. 一局游戏应该具有以下属性:
  • 游戏里有?
  • 游戏的范围是哪里?
  • 这个游戏的状态是怎么样的?
  • 这个游戏应该要能被启动和停止
  • 一局游戏需要储存游戏的各项统计
  • 这个游戏的Runner是谁
  • 指南针是否启用

与此同时,游戏应该传入一个 Region 作为游戏范围。

Region

Region 的语义是区域
区域可以提供多种实现,例如:

  • 你家小学生用木斧头随便画得一块区域
  • 一个世界组合
    ....
    为了最大程度上的拓展性,他应该是这样的:
interface GamingRegion{
  boolean isInRegion(Location loc);
  Location getCenter(); //Center 相当于 Lobby,即玩家等待玩家进入/开局时的地方。
  void setProperty(RegionProperty prop,Object property); //例如 freezeTime Difficulty
  Object getProperty(RegionProperty prop);
  boolean isLocked();
  void setLocked(boolean status); //解锁出生点限制。
  void setLockRadius(int radius); //出生点限制范围,为了上述例子中的第一条做的准备。
}

接着我们通过RegionProvider获取到GamingRegion:

interface RegionProvider{
  GamingRegion claim();
}

@iceBear67 iceBear67 modified the milestones: Refactor#1, ManHunt v2 Jan 22, 2021
@iceBear67
Copy link
Collaborator Author

游戏机制:Runner

拓宽范围。Runner或许可以不止一个。
Runner应默认在不同的地方被空投,且当所有 Runner 死亡后游戏才判断结束。

@iceBear67
Copy link
Collaborator Author

9a8636c
根据具体情况对GameRegion等做了调整

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants