Talking about the game server-functional modules (2)

Source: Internet
Author: User

The next step is to write this article. From the perspective of internal technology, there is no technical content in itself, but as the saying goes, it is good to say that it is isolated from the ground, inside the house, the door-guard, what the layman is, people who want to touch this stuff, but have never done it. I am confused about it. I love it. I want to write a functional module and then write another architecture. Then I will start from the network package to build the simplest and most lightweight small architecture, trying to let people know what programming is, they can do things on it.
Continue with the functional modules.
I. There is another ai module, which should not be forgotten.
However, please note that the AI Module I mentioned here and the AI areas I mentioned in Section 1 do not mean ai for a while.
Here the AI module, haha, is called Algorithm The algorithm reaches the place where Nb is applied.
Targeting NPC monsters, such as the most basic pathfinding algorithm.
What is the result of this module? That is, when a monster dies and lives, the monster sees you and knows to chase you, and the monster knows to beat you and find ways to hide.
What is the most basic a * algorithm? A B C D E F D
A monster wants to chase you, but why does he know to walk with you? Or if you click a place, Why can he automatically walk over and automatically bypass obstacles. This module is to implement these basic things.
2d is generally calculated based on the grid. It's just about 2D, and it's about pixel, 3D, and so on.
There are a total of eight grids beside the role. When you click a place, the role finds the nearest grid next to the correct direction and determines whether the grid is blocked, if there is no, go over. If there is a block, search for another lattice next to it. Then, it is recursion until it reaches the destination lattice.
The Basic Automatic pathfinding algorithm is just like the above. Of course, in actual operation, it will certainly not use such an efficiency-based algorithm, here is a brief introduction to the n-"a * algorithm that lived before N-" B .. Na. For details, refer to my AI book.
The server needs to know where the monster is going and send messages to the players around it, so the server needs this. This is a good reason ,,,
The client also needs to automatically find routes for players or pets and use them internally.
Why do I say that the AI here is different from what I said in "1"? It is because the basic automatic function is implemented here, and then you can develop advanced AI intelligence based on this module, combine script and table configuration to use skills. For example, in a game, there are white blame, blue blame, purple blame, and boss
White blame, just give him the most basic set of skills that can walk, hide, and beat others.
The blue monster is a little more advanced and can be expanded on the Basic module, Program To a certain extent, the system will escape and call out associates,

The above two types of table modules can be configured based on properties to read the program based on the monster type, the program determines whether to activate extended AI Based on the Type

The table is as follows:
NPC name Type

Purple blame and advanced point custom AI, You can pre-define a group of advanced AI in the program, such as the ten possibilities pre-imagined, for example, put a skill and put B skill to automatically add blood and so on, and then can be configured In the table, for example, set a table in advance a monster can have up to four custom AI

The table is as follows:
Custom NPC name type customization aI1 custom ai2 custom AI3 custom ai4

It is better for the program to read the corresponding type and activate the corresponding module or use the script to write the corresponding AI in advance.

Boss, you have to deal with it completely. No, the script plays a role. The full script implements a set of interfaces for the program, such as the equipment interface and skill-setting interface, in Lua, let's write it crazy. As long as the interface is complete, it's okay to write it into a wow.

The table is as follows:
Custom NPC name type customization aI1 custom ai2 custom AI3 custom ai4 script AI

For a 2D game, if the FB boss is not intelligent enough, the players will know that several players in the card boss circle the boss and allow remote players outside to play the game. players on the grid should not be repeated, boss won't go out, he just wants to kill the players who beat him, and then he gets stuck there, players who want to play a game cannot beat any other player, and do not want to play ....... What should we do? Special AI processing, card boss? If the system determines that the boss is not shot in 10 seconds, it will enlarge the skill to kill the people around him ....

After all, the AI module is the most basic algorithm, program customization, script customization, Attribute Table configuration, and script-specific processing, which can basically meet the needs.

Ii. Expand the database module and Log Module mentioned above
Please note that other threads should be used for such databases and I/O operations as much as possible and should not be used together with the main thread.
In the current popular architecture, network interfaces are generally enabled with multiple threads on the server. In addition, a dedicated single-open proxy program is used to send messages to the data proxy for data operations.
For the Log Module and local debugging, use document recording, operation logs, and open a single proxy. This operation is quite frequent, it affects performance together with the proxy of the login and save role. What does it mean, after all, this Asynchronous interaction is not associated. A slight reminder is that if you do not remember all the items when doing the item flow, it would be sb, if all the flow logs are recorded, how many tens of thousands of records will be logged on that day? 100,000? Millions?
Table Configuration:
Item Name, item ID, whether to record the log // other columns following it are other attributes
Every time an item is generated, for example, buying an equipment to a bag to trade an equipment.
If (pitemproperty-> bcansavelog)
{
// Sendmessagetologdb
}

In this way, you can record some precious items.

By my category, I generally divide proxy into account proxy role proxy game proxy log proxy O & M controller proxy

Here we will not talk about what each proxy needs to do when talking about the architecture.
One aim is to reduce the pressure on every detail, but ensure that there is no data crossover.

I have also seen that some projects do not have specific data operation proxies, but they are directly operated on the server. I personally think it is not necessary to save money for the boss to start a new process asynchronously, all of them are overwhelmed by a game, and if it is distributed, you must have a unified data outlet, otherwise .. I never thought about how the data is not uniform? Database deadlock?

Iii. O & M Module
O & M is separated by operation and maintenance .. Because they are using the same architecture, let's talk about it here.
First, describe their cause: it is impossible to update the server every time, monitor the server maintenance process, or extract the logs of a certain file on a remote hardware server. In this case, the maintainer's working efficiency is too low.
It is impossible for GM to log on to a client on every server .. Therefore, this module was created to implement remote operations for the maintainer and offline operations for the GM.
Tool function: monitors and disables servers, and actively pushes Update file update scripts.
GM can operate basic commands offline, monitor chats, compensate for items, and send game emails.
Developers can actively extract debugging logs
The accountant can take the initiative to open the background to view operation log records, calculate ARPU values, view online records, and so on.
I do not recommend GM for online operations now. Just like the legend before, GM commands are entered in the chat box, I personally think that the internal operation is still a good backdoor. Do not walk with the player from the front door. Note that this part must be monitored, recorded, and verified on the central controller agent, to ensure operation security and prevent unauthorized operations. Try to bind the tool client to a certain machine. For example, you can send the account password Mackey IP subnet mask to a code During O & M logon, and so on. you can log on to the control center only after the verification is successful in the control center, the tool client can operate,
This module focuses on security and ease of operation. It is combined with the Log Module to achieve good log record classification mining.

The specific architecture will be discussed later
After all, this is just a discussion, so there is no practicalCodeThe content is to let a friend who does not know what kind of architecture is a workflow.
I read the message. This blog, different IP addresses. If I click it, I will add one to read it. It's boring. I don't know if there is any value to continue,

I tried to show how these things could be done in the shortest language. I don't even understand the depth of it. Just flat me ,. I think it's boring to leave a comment and take a brick. I'm glad to leave a comment, mainly because I did not write a draft directly. I'm sure I still have some omissions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.