Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of sending configuration to Unity server?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article "what is the method of sending the configuration to the Unity server", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this article, "what is the method of sending configuration to the Unity server?"

1 Sproto protocol

As we have described in previous articles on client technology selection, the server uses SkyNet.

Sproto is a variant of Google Proto and an optimized format for Cloud Wind based on SkyNet. This format was chosen because SkyNet's support for Proto is only 2.x and is no longer maintained. Sproto is more in line with the current performance of the server on the Lua side. To match the communication protocol format of the server, the client also chooses to use Sproto.

For detailed content and extended reading, you can refer to the Sproto section of the technical selection article.

2 Sproto form

The client focuses on two parts of the data, one from the distribution of the runtime server and the other from the static planning configuration. Since the Sproto format is used to communicate with the server, there is no reason for an additional set of data formats to process the planning data.

However, planners use Excel to edit data most of the time, so we need to make a guide table tool to convert tabular data into Byte files serialized in Sproto format, just like Proto.

The conversion process here is a bit complicated and complicated, so we will elaborate on it when we are free to talk about the guide table tool. In a word, the client unifies the communication protocol of the server and the planned table configuration into Sproto format reading and processing. This brings a lot of benefits, for example, when we want to jointly transfer server data, we can use table forgery data for joint debugging, or persist the data issued by the server and become part of the static data. At the same time, it also allows the planner to configure part of the sensitive data on the server, and then send it to a safe place after logging in to prevent decompilation.

Of course, we did not do any of these features, but only used the consistent characteristics of the server data format and the planning data format, and made some changes to the table. Of course, this includes changes to multiple languages.

(3) adding and changing the structure

The client is also stored separately for different data sources, the planning data is summarized in DataManager, and the server data is summarized in NetDataManager. There is little interaction between the two, except in one case. After the server issues the login success agreement, it will send the hot update Bytes of the planning data sheet immediately.

This needs to be different from the traditional hot update of client resources. The hot update on the client side is static and uses CDN, which is a conventional pipeline function with a large amount of updated resources and many kinds. But only before the game logs in (usually just started). Our implementation of this function is a backup strategy applied for emergency or repair of BUG. Server traffic is already expensive and should not be used to distribute large amounts of static / tabular data. At the same time, as an emergency function, it can not be overused, which leads to too much complex logic.

We will place the table data that needs hot change in a special guide table directory, and after export, the server will recognize all the files in this directory, establish a name-data index according to the file name, and then store it in memory. After the client connects, it is sent with a special protocol, and after the client receives it, it compares with the data in the cache, the additions that do not exist, and the existing coverage.

This feature is hot and overloaded for the server, and for those clients that are already online, you can also broadcast through the operating tools to repair the data or BUG without server downtime or client restart.

4 realization of shielding words

There is some trouble with the shielding words. In order to take into account the efficiency of search and replacement, we use the trie Tree approach. If anything is not clear, you can go back to read this article.

Because there are so many entries for shielding words (we have reviewed 520000 versions, and the text file is close to 10m), you must process the shielding words offline in advance and then load them at run time (otherwise you may have to wait more than 10 seconds for each login). However, this also brings additional problems, because it is not as discrete as other tabular data, so it cannot be sent incrementally using the above method.

Because the tree of shielded words traverses all the phrases in advance and then generates them offline, it does not have the function of dynamic insertion (it is very expensive to regenerate the whole tree). So we use another set of rules for shielding words. Since they can't be put together, they might as well be completely independent of two trees. The data format is the same, but the data source is different, so we will create two versions, the Server version and the Client version. There are many and large versions of Client, which are generated offline. The server version is small and dynamically generated. When you need to query the masking words, query the server version first, not Client.

At this time, data distribution can still supplement data through the above framework structure. Every time the server has a shield word, the server shield word tree is rebuilt, because the number of entries added by the server is generally very small. It will hardly cause performance problems (even if there is a moment).

In our review of the version, the use of this scheme reduces the problem of calling back the package many times.

5 Hot repair of compound configuration

The so-called compound configuration is that some problems cannot be repaired by a single data table. For example, if there is a lack of data template in the data table of system mail, we not only need to send language-related content, but also need to send additional data. Similarly, if the email also involves new reward items, it can also be added by sending out the Item form. Of course, all of these are based on the supplementary framework mentioned above.

6 Operation intervention

This part is concerned with various announcements and notices of the operation. Such as emergency downtime, emergency, and so on, these are unpredictable, and naturally it is impossible to configure the language or data in the table in advance. What we are dealing with above is the game function, which belongs to the BUG repair at the planning level. However, when it comes to the operation level, the preferred operation editor announcement or dealing with servers in different regions should not all go through planning or development groups. In fact, game operators and developers may be completely different companies. If it is distributed locally in different countries, it doesn't even understand the language.

At this point, a complete tool chain is needed to help operators use this feature directly. As we have talked so much before, we also know that there is no problem with data addition between the server and the client, and now we need to add a control party to this link. To be exact, it should be to change a control party. Because the existing link server and client interaction is in a special directory, there is a special byte file. And this document is generated by the planning guide table. The server reads the file, converts it to binary, and sends it through the protocol.

Let's change our thinking a little bit, that is, to provide an operational tool so that they can generate a specified file or binary cache through the tool, pass it to the server, and then follow the normal process to supplement the data.

The above is the content of this article on "what is the method of sending configuration to the Unity server". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report