亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? full tutorial.htm

?? 通用網絡游戲開發框架
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<CENTER><H3><FONT COLOR="#AOAO99">WinBattle - A Multi-player Game Tutorial and Reusable Framework</FONT></H3></CENTER><HR><h3>Introduction</h3><p>This is WinBattle. It's mainly a tutorial in writing a multi-playernetwork game but it also provides re-useable client/server framework codethat can form the basis of subsequent projects. Oh, and it resurrectsa game from the early 90s that I (and a lot of other people) used tofind great fun: XBattle.<h3>The Tutorial Game</h3> <p>It's quite simple. There is a playing board that represents alandscape. Sea is blue, flat land is green and darker shades of brownrepresents higher ground. Each player has bases (shown as circles)that generate troops which are shown as coloured circles. The moretroops present in a hexagonal cell the bigger the circle. Troops canbe made to move across the board by clicking on them to set movementvectors which show up as small lines. Click near the side of thehexagon in the direction you want to send your troops (you must havetroops in the hexagonal cell in order to set the vector).<p>A few minutes into a two-player game might look something like this:<!-- Sample image - gif or jpg --><P><IMG SRC="Full Tutorial_files/image001.jpg" ><p>The idea, of course, is to attack your opponent's troops, capturetheir bases and wipe them off the board.<p>To attack, just point your movement vectors at a cell occupied by theenemy. However, you'll find that you need to attack from more than oneside to successfully occupy a cell.  <h3>Origin and Acknowledgments</h3><p>Back in the early 90s real-time multi-player games were pretty muchunheard of. Computers were expensive and the only place you would findthem connected to a network was at work and they would usually berunning UNIX (or some manufacturer's proprietary operatingsystem). Games were available but they were almost exclusively singleplayer.<p>Then Steve Lehar released XBattle on the comp.sources.xnewsgroup. This was a two-player battle simulation that was picked upby Greg Lesher and developed (over a number of years) into amulti-player real-time battle simulation game that was quite unlikeanything seen before. And great fun to play.<p>You can find an excellent description of the game here:<A HREF="http://cns-web.bu.edu/pub/xpip/html/xbattle.html">The XBattle Home Page</A><BR><p>Greg Lesher stopped working on XBattle back in 1996. However, it isstill available for download for UNIX systems on the website (at leastit was when I wrote this). <p>Anyway, one wet weekend I was feeling nostalgic and reminiscing aboutthe old games. XBattle came to mind and a quick trip to Googledelivered me to the XBattle home page. After browsing the site Ithought it would be fun to play it again but I no longer have a UNIXworkstation so off I went in search of a Windows version thinkingsomebody must have done a PC version over the years. I didn't findone. There was a hint of a PC version on the XBattle home page (aprogram called Energy Battle) but that has long since disappeared. So,as I was looking for a hobby project at the time, I thought I'd portXBattle to windows thinking "how hard could it be?".<p>The answer is <i>very</i>. XBattle was written for the UNIX X-Window systemand is so tied into the way that works that getting the original codeworking under Windows would have taken quite a while. Also, theoriginal code is written in C when I prefer C++. So I wrote a Windowsversion from scratch.<p>Although I didn't use any of Greg's original code I wanted to carry onthe spirit of XBattle and release my version as free software. Ane-mail exchange with Greg verified he had no problem with this as longas I changed the name slightly to indicate that it is not an"official" follow-on from XBattle. Hence WinBattle.  <p>The demo project is, of course, a very fun game. However, I wanted torelease it as free software so that budding programmers have a(relatively) simple example of a way to build multi-player games. Justgetting programs to talk to each other has always been hard work andWinBattle includes an easy to use mechanism that can be reused inother projects.  <h3>Trying Out The Demo</h3><p>You'll find client and server programs available for download(WinBattle_demo.zip). Run the server on a PC and start up to 6 clientson networked PCs with the command:<p> winbattle <i>server computer name</i><p>Where <i>server computer name</i> is the name of the computer where theserver is running.<p> Or create a shortcut that does the same thing (by the way, the defaultserver computer name is <i>localhost</i> so if you want to try it out on justone PC just start the server and one or two clients on that machine toplay). Press the start button on the server and away you go.<p>The server has a small number of options that are available in thedialog that looks like this:<P><IMG SRC="Full Tutorial_files/image004.jpg" ><p>The <i>Explore</i> option means your troops have to scout out the terrainbefore you can see what's there. Turn it off and all players see thewhole board from the start.<p>The <i>Attrition</i> option will cause troops to slowly waste away. Thisprevents the build up of totally massive amounts of troops.<p>The <i>Group Bases</i> option does just that. A player's bases will bepositioned close together when this option is set and randomlyscattered when it isn't.<p>The <i>Disrupt</i> option will cause enemy movement vectors to becancelled when attacked. This allows a small number of troops to wrecksupply lines that have to be constantly repaired.<p>The <i>Hide Enemy Vectors</i> option means you can only see an enemy'smovement vectors if there are troops present in the cell (thisprovides a stealthier start to games as tracks back to your basesaren't obviously visible if you scout with a small number of troops).<p>Finally, you can set the number of bases each player is given.<p>On the client side the commands implemented are:<p> <b>Mouse:</b><p>left mouse button - Set a movement vector adding to any already set<br>right mouse button - Set a movement vector cancelling any others<br>shift + left mouse - March troops automatically across the board<br>Click in centre of cell - Cancel all movement vectors<p> <b>Keyboard:</b><p> a - Attack: position cursor over cell to attack<br>f - Fill-in sea: set one movement vector to point to the sea cell to fill in<br>s - Scuttle a base: position cursor over base to scuttle <p>And that's basically it. If you would like a considerably moredetailed description of how to play I recommend you visit the<A HREF="http://cns-web.bu.edu/pub/xpip/html/xbattle.html">XBattle Home Page</A>and read the first few pages of the tutorial. As far as thebasic operation is concerned XBattle and WinBattle are prettyidentical.<h3>Project Contents</h3>The source code zip file expands to produce the following folders:<p>Client - Contains the client-side specific code<br>Common - Contains utility functions used by the client and server<br>Game - All of the code that is specific to WinBattle is held here<br>Notes - Holds the full tutorial (in HTML format)<br>Server - Contains the server-side specific code<p>The project was built with Visual Studio version 6 although it hasalso been tried with Visual Studio .Net. Should you want to compilethe source code you only need to compile and build the client andserver components. They will automatically pull in what they need fromthe <i>common</i> and <i>game</i> folders.  <h3>Tutorial Introduction</h3> <p>This tutorial section talks about the WinBattle client server programsin general (how they start-up, communicate, etc.). There is nothingrelated to the game itself here because the client and server codedoesn't really care which game it's running.<p>What this means is that if you want to write a new game all you haveto do is write the game code. You can re-use the client and servercode pretty much as is. Of course, it isn't <i>quite</i> that simple but moreon this later.  <p>Note, although you can read this tutorial in isolation, to get themost from it you really should take a peek at the code in the clientand server folders to get a feel for what's going on. Pretty mucheverything else can be ignored.<p>Anyway, as should be apparent by now, there are two programs used torun the game: a server and a client. The server actually runs thegame, updating the board in real-time and sending the current state toall the clients. The client does very little. It displays the currentstate of play and accepts commands from the player which it justpasses on to the server.<p>The clients and server communicate using sockets. Sockets can betricky to get right so all of the detail is hidden in a <i>Socket</i>class. As far as using it is concerned, it's just like reading andwriting from a file. For example, to send some value from a clientprogram to the server just requires the following line of code in theclient:<pre>server << some_value << "\n";</pre><p>In order to read this value in the server, again, just requires oneline of code:<pre>client >> some_value;</pre><p>You can find more details on using the Socket class later on in thetutorial. For now, we'll concentrate on how the client and serverprograms interact.<h3>Start-up</h3> <p>The server main program can be found in <i>server.cpp</i>. All thisdoes is pop up a dialog box that allows a number of options to be setsuch as the number of bases, whether bases are grouped together,etc. All of the dialog handling can be found in<i>main_dialog.cpp</i>. It's pretty much standard Windows programmingalthough some of the details of the Windows API calls are tucked awayin the class <i>Control</i> for readability.As part of the dialog initialisation, the server starts two threads:<i>game_handler</i> and <i>update_handler</i>. The first threadhandles commands going back and forth between the clients and theserver and the second thread sends game updates to the clients oncethe game is actually started.<p>Actually establishing the network communication is probably thehardest part so let's begin by looking at the <i>game_handler</i>thread, the core of its operation is the following code:<pre>Socket server(server_port);while (true) {   server.listen();   for (int i = 0; i < max_players; i++) {       if (! clients[i].in_use) {          clients[i].connection = server.get_connection();          clients[i].in_use     = true;          DWORD thread_id (0);          CreateThread(0, 0, client_handler,                        reinterpret_cast<LPVOID>(i), 0, &thread_id);          break;       }   }}</pre><p>The code creates a socket telling it the port number to use. Portnumbers are just a unique number so that many programs can use socketswithout worrying about getting other program's messages. As long asthe clients and servers both use the same number then everythingshould work just fine. The default for the WinBattle client andservers is set at 3333 as there isn't much chance of that number beingin use on most PCs. However, if it is and you get a "port in use"error when you start the server, you can change it to any free port(you'll find that the port number is defined in the <i>common</i>folder in the file<i>universal.h</i>). <p>You can find out which ports are in use on your PC by issuing thefollowing command at a DOS prompt (the port numbers are the ones afterthe ":" in the command output):<pre>netstat -a</pre><p>The thread then calls <i>listen</i>. This function will simply waituntil some client program says it wants to communicate with the serveron port 3333 (this is done from the client with a call to<i>connect</i> in <i>client.cpp</i>). Once a client has connected the<i>listen</i> function returns and the code runs through a table of

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区在线视频免费观看| 成人一级黄色片| 国产在线播精品第三| 成人污视频在线观看| 4438x成人网最大色成网站| 国产日本欧洲亚洲| 毛片基地黄久久久久久天堂| 在线视频欧美区| 国产精品久线在线观看| 国产一区在线精品| 精品少妇一区二区三区日产乱码 | 图片区小说区区亚洲影院| av高清久久久| 国产欧美一区二区三区在线老狼| 天堂在线一区二区| 欧美性极品少妇| 亚洲激情第一区| 91视频在线观看免费| 国产精品三级视频| 国产又黄又大久久| 精品日韩在线观看| 日韩福利视频网| 欧美日韩欧美一区二区| 亚洲一区在线看| 欧美日韩在线播放三区| 亚洲综合另类小说| 色婷婷综合在线| 国产精品久久久久久久久久久免费看 | 成人永久看片免费视频天堂| 欧美岛国在线观看| 久久99国产精品久久| 日韩精品一区二区三区老鸭窝 | 久久久久久久综合| 久久成人免费电影| 91精品国产一区二区三区| 日韩电影在线免费看| 欧美一区二区三区免费观看视频| 亚洲国产精品久久久男人的天堂 | 国产aⅴ综合色| 亚洲国产高清aⅴ视频| 国产白丝精品91爽爽久久| 欧美国产精品v| 9人人澡人人爽人人精品| 亚洲精品视频免费看| 欧美男男青年gay1069videost | 欧美一区二区三区日韩视频| 日本不卡一二三| 国产亚洲欧美日韩日本| voyeur盗摄精品| 一区二区三区精密机械公司| 欧美日韩一区小说| 麻豆精品精品国产自在97香蕉| 精品福利视频一区二区三区| 精品在线播放免费| 国产精品乱码妇女bbbb| 91视频在线观看| 奇米色一区二区三区四区| 日韩欧美色综合| 95精品视频在线| 午夜久久久影院| 国产偷国产偷精品高清尤物| 99国产一区二区三精品乱码| 亚洲福利电影网| 久久久国产精品不卡| 91国模大尺度私拍在线视频 | 亚洲精品亚洲人成人网 | 国产精品福利一区二区| 欧美视频在线不卡| 国产一区二区在线观看免费| 国产精品久久精品日日| 91精品国产福利| 99re成人精品视频| 麻豆91小视频| 一区二区三区免费网站| 久久免费电影网| 欧美中文字幕一区二区三区| 国产精品一区三区| 日精品一区二区三区| 亚洲欧洲国产日韩| 亚洲精品一区二区三区99| 色天天综合久久久久综合片| 日韩精品电影在线观看| 亚洲色图视频网| 国产三级精品三级| 欧美www视频| 欧美理论电影在线| 色综合中文字幕| 粉嫩在线一区二区三区视频| 日韩av一区二区三区| 亚洲一二三区在线观看| 国产精品久久二区二区| 精品久久久久久久人人人人传媒| 欧美午夜在线观看| 色综合久久久网| 99久久精品国产麻豆演员表| 国产一区二区精品在线观看| 日韩电影一区二区三区| 亚洲一区二区三区在线播放| 中文字幕日韩欧美一区二区三区| 精品理论电影在线观看| 欧美一区二区三区四区久久| 欧美日韩欧美一区二区| 欧美性大战久久久| 欧美性色黄大片| 欧美在线免费视屏| 色综合欧美在线| 一本久道久久综合中文字幕| www.欧美色图| 99久久国产综合精品麻豆| 成人免费看片app下载| 成人性生交大片免费看中文网站| 国产精品91一区二区| 国产一区二区三区不卡在线观看 | 一区二区三区欧美久久| 一区二区三区在线免费播放| 中文字幕欧美激情| 国产精品久久久久久久久免费丝袜 | 亚洲综合色自拍一区| 亚洲最大的成人av| 亚洲一区在线视频| 秋霞午夜av一区二区三区| 免费人成在线不卡| 精品在线一区二区三区| 福利一区二区在线| 成人一道本在线| 一本大道综合伊人精品热热| 91福利国产精品| 欧美日韩美少妇| 欧美电视剧免费全集观看| 久久九九久久九九| 国产精品黄色在线观看| 亚洲成人免费视| 久久成人免费网站| 成人国产视频在线观看| 欧美专区亚洲专区| 3atv一区二区三区| 久久先锋影音av| 亚洲天堂福利av| 日韩高清不卡一区| 国产大陆亚洲精品国产| 91视频在线看| 精品三级在线观看| 亚洲日本在线天堂| 免费成人小视频| av在线综合网| 欧美一级免费观看| 中文在线一区二区| 亚洲午夜久久久久久久久久久| 美国毛片一区二区三区| va亚洲va日韩不卡在线观看| 欧美精品国产精品| 国产精品免费久久| 日日夜夜精品视频免费| 国产黄色精品网站| 欧美日韩国产高清一区二区三区 | 国产午夜精品一区二区三区嫩草| 国产精品久久久久久久第一福利| 亚州成人在线电影| 成年人午夜久久久| 91精品久久久久久久91蜜桃 | 蜜臀久久久久久久| bt7086福利一区国产| 91精品国产黑色紧身裤美女| 综合久久一区二区三区| 日韩电影在线一区二区三区| 波多野结衣中文一区| 日韩精品一区二区三区视频播放 | 久久av老司机精品网站导航| 色综合天天性综合| 久久伊人中文字幕| 亚洲va欧美va天堂v国产综合| 成人污污视频在线观看| 亚洲精品在线免费观看视频| 性久久久久久久久| 91黄色激情网站| 国产精品欧美久久久久无广告 | 欧美xfplay| 亚洲蜜臀av乱码久久精品| 国产乱码精品一区二区三区av| 欧美午夜精品理论片a级按摩| 国产人成一区二区三区影院| 免费成人结看片| 日韩一区二区视频| 婷婷开心久久网| 欧美三级电影网| 亚洲综合一区二区三区| 日本精品一区二区三区高清 | 国产无人区一区二区三区| 日韩黄色片在线观看| 精品视频1区2区| 亚洲综合男人的天堂| 欧美影院午夜播放| 亚洲自拍偷拍麻豆| 欧美午夜寂寞影院| 亚洲国产成人91porn| 欧美在线观看视频在线| 亚洲综合图片区| 精品1区2区3区| 日韩精品亚洲一区| 欧美区一区二区三区|