【文章內(nèi)容簡介】
c e 圖 表 EmplaceAccess 屬性 后綴為 Access 代表為本地數(shù)據(jù)庫里的表 以上表的實體關系 (如 圖 ) : 重慶大學本科學生畢業(yè)設計(論文) 3 系統(tǒng)設計 14 T h i n gP K T h i n g I d A c c o u n t I d T h i n g T y p e b B i n d b I n s t a l l e d A c t i v e T i m e A c c e s s I d S h i p A c c e s s I d E m p l a c e I n d e xG i f tP K G i f t I d A c c o u n t I d T h i n g T y p e A c c e s s I d B e n e f a c t o r D e s c T e x tH S G C V e r i f y C o d eP K H S G C V e r i f y C o d e I d A c c o u n t I d V e r i f y C o d eA c c o u n tP K A c c o u n t I d U s e r N a m e P a s s w o r d E x p e r i e n c e M o n e y L e v e l C u r S h i p A c c e s s I dS h i p A c c e s sP K S h i p A c c e s s I d T y p e G o o d s F o r w a r d V T u r n i n g V V o l E m p l a c e C o u n t H p D e f C a n n o n D e f T o r p e d oR o l e A c c e s sP K R o l e A c c e s s I d G o o d s t o n n a g e o p e r a t e L o a d B u l l e tG u n A c c e s sP K G u n A c c e s s I d T y p e G o o d s R o t a t e S p e e d P i p e C o u n t S h o o t G a p S h o o t R a n g e P o w e r P o w e r R a n g e T o r p e d o S p e e d B u l l e t S i z eI t e m A c c e s sP K I t e m A c c e s s I d G o o d s U s e C o u n t P l u s M o d e T a r g e t D i f f 1 T a r g e t D i f f 2 T a r g e t T y p e V a l u e V a l u e A c c M o d e V a l u e C o n t i n u e M o d e P l u s T i m e R e g i o n RE m p l a c e A c c e s sP K E m p l a c e A c c e s s I d T y p e S h i p A c c e s s E m p l a c e I n d e P l a c e 圖 實體關系圖 數(shù)據(jù)庫邏輯設計 邏輯設計:主要工作是將現(xiàn)實世界的概念數(shù)據(jù)模型設計成數(shù)據(jù)庫的一種邏輯模式,即適應于某種特定數(shù)據(jù)庫管理系統(tǒng)所支持的邏輯數(shù)據(jù)模式。與此同時,可重慶大學本科學生畢業(yè)設計(論文) 3 系統(tǒng)設計 15 能還需為各種數(shù)據(jù)處理應用領域產(chǎn)生相應的邏輯子模式。這一步設計的結果就是所謂“邏輯數(shù)據(jù)庫”。 [6] 在數(shù)據(jù)庫概念設計完成之后,我們可進行數(shù)據(jù)庫邏輯設計。 ① 創(chuàng)建數(shù)據(jù) 庫 ocean。 在 MySQL Command Line Client 中執(zhí)行如下命令: 執(zhí)行完畢后,數(shù)據(jù)庫 ocean 創(chuàng)建成功。(如圖 ) 圖 數(shù)據(jù)庫 ocean ② 然后連接數(shù)據(jù)庫 ocean。 在 MySQL Command Line Client 中執(zhí)行如下命令: 執(zhí)行完畢后,提示數(shù)據(jù)庫連接成功。 ③ 在數(shù)據(jù)庫 ocean 中創(chuàng)建表 account。 在 MySQL Command Line Client 中執(zhí)行如下命令: CREATE TABLE `account` ( `AccountId` int (10) unsigned NOT NULL auto_increment, `UserName` varchar (45) character set latin1 NOT NULL, `Password` varchar (45) character set latin1 NOT NULL, `Experience` int (10) unsigned NOT NULL, `Money` int (10) unsigned NOT NULL, `Level` int (10) unsigned NOT NULL, `CurShipAccessId` int (10) unsigned NOT NULL, PRIMARY KEY (`AccountId`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8。 USE ocean; CREATE DATABASE ocean; 重慶大學本科學生畢業(yè)設計(論文) 3 系統(tǒng)設計 16 執(zhí)行完畢后,表 account 創(chuàng)建成功。(如圖 ) 圖 表 account ④ 在數(shù)據(jù)庫 ocean 中創(chuàng)建表 gift。 在 MySQL Command Line Client 中執(zhí)行如下命令: 執(zhí)行完畢后,表 gift 創(chuàng)建成功。(如圖 ) CREATE TABLE `gift` ( `GiftId` int (10) unsigned NOT NULL auto_increment, `AccountId` int (10) unsigned NOT NULL, `ThingType` int (10) unsigned NOT NULL, `AccessId` int (10) unsigned NOT NULL, `Benefator` varchar (45) NOT NULL, `DescText` varchar (45) NOT NULL, PRIMARY KEY (`GiftId`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8。 重慶大學本科學生畢業(yè)設計(論文) 3 系統(tǒng)設計 17 圖 表 gift ⑤ 在數(shù)據(jù)庫 ocean 創(chuàng)建表 hsgcverifycode。 在 MySQL Command Line Client 中執(zhí)行如下命令: 執(zhí)行完畢后,表 hsgcverifycode 創(chuàng)建成功。(如圖 ) 圖 表 hsgcverifycode ⑥ 創(chuàng)建表 thing。 在 MySQL Command Line Client 中執(zhí)行如下命令: CREATE TABLE `hsgcverifycode` ( `HSGCVerifyCodeId` int (10) unsigned NOT NULL auto_increment, `AccountId` int (10) unsigned NOT NULL, `VerifyCode` int (10) unsigned NOT NULL, PRIMARY KEY (`HSGCVerifyCodeId`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1。 重慶大學本科學生畢業(yè)設計(論文) 3 系統(tǒng)設計 18 執(zhí)行完畢后,表 thing 創(chuàng)建成功。(如圖 ) 圖 表 thing CREATE TABLE `thing` ( `ThingId` int (10) unsigned NOT NULL auto_increment, `AccountId` int (10) unsigned NOT NULL, `ThingType` int (10) unsigned NOT NULL, `bBind` int (10) unsigned NOT NULL, `bInstalled` int (10) unsigned NOT NULL, `ActiveTime` int (10) unsigned NOT NULL, `AccessId` int (10) unsigned NOT NULL, `ShipAccessId` int (10) unsigned NOT NULL, `EmplaceIndex` int (10) unsigned NOT NULL, PRIMARY KEY (`ThingId`) ) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=latin1。 重慶大學本科學生畢業(yè)設計(論文) 4 系統(tǒng)難點技術分 析與設計 19 4 系統(tǒng)難點技術分 析與設計 系統(tǒng)架構設計與分析 根據(jù)分析,我們設計出系統(tǒng)架構圖。(如圖 ) 登 陸 器游 戲 客 戶 端登 錄 服 務 器大 廳 服 務 器游 戲 服 務 器數(shù) 據(jù) 庫 處 理 服 務 器數(shù) 據(jù) 庫登錄啟動選 擇 大 廳更換大廳查詢、操作房間內(nèi)游戲調(diào)配游 戲 邏 輯 交 互游 戲開 始通 知房 間信 息游戲結束返回結果登錄驗證房間維護數(shù)據(jù)庫操作返回結果版本更新 圖 系統(tǒng)架構圖 從圖我們可以看出系統(tǒng)各個部分的工作情況以及數(shù)據(jù)的交互情況??蓮膬蓚€部分來分析: ① 登錄服務器與數(shù)據(jù)庫服務器的交互。其中包括: 用戶由登錄器客戶端登陸登錄服務器時,登錄服務器請求數(shù)據(jù)庫服務器執(zhí)行登陸驗證操作,數(shù)據(jù)庫服務器再對數(shù)據(jù)庫進行查詢操作,并返回查詢結果。 ② 大廳服務器與數(shù)據(jù)庫服務器的交互。其中包括: 1) 用戶由游戲客戶端登陸大廳服務器時,大廳服 務器請求數(shù)據(jù)庫服務器執(zhí)行登陸驗證操作,數(shù)據(jù)庫服務器再對數(shù)據(jù)庫進行查詢操作,并返回查詢結果。 2) 用戶更換大廳時,大廳服務器請求數(shù)據(jù)庫服務器執(zhí)行更換大廳操作,數(shù)據(jù)庫服務器再對數(shù)據(jù)庫進行相應操作,并返回操作后的結果。 3) 用戶對物品進行查詢、配置、激活、丟棄、購買、贈送、接收時,大廳服務器請求數(shù)據(jù)庫服務器執(zhí)行相應操作,數(shù)據(jù)庫服務器在對數(shù)據(jù)局進行相應的操作,并返回操作后的結果。 重慶大學本科學生畢業(yè)設計(論文) 4 系統(tǒng)難點技術分 析與設計 20 4) 一局游戲結束后,游戲服務器將游戲過程中各種信息的變化傳給大廳服務器,大廳服務器請求數(shù)據(jù)庫服務器執(zhí)行數(shù)據(jù)更新操作,數(shù)據(jù)庫服務器再對數(shù)據(jù)庫進行更新操 作,并返回更新后的結果。 5) 用戶退出游戲時,大廳服務器請求數(shù)據(jù)庫執(zhí)行退出操作,數(shù)據(jù)庫服務器再對數(shù)據(jù)庫進行相應的刪除數(shù)據(jù)操作。 其中值得注意到一點是:游戲服務器沒有直接與數(shù)據(jù)庫服務器進行交互,而是通過大廳服務器與數(shù)據(jù)庫服務器進行數(shù)據(jù)的傳遞。之所以是這樣,主要是因為這類網(wǎng)絡對戰(zhàn)游戲不需要在游戲過程中實時更新數(shù)據(jù),可以通過大廳服務器,在一局游戲結束后,再進行游戲數(shù)據(jù)的更新。所以,本系統(tǒng)采用的是這種數(shù)據(jù)交換方式。 下面,我們結合系統(tǒng)需求,對架構圖進行詳細的分析: 表 術語表 縮寫 全寫 定義 LC Login Client 登陸器客戶端 LS Login Server 登錄服務器 GC Game Client 游戲客戶端 HS Hall Server 大廳服務器 DS DB Server 數(shù)據(jù)庫處理服務器 GS Game