Game configuration data calling method and device, storage medium, and electronic device
By exporting game configuration data to database files and calling it to memory using embedded scripts, the problem of configuration data occupies a lot of memory in game development is solved, and more efficient memory management is achieved.
Patent Information
- Application Number
- CN202111161854.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-09-30
AI Technical Summary
During the game development process, the configuration data occupies a large amount of memory when loading into memory, which affects the game operation. The existing solutions such as data table splitting and binary format conversion fail to fundamentally solve the problem of insufficient memory.
By reading the configuration information of the source table file, the game configuration data is exported to the database file of the database engine, and the embedded script is used to call the data from the database file to memory.
The memory usage of game configuration data is optimized, the memory requirement for runtime is reduced, and the memory shortage in the existing technology is solved.
Smart Images

Figure CN113900702B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for calling game configuration data, a storage medium, and an electronic device. Background Art
[0002] In the related art, there is a large amount of configuration data in the game development process, which is used to configure the internal data attributes of the game. Most of these attributes are related to the game play and values. During the game running process, the configuration data is loaded into the memory through the configuration file for use.
[0003] In the related art, the source file is generally exported to a specific format, the data is loaded into the memory when it is used, and then converted into the Lua table format for use in the game business. Because the configuration data needs to be searched according to the ID of the table where the data is located, all the data in the table needs to be loaded into the memory when it is used. When the table is large in size, a large amount of memory is required, which affects the operation of the game.
[0004] In the related art, the solution to this problem includes two common ideas: split the data table and search for data according to the mapping of table name and table id. This solution solves some memory problems, but there are still defects: there are too many files after splitting, which affects the packaging speed; the file search is limited by the IO speed and the time performance is poor; for some data types, such as luatable, there will be a situation where the data cannot be automatically garbage collected by the virtual machine after reading the data; it is impossible to search the data in a range or accurately locate a row or column. Convert the data into a binary format with tight memory distribution, and convert the data into the required format when using it. This method solves some memory problems, but there are also some defects: it takes up less memory than the direct luatable format, but because the entire table data is still added to the memory, it does not fundamentally solve the problem. When the project scale reaches a certain level, there will still be insufficient memory problems; it is inconvenient to use, because in order to save space, the deserialization interface of each table needs to be written manually.
[0005] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention
[0006] The embodiments of the present invention provide a method and device for calling game configuration data, a storage medium, and an electronic device.
[0007] According to one embodiment of the present invention, there is provided a method for calling game configuration data, comprising: reading configuration information of a plurality of source table files, wherein the configuration information is used to indicate data usage rules of the source table files; for each source table file, exporting the game configuration data in the source table file to a database file of a database engine based on the configuration information, wherein the database file is stored on a disk; and using an embedded script to call the game configuration data from the database file to a memory.
[0008] Optionally, exporting the game configuration data in the source table file to the database file of the database engine based on the configuration information includes: performing a legality check on the game configuration data in the source table file; if the game configuration data in the source table file is legal, exporting a metadata table of the game configuration data from the source table file, exporting a data table of the game configuration data from the source table file, exporting a log file of the game configuration data from the source table file, and exporting an auxiliary file of the game configuration data from the source table file, wherein the auxiliary file is used to generate prompt information in a code editor; and copying the metadata table, the data table, the log file, and the auxiliary file to a database file that matches the configuration information.
[0009] Optionally, performing a validity check on the game configuration data in the source table file includes: converting the source table file into a two-dimensional array; reading a header segment and a data segment of the source table file from the two-dimensional array; using the header segment to perform data integration on the data segment to obtain intermediate data; traversing the intermediate data, and performing at least one of the following verification steps on the intermediate data: verifying whether the header format of the intermediate data is correct, verifying whether there are blank rows in the intermediate data, verifying whether the key values of the intermediate data are repeated, verifying whether the data format of the intermediate data is correct, and verifying whether the table association identifier of the intermediate data is valid; if the intermediate data verification passes, it is determined that the game configuration data in the source table file is legal.
[0010] Optionally, exporting the metadata table of the game configuration data from the source table file includes: extracting the table name and rule content from the source table file, wherein the rule content includes the following data items: the database name of the database to which the table belongs, the data format of each column in the table, and the association information of the table; storing the rule content in a key-value format, and recording multiple data items of the rule content in multiple tables, wherein the key is the table name, the value is the rule content, and each data item corresponds to a table.
[0011] Optionally, using an embedded script to call the game configuration data from the database file to the memory includes: writing an SQL statement in the embedded script, calling the interface of the database engine in the game script through the embedded script to return a pointer to the data; obtaining the game configuration data in the database file line by line based on the pointer, and copying the game configuration data line by line to the virtual machine of the embedded script, and converting the game configuration data into the table format of the embedded script in the virtual machine, wherein the virtual machine runs in the memory.
[0012] Optionally, obtaining the game configuration data in the database file line by line based on the pointer includes: compiling the database engine of the game script, mapping each database file of the database engine to a physical file, wherein the physical file includes a number of data stored in Pages of the same size, and the relationship between the multiple Pages is stored in a B+ tree structure, which is indexed by a pointer index of the B+ tree structure; running the database engine, loading the pointer into memory, and indexing the game configuration data line by line on the disk through the pointer.
[0013] Optionally, after indexing the game configuration data line by line in the disk through the pointer, the method further includes: exporting the game configuration data to an encryption module using the encryption function interface of the embedded script, wherein the encryption module is used to perform Advanced Encryption Standard AES encryption on each page separately; importing the encrypted game configuration data into the memory using the encryption function interface; transferring the key into the memory using the decryption function interface of the embedded script, and using the key to decrypt the encrypted game configuration data.
[0014] Optionally, before calling the interface of the database engine in the game script through the embedded script to return a pointer to the data, the method also includes: compiling the embedded script and the database engine into two dynamic libraries, adding an interface in the function library of the database engine, wherein the embedded script and the database engine use the same function library; and injecting the interface into the virtual machine of the embedded script.
[0015] Optionally, writing SQL statements in the embedded script includes: encapsulating the SQL statements using a metatable of the embedded script, passing in a table ID, and generating SQL statements; querying an SQL string that matches the metatable, wherein an SQL string is pre-cached for each SQL statement in the metatable.
[0016] According to another embodiment of the present invention, there is provided a device for calling game configuration data, comprising: a reading module for reading configuration information of a plurality of source table files, wherein the configuration information is used to indicate data usage rules of the source table files; an export module for exporting the game configuration data in the source table files to a database file of a database engine for each source table file based on the configuration information, wherein the database file is stored on a disk; and a calling module for calling the game configuration data from the database file to a memory using an embedded script.
[0017] Optionally, the export module includes: a verification unit, used to verify the legitimacy of the game configuration data in the source table file; an export unit, used to export a metadata table of the game configuration data from the source table file, export a data table of the game configuration data from the source table file, export a log file of the game configuration data from the source table file, and export an auxiliary file of the game configuration data from the source table file if the game configuration data in the source table file is legal, wherein the auxiliary file is used to generate prompt information in a code editor; and a copying unit, used to copy the metadata table, the data table, the log file, and the auxiliary file to a database file that matches the configuration information.
[0018] Optionally, the verification unit includes: a conversion subunit, used to convert the source table file into a two-dimensional array; a reading subunit, used to read the header segment and data segment of the source table file from the two-dimensional array; an integration subunit, used to use the header segment to integrate the data segment to obtain intermediate data; a verification subunit, used to traverse the intermediate data and perform at least one of the following verification steps on the intermediate data: verifying whether the header format of the intermediate data is correct, verifying whether there are blank lines in the intermediate data, verifying whether the key values of the intermediate data are repeated, verifying whether the data format of the intermediate data is correct, and verifying whether the table association identifier of the intermediate data is valid; a determination subunit, used to determine that the game configuration data in the source table file is legal if the intermediate data verification passes.
[0019] Optionally, the export unit includes: an extraction subunit, used to extract the table name and rule content from the source table file, wherein the rule content includes the following data items: the database name of the database to which the table belongs, the data format of each column in the table, and the association information of the table; a storage subunit, used to store the rule content in a key-value format, and record multiple data items of the rule content in multiple tables, wherein the key is the table name, the value is the rule content, and each data item corresponds to a table; a recording subunit, used to record the multiple tables in the same metadata database to obtain a metadata table.
[0020] Optionally, the calling module includes: a calling unit, used to write SQL statements in an embedded script, and call the interface of the database engine in the game script through the embedded script to return a pointer to the data; a processing unit, used to obtain the game configuration data in the database file line by line based on the pointer, and copy the game configuration data line by line to the virtual machine of the embedded script, and convert the game configuration data into the table format of the embedded script in the virtual machine, wherein the virtual machine runs in memory.
[0021] Optionally, the processing unit includes: a mapping subunit, used to compile the database engine of the game script, and map each database file of the database engine into a physical file, wherein the physical file includes a number of data stored in Pages of the same size, and the relationship between multiple Pages is stored in a B+ tree structure and indexed by a pointer index of the B+ tree structure; an indexing subunit, used to run the database engine, load the pointer into memory, and index the game configuration data line by line on the disk through the pointer.
[0022] Optionally, the processing unit further includes: an export subunit, used to export the game configuration data to an encryption module using the encryption function interface of the embedded script after the index subunit indexes the game configuration data line by line in the disk through the pointer, wherein the encryption module is used to perform Advanced Encryption Standard AES encryption on each page separately; an encryption subunit, used to import the encrypted game configuration data into the memory using the encryption function interface; and a processing subunit, used to transfer the key into the memory using the decryption function interface of the embedded script, and use the key to decrypt the encrypted game configuration data.
[0023] Optionally, the calling module also includes: an adding unit, used to compile the embedded script and the database engine into two dynamic libraries, and add an interface in the function library of the database engine before the calling unit calls the interface of the database engine in the game script through the embedded script to return a pointer to the data, wherein the embedded script and the database engine use the same function library; an injection unit, used to inject the interface into the virtual machine of the embedded script.
[0024] Optionally, the calling unit includes: an encapsulation subunit, used to encapsulate the SQL statement using the metatable of the embedded script, pass in the table ID, and generate the SQL statement; a query subunit, used to query the SQL string matching the metatable, wherein an SQL string is pre-cached for the SQL statement of each metatable.
[0025] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0026] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0027] Through the present invention, configuration information of several source table files is read, wherein the configuration information is used to indicate data usage rules of the source table files, and for each source table file, game configuration data in the source table file is exported to a database file of a database engine based on the configuration information, wherein the database file is stored on a disk, and an embedded script is used to call the game configuration data from the database file to the memory. By exporting the game configuration data to the database file of the database engine based on the configuration information, and then calling it to the memory using the embedded script, the memory occupancy when calling the game configuration data is optimized, the technical problem of high memory occupancy when calling game configuration data from the outside in the related technology is solved, and the memory occupancy at runtime is effectively reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0029] Figure 1 is a hardware structure block diagram of a computer for calling game configuration data according to an embodiment of the present invention;
[0030] Figure 2is a flowchart of a method for calling game configuration data according to an embodiment of the present invention;
[0031] Figure 3 is a schematic diagram of an interface of a metadata database according to an embodiment of the present invention;
[0032] Figure 4 is a schematic diagram of a process of exporting data according to an embodiment of the present invention;
[0033] Figure 5 is a schematic diagram of using a B+ tree to index game configuration data according to an embodiment of the present invention;
[0034] Figure 6 is a structural block diagram of a device for calling game configuration data according to an embodiment of the present invention;
[0035] Figure 7 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] Example 1
[0039] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, tablet, server, computer or similar electronic terminal. Taking running on a computer as an example, Figure 1FIG. 1 is a hardware structure diagram of a computer for calling game configuration data according to an embodiment of the present invention. Figure 1 As shown, the computer may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Computers shown have different configurations.
[0040] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for calling game configuration data in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. In this embodiment, the processor 104 is used to respond to human-computer interaction instructions and game strategies, and control the target virtual character to perform specified operations to complete the game task. The memory 104 is used to store program scripts, configuration information, attribute information of virtual characters, etc. of electronic games.
[0041] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0042] Optionally, the input-output device 108 further includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface and for presenting images in a virtual scene;
[0043] In this embodiment, a method for calling game configuration data is provided. Figure 2 FIG. 1 is a flow chart of a method for calling game configuration data according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0044] Step S202, reading configuration information of a plurality of source table files, wherein the configuration information is used to indicate data usage rules of the source table files;
[0045] Optionally, the data usage rules may include a storage table of game configuration data (different game configuration data are stored in different database files), and a storage location.
[0046] Step S204, for each source table file, exporting the game configuration data in the source table file to a database file of a database engine based on the configuration information, wherein the database file is stored on a disk;
[0047] In this embodiment, the database engine can be sqlite (including sqlite3 and other versions), etc., and the game configuration data is exported from the source excel to the database file (DB file, database file) of sqlite. The format of the exported game configuration data can be lua, Json, FlatBuffers, ProtocolBuffers and other formats. In this embodiment, the Json format is used as an example for explanation.
[0048] Step S206, using an embedded script to call the game configuration data from the database file into the memory.
[0049] Through the above steps, the configuration information of several source table files is read, wherein the configuration information is used to indicate the data usage rules of the source table files, and for each source table file, the game configuration data in the source table file is exported to the database file of the database engine based on the configuration information, wherein the database file is stored on the disk, and the game configuration data is called from the database file to the memory using an embedded script. By exporting the game configuration data to the database file of the database engine based on the configuration information, and then calling it to the memory using an embedded script, the memory usage when calling the game configuration data is optimized, the technical problem of high memory usage when calling the game configuration data from the outside in the related technology is solved, and the memory usage at runtime is effectively reduced.
[0050] In one implementation of this embodiment, exporting the game configuration data in the source table file to the database file of the database engine based on the configuration information includes:
[0051] S11, verifying the legitimacy of the game configuration data in the source table file;
[0052] In some implementation scenarios, the validity check of the game configuration data in the source table file includes: converting the source table file into a two-dimensional array; reading the header segment and data segment of the source table file from the two-dimensional array; using the header segment to integrate the data segment to obtain intermediate data; traversing the intermediate data, and performing at least one of the following verification steps on the intermediate data: verifying whether the header format of the intermediate data is correct, verifying whether there are blank lines in the intermediate data, verifying whether the key values of the intermediate data are repeated, verifying whether the data format of the intermediate data is correct, and verifying whether the table association identifier of the intermediate data is valid; if the intermediate data verification passes, it is determined that the game configuration data in the source table file is legal.
[0053] In an example, the source table file is a data table of an Excel table, including multiple data tables. Reading and exporting the configuration information of several source table files includes: traversing all Excel tables and reading the configuration into the memory; reading each data table as a two-dimensional array, and then parsing the array according to the method of the configuration table, extracting the header segment and data segment of each table, and integrating the data segments according to the header.
[0054] The integrated data supports multiple types: such as basic string, int, float, long, bool, double, etc. This embodiment can also support some special types of data in the following ways:
[0055] json: directly configure the data in json format and store it in the form of a string;
[0056] luatable: directly configure the lua table in the configuration, and convert it into the corresponding table instance by calling lua's dostring when reading, so that it can be used directly in the logic layer;
[0057] Lua code: This code will be executed when the data is read and the return value will be kept;
[0058] Separator table: a string that uses separators to represent different data, which will be converted into a table in Lua;
[0059] When the calling script (code language script of the game operating system) is a script compiled in C# language, when C# reads data, the exported json format data needs to be deserialized. This embodiment uses C#'s custom attribute (property) for marking, and uses reflection to obtain the attribute when reading data to determine whether to deserialize the data. If necessary, the exported game configuration data is deserialized.
[0060] Traverse the integrated data, perform legality verification, and check the validity of the data: check whether there are empty rows, verify the validity of the data according to the data format, verify key value duplication, verify whether the table-related id is valid, etc. Format verification supports all basic types, and also supports verification of formats such as json. During verification, the interface of the json library is called to check the json format. If the format is wrong, an error will be reported and a log will be output; each row of data in each table has a unique id in the table. If the id is not filled in or the id is repeated, an error will be reported and a log will be output; some columns in the table can be associated with the id of other tables. For example, the configuration data of a column in table A is the id of table B. During data verification, it will check whether the id associated with this column of A exists in table B. If the id is invalid, an error will be reported and a log will be input.
[0061] S12, if the game configuration data in the source table file is legal, export the metadata table of the game configuration data from the source table file, export the data table of the game configuration data from the source table file, export the log file of the game configuration data from the source table file, and export the auxiliary file of the game configuration data from the source table file, wherein the auxiliary file is used to generate prompt information in the code editor;
[0062] Optionally, exporting a metadata table of game configuration data from a source table file includes: extracting a table name and rule content from the source table file, wherein the rule content includes the following data items: a database name of the database to which the table belongs, a data format of each column in the table, and association information of the table; storing the rule content in a key-value format, and recording multiple data items of the rule content in multiple tables, wherein the key is the table name, the value is the rule content, and each data item corresponds to a table; and recording multiple tables in the same metadata database to obtain a metadata table.
[0063] In this embodiment, table is a data structure of Lua that helps us create different data types, such as arrays, dictionaries, etc.
[0064] The data format, including the table name, the database name to which each table belongs, the data format of each column in the table, the table association rules and other information, is recorded in different tables in the form of key as table name and value as rule content. These tables are recorded in a metadata database (metadata.DB). At runtime, the Lua side parses the database structure according to these rules to facilitate hot updates. Figure 3 : This is a schematic diagram of the interface of the metadata database according to an embodiment of the present invention. The table DataIndexTable in Metadata.DB is used to record the DB file to which the table belongs. After the import is completed, the game configuration data in the configuration table is determined by configuring Excel to store in which DB file. By default, the data will be imported into the default database data.DB.
[0065] Optionally, before exporting the game configuration data in the source table file to the database file of the database engine based on the configuration information, it also includes: reading the configuration file, splitting the configuration information based on the configuration file, wherein the configuration file is used to define the minimum storage unit of the database file. Import different tables into different database files according to user-defined rules. Because putting all tables into one database will cause a single file to be too large, the database needs to be split at this step. The splitting rules need to be customized by the user based on the specific business. The user customizes the rules of the configuration table by filling in the configuration file setting.json. When exporting data to DB, setting.json will be parsed and the configuration table will be read according to the rules defined by the user.
[0066] In some examples, the auxiliary file for exporting the game configuration data from the source table file includes: generating an annotation file according to the format of the auxiliary file, wherein the annotation file is used to generate prompt information on the editor, and generating a specified database file in a specified code language, wherein the specified database file contains the data structure and tool class of each table in the source table file, and the tool class is used to encapsulate the interface for operations such as initialization of the table.
[0067] In this example, the exported auxiliary files include: auxiliary files in Emmylua format: according to the format of Emmylua, comment files are generated, and users can get automatic prompts when writing code in the editor; in order to read the database in C#, the *.cs file used by C# is exported, which contains the data structure of each table and a tool class, which encapsulates the interface of table initialization and other operations; after the first installation of the package, in order to allow the database to be read, the database file needs to be exported outside the apk package. Therefore, a file needs to be exported to record the files that need to be copied outside the package.
[0068] S13, copying the metadata table, data table, log file, and auxiliary file to a database file that matches the configuration information.
[0069] Figure 4 It is a flowchart of data export according to an embodiment of the present invention, which optimizes the data structure when exporting the source table file, reduces the direct concatenation of character strings, speeds up the table export, and ensures the integrity and correctness of the game configuration data through data verification.
[0070] After the game configuration data in the source table file is successfully exported, multiple data files, some log files, and some auxiliary files will be generated in this embodiment. The files can be copied to the memory through the automated script.
[0071] In one implementation of this embodiment, using an embedded script to call game configuration data from a database file into memory includes:
[0072] S21, write SQL statements in the embedded script, and call the interface of the database engine in the game script through the embedded script to return a pointer to the data;
[0073] In some examples, writing SQL statements in an embedded script includes: encapsulating the SQL statements using a metatable of the embedded script, passing in a table ID, and generating SQL statements; and querying an SQL string that matches the metatable, wherein an SQL string is pre-cached for each SQL statement in the metatable.
[0074] Optionally, the embedded script is a script in lua format, and lua's metatable is used to encapsulate SQL statements. The user passes in the table id using luatable syntax, generates the corresponding SQL statement using lua's __newindex metamethod, obtains data through sqlite3 and returns it to the user. In this way, the user does not need to care about the specific usage details of sqlite3, and there is no difference in usage when using it and querying data using luatable. For example, for the SQL statement select * from table where id == 10, when used in lua, you only need to execute table
[10] ;
[0075] In this implementation, the following performance optimizations are performed on the SQL statement:
[0076] Based on the characteristics of the game business, cache the SQL statement strings required for each table so that duplicate SQL strings will not be generated each time a query is made;
[0077] Because the Lua call stack has a greater impact on performance than other languages, in order to reduce the Lua function call stack, the Lua logic is written into a large function, that is, written into the SQL statement;
[0078] Manage sqlite3's DB cache according to database characteristics, cache the corresponding DB instance of the opened database, and avoid performance loss caused by frequent opening of the DB. At the same time, in order to take into account the flexible update of DB files during development, it supports reopening the DB each time it is used in the editor, and closing the DB after use.
[0079] S22, based on the pointer, obtain the game configuration data in the database file line by line, and copy the game configuration data to the virtual machine of the embedded script line by line, and convert the game configuration data into a table format of the embedded script in the virtual machine, wherein the virtual machine runs in the memory.
[0080] For example, the embedded script is a lua script, the game script is a script compiled in C language (including family languages such as C#), the database engine is Sqlite3, the SQL statement is written in lua, and the Sqlite3 interface is called directly in C through lua, and a pointer to the data is returned. Through this pointer, each row of data can be obtained, and this row of data is copied to the lua virtual machine and converted into the luaTable format, and then the pointer points to the next row of data.
[0081] In some examples, obtaining game configuration data in a database file line by line based on a pointer includes: compiling a database engine of a game script, mapping each database file of the database engine to a physical file, wherein the physical file includes a number of data stored in Pages of the same size, and the relationship between multiple Pages is stored in a B+ tree structure, which is indexed by a pointer index of the B+ tree structure; running the database engine, loading the pointer into memory, and indexing the game configuration data line by line on disk through the pointer.
[0082] The B+ tree of this embodiment includes the following features: the intermediate nodes of k subtrees contain k elements, each element does not store data, but is only used for indexing, and all data is stored in leaf nodes. All leaf nodes contain information about all elements and pointers to records containing these elements, and the leaf nodes themselves are linked in order from small to large according to the size of the keyword. All intermediate node elements exist in the child nodes at the same time, and are the largest (or smallest) elements in the child node elements.
[0083] Optionally, after indexing the game configuration data line by line in the disk through a pointer, it also includes: using the encryption function interface of the embedded script to export the game configuration data to the encryption module, wherein the encryption module is used to encrypt each page separately using the Advanced Encryption Standard AES (Advanced Encryption Standard); using the encryption function interface to import the encrypted game configuration data into the memory; using the decryption function interface of the embedded script to transfer the key to the memory, and using the key to decrypt the encrypted game configuration data.
[0084] Compile the sqlite3 library with AES encryption function. A SQLite DB corresponds to a physical file. The data in the file is divided into several pages of equal size for storage. The relationship between these pages is organized and managed by a B+ tree structure, and indexed by a B+ tree structure index. At runtime, the index will be loaded into memory, and then the index will be used to index the data in the disk. For easy management, the size of each page is the same. Figure 5 is a schematic diagram of using a B+ tree to index game configuration data according to an embodiment of the present invention, wherein data is the game configuration data.
[0085] In an example of encryption and decryption performed in this embodiment, the encryption function is sqlite3_rekey, and the decryption function is sqlite3_key. The encryption is performed through the AES symmetric encryption algorithm to encrypt the data part of each page file. When encrypting, it is necessary to call the sqlite3_rekey() interface to add an encryption module. Adding an encryption module requires modification based on the sqlite3 source code. sqlite3_rekey() will export and import all data, and each page will be encrypted by AES separately. After encryption, the file will be a little larger than the original data file. When decrypting, first call sqlite3_key() to pass in the key, and then sqlite3 calls the internal sqlite3_key to decrypt the DB. If the key is wrong, an exception is thrown.
[0086] In some examples, before calling the interface of the database engine in the game script through the embedded script to return a pointer to the data, it also includes: compiling the embedded script and the database engine into two dynamic libraries, adding the interface to the function library of the database engine, wherein the embedded script and the database engine use the same function library; and injecting the interface into the virtual machine of the embedded script.
[0087] In this embodiment, if the interface added to the function library of the database engine is the interface of sqlite3, and the virtual machine of the embedded script is the lua virtual machine, the interface of sqlite3 needs to be injected into the lua virtual machine during operation, so the interface injected into the lua virtual machine needs to be added in the sqlite3 library. In order to solve the coupling of lua and sqlite3, this embodiment compiles the two into two dynamic libraries. In different operating ecological environments, the strategies are as follows:
[0088] On Windows platform, use the symbol table file exported after Lua compilation to do static linking with sqlite3, and then do dynamic linking when sqlite3 calls Lua's C code interface at runtime;
[0089] On the Android platform, compile the lua dynamic library lua.so first, and then make lua.so dependent when compiling the sqlite3 dynamic library;
[0090] On iOS, compile the lua static library first, and then compile the sqlite3 static library directly as a compilation dependency;
[0091] On the MacOS platform, first compile the Lua dynamic library file lua.bundle, and extract the ELF executable file, and then compile the dependency when compiling sqlite3.
[0092] Since the sqlite3 used in lua and sqlite comes from the same c library, only one sqlite3 will be started at runtime, saving memory space; Sqlite3 will maintain a memory space at runtime to optimize query speed, and multiple DBs will share a cache space when opened. This solution is based on the business scenario of the game, optimizes this memory, modifies the default cache size parameters, reduces the default cache size at runtime, and reduces the runtime memory from 20MB to 3MB.
[0093] This embodiment implements an automatic data caching solution. Each time a file is obtained from the database, the game configuration data is cached in a hash table, using the data attribute ID as the key. The entire table data can also be directly cached, so that the corresponding data is searched from the memory during the second read, avoiding memory leaks caused by multiple instances of the same row of data, improving query efficiency, and users do not need to worry about the specific internal details.
[0094] In this embodiment, the SQL for range search and conditional search is encapsulated. For example, for the SQL statement, select * from table where id from 1 to 10, when used in the format of lua of the exported game configuration data, it is only necessary to execute table[1,10], which reduces the search time. The controller class is used to encapsulate the SQL statement using the metatable of the embedded script, and the operation of sqlite3 is encapsulated on the C# side. For example, calling the C interface to obtain data, converting the data into C# type, and managing the control handle of the DB are all encapsulated. By using overloaded operators, the usage is the same as using C# arrays to query data, and users do not need to worry about the details. For example, for the SQL statement, select * from table where id == 10, when used in Lua, you only need to execute table
[10] ; the code is optimized on the C# side, and the anonymous temporary delegate generated by the lambda expression is changed to an explicitly declared and cached delegate instance, reducing the GC (GCAlloc) caused by the LINQ statement; the Lua side and the C# side can also provide interfaces for controlling the DB switch, and all DBs can be manually closed through the interface during hot update.
[0095] The solution of this embodiment effectively reduces the memory usage when the client calls the game configuration data, and meets the usage requirements of different project teams. In the actual use of the project team, before using this solution, lua occupies 132MB of memory, and after use it is 81MB, and the database engine sqlite3 has an additional overhead of 6MB, saving a total of 45MB of memory.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0097] Example 2
[0098] In the present embodiment, a device for calling game configuration data is also provided to implement the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated here. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0099] Figure 6 is a structural block diagram of a device for calling game configuration data according to an embodiment of the present invention. Figure 6 As shown, the device includes: a reading module 60, an exporting module 62, and a calling module 64, wherein:
[0100] A reading module 60, used for reading configuration information of a plurality of source table files, wherein the configuration information is used for indicating data usage rules of the source table files;
[0101] An export module 62, for exporting the game configuration data in each source table file to a database file of a database engine based on the configuration information, wherein the database file is stored on a disk;
[0102] The calling module 64 is used to call the game configuration data from the database file to the memory using an embedded script.
[0103] Optionally, the export module includes: a verification unit, used to verify the legitimacy of the game configuration data in the source table file; an export unit, used to export a metadata table of the game configuration data from the source table file, export a data table of the game configuration data from the source table file, export a log file of the game configuration data from the source table file, and export an auxiliary file of the game configuration data from the source table file if the game configuration data in the source table file is legal, wherein the auxiliary file is used to generate prompt information in a code editor; and a copying unit, used to copy the metadata table, the data table, the log file, and the auxiliary file to a database file that matches the configuration information.
[0104] Optionally, the verification unit includes: a conversion subunit, used to convert the source table file into a two-dimensional array; a reading subunit, used to read the header segment and data segment of the source table file from the two-dimensional array; an integration subunit, used to use the header segment to integrate the data segment to obtain intermediate data; a verification subunit, used to traverse the intermediate data and perform at least one of the following verification steps on the intermediate data: verifying whether the header format of the intermediate data is correct, verifying whether there are blank lines in the intermediate data, verifying whether the key values of the intermediate data are repeated, verifying whether the data format of the intermediate data is correct, and verifying whether the table association identifier of the intermediate data is valid; a determination subunit, used to determine that the game configuration data in the source table file is legal if the intermediate data verification passes.
[0105] Optionally, the export unit includes: an extraction subunit, used to extract the table name and rule content from the source table file, wherein the rule content includes the following data items: the database name of the database to which the table belongs, the data format of each column in the table, and the association information of the table; a storage subunit, used to store the rule content in a key-value format, and record multiple data items of the rule content in multiple tables, wherein the key is the table name, the value is the rule content, and each data item corresponds to a table; a recording subunit, used to record the multiple tables in the same metadata database to obtain a metadata table.
[0106] Optionally, the calling module includes: a calling unit, used to write SQL statements in an embedded script, and call the interface of the database engine in the game script through the embedded script to return a pointer to the data; a processing unit, used to obtain the game configuration data in the database file line by line based on the pointer, and copy the game configuration data line by line to the virtual machine of the embedded script, and convert the game configuration data into the table format of the embedded script in the virtual machine, wherein the virtual machine runs in memory.
[0107] Optionally, the processing unit includes: a mapping subunit, used to compile the database engine of the game script, and map each database file of the database engine into a physical file, wherein the physical file includes a number of data stored in Pages of the same size, and the relationship between multiple Pages is stored in a B+ tree structure and indexed by a pointer index of the B+ tree structure; an indexing subunit, used to run the database engine, load the pointer into memory, and index the game configuration data line by line on the disk through the pointer.
[0108] Optionally, the processing unit further includes: an export subunit, used to export the game configuration data to an encryption module using the encryption function interface of the embedded script after the index subunit indexes the game configuration data line by line in the disk through the pointer, wherein the encryption module is used to perform Advanced Encryption Standard AES encryption on each page separately; an encryption subunit, used to import the encrypted game configuration data into the memory using the encryption function interface; and a processing subunit, used to transfer the key into the memory using the decryption function interface of the embedded script, and use the key to decrypt the encrypted game configuration data.
[0109] Optionally, the calling module also includes: an adding unit, used to compile the embedded script and the database engine into two dynamic libraries, and add an interface in the function library of the database engine before the calling unit calls the interface of the database engine in the game script through the embedded script to return a pointer to the data, wherein the embedded script and the database engine use the same function library; an injection unit, used to inject the interface into the virtual machine of the embedded script.
[0110] Optionally, the calling unit includes: an encapsulation subunit, used to encapsulate the SQL statement using the metatable of the embedded script, pass in the table ID, and generate the SQL statement; a query subunit, used to query the SQL string matching the metatable, wherein an SQL string is pre-cached for the SQL statement of each metatable.
[0111] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0112] Example 3
[0113] The present application also provides an electronic device, Figure 7 is a structural diagram of an electronic device according to an embodiment of the present invention. Figure 7 As shown, it includes a processor 71, a communication interface 72, a memory 73 and a communication bus 74, wherein the processor 71, the communication interface 72, and the memory 73 communicate with each other through the communication bus 74, and the memory 73 is used to store computer programs;
[0114] The processor 71 is used to execute the program stored in the memory 73 to implement the following steps: read the configuration information of several source table files, wherein the configuration information is used to indicate the data usage rules of the source table files; for each source table file, export the game configuration data in the source table file to the database file of the database engine based on the configuration information, wherein the database file is stored on the disk; and use an embedded script to call the game configuration data from the database file to the memory.
[0115] Optionally, exporting the game configuration data in the source table file to the database file of the database engine based on the configuration information includes: performing a legality check on the game configuration data in the source table file; if the game configuration data in the source table file is legal, exporting a metadata table of the game configuration data from the source table file, exporting a data table of the game configuration data from the source table file, exporting a log file of the game configuration data from the source table file, and exporting an auxiliary file of the game configuration data from the source table file, wherein the auxiliary file is used to generate prompt information in a code editor; and copying the metadata table, the data table, the log file, and the auxiliary file to a database file that matches the configuration information.
[0116] Optionally, performing a validity check on the game configuration data in the source table file includes: converting the source table file into a two-dimensional array; reading a header segment and a data segment of the source table file from the two-dimensional array; using the header segment to perform data integration on the data segment to obtain intermediate data; traversing the intermediate data, and performing at least one of the following verification steps on the intermediate data: verifying whether the header format of the intermediate data is correct, verifying whether there are blank rows in the intermediate data, verifying whether the key values of the intermediate data are repeated, verifying whether the data format of the intermediate data is correct, and verifying whether the table association identifier of the intermediate data is valid; if the intermediate data verification passes, it is determined that the game configuration data in the source table file is legal.
[0117] Optionally, exporting the metadata table of the game configuration data from the source table file includes: extracting the table name and rule content from the source table file, wherein the rule content includes the following data items: the database name of the database to which the table belongs, the data format of each column in the table, and the association information of the table; storing the rule content in a key-value format, and recording multiple data items of the rule content in multiple tables, wherein the key is the table name, the value is the rule content, and each data item corresponds to a table.
[0118] Optionally, using an embedded script to call the game configuration data from the database file to the memory includes: writing an SQL statement in the embedded script, calling the interface of the database engine in the game script through the embedded script to return a pointer to the data; obtaining the game configuration data in the database file line by line based on the pointer, and copying the game configuration data line by line to the virtual machine of the embedded script, and converting the game configuration data into the table format of the embedded script in the virtual machine, wherein the virtual machine runs in the memory.
[0119] Optionally, obtaining the game configuration data in the database file line by line based on the pointer includes: compiling the database engine of the game script, mapping each database file of the database engine to a physical file, wherein the physical file includes a number of data stored in Pages of the same size, and the relationship between the multiple Pages is stored in a B+ tree structure, which is indexed by a pointer index of the B+ tree structure; running the database engine, loading the pointer into memory, and indexing the game configuration data line by line on the disk through the pointer.
[0120] Optionally, after indexing the game configuration data line by line in the disk through the pointer, the method further includes: exporting the game configuration data to an encryption module using the encryption function interface of the embedded script, wherein the encryption module is used to perform Advanced Encryption Standard AES encryption on each page separately; importing the encrypted game configuration data into the memory using the encryption function interface; transferring the key into the memory using the decryption function interface of the embedded script, and using the key to decrypt the encrypted game configuration data.
[0121] Optionally, before calling the interface of the database engine in the game script through the embedded script to return a pointer to the data, the method also includes: compiling the embedded script and the database engine into two dynamic libraries, adding an interface in the function library of the database engine, wherein the embedded script and the database engine use the same function library; and injecting the interface into the virtual machine of the embedded script.
[0122] Optionally, writing SQL statements in the embedded script includes: encapsulating the SQL statements using a metatable of the embedded script, passing in a table ID, and generating SQL statements; querying an SQL string that matches the metatable, wherein an SQL string is pre-cached for each SQL statement in the metatable.
[0123] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0124] The communication interface is used for communication between the above terminal and other devices.
[0125] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0126] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0127] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method for calling game configuration data described in any of the above embodiments.
[0128] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the method for calling game configuration data described in any one of the above embodiments.
[0129] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0130] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0131] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0132] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0133] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0134] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0135] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0136] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for calling game configuration data, characterized in that: include: Reading configuration information of a plurality of source table files, wherein the configuration information is used to indicate data usage rules of the source table files; For each source table file, exporting the game configuration data in the source table file to a database file of a database engine based on the configuration information, wherein the database file is stored on a disk; Using an embedded script to call the game configuration data from the database file into the memory; Among them, using an embedded script to call the game configuration data from the database file to the memory includes: writing SQL statements in the embedded script, compiling the embedded script and the database engine into two dynamic libraries, adding an interface in the function library of the database engine, wherein the embedded script and the database engine use the same function library; injecting the interface into the virtual machine of the embedded script, calling the interface of the database engine in the game script through the embedded script to return a pointer to the data; obtaining the game configuration data in the database file line by line based on the pointer, and copying the game configuration data line by line to the virtual machine of the embedded script, and converting the game configuration data into the table format of the embedded script in the virtual machine, wherein the virtual machine runs in the memory.
2. The method according to claim 1, characterized in that Exporting the game configuration data in the source table file to the database file of the database engine based on the configuration information includes: Performing a legality check on the game configuration data in the source table file; If the game configuration data in the source table file is legal, export the metadata table of the game configuration data from the source table file, export the data table of the game configuration data from the source table file, export the log file of the game configuration data from the source table file, and export the auxiliary file of the game configuration data from the source table file, wherein the auxiliary file is used to generate prompt information in the code editor; The metadata table, the data table, the log file, and the auxiliary file are copied to a database file that matches the configuration information.
3. The method according to claim 2, characterized in that The legitimacy check of the game configuration data in the source table file includes: Convert the source table file into a two-dimensional array; Reading the header segment and the data segment of the source table file from the two-dimensional array; Using the header segment to perform data integration on the data segment to obtain intermediate data; Traversing the intermediate data, performing at least one of the following verification steps on the intermediate data: verifying whether the table header format of the intermediate data is correct, verifying whether there are blank lines in the intermediate data, verifying whether the key values of the intermediate data are repeated, verifying whether the data format of the intermediate data is correct, and verifying whether the table association identifier of the intermediate data is valid; If the intermediate data verification passes, it is determined that the game configuration data in the source table file is legal.
4. The method according to claim 2, characterized in that The metadata table for exporting the game configuration data from the source table file includes: Extracting a table name and rule content from the source table file, wherein the rule content includes the following data items: a database name of a database to which the table belongs, a data format of each column in the table, and association information of the table; The rule content is stored in a key-value format, and multiple data items of the rule content are recorded in multiple tables, where the key is the table name, the value is the rule content, and each data item corresponds to a table; The multiple tables are recorded in the same metadata database to obtain a metadata table.
5. The method according to claim 1, characterized in that Acquiring the game configuration data in the database file line by line based on the pointer includes: Compile the database engine of the game script, and map each database file of the database engine into a physical file, wherein the physical file includes a plurality of data stored in Pages of the same size, and the relationship between the plurality of Pages is stored in a B+ tree structure and indexed by a pointer index of the B+ tree structure; The database engine is run, the pointer is loaded into the memory, and the game configuration data is indexed line by line in the disk through the pointer.
6. The method according to claim 5, characterized in that After indexing the game configuration data line by line in the disk through the pointer, the method further includes: The game configuration data is exported to an encryption module using the encryption function interface of the embedded script, wherein the encryption module is used to perform Advanced Encryption Standard AES encryption on each page individually; Importing the encrypted game configuration data into the memory using the encryption function interface; The decryption function interface of the embedded script is used to transfer the key into the memory, and the encrypted game configuration data is decrypted using the key.
7. The method according to claim 1, characterized in that Writing SQL statements in an embedded script involves: The SQL statement is encapsulated by using the metatable of the embedded script, the table id is passed in, and the SQL statement is generated; The SQL string matching the metatable is queried, wherein an SQL string is pre-cached for the SQL statement of each metatable.
8. A device for calling game configuration data, characterized in that: include: A reading module, used for reading configuration information of a plurality of source table files, wherein the configuration information is used for indicating data usage rules of the source table files; An export module, for exporting the game configuration data in each source table file to a database file of a database engine based on the configuration information, wherein the database file is stored on a disk; A calling module, used for calling the game configuration data from the database file to the memory using an embedded script; The calling module includes: a calling unit, which is used to write SQL statements in an embedded script, compile the embedded script and the database engine into two dynamic libraries, and add an interface in the function library of the database engine, wherein the embedded script and the database engine use the same function library; inject the interface into the virtual machine of the embedded script, and call the interface of the database engine in the game script through the embedded script to return a pointer to the data; a processing unit, which is used to obtain the game configuration data in the database file line by line based on the pointer, and copy the game configuration data line by line to the virtual machine of the embedded script, and convert the game configuration data into the table format of the embedded script in the virtual machine, wherein the virtual machine runs in the memory.
9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data access method for game client, and client game system
CN106850650A
Data import management method and apparatus, mobile terminal, and storage medium
CN108874866A
A game configuration table loading memory optimization method and device
CN109885395A