编辑“︁
GameDesign
”︁(章节)
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
= GameManager = The logic is similar to this: <pre> GameManager { NetworkManager read Message switch(Message type) { case ...; } } </pre> So let's define the reply to each message. First, let's clarify that the best way of modelling this system is using finite automates, (a finite state machine) where, based on the input, we change the state we are currently in and produce an output. == Login stage == <b>NOTE</b>: This stage has been split in 3 to allow proper secure login. <b>NOTE</b>: Explain here how secure login works. <pre> Process C2S Login ( STATE_BEGIN_LOGIN ) Precondition: The state MUST be NULL Test if there is room for more players. if there is no more room { reply S2C Login NACK( SERVER_FULL ) state = NULL } if check username, password in database is correct { create clientid add PlayerEntry notify database reply S2C Login ACK get characters list of the player reply S2C CharacterList state = STATE_LOGIN_COMPLETE } else { notify database reply S2C Login NACK( LOGIN_INCORRECT ) state = NULL } Postcondition: The state MUST be NULL or STATE_LOGIN_COMPLETE and a we have created a PlayerEntry for this player with a unique clientid. </pre> == Choose character stage == <pre> Process C2S ChooseCharacter ( STATE_LOGIN_COMPLETE ) Precondition: The state MUST be STATE_LOGIN_COMPLETE if character exists in database { add character to Player's PlayerEntry add character to game reply S2C Choose Character ACK state = STATE_GAME_BEGIN } else { reply S2C Choose Character NACK state = STATE_LOGIN_COMPLETE } Postcondition: The state MUST be STATE_GAME_BEGIN and the PlayerStructure should be completely filled or if the character choise was wrong the state is STATE_LOGIN_COMPLETE </pre> == Logout stage == <pre> Process C2S Logout ( STATE_GAME_END ) Precondition: The state can be anything but STATE_LOGIN_BEGIN if( rpEngine allows player to logout ) { reply S2C Logout ACK state = NULL store character in database remove character from game delete PlayerEntry } else { reply S2C Logout NACK } Postcondition: Either the same as the input state or the state currently in </pre> == Perception confirmation stage == <pre> Process C2S Perception ACK Precondition: The state must be STATE_LOGIN_BEGIN notify that the player received the perception. Postcondition: The state is STATE_LOGIN_BEGIN and Timestamp field in PlayerContainer is updated. </pre> == Transfer confirmation stage == <pre> Process C2S Transfer ACK Precondition: The state must be STATE_LOGIN_BEGIN foreach content waiting for this player { if client acked it { send content to client } } Postcondition: The state is STATE_LOGIN_BEGIN and the content waiting for player is clear. </pre>
摘要:
请注意,所有对gamedev的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Gamedev:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
页面
讨论
不转换
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息