Game configuration table ID replacement method and system, electronic equipment and storage medium
By adopting a two-step replacement process in the game configuration table ID replacement, using the xml configuration file and mapping cache, the problem of poor accuracy caused by error-prone and repeated replacement in the existing technology is solved, and more efficient and accurate IDs are achieved Replacement effect.
Patent Information
- Application Number
- CN202411232751.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, game configuration table ID replacement is prone to errors, and automation tools have repeated replacement problems, resulting in poor accuracy.
A two-step replacement process is adopted, first replacing the original ID with different and independent intermediate IDs, and then replacing the intermediate ID with the new ID, and automatic replacement is achieved through the xml configuration file and mapping cache.
It improves the accuracy and efficiency of ID replacement, reduces the probability of errors in manual operations, and avoids the accuracy problems caused by repeated replacement.
Smart Images

Figure CN119396874A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of game development, and in particular to a method, system, electronic device and computer-readable storage medium for replacing a game configuration table ID. Background Art
[0002] The game configuration table is an important tool used in game development to manage and configure game elements. It is usually one or more tables that contain data on various systems, objects, parameters, and properties in the game. This data is read and parsed by the program to guide the operation and performance of the game. By defining and configuring the parameters and properties of these systems, game planners can control the difficulty, balance, flow, etc. of the game to achieve the goals of game design.
[0003] In the related art, when the game configuration table needs to be updated, the game planner needs to manually operate Excel to perform the replacement. Manually operating Excel team building to replace the ID will inevitably lead to omissions or errors in the replacement, or lead to some other tables using the ID being omitted. When replacing through automated tools, some IDs with the same fields will be replaced, and some IDs with preconditions may not be replaced or cannot be replaced correctly.
[0004] Currently, no effective solution has been proposed for the problem that game configuration table ID replacement is prone to errors in related technologies. Summary of the invention
[0005] The embodiments of the present application provide a method, system, computer device and computer-readable storage medium for replacing a game configuration table ID, so as to at least solve the problem that game configuration table ID replacement in the related art is prone to errors.
[0006] In a first aspect, an embodiment of the present application provides a method for replacing a game configuration table ID, the method comprising:
[0007] Reading the original ID and the new ID from the ID replacement list, and establishing a first mapping cache between the original ID and the new ID;
[0008] In the first replacement step, the game configuration table in the game configuration directory file is copied to a temporary replacement directory by a replacement program, and the original ID in the game configuration table is replaced with an intermediate ID in the temporary replacement directory according to the first mapping cache;
[0009] In the second replacement step, the temporary replacement directory is traversed by the replacement program, and based on the first mapping cache, the intermediate ID is replaced with the new ID, and all table files involved in the replacement under the temporary replacement directory are overwritten to the game configuration directory.
[0010] In some embodiments, before reading the original ID and the new ID from the ID list file, the method further includes:
[0011] Constructing an XML configuration file, in which a plurality of different configuration information are defined;
[0012] In the xml configuration file, the table name, table field name, and the table field name including the condition field associated with the subsequent replacement task are defined.
[0013] In some embodiments, the method further comprises:
[0014] By means of the replacement program, the XML configuration file is read to obtain information to be replaced, wherein the information to be replaced includes a table name, a table field name, and a conditional field of the table field name;
[0015] A second mapping cache is established between all table field names that need to be replaced and their corresponding table index numbers.
[0016] In some embodiments, according to the first mapping cache, replacing the original ID in the game configuration table with the intermediate ID in the temporary replacement directory includes:
[0017] All data rows of each table file in the temporary replacement directory are traversed in sequence by a replacement program, and data rows to be replaced are identified according to the information to be replaced;
[0018] According to the first mapping cache, the original ID of the data row is replaced with the intermediate ID, and it is determined whether the data row contains a conditional field. If not, the table field name in the data row is directly replaced based on the second mapping cache.
[0019] If so, based on the second mapping cache, obtain whether the condition value corresponding to the table field name in the data row meets the replacement condition; if so, replace the table field name in the data row.
[0020] In some embodiments, traversing the temporary replacement directory by the replacement program and replacing the intermediate ID with the new ID based on the first mapping cache includes:
[0021] According to the first mapping cache and the intermediate ID, establishing an updated first mapping cache between the intermediate ID and the new ID;
[0022] By using a replacement program, each table file in the temporary replacement directory is traversed in turn, and all data rows in all table files are traversed, and the data rows to be replaced are identified according to the information to be replaced;
[0023] According to the second mapping cache, the intermediate ID of the data row is replaced with a new ID, and it is determined whether the data row contains a conditional field. If not, the table field name in the data row is replaced based on the second mapping cache.
[0024] If so, based on the second mapping cache, obtain whether the condition value corresponding to the table field name in the data row meets the replacement condition; if so, replace the table field name in the data row.
[0025] In some of the embodiments, the intermediate IDs of the various data columns in the game configuration table are independent of each other and do not overlap with the original ID or the new ID, and the intermediate ID is generated by adding special characters to the original ID.
[0026] In a second aspect, the embodiment of the present application further provides a game configuration table ID replacement system, the system comprising: a preprocessing module and a replacement module, wherein:
[0027] The preprocessing module is used to read the original ID and the new ID from the ID replacement list, and establish a first mapping cache between the original ID and the new ID;
[0028] The replacement module is used for, in a first replacement step, copying the game configuration table in the game configuration directory file to a temporary replacement directory through a replacement program, and replacing the original ID in the game configuration table with the intermediate ID in the temporary replacement directory according to the first mapping cache;
[0029] And, in the second replacement step, the temporary replacement directory is traversed by the replacement program, and based on the first mapping cache, the intermediate ID is replaced with the new ID, and all table files involved in the replacement under the temporary replacement directory are overwritten to the game configuration directory.
[0030] In some of the embodiments, the preprocessing module is further used to: construct an XML configuration file before reading the original ID and the new ID from the ID list file, wherein a plurality of different configuration information are defined in the XML configuration file;
[0031] And in the xml configuration file, the table name, table field name, and the table field name containing the condition field associated with the subsequent replacement task are defined.
[0032] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect above when executing the computer program.
[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the second aspect above.
[0034] Compared with the related art, the game configuration table ID replacement method provided in the embodiment of the present application is not only more efficient but also has a lower error probability through an automated tool based on XML files, compared with the solution of manually implementing ID replacement in the related art. In addition, compared with the repeated replacement problem existing in the replacement tools in the prior art, the replacement method provided by the technical solution of the present application, by designing a two-step replacement process, first replaces the original ID with an intermediate ID that is distinguishable and independent from each other, and then, in the second step, replaces the intermediate ID with a new ID; thereby solving the problem of poor accuracy caused by repeated replacement in the prior art, and improving the accuracy of ID replacement. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0036] Figure 1 is a flow chart of a method for replacing a game configuration table ID according to an embodiment of the present application;
[0037] Figure 2 is a schematic diagram of an ID replacement list according to an embodiment of the present application;
[0038] Figure 3 is a schematic diagram of a game configuration table having condition fields according to an embodiment of the present application;
[0039] Figure 4 is a structural block diagram of a game configuration table ID replacement system according to an embodiment of the present application;
[0040] Figure 5 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0042] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0043] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0044] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0045] The game configuration table is an important tool for managing and configuring game elements in game development. It is usually one or more tables that contain data on various systems, objects, parameters, and properties in the game. These data are read and parsed by the program to guide the operation and performance of the game. The design of the game configuration table covers many aspects, including but not limited to levels, skills, battles, tasks, props and other systems. By defining and configuring the parameters and properties of these systems, game planners can control the difficulty, balance, process and other aspects of the game to achieve the goals of game design.
[0046] In the game configuration table, ID is a key concept, which usually represents some kind of unique identifier (UniqueIdentifier). Specifically, ID is used to uniquely identify a game element or object in the configuration table. For example, a level configuration table may have multiple level entries, and each level entry will have a unique ID to distinguish different levels; similarly, a prop configuration table may also contain multiple prop entries, and each prop will have a unique ID to identify its identity.
[0047] Usually, game planners manually use Excel to replace data, which may lead to omissions or errors, and some fields referenced by other tables may also be omitted. Another method of using tools to replace data may also cause other fields with the same ID to be replaced, and some IDs with preconditions may not be replaced or replaced correctly.
[0048] In view of the above problems, the present application embodiment provides a method for replacing a game configuration table ID. Figure 1 is a flowchart of a method for replacing a game configuration table ID according to an embodiment of the present application. Figure 1 As shown, the process includes the following steps:
[0049] S101, reading the original ID and the new ID from the ID replacement list, and establishing a first mapping cache between the original ID and the new ID;
[0050] Before step S101, it is necessary to first construct an XML configuration file, in which multiple different table configuration information is defined;
[0051] The specific details of the replacement scheme are written into the XML configuration file. XML (Extensible Markup Language) is a format for storing and transmitting data. It has a clear structure and is easy to parse, so it is widely used in configuration files, and is particularly suitable for describing the structure of data.
[0052] Furthermore, the XML configuration file can support multiple table configurations, and each function ID replacement can define different configuration information respectively. For example, item ID replacement can be defined as configuration information item.xml, and task ID replacement can be defined as configuration information: task.xml.
[0053] In addition, you need to set the Excel table name and table field name involved in the subsequent replacement process in the XML configuration file; in addition, when some table field names involve replacement conditions, you also need to design replacement condition fields, where the same replacement field name can be configured with multiple condition fields;
[0054] The following is an example of an XML configuration file according to an embodiment of the present application:
[0055]
[0056] It can be understood that the above XML configuration file is the basic support for implementing the replacement solution. The replacement solution needs to use the XML file to define in detail which table data needs to be replaced, the replacement conditions, and the specific replacement rules.
[0057] Furthermore, it is necessary to construct the ID replacement list "id.xlsx"; Figure 2 is a schematic diagram of an ID replacement list according to an embodiment of the present application, such as Figure 2 As shown in the figure, the ID replacement list includes the original ID and the new ID after replacement. In addition, the original ID and the new ID can be read from the id.xlsx file and a mapping cache can be established. This cache will be used for subsequent data processing and replacement operations to ensure data accuracy and consistency. Specifically, the establishment of a mapping cache can be achieved through the pandas and openpyxl libraries.
[0058] S102, in a first replacement step, copying a game configuration table in the game configuration directory file to a temporary replacement directory through a replacement program, and replacing an original ID in the game configuration table with an intermediate ID in the temporary replacement directory according to a first mapping cache;
[0059] Among them, the game configuration table is an important tool for managing and configuring game elements in game development. It is usually one or more tables that contain data on various systems, objects, parameters, and properties in the game;
[0060] It can be understood that the temporary replacement directory is a directory specially designed for ID replacement tasks. In order to avoid directly modifying the original game configuration files during the replacement process, these files need to be copied to a temporary replacement directory first. In this way, the replacement operation can be safely performed in the temporary directory without affecting the original files.
[0061] Furthermore, before executing the first step of replacement, the replacement program needs to read the XML configuration file to obtain the information to be replaced, wherein the information to be replaced includes the table name, the table field name, and the conditional field of the table field name;
[0062] For example, if the field name that needs to be replaced is defined as ItemID in the item.xml file, and this field name may be associated with certain conditional field names (such as ItemType), the program will record this information and perform replacement operations on these field names later.
[0063] In addition, a second mapping cache is established between all table field names that need to be replaced and their corresponding table index numbers. In this embodiment, when reading an Excel file, the program not only records the file name, but also obtains the index number of each column in the table by analyzing the table header (i.e., the first row of the table), and establishes a mapping relationship between these index numbers and field names. The purpose of this step is to quickly access and modify specific columns in the table in subsequent steps.
[0064] For example, in a table, ItemID may be in the second column, and ItemType may be in the fourth column. The program will cache the index numbers of these columns so that it can quickly locate the data to be replaced during subsequent replacements.
[0065] By reading the table header, the program will generate a second mapping cache containing the table field name and the corresponding column number. This cache will be frequently used when reading the data of each row and column of the table later. This can greatly improve the efficiency of the replacement operation because the program no longer needs to re-parse the table header every time it operates.
[0066] After the above steps, the data preparation before replacement is completed. Specifically, the first round of data ID replacement includes the following subdivision steps:
[0067] Step 1, traverse each table file in the temporary replacement directory in turn through the replacement program, and traverse all data rows in all table files, and identify the data rows that need to be replaced according to the information to be replaced;
[0068] Among them, all table files (such as Excel files) in the temporary replacement directory are opened one by one, and then all data rows in the table files are traversed: all rows in each table file are processed to check whether the data in these rows need to be replaced.
[0069] And further, according to the information to be replaced read in step S102, it is determined which data rows need to be replaced with IDs, which is usually determined according to certain identifiers or conditions, such as a specific ID column or field value.
[0070] In this embodiment, the intermediate ID is unique and does not duplicate any original ID or new ID. This uniqueness ensures that there will be no ID conflicts during the replacement process, thus avoiding incorrect replacements. For example, if the original ID A001 is to be replaced with the new ID B001, the intermediate ID may be set to $$0001$$, and this ID will not be used elsewhere.
[0071] Step2, according to the first mapping cache, replace the original ID of the data row with the intermediate ID, and determine whether there are conditional fields in the data row. If not, replace the table field name in the data row based on the second mapping cache;
[0072] Among them, the first mapping cache is a mapping relationship that contains the original ID and the corresponding intermediate ID. For the data rows identified as needing replacement, according to the first mapping cache, replace the original ID in the data row with the intermediate ID; for example, when changing from A001 to B001, an intermediate ID named $$0001$$ will be created.
[0073] In addition, further check whether the current data row contains conditional fields. Conditional fields refer to those fields that need to meet specific conditions to be replaced. If there are no conditional fields in the data row, directly replace the table field name (column name) in the data row based on the second mapping cache, that is, through the second mapping cache, which is used to map the old field name to the new field name and replace it with the new field name.
[0074] Step3, if so, based on the second mapping cache, obtain whether the conditional value corresponding to the table field name in the data row meets the replacement conditions. If so, replace the table field name in the data row.
[0075] Among them, if the data row contains conditional fields, it is necessary to further determine whether the values of these fields meet the replacement conditions. Extract the values of the conditional fields from the data row, and obtain the corresponding conditional values of the row for determination. If the conditions are met, based on the second mapping cache, replace the table field name (column name) in the data row with the new field name. If the conditions are not met, no replacement is performed and the original field name is retained.
[0076] For example, data A must be a skin unlock card for data A to be replaced with A001, while if data A is a task, data A will not be replaced with A001. The following is the code implementation of the replacement in this step:
[0077] <re col name="Value A">
[0078] <comd col name="Data A" cond="Skin unlock card" / >
[0079] <comd col name="Data" cond="Pet skill book type" / >
[0080] < / re col>
[0081] Figure 3 This is a schematic diagram of a game configuration table with conditional fields according to an embodiment of the present application. Through the above step S102, the original ID is replaced with the intermediate ID according to the first mapping cache, and it is checked whether the conditional field exists. It is determined whether to replace the field name according to the conditional field, ensuring that the ID and field name in the data row are correctly replaced and all relevant conditions are met.
[0082] S103, in the second replacement step, the temporary replacement directory is traversed by the replacement program, and based on the first mapping cache, the intermediate ID is replaced with a new ID, and all table files involved in the replacement under the temporary replacement directory are overwritten to the game configuration directory.
[0083] Secondly, in the second round of replacement, the program will replace the intermediate ID introduced in the first round of replacement with the final new ID;
[0084] Before starting the second round of replacement, the program will reload the ID mapping relationship defined in the id.xlsx file. This mapping relationship contains the mapping from the intermediate ID to the new ID, for example, $$0001$$ is mapped to B001. In addition, the program will reconfirm the table field information contained in the first mapping cache to ensure that the same table and fields are used in the second round of replacement as in the first round.
[0085] And further traverse all Excel files in the temporary replacement directory again. Each file has replaced the original ID with the intermediate ID in the first round of replacement, and now needs to further replace the intermediate ID with the final new ID.
[0086] Specifically, similar to the first round of replacement, the program will lock the fields to be replaced based on the first mapping cache. Specific columns in each Excel file (such as ItemID) may contain intermediate IDs, which need to be replaced with the final new IDs in this step.
[0087] For example, the program reads the data in the table row by row. For each row, the program checks whether there is a field value that is an intermediate ID, such as $$0001$$. If a matching intermediate ID (such as $$0001$$) is found, the program looks for its corresponding final new ID (such as B001) and replaces it.
[0088] In addition, the steps of judging and replacing the conditional field name are the same as those in step S102, and therefore, they are not described in detail in this embodiment.
[0089] After the second replacement step, all original IDs are replaced with new IDs. In this case, all table files involved in the replacement in the temporary replacement directory are copied back to the original game configuration directory files to overwrite the tables with the same sequence in the original files, completing the entire replacement process.
[0090] Through the above steps S101 to S103, compared with the solution of manually implementing ID replacement in the related art, the present application provides an automated tool based on XML files, which is not only more efficient but also has a lower error probability.
[0091] In addition, compared with the duplicate replacement problem existing in the replacement tool in the prior art, for example, for a replacement task where A003 is replaced by A001 and A001 is replaced by A002, if the existing replacement tool is used without processing, after A003 is replaced by A001, all A001s are replaced by A002, resulting in A001 and A003 being replaced by A002;
[0092] The replacement method provided by the technical solution of the present application designs a two-step replacement process, first replacing the original ID with an intermediate ID that is independent of each other, and then, in a second step, replacing the intermediate ID with a new ID; thereby solving the problem of poor accuracy in the prior art due to repeated replacements and improving the accuracy of ID replacement.
[0093] For example: To prevent replacement errors caused by duplication between the original ID and the new ID, the program generates an intermediate ID and performs a two-step replacement to prevent errors. For example, when A001 is replaced with B001, an intermediate ID named $$0001$$ will be created. During the replacement process, A001 will be replaced with $$0001$$ first, and after all ID tables have been replaced, $$0001$$ will be replaced with B001.
[0094] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0095] This application also provides a game configuration table ID replacement system. Figure 4 is a structural block diagram of a game configuration table ID replacement system according to an embodiment of the present application, such as Figure 4 As shown, the system includes: a pre-processing module 40 and a replacement module 41, wherein:
[0096] The preprocessing module 40 is used to read the original ID and the new ID from the ID replacement list, and establish a first mapping cache between the original ID and the new ID;
[0097] The replacement module 41 is used to, in a first replacement step, copy the game configuration table in the game configuration directory file to a temporary replacement directory through a replacement program, and replace the original ID in the game configuration table with the intermediate ID in the temporary replacement directory according to the first mapping cache;
[0098] And, in the second replacement step, the temporary replacement directory is traversed by the replacement program, and based on the first mapping cache, the intermediate ID is replaced with the new ID, and all table files involved in the replacement under the temporary replacement directory are overwritten to the game configuration directory.
[0099] Through the above system, a two-step replacement process is designed, in which the original ID is first replaced with an intermediate ID that is independent of each other, and then, in a second step, the intermediate ID is replaced with a new ID; thereby solving the problem of poor accuracy in the prior art due to repeated replacements and improving the accuracy of ID replacement.
[0100] In one embodiment, Figure 5 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 5 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 5 The electronic device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a game configuration table ID replacement method.
[0101] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0102] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0103] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0104] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for replacing a game configuration table ID, characterized in that: The method comprises: Reading the original ID and the new ID from the ID replacement list, and establishing a first mapping cache between the original ID and the new ID; In the first replacement step, the game configuration table in the game configuration directory file is copied to a temporary replacement directory by a replacement program, and the original ID in the game configuration table is replaced with an intermediate ID in the temporary replacement directory according to the first mapping cache; In the second replacement step, the temporary replacement directory is traversed by the replacement program, and based on the first mapping cache, the intermediate ID is replaced with the new ID, and all table files involved in the replacement under the temporary replacement directory are overwritten to the game configuration directory.
2. The method according to claim 1, characterized in that Before reading the original ID and the new ID from the ID list file, the method further includes: Constructing an XML configuration file, in which a plurality of different configuration information are defined; In the xml configuration file, the table name, table field name, and the table field name including the condition field associated with the subsequent replacement task are defined.
3. The method according to claim 2, characterized in that The method further comprises: By means of the replacement program, the XML configuration file is read to obtain information to be replaced, wherein the information to be replaced includes a table name, a table field name, and a conditional field of the table field name; A second mapping cache is established between all table field names that need to be replaced and their corresponding table index numbers.
4. The method according to claim 3, characterized in that According to the first mapping cache, replacing the original ID in the game configuration table with the intermediate ID in the temporary replacement directory comprises: All data rows of each table file in the temporary replacement directory are traversed in sequence by a replacement program, and data rows to be replaced are identified according to the information to be replaced; According to the first mapping cache, the original ID of the data row is replaced with the intermediate ID, and it is determined whether the data row contains a conditional field. If not, the table field name in the data row is directly replaced based on the second mapping cache. If so, based on the second mapping cache, obtain whether the condition value corresponding to the table field name in the data row meets the replacement condition; if so, replace the table field name in the data row.
5. The method according to claim 3, characterized in that: Traversing the temporary replacement directory by the replacement program and replacing the intermediate ID with the new ID based on the first mapping cache includes: According to the first mapping cache and the intermediate ID, establishing an updated first mapping cache between the intermediate ID and the new ID; By using a replacement program, each table file in the temporary replacement directory is traversed in turn, and all data rows in all table files are traversed, and the data rows to be replaced are identified according to the information to be replaced; According to the second mapping cache, the intermediate ID of the data row is replaced with a new ID, and it is determined whether the data row contains a conditional field. If not, the table field name in the data row is replaced based on the second mapping cache. If so, based on the second mapping cache, obtain whether the condition value corresponding to the table field name in the data row meets the replacement condition; if so, replace the table field name in the data row.
6. The method according to claim 1, characterized in that The intermediate IDs of the various data columns in the game configuration table are independent of each other and do not overlap with the original ID or the new ID. The intermediate ID is generated by adding special characters to the original ID.
7. A game configuration table ID replacement system, characterized in that: The system comprises: a pre-processing module and a replacement module, wherein: The preprocessing module is used to read the original ID and the new ID from the ID replacement list, and establish a first mapping cache between the original ID and the new ID; The replacement module is used for, in a first replacement step, copying the game configuration table in the game configuration directory file to a temporary replacement directory through a replacement program, and replacing the original ID in the game configuration table with the intermediate ID in the temporary replacement directory according to the first mapping cache; And, in the second replacement step, the temporary replacement directory is traversed by the replacement program, and based on the first mapping cache, the intermediate ID is replaced with the new ID, and all table files involved in the replacement under the temporary replacement directory are overwritten to the game configuration directory.
8. The system according to claim 7, characterized in that The preprocessing module is also used for: before reading the original ID and the new ID from the ID list file, constructing an XML configuration file, wherein a plurality of different configuration information are defined in the XML configuration file; And in the xml configuration file, the table name, table field name, and the table field name containing the condition field associated with the subsequent replacement task are defined.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Automatic replacing method and apparatus of same-name file
CN104092726A
Identity updating method, identity updating system, identity management server and link device
CN104113535A
Data processing method and device
CN107526530A
A method and apparatus for updating data
CN109388644A
Field replacement method and device for low-code page, equipment and storage medium
CN116627409A