澄梦希喜广告网站制作遂宁站

一套跨平台五子棋网游的开发经历

闲来无事,因自己想要在服务器开发方面进行更深入的学习,积累更丰富的经验。决定写一套网络游戏的c/s。

昌图网站建设公司创新互联,昌图网站设计制作,有大型网站制作公司丰富经验。已为昌图1000多家提供企业网站建设服务。企业网站搭建\成都外贸网站制作要多少钱,请找那个售后服务好的昌图做网站的公司定做!

因为主要目的是服务器的开发,因此游戏我选用规则较为简单、画面特效没有要求的回合制游戏:五子棋。我曾经在刚接触编程的时候自己在控制台 下做过这个游戏,当时写的ai特nb我自己根本下不赢他。确定是制作五子棋了, 但是还要满足跨平台的特性,毕竟移动互联时代,得终端者得天下。游戏做成全平台才能更好的将各种玩家聚集在一起。跨平台?b/s是人们通常会第一个想到的 跨平台方式,的确现在市面上有很多基于b/s的页游,大部分使用的是flash作为游戏引擎。但手机上很少有人使用浏览器玩游戏。(其实根本不会 flash,html也烂得很,曾经给别人用php做的数据管理网站根本就没有像样的界面)于是选择了c++的跨平台游戏引擎cocos2dx,这引擎简 单好用,而且因为是c++作为游戏逻辑,移植特方便,以前也用过这个引擎(某比赛)。最终选用的版本是cocos2d-x 3.4。

既然是网络游戏的服务器,那么就得高效,而且是在linux下,因此我选epoll模型进行服务端的开发,epoll的部分写在这篇文章里:epoll模型的理解与封装实现,使用的linux系统为CENT OS 6.4,内核为linux2.6。

关于游戏开发步骤的思考:

按照自己以前习惯的套路来说,通信方式与协议的设计应该是放在首位的,然后是服务器、再到客户端(没有美工)。

而自己以前曾经玩到很多的单机游戏,更新版本后,游戏便增加了网络游戏功能。这似乎说明了很多游戏与网络协议之间是相互独立的。甚至网络协议是根据实际的游戏逻辑设计的,而不是游戏根据协议来设计自身的逻辑。

最终决定先把单机的版本做出来。于是制定了如下的开发流程:

1、游戏的算法与数据结构设计与实现

2、游戏交互设计与实现

3、单机游戏的实现

4、游戏通信协议设计

5、服务器实现(不可忽略掉的重点,自己写游戏的目的)

6、网络游戏功能实现

7、平台移植

1、游戏的算法与数据结构设计与实现:

五子棋这个游戏是一个二维平面上的游戏,我们将棋盘看做一个数组,每一个格子的状态分为两种:没棋和有棋,有棋因不同玩家而区别(数量不限,可直接作为多人多子棋的游戏基类)

代码:

 
 
  1. //Chess.h 
  2. #ifndef  _CHESS_H_ 
  3. #define  _CHESS_H_ 
  4. #include "cocos2d.h" 
  5. USING_NS_CC; 
  6.  
  7. //下棋坐标状态结构体 
  8. struct Chesspos 
  9. { 
  10.     int x,y; 
  11.     int player;//该步数所属玩家 
  12.     Chesspos(){}; 
  13.     Chesspos(int px,int py,int pp) 
  14.     { 
  15.         x=px; 
  16.         y=py; 
  17.         player=pp; 
  18.     } 
  19. }; 
  20.  
  21. class Chessway 
  22. { 
  23.     Chesspos *way;//路径数组 
  24.     int totallen;//总长度 
  25.     int len;//当前步数 
  26.  
  27. public: 
  28.     Chessway(int totalnum); 
  29.     ~Chessway(void); 
  30.     void setempty(); 
  31.     bool addway(int x,int y,int player);//添加步数 
  32.     int getstep(); 
  33.     Chesspos getnow(); 
  34. }; 
  35.  
  36. class Chess 
  37. { 
  38. public: 
  39.     Chess(int width,int heigh,int winlen=5,int playernum=2); 
  40.     ~Chess(void); 
  41.  
  42.     int **board; 
  43.     int w,h; 
  44.     int pnum; //palyer num 
  45.     int wlen; //how number can win 
  46.     Chessway *way; 
  47.     int playercnt;//player start at 1 
  48.     bool isgameend; 
  49.      
  50.     bool init(int width,int heigh,int winlen=5,int playernum=2); 
  51.     void exit(); 
  52.  
  53.     void restart(); 
  54.     bool nextstep(Chesspos np);//下棋,自动判断玩家 
  55.     bool nextstep(int x,int y); 
  56.  
  57.     int getstatus(int x,int y);//获取游戏状态 
  58.  
  59.     bool checklen(int x,int y); 
  60.     int checkwin();//判断游戏是否结束并返回胜利玩家 
  61. }; 
  62.  
  63.  
  64. #endif //_CHESS_H_ 

检测胜利的逻辑很简单:找到一个下有棋的位置,检查这个位置下、右、左下、右下是否有连续相等的5个棋,即为游戏胜利。游戏一旦胜利是不可以继续下棋的,所以只会有一个玩家胜利。下面给出判断代码:

 
 
  1. //Chess.cpp 
  2. //胜利检测代码 
  3. bool Chess::checklen(int x,int y) 
  4. { 
  5.     for(int i=1;i
  6.     { 
  7.         if(x+i>=w) 
  8.         { 
  9.             break; 
  10.         } 
  11.         if(board[x+i][y]!=board[x][y]) 
  12.         { 
  13.             break; 
  14.         } 
  15.         if(i==wlen-1) 
  16.         { 
  17.             return true; 
  18.         } 
  19.     } 
  20.  
  21.     for(int i=1;i
  22.     { 
  23.         if(y+i>=h) 
  24.         { 
  25.             break; 
  26.         } 
  27.         if(board[x][y+i]!=board[x][y]) 
  28.         { 
  29.             break; 
  30.         } 
  31.         if(i==wlen-1) 
  32.         { 
  33.             return true; 
  34.         } 
  35.     } 
  36.  
  37.     for(int i=1;i
  38.     { 
  39.         if(x+i>=w||y+i>=h) 
  40.         { 
  41.             break; 
  42.         } 
  43.         if(board[x+i][y+i]!=board[x][y]) 
  44.         { 
  45.             break; 
  46.         } 
  47.         if(i==wlen-1) 
  48.         { 
  49.             return true; 
  50.         } 
  51.     } 
  52.  
  53.     for(int i=1;i
  54.     { 
  55.         if(x-i<0||y+i>=h) 
  56.         { 
  57.             break; 
  58.         } 
  59.         if(board[x-i][y+i]!=board[x][y]) 
  60.         { 
  61.             break; 
  62.         } 
  63.         if(i==wlen-1) 
  64.         { 
  65.             return true; 
  66.         } 
  67.     } 
  68.     return false; 
  69. } 
  70. int Chess::checkwin() 
  71. { 
  72.     for(int i=0;i
  73.     { 
  74.         for(int j=0;j
  75.         { 
  76.             if(board[i][j]) 
  77.             { 
  78.                 if(checklen(i,j)) 
  79.                 { 
  80.                     isgameend=true; 
  81.                     return board[i][j]; 
  82.                 } 
  83.             } 
  84.         } 
  85.     } 
  86.     return 0; 
  87. } 

#p#

2、游戏交互设计与实现

涉及到游戏交互,这里就要使用到游戏引擎了。首先需要把游戏的一些图片资源大致搞定,这里用画图这画了几个不堪入目的图片资源:

别看这画的丑,我可是用鼠标和window自带的画图画出来的,到时候在游戏中看起来是毫无违和感的(笔者小学就会画H漫了)。

这里就要用到cocos2dx的东西了。首先为每一个下棋的格子设计一个个块状的节点,然后设计游戏主体布景层:

 
 
  1. class ChessNode:public Node
    class ChessMain:public Layer 

作为游戏棋盘,每一个格子的形态都是一样的,我只需要将它们拼接成矩阵就成了一个完整的棋盘。因此在游戏布景层里,我开了一个Vector 的ChessNode,将其依次紧凑地排列在屏幕上。在游戏初始状态时,chess_1.png、chess_2.png是不会显示的,如图(截图我直接 使用现成游戏的截图):

这样的棋盘看起来是不是很没有违和感?

当下棋后,就可以把对应的棋图显示出来:

后面发现好像真正的下棋是下在十字交叉处的。。

这部分的注意事项主要就在于触摸检测与棋盘屏幕大小。触摸的话计算相对棋盘布景层的坐标可以得出下棋的位置。棋盘就以静态值480px为标准,在其他地方调用的时候缩放即可。

 
 
  1. #ifndef  _CHESSMAIN_H_ 
  2. #define  _CHESSMAIN_H_ 
  3. #include "cocos2d.h" 
  4. #include "Chess.h" 
  5. USING_NS_CC; 
  6.  
  7.  
  8. #define defaultwinsize 480.0 
  9. #define chesspicsize 50.0 
  10.  
  11.  
  12. static Point winsize; 
  13.  
  14. class ChessNode:public Node 
  15. { 
  16.     public: 
  17.     ChessNode(int playernum=2); 
  18.  
  19.     Vector chesspicarr; 
  20.     Sprite * basepic; 
  21. }; 
  22.  
  23. class ChessMain:public Layer 
  24. { 
  25. public: 
  26.  
  27.     Chess *chessdata; 
  28.  
  29.     Vector basenode; 
  30.  
  31.     virtual bool init(); 
  32.     //virtual void onEnter(); 
  33.  
  34.     void restart(); 
  35.     void updateone(int x,int y); 
  36.     void updateall(); 
  37.  
  38.     bool nextstep(int x,int y); 
  39.     int  checkwin(); 
  40.  
  41.  
  42.     CREATE_FUNC(ChessMain); 
  43. }; 
  44.  
  45. #endif //_CHESSMAIN_H_
 
 
  1. #include "ChessMain.h" 
  2.  
  3. ChessNode::ChessNode(int playernum) 
  4. { 
  5.     basepic=Sprite::create("chess_base_1.png"); 
  6.     basepic->setAnchorPoint(ccp(0,0)); 
  7.     this->addChild(basepic); 
  8.      
  9.     char addname[]="chess_1.png"; 
  10.     for(int i=0;i
  11.     { 
  12.         addname[6]='0'+i+1; 
  13.         auto newsprite=Sprite::create(addname); 
  14.         chesspicarr.pushBack(newsprite); 
  15.         chesspicarr.back()->setAnchorPoint(ccp(0,0)); 
  16.         this->addChild(chesspicarr.back()); 
  17.          
  18.     } 
  19. } 
  20.  
  21. bool ChessMain::init() 
  22. { 
  23.     winsize=Director::sharedDirector()->getWinSize(); 
  24.  
  25.     //默认值棋盘 
  26.     chessdata=new Chess(15,15); 
  27.  
  28.     for(int i=0;iw;i++) 
  29.     { 
  30.         for(int j=0;jh;j++) 
  31.         { 
  32.             basenode.pushBack(new ChessNode()); 
  33.              
  34.             basenode.back()->setScale((defaultwinsize/chessdata->h)/chesspicsize); 
  35.             basenode.back()->setPosition( 
  36.                 ccp(defaultwinsize/chessdata->w*i,defaultwinsize/chessdata->h*j) 
  37.                 ); 
  38.             basenode.back()->setAnchorPoint(ccp(0,0)); 
  39.              
  40.             this->addChild(basenode.back()); 
  41.         } 
  42.     } 
  43.  
  44.     restart(); 
  45.  
  46.      
  47.  
  48.     return true; 
  49. } 
  50. /* 
  51. void ChessMain::onEnter() 
  52. { 
  53.     ; 
  54. } 
  55. */ 
  56. void ChessMain::restart() 
  57. { 
  58.     chessdata->restart(); 
  59.     updateall(); 
  60. } 
  61. void ChessMain::updateone(int x,int y) 
  62. { 
  63.     for(int i=0;ipnum;i++) 
  64.     { 
  65.         if(chessdata->getstatus(x,y)==i+1) 
  66.         { 
  67.             basenode.at(x*chessdata->w+y)-> 
  68.                 chesspicarr.at(i)->setVisible(true); 
  69.         } 
  70.         else 
  71.         { 
  72.             basenode.at(x*chessdata->w+y)-> 
  73.                 chesspicarr.at(i)->setVisible(false); 
  74.         } 
  75.     } 
  76. } 
  77. void ChessMain::updateall() 
  78. { 
  79.     for(int i=0;iw;i++) 
  80.     { 
  81.         for(int j=0;jh;j++) 
  82.         { 
  83.             updateone(i,j); 
  84.         } 
  85.     } 
  86. } 
  87.  
  88. bool ChessMain::nextstep(int x,int y) 
  89. { 
  90.     if(chessdata->isgameend) 
  91.     { 
  92.         return false; 
  93.     } 
  94.     if(!chessdata->nextstep(x,y)) 
  95.     { 
  96.         return false; 
  97.     } 
  98.     updateone(x,y); 
  99.     checkwin(); 
  100.  
  101.     return true; 
  102. } 
  103.  
  104. int ChessMain::checkwin() 
  105. { 
  106.     return chessdata->checkwin(); 
  107. } 
  108.  
  109. /* 
  110. bool ChessMain::onTouchBegan(Touch *touch, Event *unused_event) 
  111. { 
  112.     Point pos=convertTouchToNodeSpace(touch); 
  113.  
  114.     if(pos.x>defaultwinsize||pos.y>defaultwinsize) 
  115.     { 
  116.         return false; 
  117.     } 
  118.     int x=chessdata->w*(pos.x/defaultwinsize); 
  119.     int y=chessdata->h*(pos.y/defaultwinsize); 
  120.  
  121.     return nextstep(x,y); 
  122. } 
  123. */ 

这里的触摸函数会由以后ChessMain的子类重写。

#p#

3、单机游戏的实现

单机游戏,只需写好对手的AI逻辑即可。幸好是五子棋不是围棋,AI很好写,能很快计算出必胜态。由于自己主要目的是写网络端。因此我把单机功能实现后并没有写AI,把接口留着的,只接了一个随机函数,等以后有闲情把AI逻辑加上。

总的来说这部分就是加上了进入游戏前的菜单以及单机游戏的选项和游戏结束的对话框:

 
 
  1. #include "ChessMain.h" 
  2.  
  3. ChessNode::ChessNode(int playernum) 
  4. { 
  5.     basepic=Sprite::create("chess_base_1.png"); 
  6.     basepic->setAnchorPoint(ccp(0,0)); 
  7.     this->addChild(basepic); 
  8.      
  9.     char addname[]="chess_1.png"; 
  10.     for(int i=0;i
  11.     { 
  12.         addname[6]='0'+i+1; 
  13.         auto newsprite=Sprite::create(addname); 
  14.         chesspicarr.pushBack(newsprite); 
  15.         chesspicarr.back()->setAnchorPoint(ccp(0,0)); 
  16.         this->addChild(chesspicarr.back()); 
  17.          
  18.     } 
  19. } 
  20.  
  21. bool ChessMain::init() 
  22. { 
  23.     winsize=Director::sharedDirector()->getWinSize(); 
  24.  
  25.     //默认值棋盘 
  26.     chessdata=new Chess(15,15); 
  27.  
  28.     for(int i=0;iw;i++) 
  29.     { 
  30.         for(int j=0;jh;j++) 
  31.         { 
  32.             basenode.pushBack(new ChessNode()); 
  33.              
  34.             basenode.back()->setScale((defaultwinsize/chessdata->h)/chesspicsize); 
  35.             basenode.back()->setPosition( 
  36.                 ccp(defaultwinsize/chessdata->w*i,defaultwinsize/chessdata->h*j) 
  37.                 ); 
  38.             basenode.back()->setAnchorPoint(ccp(0,0)); 
  39.              
  40.             this->addChild(basenode.back()); 
  41.         } 
  42.     } 
  43.  
  44.     restart(); 
  45.  
  46.      
  47.  
  48.     return true; 
  49. } 
  50. /* 
  51. void ChessMain::onEnter() 
  52. { 
  53.     ; 
  54. } 
  55. */ 
  56. void ChessMain::restart() 
  57. { 
  58.     chessdata->restart(); 
  59.     updateall(); 
  60. } 
  61. void ChessMain::updateone(int x,int y) 
  62. { 
  63.     for(int i=0;ipnum;i++) 
  64.     { 
  65.         if(chessdata->getstatus(x,y)==i+1) 
  66.         { 
  67.             basenode.at(x*chessdata->w+y)-> 
  68.                 chesspicarr.at(i)->setVisible(true); 
  69.         } 
  70.         else 
  71.         { 
  72.             basenode.at(x*chessdata->w+y)-> 
  73.                 chesspicarr.at(i)->setVisible(false); 
  74.         } 
  75.     } 
  76. } 
  77. void ChessMain::updateall() 
  78. { 
  79.     for(int i=0;iw;i++) 
  80.     { 
  81.         for(int j=0;jh;j++) 
  82.         { 
  83.             updateone(i,j); 
  84.         } 
  85.     } 
  86. } 
  87.  
  88. bool ChessMain::nextstep(int x,int y) 
  89. { 
  90.     if(chessdata->isgameend) 
  91.     { 
  92.         return false; 
  93.     } 
  94.     if(!chessdata->nextstep(x,y)) 
  95.     { 
  96.         return false; 
  97.     } 
  98.     updateone(x,y); 
  99.     checkwin(); 
  100.  
  101.     return true; 
  102. } 
  103.  
  104. int ChessMain::checkwin() 
  105. { 
  106.     return chessdata->checkwin(); 
  107. } 
  108.  
  109. /* 
  110. bool ChessMain::onTouchBegan(Touch *touch, Event *unused_event) 
  111. { 
  112.     Point pos=convertTouchToNodeSpace(touch); 
  113.  
  114.     if(pos.x>defaultwinsize||pos.y>defaultwinsize) 
  115.     { 
  116.         return false; 
  117.     } 
  118.     int x=chessdata->w*(pos.x/defaultwinsize); 
  119.     int y=chessdata->h*(pos.y/defaultwinsize); 
  120.  
  121.     return nextstep(x,y); 
  122. } 
  123. */

现在一个能玩的游戏已经完成,接下来是重点的网络部分。

#p#

4、游戏通信协议设计

因为是PC、手机都能玩的游戏,考虑到糟糕的手机网络环境,通信采用客户端单方发起请求,服务器回复的方式,使服务器不用考虑确保手机信号不好或IP变更的情况,类似于web方式。

游戏没有设计固定的用户,采用的是游戏每次向服务器申请一个游戏ID,使用这个游戏ID在互联网上和其他用户对战。于是协议报文设计了两种:普通请求/回复报文gamequest、游戏数据报文nextquest。

 
 
  1. #include  
  2. #include  
  3. #include  
  4.  
  5.  
  6. #define NEWID       (char)1 
  7. #define NEWGAME     (char)3 
  8. #define NEXTSTEP    (char)5 
  9. #define GETNEXTSTEP (char)6 
  10. #define GAMEEND     (char)10 
  11.  
  12. #define NEWID_FAIL       0 
  13. #define NEWID_SECC       1 
  14.  
  15. #define NEWGAME_FAIL     0 
  16. #define NEWGAME_ISFIRST  1 
  17. #define NEWGAME_ISSEC    2 
  18.  
  19. #define NEXTSTEP_FAIL    1 
  20. #define NEXTSTEP_SEC     1 
  21.  
  22. struct gamequest 
  23. { 
  24.     unsigned int id; 
  25.     char type; 
  26.     unsigned int data; 
  27. }; 
  28.  
  29. struct nextstephead 
  30. { 
  31.     unsigned int id; 
  32.     char type; 
  33.     char x; 
  34.     char y; 
  35.     char mac;//游戏数据校验 
  36.     short stepno; 
  37. }; 

NEWID:申请一个新的游戏ID的请求与回复

NEWGAME:申请开始游戏的请求与回复

NEXTSTEP:更新游戏对局数据的请求与回复

GETNEXSTEP:获取游戏对局数据的请求与回复

GAMEEND:终止或结束游戏的请求

关于游戏请求与游戏对局时的通信,因为采用的是请求加回复的方式,服务器不能主动通知客户端有新的游戏开始或是对手已经喜下了下一步棋,因 此需要客户端主动向服务器获取相应的信息。于是这部分被设计为客户端定时向服务器发送更新数据的请求,服务器一旦接收到请求,就把通过该请求的TCP连接 发回去。这样虽然增加了网络的流量,但为了数据的稳定性必须做出牺牲。好的是该协议报文很小,而且因为是对局游戏,就算有几万人同时在玩,实际单位时间的 数据量也不会太多,最重要的是在处理并发数据的情况。

#p#

5、服务器实现:

这是最重要最核心的部分。一个高效、稳定的游戏服务器程序直接决定了游戏的体验。在实际的游戏服务器开 发中,游戏逻辑与网络通信逻辑可能分工由不同的人员开发。因此,游戏逻辑与网络通信逻辑应在保证效率的情况下尽可能地实现低耦合。我这里虽然是独立开发 的,是因为游戏的逻辑很简单,但如果比如去开发一个像GTAOL这样的游戏服务器,本来做网络通信的人想要做出GTA的游戏逻辑那就相当地困难,需要写处 理世界、物体、角色,还要和游戏端的逻辑一致,累成狗狗。

所以说游戏的逻辑与网络的通信需要尽可能地独立,就这个五子棋服务器而言,网络通信端使用PPC、select、epoll都和游戏逻辑无 关,只要能接收分类并交给游戏逻辑处理,并将游戏逻辑处理好的数据发出即可。该服务器选用的epoll实现的,因篇幅原因,网络通信部分已经在这篇文章中 说明清楚:epoll模型的理解封装与应用。

关于服务器的游戏逻辑,首先看看我们的服务器要做哪些事情:

1、用户游戏ID的申请与管理

2、对局数据的处理与管理

大致就以上这两种事情。但是因为游戏的客户端数量很多,不同的客户端之间进行对局,必须要清晰地处理与管理这些数据。我这里建立了一个idpool,用于id的储存于申请,以防发生错误给用户分配无效或是重复的id。

对局数据的处理与管理:

在两个用户都有id的情况下,双方都能申请进行游戏。这是服务端要做的就是匹配好这些用户并通知这些用户开始游戏。为方便说明,我先把代码粘上来:

 
 
  1. #ifndef  _GAME_H_ 
  2. #define  _GAME_H_ 
  3.  
  4. #include 
  5. #include 
  6. #include 
  7. #include 
  8. #include 
  9. #include 
  10.  
  11. #include "ssock.h" 
  12. #include "gameprotocol.h" 
  13.  
  14. using namespace std; 
  15.  
  16. #define idpoollength 1000 
  17. #define datapoollength 50 
  18.  
  19. //链式IDpool 
  20. class idpool 
  21. { 
  22.     list ids; 
  23. public: 
  24.     idpool() 
  25.     { 
  26.         for(int i=1;i
  27.         { 
  28.             ids.push_back(i); 
  29.         } 
  30.     } 
  31.     unsigned getid() 
  32.     { 
  33.         if(ids.empty()) 
  34.         { 
  35.             return 0; 
  36.         } 
  37.         unsigned re=ids.front(); 
  38.         ids.pop_front(); 
  39.         return re; 
  40.     } 
  41.     void freeid(unsigned int x) 
  42.     { 
  43.         ids.push_front(x); 
  44.     } 
  45.  
  46. }; 
  47.  
  48. //对局匹配类 
  49. class p2p 
  50. { 
  51.     unsigned int with[idpoollength]; 
  52.     unsigned int info[idpoollength]; 
  53. public: 
  54.     p2p() 
  55.     { 
  56.         for(int i=0;i
  57.         { 
  58.             with[i]=i; 
  59.         } 
  60.     } 
  61.     bool ispair(unsigned int x1) 
  62.     { 
  63.         return with[x1]!=x1&&with[x1]!=0; 
  64.     } 
  65.     //设置为该id等待匹配 
  66.     void setwait(unsigned int x1) 
  67.     { 
  68.         with[x1]=0; 
  69.     } 
  70.     //自动匹配函数 
  71.     bool makepair(unsigned int x1) 
  72.     { 
  73.         for(int i=1;i
  74.         { 
  75.             if(with[i]==0&&x1!=i) 
  76.             { 
  77.                 setp2p(x1,i); 
  78.                 return true; 
  79.             } 
  80.         } 
  81.         return false; 
  82.     } 
  83.     //设置两id匹配 
  84.     void setp2p(unsigned int x1,unsigned x2) 
  85.     { 
  86.         with[x1]=x2; 
  87.         with[x2]=x1; 
  88.         info[x1]=1; 
  89.         info[x2]=2; 
  90.     } 
  91.     //释放匹配(单方向) 
  92.     void freep2p(unsigned int x1) 
  93.     { 
  94.         //with[with[x1]]=with[x1]; 
  95.         with[x1]=x1; 
  96.     } 
  97.     unsigned int getotherid(unsigned int x1) 
  98.     { 
  99.         return with[x1]; 
  100.     } 
  101.     unsigned int getp2pinfo(unsigned int x1) 
  102.     { 
  103.         return info[x1]; 
  104.     } 
  105. }; 
  106.  
  107. struct step 
  108. { 
  109.     unsigned short x; 
  110.     unsigned short y; 
  111.     short stepno; 
  112. }; 
  113. //对于下棋状态类 
  114. class 网站名称:一套跨平台五子棋网游的开发经历
    浏览地址:http://hfanp.com/article/codespe.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部