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

Make ViewAsSkill generic for both server and client's usage #51

Open
ghost opened this issue Aug 12, 2012 · 3 comments
Open

Make ViewAsSkill generic for both server and client's usage #51

ghost opened this issue Aug 12, 2012 · 3 comments
Milestone

Comments

@ghost
Copy link

ghost commented Aug 12, 2012

Currently viewAs and viewFilter are only for client side usage. To make it usable on server side for anti-cheating and other purposes. Do following things:

  1. Put currentPlayer, currentPhase and ardUseStruct.pattern into RoomState.
  2. Add a function in Engine that can returns a RoomState for both client and server.
  3. Update roomstate accordingly in both server and client side.
  4. Search for "ClientInstance->getStatus()" and "ClientInstance->getPattern()" in all "Solution" scope, replace all of them with Sanguosha->getRoomState()->getStatus(), Sanguosha->getRoomState()->getPattern()
@ghost
Copy link
Author

ghost commented Aug 12, 2012

In the end we need to move currentPlayer, currentPhase and what ever states that are shared by client/server into RoomState rather than duplicating them. But duplicating it seems to be the only feasible way in the first pass.

ghost pushed a commit that referenced this issue Aug 13, 2012
@pansz
Copy link
Collaborator

pansz commented Aug 13, 2012

有些功能必须被重复。我来解释一下:

1。对于任何一个操作,服务器端接收到之后,需要检查这个操作的合法性,例如我可以杀一个距离8的人,或者杀空城诸葛亮,服务器应当期待从客户端而言,可能发出任何指令。——所以对服务器提起一个操作之后,服务器要有权说不。此时返回客户端之后,相当于该操作没有发生。

2。对于任何你可能发生非法操作之前,客户端可以从『方便用户』的角度,对某些非法操作进行屏蔽,例如使用杀的时候,自动把超过攻击范围的角色,以及空城诸葛,都给屏蔽了。——但客户端的这个行为,只是一种辅助性 AI ,用来辅助用户操作的,它不可以被依赖为检验动作合法性的标准,服务器端才是用于检测这个动作合法性的实体。

所以,某些操作必然是在客户端存在,同时在服务器端也存在的,虽然他们的用途不完全相同。客户端的存在意义只是帮助用户筛选出合法的操作,但客户端也有权不帮助用户进行这种筛选(例如 3V3 比赛中,你可以故意进行非法操作,扣技术分,然后达到某种目的),真正筛选的是服务器端,这样对所有客户端一视同仁,客户端即使是 AI 也不能作弊了。

@ghost
Copy link
Author

ghost commented Aug 13, 2012

@pansz That is what this patch is intended for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant