Jump to content
  • Advertisement
Sign in to follow this  

What kind of engine does the game server need?

This topic is 627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

        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
        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
        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
        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
        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
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



        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:


        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:


        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:


        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:


        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:



        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

        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
        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.


Share this post

Link to post
Share on other sites

I'm moving this to Your Announcements because it looks more like an advertisement than actual discussion.

You might want to consider enlisting some help from an experienced translator because this text is very hard to read.

Share this post

Link to post
Share on other sites

I'm moving this to Your Announcements because it looks more like an advertisement than actual discussion.

You might want to consider enlisting some help from an experienced translator because this text is very hard to read.

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.

Share this post

Link to post
Share on other sites

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!