c语言军棋,基于C 的网络军棋设计果皮版.doc
摘 要
本文詳細介?紹了一個網?絡對戰軍棋?游戲的設計?和實現。對于軍棋游?戲來說,規則非常簡?單,就是按照先?后順序在棋?盤上走棋吃?子,直到一方最?先將對方的?“軍旗”挖掉為勝。
這里使用了?UDP(User Data Proto?col)。UDP是用?戶數據文報?協議的簡稱?,兩臺計算機?之間的傳輸?類似于傳遞?郵件;兩臺之間沒?有明確的連?接,使用UDP?協議建立對?等通信。游戲開始后?,創建一個線?程啟動線程后?,通過不斷偵?聽本機設定?的端口,得到對方發?送來的信息?,根據自己定?義的通信協?議中傳送的?是“輸贏信息”、“下的棋子位?置信息”、“重新開始”等信息而分?別處理。發送信息較?為簡單,主要實現創?建UDP網?絡服務,傳送信息到?指定計算機?的端口號后?,關閉UDP?服務。
軍棋UDP;C#
Abstr?act
This paper? descr?ibes the desig?n and imple?menta?tion of the Versu?s-netwo?rk Jun Qi.Game rules? are very simpl?e:take turns? playi?ng chess? on a chess? board?,and the one who dig the “flag” of the other? side first? will be the winne?r.
The game uses the C # progr?ammin?g to estab?lish commu?nicat?ion in the netwo?rk .UDP is used there?.UDP is the short? for User Data Proto?col.Trans?missi?on betwe?en two compu?ters is simil?ar to deliv?ering? the messa?ge;There? is no clear? conne?ction? betwe?en the two, using? the UDP proto?col to estab?lish peer commu?nicat?ions.After? the start? of the game, creat?e a threa?d.After? start?ing the threa?d ,throu?gh conti?nuous?ly liste?ning to the port we set,we get infor?matio?n from the other? side. Then proce?ss respe?ctive?ly "winni?ng or losin?g ", "the piece?s posit?ion", "start? again?" and other? infor?matio?n accor?ding to our own defin?ition? of commu?nicat?ion proto?col.Sendi?ng infor?matio?n is relat?ively? simpl?e,mainl?y to creat?e UDP netwo?rk servi?ces, trans?mit infor?matio?n to the desig?nated? remot?e port of the other? compu?ter, shut down the UDP servi?ce.
Creat?ing the game, joini?ng the game and other? funct?ions can be achie?ved in the netwo?rk.
Keywo?rds: Jun Qi;UDP;C #
目 錄
1 緒 論1
1.1 網絡棋牌游?戲的現狀1
1.2 網絡棋牌游?戲的未來發?展?2
2 軍棋游戲功?能分析4
3 開發環境及?關鍵技術6
3.1Visu?al Studi?o 2010開?發平臺6
3.2 C#編程技術7
3.3UDPC?lient?協議9
3.4C#的UdpC?lient?類11
3.5 12
4 軟件整體設?計13
4.1界面設計?13
4.2棋盤數據?結構14
4.3通信協議?設計14
4.4走棋規則?設計16
4.5布陣規則?設計18
5軟件詳細?設計20
5.1初始化棋?盤22
5.2棋子控件?的四個事件?24
5.3走棋規則?32
5.4讀寫布陣?棋譜文件39
5.5“保存布陣”、“讀取布陣”、“開始對戰”41
5.6通信過程?42
5.7“主機
總結
以上是生活随笔為你收集整理的c语言军棋,基于C 的网络军棋设计果皮版.doc的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vue2集成声网-环信即时通讯SDK,建
- 下一篇: 3D视觉应用案例:引导板件定位抓取