国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

MMO position synchronization and sample

2019-11-08 20:30:26
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

Summary

         ThePRoblem of location synchronization involves three aspects: client, server, andother clients.

         Gameplayer feel is the most priority to meet the conditions, so the position of theclient game player is a benchmark, but depends entirely on the game playerclient data is in danger of being cheated, so the server per second will bebased on the general state of the projection of a game player client position.

         Theposition that other clients see depends entirely on the state of the baseclient, and if there is a delay or pause, the state will be reset according tothe latest status.

         movingenvironment of gird

         Howdo clients perceive each other's presence? The server map is divided into agrid of the same specifications, each client and NPC are assigned to differentlattices. As shown in the following figure

         3Dor 2D games can be divided in this way, the difference is that the height of the3D game will be much larger than the grid X or Y, so that the same XY areaunder the 3D game to have more space.

Server synchronization grid data.

         Inthe MMO game, players want to see all the players in the visible range, whichrequires other players to synchronize data over the network. Synchronoususually use 9 house grids determine what data need to be synchronized over thegame player, and then their behavior to be synchronized to what game player.

         Thesize of the server large grid to 3*3 lattice to the client than to show alarger range of principles. Larger than the client, is to reserve the time toload the resources.

         Asshown below, green represents the display area of the mobile client, when thecharacter A is in grid 6, he could see the contents of the 9 lattices of1,2,3,5,6,7,9,10,11, so when his state changes, you need to synchronize all theplayers in the 9 grids. also, when there is a change in the player or monsterin the 9 grids, it also needs to be synchronized to the character A.

Server synchronization grid data.

         Inthe MMO game, players want to see all the players in the visible range, whichrequires other players to synchronize data over the network. Synchronoususually use 9 house grids determine what data need to be synchronized over thegame player, and then their behavior to be synchronized to what game player.

         Thesize of the server large grid to 3*3 lattice to the client than to show alarger range of principles. Larger than the client, is to reserve the time toload the resources.

         Asshown below, green represents the display area of the mobile client, when thecharacter A is in grid 6, he could see the contents of the 9 lattices of1,2,3,5,6,7,9,10,11, so when his state changes, you need to synchronize all theplayers in the 9 grids. also, when there is a change in the player or monsterin the 9 grids, it also needs to be synchronized to the character A.

Player state is divided into 8 directions,corresponding to the keyboard up, dawn, right, lefe. When you press the"up" button will trigger the state of the broadcast, the player'scurrent location, state sent to the server, and through the server to allvisible players broadcast. see HelloWorldScene.cpp onKeyPressed () function.The client coordinates the current player's coordinates x, y, and status(setstatus) to the server. The server handles this request via status.lua.Status.lua first get the length and width of the grid into g_x_len, g_y_len. calculatethe current player client request. get the server to calculate the currentposition of the player to calculate the coordinates of the grid. and set theplayer's new status to path. the path is then put into the output buffer"script.out" and the "helpregist" script is used tocalculate the grid and the grid that the player is going to enter. and call"client/clientregist", "client/clientunregist" script.

         Theserver has two lists for each grid. "Client/clientregist" is thescript executed by the server when the client enters the grid. first, the datain the "listclient" table is sent to the client, Here are all theclient data stored in the grid. the player's data is then sent to otherclients. the NPC data in the listnpc table is then sent to the client. thendetermine whether the input parameter r is 1 if it is 1 to record the currentgrid. "s.replyid" will format the content of "script.out"to xml and return it to the client.

         The"parabuf" function in the client HelloWorldScene.cpp is used tohandle all the returned data from the server. the "regist" commandcontains the NPC data within the visible range of the player. among them arethe initial coordinates of NPC "P0" and the "P1" start timestamp "stamp". the client determines whether the current NPC existsand creates a, and according to the timestamp exists, if it does not exist as a"bomb" object.and according to the NPC coordinates and playercoordinates to calculate the coordinates of the screen in the NPC, the NCP willbe placed into the screen.

 

         Sampleprogram download

         https://sourceforge.net/projects/starrydb-publice/files/2017-2-9/

         Compiledclient relies on cocos2dx, download address

         http://www.cocos2d-x.org/download

starrydb is game server engine


發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 翁源县| 阿鲁科尔沁旗| 乌海市| 建德市| 绥中县| 绥芬河市| 南溪县| 霍林郭勒市| 吉隆县| 嘉禾县| 友谊县| 临泽县| 永宁县| 阳城县| 南丹县| 和林格尔县| 广丰县| 玛沁县| 鄂托克旗| 新龙县| 油尖旺区| 舒兰市| 远安县| 马关县| 大英县| 德阳市| 苏州市| 乐安县| 伊宁县| 丹棱县| 石城县| 武安市| 金堂县| 苏尼特右旗| 普洱| 仙游县| 台东市| 扬州市| 上虞市| 平定县| 桃园县|