Jump to content
  • Advertisement

gantleman

Member
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

130 Neutral

About gantleman

  • Rank
    Newbie

Personal Information

  • Interests
    |programmer|
  1. gantleman

    What kind of engine does the game server need?

    Can not everyone see it? We need to get rid of the shackles of hardware, so that the software has more freedom of space.
  2. gantleman

    What kind of engine does the game server need?

    I am sorry my English is relatively poor, in fact, this article is used in Chinese is also more obscure. Although it is very fun to describe some interesting, but still very theoretical things. After all, put forward a new subversive technology is not easy to be understood, can be considered a normal thing.
  3.         A.twenty engaged in the development of games related work has been more than and 10 years. In the development of six years after many twists and turns almost give up Starrydb.com project also ushered in the 1.0 version of the line. Although the demo version as well as cluster features as early as 17 years on January The development is complete but the modification and improvement plan is still in full swing, led to a push on the 1.0 version is still not satisfied.         Speaking of the original development of the project's original intention, like the green light in the fog of excitementI ,also hope that the people who have been hurt because of my dedication. The following cited "the Great Gatsby" “Gatsby believed in the green light, the orgastic future that year by year recedes before us. It eluded us then, but that's no matter--tomorrow we will run faster, stretch out our arms farther.... And one fine morning---- So we beat on, boats against the current, borne back ceaselessly into the past.”         Maybe people haven't realized it yet, the game server will be following the computer operating system, the most complex computing system in modern software engineering. With the rise of wow and countless gaming companies, the system has grown rapidly. The original game server engine can be traced back to 1992 mudos. This is a simple text dialogue system, but can be multiplayer online. Because the interaction is simple and the performance is not high, ordinary server can support thousands of people online at the same time. Over the next few years, mudOS represents the classic prototype of the game server engine. We can call this kind of server engine as the classic game server engine.The core of the classic game server engine is built on logical servers, The so-called logic server is the user's input data processing, the output data returned to the user. See Figure 1 [attachment=35151:1.jpg]         Because of the collapse of the game logic server and memory usage is not stable, Server instability resulting in data loss. server needs a stable hard disk storage service. mysql appears on the logical server instead of the logical server's hard disk. See Figure 2 [attachment=35152:2.jpg]         Because the MySQL database to read and write speed, data operations need to wait too long, before the hard disk database, the memory database is added to the cache server.         Maybe you see the problem, in order to solve the problem of losing data in logic server, cache server and data storage server, but increased the complexity of the system, increase the difficulty of development and lead to a more complex and more easily broken logical server. It took a long time and a lot of ways to improve the stability of the logical server. See Figure 3 [attachment=35153:3.jpg]         The main reason for the server crash is the leakage of the memory pointer, In order to solve the problem of collapse, a variety of scripting languages instead of pointer language. The server can function more and more, more and more complex, the collapse, death card, memory leaks like a logical server over the clouds lingering.The first requirement of the server is stable, but still can not stop people's endless desire for server functionality. so a new idea is split to extend the server's load capacity. See Figure 4 [attachment=35154:4.jpg]         Classic game server here to the peak, The complexity of data processing is much higher than that of any server system. Why is the complexity of processing data higher than any server system, because the server system is to serve the real life, The game server is to serve the pure virtual world. For example, mail items, The game server is an instruction, maybe in the chat process, maybe in the battle process. There is no waiting process in reality, need the game server to return immediately. And can occur on any functional server. For example, in the process of chatting, give each other a thing, which is absolutely impossible in reality.Because the function and function is not absolutely independent, The classic server system is more and more thin with the division of functions, the communication between each server becomes more and more complex. This is reminiscent of the complex and inefficient bureaucracy. a large number of requests are wasted in communication and complex communication, but each developer to carefully, I don't know which logic will go wrong.         One night six years ago, looking at this more and more complex monster, I like Tangic de toward the windmill waving spears. in a moment an idea into the brain, why can't a server handle all the requests of a player? It's like having a full-time secretary for each player, any requirement is given to the secretary, communication with other players, The Secretary will find other players to communicate with the secretary. See Figure 5 [attachment=35155:5.jpg] Example of purchasing goods 1, the player A to the server C to send the request to buy goods, the server C deduct the player A currency; 2, server C sends the request to the server D; 3, the server D deduct player B items and add currency and return the results to the player B; 4, return the transaction results to play A;         This design pattern is called " one object do something" The first advantage of this design pattern is to reduce the difficulty of software development. In a server that is split by function, each server is a different function of the code. the link between each function is a coupling relationship. there is a risk of uncertainty in the code of the coupling relationship, There seems to be no problem with each feature, but together with each other will be a variety of uncertainties. Starrydb " one object do something " in the model server C and server D use the code is the same. this is the relationship between the purchase of A to B or B to buy A process are the same. Such a high cohesion of the project in the process of development and debugging is not prone to errors. the development speed and software quality are improved, and the uncertainty of software engineering is reduced.         Another advantage of Starrydb's " one object do something " model is the great convenience of server extensions. because each server configuration is the same, add a new server when the user increases, can meet the needs of data processing. traditional classic server architecture, by the function of the structure of the server will be a bottleneck, function can not always be subdivided. See Figure 6 [attachment=35156:6.jpg]           Human beings are social animals, we each have our own social circle. call your mother every week, annual family gathering, go to the bar to meet new friends, go to the seaside with old friends, negotiate with customers in the company. social networking is a lot more diverse, network and video links, We can not be limited by the geographical. For each of us, Social networking can be measured in the following ways, Total number of contacts, Total number of persons, Each time length, The product of these three aspects of our social input time. Let us assume that the enthusiasm of the unit time into the same. So the passion we put into social activities over a certain period of time is, Total number* frequency* When long* When long.           The game server engine is also a small virtual society, Every player is a part of the society. The performance of the object of the distributed game server engine can also be applied to this formula. The number of objects accessed by another object (or other objects), Number of visits per object, The ability to access and CPU units per visit. You can calculate the CPU computing power consumed by the object in the cluster. If multiplied by the average number of memory occupied by this object, one can calculate the total consumption of an object in the cluster. Assume that the server handles each time is very small and more average, CPU unit of computing time is relatively fixed. Then the number of communication between each object and other objects and the number of communication objects become the key to determine the capacity of the service cluster.           In the extreme case of not limiting the range of communication between objects and the number of times each object is communicating. The number of players in the server is x, Assume that each player has social connections with all the remaining players, Then the number of message server per second for x². Assume that the server handles the upper limit of the number of messages to n, Then the number y=x²/n required by the server, Bearer number x=?(ny).See figure 7: [attachment=35157:7.jpg]         Limit the frequency of the user's social capacity and the number of CPU positive correlation, Up to a single CPU processing limit. Assuming a single CPU processing limit is 10, 10 after the processing capacity will fall sharply to the server denial of service. See figure 8: [attachment=35158:8.jpg]         After making appropriate restrictions on the amount and frequency of social relationships per unit of time the system can be extended indefinitely with the increase of cpu. See figure 9: [attachment=35159:9.jpg]         In the classic game server engine, The modules are divided into different servers. This can also be referred to as distributed, But we know how to split different functions to run on different hardware, Need to make a lot of changes to the original software system. This extension is not linear but ladder oriented. See figure 10: [attachment=35160:10.jpg]         The upper limit of system capacity is the hardware limit, With the increase of the system function, the bearing capacity is gradually decreased. But each time the upper limit is to improve the hardware function, Load capacity will be improved. With the increasing number of hardware development complexity is also increasing.   “Do not , for one repulse , give up the purpose that you resolved to effect .(William Shakespeare , British dramatist)”           We see that it is necessary to follow the basic mathematical guidelines for the unlimited expansion of the server. Limit the number of units per hour or the frequency of data exchange. The result is depressing, But on the other hand, we also see the possibility of unlimited expansion of distributed servers. Here we have a math standard for evaluating the game server engine. It is possible to write a stable, high-performance, scalable game server engine as long as you follow this standard. See figure 11: [attachment=35161:11.jpg]           The ideal game server engine has a positive correlation with the hardware performance, Parallel to the development difficulty. To achieve such an ideal state, To reduce the complexity of development needs to be guaranteed at three levels. From top to bottom are stability, high performance, expansibility. See Figure 12 [attachment=35162:12.jpg]           Stability is the cornerstone of the game server engine. The meaning of this stability is to minimize the coupling, Let the calculation work in the most simple and reliable environment. Only as much as possible to store the data on the same computer. Reduce data exchange between each computer node. With the fastest time to deal with each data request. This is the higher the data and computing the higher the efficiency of the system more stable. Classic game server engine data is saved in three copies. The server has a copy?Data cache server has a copy?Hard disk database has a copy. In the operation of the system to confirm the data consistency and integrity of the work will consume more than half. But there is disconnection and downtime, is very easy to destroy the consistency and integrality of data. Is a potential factor for server stability.             High performance is the second goal of the server after the pursuit of stability. For unlimited access to the upper limit of hardware processing, No waste of hardware resources. This seems to contradict the distributed system, Because the distributed system is to assign data and tasks to each server in the cluster, The distribution process will inevitably bring loss. But can not turn the high performance on the optimization of the development of the library. Because we know that the server is limited by the processing power of cpu. The development of libraries to add functionality will affect the efficiency of software, The development of library partition function will increase the cost of data replication. Reduce the difficulty of software development is to strengthen the cohesion and reduce coupling, reduce the complexity of the project.           Expansibility is the ultimate goal of the game server engine, Although the mathematical guidelines tell us that such pursuits have limitations for distributed systems. However, it is necessary to establish a linear relationship between the number of online extensions and the number of server hardware. The expansion of the classic game server engine to the map server cannot be accurately described as a linear relationship. Because players may not be distributed to each map server according to the developer's will.     "You are not a fish; how do you know what constitutes the enjoyment of fishes?------ Chuangcius"           In such a huge system for data security and how to protect it? See Figure 13 [attachment=35163:13.jpg]           Data security can not be guaranteed starrydb, Starrydb is just a system function implementation, I don't think any system is reliable for data security. Node can be down, Link disconnection?Just assume that the hardware is unreliable, Then the system is unreliable. We have to find a way to use the system on the one hand to make up for reliable unreliable. At the moment, the only thing that can really be reliable is the premise of a clear assumption of unreliability, Check and check each other on data logic.           The task of implementing operational data logic can be re checked.The task of re entrant is a safe way to check the integrity of data consistency, Reentrant means that the relevant data of the task is record, For example, deposit 1 dollars, Then the bank record is deposited in 1 dollars, The current balance of 2 dollars. Correspondence is two records, Currently stored data, Cumulative data. Accumulate data for easy reading. So the corresponding key-value should be 3 data.   Key: task number, value: sequence id; The task is the client generated sequence ID sequence number is generated from the server, to facilitate inquiries last task.   Key: sequence ID, value: addition and subtraction value; The value of the current order ID addition and subtraction.   Key: sequence ID, value: after addition and subtraction of the total value;           Based on the calculated value of the last ID convenience query.Reentrant awareness is that you can take the client's task number to check whether the current task has been generated in order ID has been written to the correct addition and subtraction value, Whether it has produced the correct value, Record if not. So as long as the client's task number does not change the same task will not produce repeated operations, Ensure data consistency and integrity. If any breakage causes a task interruption, the transaction will be recorded. The user interface will show that the transaction fails. Can continue to trade manually by the originator, Until the transaction is complete. A normal transaction has 3 states of interruption, failure, and success.           The system's response to the crash, It's like getting money from both sides of the transaction, At the same time or articles for money. Assume that the two objects have the same data, This computer is rolled back. Then the transaction data of the two objects disappear at the same time, The deal doesn't exist. That is not to lose money will not be deducted items. If the data of the two objects are on different computers, One of the computers failed to run. Each user is out of money to get the goods, I get the money or goods, a balance of payments.For a one-way transaction A object money, B object to get money. If the A server is rolled back to no money, Then B will get a sum of money out of thin air. Then the A in charge to wait for a period of time, After the server writes to the hard disk, This period is estimated to be 10 minutes to 30 seconds. And then start the B object to get money to operate. So if A does not write data to the hard disk, Server downtime data rollback, B won't get any money. A can restart the process to complete the remittance.           Here we have a distributed, Flat development complexity, Reentrant data, Linear expansion game server engine. You are welcome to pay attention to starrydb.com and its future development. There are suggestions and intentions can be sent to admin@starrydb.com. Thank you for supporting my family and loyal Awang and white. from starrydb.com.    
  4. gantleman

    MMO position synchronization and sample

    You mentioned some interesting questions. These questions revolve around a core issue. The game server engine can solve those problems. For a distributed data processing system which is divided into three levels. The first "stability", first of all only a stable game server to be able to meet the needs of multiplayer online games. The second "high performance", you mainly mentioned how the server to take full advantage of hardware performance. Octrees, and multi-resolution hash grids can handle high-performance AOI (Area Of Interest) issues. Why did not adopt some technical solutions, is to meet another condition, "high scalability". The third "high scalability", which is divided into two aspects, one is the ability of high scalability, one is the function of high scalability. The ability of high scalability refers to the same in the case of density can be added by adding servers to meet the needs of more players online and social. The high scalability of a function means that you can extend the game functionality by adding a server. So a distributed game data processing system can linearly expand only the number of servers. The hotspot problem you mentioned is the high density problem in the map. There is no way to solve the problem by expanding the number of servers. Because this problem is only related to the computing power of the server unit time. When the server's software performance is optimized to a certain extent, the problem depends on the hardware performance improvement. Starrydb.com, thank you for your attention
  5. gantleman

    MMO position synchronization and sample

    Yes, the grid is more mature in the mmo game technology, especially on large maps.but some small map scenes like diablo type, processing techniques will be simplified into a cell.
  6. gantleman

    MMO position synchronization and sample

      Yes, because the player is moving the need to advance the perception of the object will enter the screen.
  7. gantleman

    MMO position synchronization and sample

    MMO refers to Massive Multiplayer Online does not specifically refer to MMOFPS(Massive Multiplayer Online First Person Shooting Game )
  8. Summary          The problem of location synchronization involves three aspects: client, server, and other clients.          Game player feel is the most priority to meet the conditions, so the position of the client game player is a benchmark, but depends entirely on the game player client data is in danger of being cheated, so the server per second will be based on the general state of the projection of a game player client position.          The position that other clients see depends entirely on the state of the base client, and if there is a delay or pause, the state will be reset according to the latest status.          moving environment of gird          How do clients perceive each other's presence? The server map is divided into a grid of the same specifications, each client and NPC are assigned to different lattices. As shown in the following figure          3D or 2D games can be divided in this way, the difference is that the height of the 3D game will be much larger than the grid X or Y, so that the same XY area under the 3D game to have more space.          [attachment=34862:1.jpg]          Server synchronization grid data.          In the MMO game, players want to see all the players in the visible range, which requires other players to synchronize data over the network. Synchronous usually use 9 house grids determine what data need to be synchronized over the game player, and then their behavior to be synchronized to what game player.          The size of the server large grid to 3*3 lattice to the client than to show a larger range of principles. Larger than the client, is to reserve the time to load the resources.          As shown below, green represents the display area of the mobile client, when the character A is in grid 6, he could see the contents of the 9 lattices of 1,2,3,5,6,7,9,10,11, so when his state changes, you need to synchronize all the players in the 9 grids. also, when there is a change in the player or monster in the 9 grids, it also needs to be synchronized to the character A.          [attachment=34863:2.jpg]          When the character A moves to the grid where the character B is (7), Then he will no longer see the contents of the three 1,5,9 (players and NPC), at the same time, he will be able to see the contents of the map in the three 4,8,12. So in this process, the server to send a message, delete the role of the client where the 1,5,9 of the three A map of the contents of the grid, while the next message to add the contents of these three 4,8,12.          Player movement process          Player status refers to the current state of the player's operation as shown below, see the example program HelloWorldScene.cpp getstatus () function. [attachment=34864:3.jpg]          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's current location, state sent to the server, and through the server to all visible 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. calculate the current player client request. get the server to calculate the current position of the player to calculate the coordinates of the grid. and set the player's new status to path. the path is then put into the output buffer "script.out" and the "helpregist" script is used to calculate the grid and the grid that the player is going to enter. and call "client/clientregist", "client/clientunregist" script.          The server has two lists for each grid. "Client/clientregist" is the script executed by the server when the client enters the grid. first, the data in the "listclient" table is sent to the client, Here are all the client data stored in the grid. the player's data is then sent to other clients. the NPC data in the listnpc table is then sent to the client. then determine whether the input parameter r is 1 if it is 1 to record the current grid. "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 to handle all the returned data from the server. the "regist" command contains the NPC data within the visible range of the player. among them are the initial coordinates of NPC "P0" and the "P1" start time stamp "stamp". the client determines whether the current NPC exists and creates a, and according to the timestamp exists, if it does not exist as a "bomb" object.and according to the NPC coordinates and player coordinates to calculate the coordinates of the screen in the NPC, the NCP will be placed into the screen.            Sample program download         http://starrydb.com          Compiled client relies on cocos2dx, download address          http://www.cocos2d-x.org/download
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!