Game resource loading method and device, storage medium and electronic device
By obtaining and updating the file path collection in the game application, the level resource files are loaded and updated, and the problem of excessive resource usage and waste in the existing technology is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202010100337.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-18
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2040-02-18
AI Technical Summary
In the prior art, it is difficult to update game resources effectively, resulting in too much resource collection content, too much system computing resources, increasing computing power consumption, and difficult to adjust the original level resources, resulting in wasted resources.
Get the first and second file path collections in the target root directory of the target game application, update the first type of path collection using the second type of file path collection, form a new path collection, and perform the files under each path Load to achieve update of level resource files.
It reduces the use of computing resources, saves resource consumption, improves user experience, and solves the problem of updating game resources.
Smart Images

Figure CN113332730B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method and device for loading game resources, a storage medium and an electronic device. Background Art
[0002] In existing game applications, the game can be set to different game modes, and different game modes correspond to different level resources. When it is necessary to add a specific gameplay to an existing game mode, the content of the specific gameplay is added to the level resources during level creation to generate new level resources, which are called special level resources. Since different game modes may share the same level resources, it is necessary to set different loading methods to achieve different game modes corresponding to different level resources. For example, the game mode that needs to load special level resources is set to A, and the game mode that shares the same resource set with game mode A is set to B. At this time, in order to prevent game mode B from mistakenly loading the special level resources configured for game mode A, the special level resources need to be set to a mode that will not be automatically loaded. After selecting game mode A, the special level resources are actively called by the program to load the special level resources.
[0003] Therefore, after selecting the game mode, the game application needs to scan all resource files in the resource collection. Since the prior art adds special level resources to the resource collection, it will cause too much content in the resource collection, resulting in excessive occupation of system computing resources, increasing the computing power consumption of the hardware used for calculations. In addition, it is difficult to adjust the original level resources, and new special level resources can only be added based on the original level resources, which makes the database used to store level resources occupied too much, thereby causing a waste of resources.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for loading game resources, a storage medium and an electronic device, so as to at least solve the technical problem in the prior art that it is difficult to effectively update game resources.
[0006] According to one aspect of an embodiment of the present invention, a method for loading game resources is provided, comprising: obtaining a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in the target format, the file paths of the first type of files do not include a first string, and the first string is used to indicate that the files under the file path where the first string is located are level resource files in a first game mode of the target game application; obtaining a file path of a second type of file in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all in the target format, the file paths of the second type of files include the first string and a second string, and the second string is used to indicate that the files under the file path where the second string is located are level resource files in a second game mode of the target game application, the first game mode is different from the second game mode, and the file path consists of multiple strings, and the multiple strings include the first string and the second string; updating the first path set using the second path set to obtain a third path set; and loading files under each path in the third path set, wherein the file format of the files under each path in the third path set is the target format.
[0007] Optionally, the use of the second path set to update the first path set to obtain a third path set includes: when the file name of the file under the second file path in the second path set is the same as the file name of the file under the first file path in the first path set, replacing the first file path in the first path set with the second file path.
[0008] Optionally, the use of the second path set to update the first path set to obtain a third path set includes: when the file name of the file under the third file path in the second path set is different from the file name of the file under all file paths in the first path set, adding the third file path to the first path set.
[0009] Optionally, obtaining the file path of the first type of files under the target root directory of the target game application to obtain a first path set includes: searching the target root directory for files with the target format to obtain a file path set of the files with the target format under the target root directory; filtering out the file path containing the first string in the file path set to obtain the first path set.
[0010] Optionally, acquiring the file path of the second type of files in the target root directory to obtain the second path set includes: filtering out the file path including the first character string and the second character string in the file path set to obtain the second path set.
[0011] Optionally, before obtaining the file path of the first type of files in the target root directory of the target game application, the method also includes: displaying a game preparation interface in the target game application, wherein a UI interaction object for identifying the second game mode is displayed on the game preparation interface; and obtaining a target operation to be performed on the UI interaction object in the target game application, wherein the target operation is used to select the second game mode.
[0012] Optionally, the target root directory is a root directory of level resources in the target game application.
[0013] According to another aspect of an embodiment of the present invention, a device for loading game resources is provided, comprising: a first acquisition module, configured to acquire file paths of first-category files in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first-category files are all in the target format, the file paths of the first-category files do not include a first string, and the first string is used to indicate that the files under the file path where the first string is located are level resource files in a first game mode in the target game application; a second acquisition module, configured to acquire file paths of second-category files in the target root directory to obtain a second path set, wherein the file formats of the second-category files are all in the target format, the file paths of the second-category files include the first string and a second string, and the second string is used to indicate that the files under the file path where the second string is located are level resource files in a second game mode in the target game application, the first game mode is different from the second game mode, and the file path consists of a plurality of strings, and the plurality of strings include the first string and the second string; an update module, configured to update the first path set using the second path set to obtain a third path set; and a loading module, configured to load files under each path in the third path set, wherein the file formats of the files under each path in the third path set are all in the target format.
[0014] Optionally, the update module includes: a replacement unit, used to replace the first file path in the first path set with the second file path when the file name of the file under the second file path in the second path set is the same as the file name of the file under the first file path in the first path set.
[0015] Optionally, the update module includes: an adding unit, used to add the third file path in the second path set to the first path set when the file name of the file under the third file path in the second path set is different from the file name of the file under all file paths in the first path set.
[0016] Optionally, the first acquisition module includes: a search unit, used to search for files with the target format in the target root directory, and obtain a file path set of files with the target format in the target root directory; and a filtering unit, used to filter out file paths containing the first string in the file path set, and obtain the first path set.
[0017] Optionally, the second acquisition module includes: a screening unit, configured to screen out file paths including the first character string and the second character string from the file path set to obtain the second path set.
[0018] Optionally, the device is also used to: display a game preparation interface in the target game application before obtaining the file path of the first type of files in the target root directory of the target game application, wherein the game preparation interface displays a UI interaction object for identifying the second game mode; and obtain a target operation to be performed on the UI interaction object in the target game application, wherein the target operation is used to select the second game mode.
[0019] Optionally, the target root directory is a root directory of level resources in the target game application.
[0020] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for loading game resources when running.
[0021] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the game resource loading method through the computer program.
[0022] In an embodiment of the present invention, a first path set and a second path set of files are obtained under a target root directory of a target game application, the first path set does not include a first string for indicating that a file under a file path where a first string is located is a level resource file under a first game mode in the target game application, the second path set includes the above-mentioned first string and a second string for indicating that a file under a file path where a second string is located is a level resource file under a second game mode in the target game application, the first game mode is different from the second game mode, the file path is composed of a plurality of strings, the plurality of strings include a first string and a second string, the first path set is updated using the second path set to obtain a third path set, and the files under each path in the third path set are loaded, thereby achieving the purpose of updating the level resource file, thereby achieving the technical effect of reducing the occupied computing resources, saving computing resource consumption, and improving the user experience, thereby solving the technical problem that it is difficult to effectively update game resources in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] 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:
[0024] Figure 1 is a schematic diagram of an application environment of a method for loading game resources according to an embodiment of the present invention;
[0025] Figure 2 is a flowchart of an optional method for loading game resources according to an embodiment of the present invention;
[0026] Figure 3 is a schematic diagram of an optional method for loading game resources according to an embodiment of the present invention;
[0027] Figure 4 is a schematic diagram of another optional method for loading game resources according to an embodiment of the present invention;
[0028] Figure 5 is a flowchart of another optional method for loading game resources according to an embodiment of the present invention;
[0029] Figure 6 is a schematic structural diagram of an optional game resource loading device according to an embodiment of the present invention;
[0030] Figure 7 is a schematic structural diagram of another optional game resource loading device according to an embodiment of the present invention;
[0031] Figure 8is a schematic structural diagram of another optional game resource loading device according to an embodiment of the present invention;
[0032] Fig. 9 It is a structural schematic diagram of yet another optional game resource loading device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] First, some nouns or terms involved in the embodiments of the present application are explained:
[0036] UE:unreal, a commercial game engine.
[0037] GameMode: Game mode is used to determine the rules of the game application. It exists in the form of resources in UE. A game mode needs to be set before each game starts.
[0038] GameMode Identifier String: A unique string that identifies the game mode.
[0039] WorldComposition: World composition, UE's large world terrain management solution.
[0040] Sublevel: The basic unit of world composition. WorldComposition manages all sublevels.
[0041] StreamLevel: The resource object of the sublevel managed by WorldComposition.
[0042] Streaming Loading: A technical implementation of WorldComposition that automatically loads and unloads levels based on the player's distance from the level.
[0043] The present invention will be described below in conjunction with embodiments:
[0044] According to one aspect of an embodiment of the present invention, a method for loading game resources is provided. Optionally, in this embodiment, the method for loading game resources can be applied to Figure 1 In the hardware environment composed of the server 101 and the user terminal 103 shown in FIG. Figure 1 As shown, the server 101 is connected to the terminal 103 via a network, and can be used to provide services (such as application services, conference services, game services, etc.) for the user terminal or the client installed on the user terminal. A database 105 can be set on the server or independently of the server to provide data storage services for the server 101. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network. The user terminal 103 is not limited to a PC, a mobile phone, a tablet computer, etc., and the game application 107 is displayed through the user terminal 103.
[0045] In an optional embodiment, a method for loading game resources is provided. Figure 2 is a flowchart of a method for loading game resources according to an embodiment of the present invention. Figure 2 As shown, the method for loading game resources includes the following steps:
[0046] S202, obtaining a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in a target format, and the file paths of the first type of files do not include a first string, and the first string is used to indicate that the file under the file path where the first string is located is a level resource file in a first game mode of the target game application;
[0047] Optionally, in this embodiment, the first type of file is a target format file that does not include a first string, and the first string may include a string for indicating that the sub-file is a file path of a resource collection related to a game mode level, for example, Figure 3 is a schematic diagram of an optional method for loading game resources according to an embodiment of the present invention, such as Figure 3As shown, the folder storing the game mode level related resources is named "game mode level", then "game mode level" is the first string, the target format is the file format of the level resource file, the file format is the file format for constituting the level resource configured based on the game development engine, and the level resource may include but is not limited to map resources, scene configuration resources and other game rule resources. The first path is the file path information of the first type of file.
[0048] S204, obtaining a file path of a second type of file in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all in the target format, the file paths of the second type of files include a first string and a second string, the second string is used to indicate that the file under the file path where the second string is located is a level resource file in a second game mode of the target game application, the first game mode is different from the second game mode, the file path consists of a plurality of strings, and the plurality of strings include the first string and the second string;
[0049] Optionally, in this embodiment, the file path of the second type of file includes the file path represented by the first character string and the second character string, and the second character string is a character string used to identify that the sub-file is a level resource corresponding to the game mode level, such as Figure 3 As shown, the second character string may include but is not limited to a general level of a game mode, a mode level directory A, and a mode level directory B, etc. In other words, the second type of file is a level resource file stored in a folder whose file name includes the second character string. The file path is composed of multiple character strings. For example, the file path of level A may be set to "picture package / game mode level / mode level directory A / level A", wherein "game mode level", "mode level directory A" and "level A" are multiple character strings that constitute the file path. The above is only an example, and the specific representation method of multiple character strings is not specifically limited in the present invention.
[0050] S206, using the second path set to update the first path set to obtain a third path set;
[0051] Optionally, in this embodiment, the above path set may include but is not limited to being represented by a path list, for example, Figure 4 is a schematic diagram of an optional method for loading game resources according to an embodiment of the present invention, such as Figure 4 As shown, the target root directory name is set to "map package", the first string is set to "game mode level", the second string is set to "Iceworld", and the first path set is represented as Figure 4 a in the second path set is expressed as Figure 4b in the figure, use the second path set to update the first path set, and get Figure 4 The third path set shown in c, the number of paths in the above path set is configured according to actual needs, Figure 4 The number of paths in is only an optional embodiment, and the present invention does not impose any specific limitation on the number of specific paths. Specifically, the contents of the first character string and the second character string can be flexibly set according to actual needs, and the present invention also does not impose any limitation on this.
[0052] S208: Load the files under each path in the third path set, wherein the file formats of the files under each path in the third path set are all in the target format.
[0053] Optionally, in this embodiment, the above-mentioned loading method may include but is not limited to the game application actively calling the files under each path in the third path set, and may also include but is not limited to setting the files under each path in the third path set to streaming loading. For example, after selecting the game mode of the game application, by scanning all the sub-levels in the map folder, Stream Level is created according to the sub-levels. In the prior art, the adjustments between different game modes will affect each other. In order not to affect the loading of the original level resource file, the loading mode of the special activity level is set to not be automatically loaded, so that the special level can be called normally. The above-mentioned setting method will pick up the characteristics of streaming loading, and the user experience is poor. By setting the files under each path corresponding to the third path set in WorldComposition to automatically load and unload the level according to the distance from the player to the level, the method of loading the above-mentioned files can be made to continue to maintain the streaming loading method, which can achieve the technical effect of reducing the occupation of computing memory, shortening the loading time, and making the game application more fluent, thereby achieving the technical effect of improving the user experience. After loading the files under each path in the third path set, it can be determined that the game of the current game mode has officially started or is preparing to start the countdown.
[0054] Through this embodiment, a first path set and a second path set of files are obtained under the target root directory of the target game application. The first path set does not include a first character string used to indicate that the file under the file path where the first character string is located is a level resource file in the game mode of the target game application. The second path set includes the above-mentioned first character string and a second character string used to indicate that the file under the file path where the second character string is located is a level resource file in the target game mode of the target game application. The first path set is updated using the second path set to obtain a third path set, and the files under each path in the third path set are loaded, thereby achieving the purpose of updating the level resource file, thereby achieving the technical effect of reducing the occupied computing resources, saving computing resource consumption, and improving the user experience, thereby solving the technical problem that it is difficult to effectively update game resources in the prior art.
[0055] In an optional embodiment, the first path set is updated using the second path set to obtain a third path set, including: when the file name of the file under the second file path in the second path set is the same as the file name of the file under the first file path in the first path set, the first file path in the first path set is replaced with the second file path.
[0056] Optionally, in this embodiment, if Figure 4 As shown, Figure 4 If the file name of the level resource in the first path set a is "Level A", and the file name of the level resource in the second path set b is also "Level A", which is the same as "Level A" in the first path set a, then the first file path about "Level A" in the first path set is replaced with the second file path about "Level A" in the second path set. In other words, the first path set is updated by using the second path set, and the files in the second path set are used to overwrite the files in the first path set with the same file name as the second path set.
[0057] Optionally, in the present embodiment, the above-mentioned use of files in the second path set to overwrite files in the first path set with the same file name as the second path set may also include but is not limited to setting files with the same file name as the second path set to blank content, so as to delete files with the same file name in the original first path set. In other words, the deletion operation is achieved by replacing files in the first path set with files in the second path set with the same file name but blank content.
[0058] Optionally, in this embodiment, the specific replacement process may be as follows:
[0059] Take out an element from the second path set: the element is a path, convert the path into a file name, for example, "map package / game mode level / IceWorld / level A" is converted into "level A", traverse the first path set, take out a path each time, and convert the path into a file name, for example, "map package / basic level / level B" is converted into "level B";
[0060] Determine whether the file name in 1) is the same as the file name returned in 2), if so, replace the path of the file name in the first path set with the file name path in the second path set to obtain the third path set.
[0061] The above operation will traverse the second path set and perform it on all elements of the second path set.
[0062] Through this embodiment, the newly added special level resources can cover the original level, thereby achieving the purpose of adjusting the original level resources, and can solve the problem that the existing technology can only add levels based on the original levels, wasting the level resource storage space.
[0063] In an optional embodiment, the first path set is updated using the second path set to obtain a third path set, including: when the file name of the file under the third file path in the second path set is different from the file name of the file under all file paths in the first path set, the third file path is added to the first path set.
[0064] Optionally, in this embodiment, if Figure 4 As shown, Figure 4 The file names of the level resources in the first path set a are "Level A", "Level B" and "Level C", and there is a level resource with the file name "Level D" in the second path set b, which is different from the file names of all level resources in the first path set a.
[0065] Through this embodiment, the newly added special level resources can be added to the Stream Level by configuring a new file name. Since there is no "Level D" in the first path set, there are no level resources that can interact with "Level D". Streaming loading of level resources can be achieved, that is, automatic loading and unloading can be achieved according to the distance between the player and the level, thereby achieving the technical effect of saving computing resources, improving user experience, and reducing loading time.
[0066] In an optional embodiment, the file path of the first type of files is obtained in the target root directory of the target game application to obtain a first path set, including: searching for files with a target format in the target root directory to obtain a file path set of files with a target format in the target root directory; filtering out file paths containing a first string in the file path set to obtain a first path set.
[0067] Optionally, in this embodiment, all file paths under the root directory are returned by calling a preset game application program interface, and a determination is made as to whether the first string is contained in all the returned file paths. When the determination result is that the file path contains the first string, the file path containing the first string is skipped and the search continues. When the determination result is that the file path does not contain the first string, the file path is added to the first path set. For example, the path of level A is "map package / game mode level / mode level directory A / level A". Because the path contains "game mode level" (corresponding to the aforementioned first string), the level is filtered out. The path of level B is "map package / basic level / level B". Because it does not contain "game mode level", "map package / basic level / level B" is added to the first path set. The above-mentioned first path set may include but is not limited to the aforementioned Stream Level and other lists for storing file paths.
[0068] The above is only an example. The content of the specific character string and the content of the path list may include but are not limited to a combination of one or more of the above, and the present invention does not make any specific limitation on this.
[0069] Through this embodiment, by searching all file paths and extracting all file paths that do not contain the first character string, it is possible to filter the file paths and distinguish different file paths based on the content of the first character string.
[0070] In an optional embodiment, obtaining the file path of the second type of files in the target root directory to obtain the second path set includes: filtering out the file path including the first character string and the second character string in the file path set to obtain the second path set.
[0071] Optionally, in this embodiment, after the above call to the preset game application program interface returns all the file paths in the root directory, all the file paths in the returned root directory are scanned according to the GameMode identification string (corresponding to the second string), and taking the first string as "game mode level" and the second string as "IceWorld" as an example, all the file paths containing the first string "game mode level" and the second string "IceWorld" are added to the second path set. The above second path set may include but is not limited to the aforementioned Stream Level and other lists for storing file paths.
[0072] Through this embodiment, by using the first character string and the second character string as filtering conditions, the level resource file paths that need to be called when the game mode is "IceWorld" can be effectively filtered out, which is convenient for subsequent search and automatic loading or unloading, saving computing resources, improving computing efficiency, and optimizing the user experience.
[0073] In an optional embodiment, before obtaining the file path of the first type of files in the target root directory of the target game application, the above method also includes: displaying a game preparation interface in the target game application, wherein a UI interaction object for identifying the target game mode is displayed on the game preparation interface; obtaining a target operation performed on the UI interaction object in the target game application, wherein the target operation is used to select the target game mode.
[0074] Optionally, in this embodiment, the target game application may include but is not limited to adventure games, chess and card games, shooting games and other game applications that require preset game rules. Figure 1 On the user terminal 103 where the game application 107 is located, the UI (user interface) interaction objects may include but are not limited to Figure 1 The A mode, B mode, C mode and other interactive buttons shown in the figure, the above target operations may include but are not limited to touch operations, voice recognition, gesture recognition and other operations that can trigger interaction with the UI interactive object.
[0075] The above is only an example. The present invention may include one or more combinations of the above operation modes for interacting with the UI interaction object, and the present invention does not make any specific limitation on this.
[0076] In an optional embodiment, the target root directory is the root directory of the level resources in the target game application.
[0077] Optionally, in this embodiment, the target root directory may include but is not limited to the parent folder of the folder corresponding to the first character string in the file path, for example, Figure 3 The map package shown is an example of an alternative root directory.
[0078] The present invention is described as a whole below in conjunction with specific embodiments:
[0079] Figure 5 FIG. 1 is a flow chart of another optional method for loading game resources according to an embodiment of the present invention. Figure 5 As shown, the specific process of the above embodiment includes:
[0080] S502, start.
[0081] S504, establish a list set for storing the level paths that need to be loaded, called a level path set (corresponding to the aforementioned path set).
[0082] S506, scanning all sub-levels in the map package, filtering out the game mode level directory, and adding the scanned level path to the collection in step S504.
[0083] S508, scanning the game mode level directory according to the game mode identification string, and scanning out the level corresponding to the game mode.
[0084] S510, determine whether the level scanned from the game mode directory has the same name as the level in the basic level target path. If the judgment result is yes, jump to step S512, otherwise, jump to S514.
[0085] S512: Replace the level path in the basic level in the level path set with the level path in the game mode.
[0086] S514, adding the game mode level path to the level path set.
[0087] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0088] According to another aspect of an embodiment of the present invention, a device for loading game resources for implementing the above-mentioned method for loading game resources is also provided. Figure 6 As shown, the device comprises:
[0089] A first acquisition module 602 is used to acquire a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in a target format, and the file paths of the first type of files do not include a first string, and the first string is used to indicate that the file under the file path where the first string is located is a level resource file in a first game mode of the target game application;
[0090] A second acquisition module 604 is used to acquire the file path of the second type of files in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all the target format, the file path of the second type of files includes the first string and the second string, the second string is used to indicate that the file under the file path where the second string is located is a level resource file in the second game mode of the target game application, the first game mode is different from the second game mode, and the file path consists of multiple strings, and the multiple strings include the first string and the second string;
[0091] An updating module 606, configured to update the first path set using the second path set to obtain a third path set;
[0092] The loading module 608 is used to load files under each path in the third path set, wherein the file format of each path in the third path set is the target format.
[0093] In an optional embodiment, if Figure 7 As shown, the update module 606 includes: a replacement unit 702, which is used to replace the first file path in the first path set with the second file path when the file name of the file under the second file path in the second path set is the same as the file name of the file under the first file path in the first path set.
[0094] In an optional embodiment, if Figure 7 As shown, the update module 606 includes: an adding unit 704, which is used to add the third file path to the first path set when the file name of the file under the third file path in the second path set is different from the file name of the file under all the file paths in the first path set.
[0095] In an optional embodiment, if Figure 8As shown, the first acquisition module 602 includes: a search unit 802, used to search for files with the target format in the target root directory, and obtain a file path set of files with the target format in the target root directory; a filtering unit 804, used to filter out file paths containing the first string in the file path set, and obtain the first path set.
[0096] In an optional embodiment, if Fig. 9 As shown, the second acquisition module 604 includes: a screening unit 902, which is used to screen out the file paths including the first character string and the second character string in the file path set to obtain the second path set.
[0097] In an optional embodiment, the device is also used to: display a game preparation interface in the target game application before obtaining the file path of the first type of files in the target root directory of the target game application, wherein the game preparation interface displays a UI interaction object for identifying the second game mode; and obtain a target operation to be performed on the UI interaction object in the target game application, wherein the target operation is used to select the second game mode.
[0098] In an optional embodiment, the target root directory is the root directory of the level resources in the target game application.
[0099] According to another aspect of an embodiment of the present invention, there is also provided an electronic device for implementing the above-mentioned method for loading game resources, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor being configured to execute the steps in any one of the above-mentioned method embodiments through the computer program.
[0100] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0101] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0102] S1, obtaining a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in a target format, and the file paths of the first type of files do not include a first string, and the first string is used to indicate that the file under the file path where the first string is located is a level resource file in a first game mode of the target game application;
[0103] S2, obtaining a file path of a second type of file in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all in the target format, the file path of the second type of files includes a first string and a second string, the second string is used to indicate that the file under the file path where the second string is located is a level resource file in a second game mode in the target game application, the first game mode is different from the second game mode, the file path consists of a plurality of strings, and the plurality of strings includes the first string and the second string;
[0104] S3, using the second path set to update the first path set to obtain a third path set;
[0105] S4, loading files under each path in the third path set, wherein the file formats of the files under each path in the third path set are all target formats.
[0106] Alternatively, those skilled in the art will appreciate that the above structure is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. For example, the electronic device may also include more or fewer components (such as a network interface, etc.) than those described above, or may have different configurations than those described above.
[0107] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the loading method and device of game resources in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned loading method of game resources. The memory 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 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof. Among them, the memory can be specifically used for information such as level resource files or path lists, but is not limited to. As an example, the above-mentioned memory may include but is not limited to the first acquisition module 602, the second acquisition module 604, the update module 606, and the loading module 608 in the above-mentioned loading device of game resources. In addition, it may also include but is not limited to the loading of the above-mentioned game resources. Other module units in the device are not repeated in this example.
[0108] Optionally, the transmission device is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0109] In addition, the electronic device further comprises: a display for displaying a shooting application interface; and a connection bus for connecting various module components in the electronic device.
[0110] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0111] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0112] S1, obtaining a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in a target format, and the file paths of the first type of files do not include a first string, and the first string is used to indicate that the file under the file path where the first string is located is a level resource file in a first game mode of the target game application;
[0113] S2, obtaining a file path of a second type of file in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all in the target format, the file path of the second type of files includes a first string and a second string, the second string is used to indicate that the file under the file path where the second string is located is a level resource file in a second game mode in the target game application, the first game mode is different from the second game mode, the file path consists of a plurality of strings, and the plurality of strings includes the first string and the second string;
[0114] S3, using the second path set to update the first path set to obtain a third path set;
[0115] S4, loading files under each path in the third path set, wherein the file formats of the files under each path in the third path set are all target formats.
[0116] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0117] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0118] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, 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, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0119] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0120] In the several embodiments provided in the present application, it should be understood that the disclosed client 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.
[0121] 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.
[0122] In addition, each functional unit in each embodiment of the present invention 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.
[0123] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for loading game resources, characterized in that: include: Obtaining a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in a target format, and the file paths of the first type of files do not include a first string, and the first string is used to indicate that the file under the file path where the first string is located is a level resource file in a first game mode of the target game application; Obtaining a file path of a second type of file in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all the target format, the file path of the second type of files includes the file path where the first string is located and the file path represented by the second string, the second string is used to indicate that the file under the file path where the second string is located is a level resource file in the second game mode of the target game application, the first game mode is different from the second game mode, and the file path consists of multiple strings, and the multiple strings include the first string and the second string; The first path set is updated according to the file names of the files under each file path in the second path set to obtain a third path set; The files under each path in the third path set are loaded, wherein the file formats of the files under each path in the third path set are all the target formats.
2. The method according to claim 1, characterized in that The updating of the first path set according to the file names of the files under each file path in the second path set to obtain a third path set includes: When the file name of the file under the second file path in the second path set is the same as the file name of the file under the first file path in the first path set, the first file path in the first path set is replaced by the second file path.
3. The method according to claim 1, characterized in that The updating of the first path set according to the file names of the files under each file path in the second path set to obtain a third path set includes: When the file names of the files under the third file path in the second path set are different from the file names of the files under all the file paths in the first path set, the third file path is added to the first path set.
4. The method according to claim 1, characterized in that: The step of obtaining the file path of the first type of files in the target root directory of the target game application to obtain a first path set includes: Searching for files in the target format under the target root directory to obtain a set of file paths of the files in the target format under the target root directory; The file paths containing the first character string are filtered out from the file path set to obtain the first path set.
5. The method according to claim 4, characterized in that The step of obtaining the file path of the second type of file in the target root directory to obtain a second path set includes: The file paths including the first character string and the second character string are screened out from the file path set to obtain the second path set.
6. The method according to any one of claims 1 to 5, characterized in that Before obtaining the file path of the first type of file in the target root directory of the target game application, the method further includes: Displaying a game preparation interface in the target game application, wherein a UI interaction object for identifying the second game mode is displayed on the game preparation interface; A target operation performed on the UI interaction object is obtained in the target game application, wherein the target operation is used to select the second game mode.
7. The method according to any one of claims 1 to 5, characterized in that The target root directory is the root directory of the level resources in the target game application.
8. A device for loading game resources, characterized in that: include: A first acquisition module is used to acquire a file path of a first type of file in a target root directory of a target game application to obtain a first path set, wherein the file formats of the first type of files are all in a target format, and the file paths of the first type of files do not include a first string, and the first string is used to indicate that the file under the file path where the first string is located is a level resource file in a first game mode of the target game application; A second acquisition module is used to acquire the file path of the second type of files in the target root directory to obtain a second path set, wherein the file formats of the second type of files are all the target format, the file path of the second type of files includes the first string and the second string, the second string is used to indicate that the file under the file path where the second string is located is a level resource file in the second game mode of the target game application, the first game mode is different from the second game mode, and the file path consists of multiple strings, and the multiple strings include the first string and the second string; An updating module, configured to update the first path set according to the file names of the files under each file path in the second path set to obtain a third path set; A loading module is used to load files under each path in the third path set, wherein the file format of each path in the third path set is the target format.
9. The device according to claim 8, characterized in that The update module includes: A replacement unit is used to replace the first file path in the first path set with the second file path when the file name of the file under the second file path in the second path set is the same as the file name of the file under the first file path in the first path set.
10. The device according to claim 8, characterized in that The update module includes: An adding unit is used to add the third file path in the second path set to the first path set when the file name of the file under the third file path in the second path set is different from the file name of the file under all the file paths in the first path set.
11. The device according to claim 8, characterized in that The first acquisition module includes: A search unit, configured to search for files in the target format under the target root directory, and obtain a set of file paths of the files in the target format under the target root directory; A filtering unit is used to filter out the file paths containing the first character string in the file path set to obtain the first path set.
12. The device according to claim 11, characterized in that The second acquisition module includes: The screening unit is used to screen out the file paths including the first character string and the second character string from the file path set to obtain the second path set.
13. The device according to any one of claims 8 to 12, characterized in that The device is also used for: Before obtaining the file path of the first type of file in the target root directory of the target game application, displaying a game preparation interface in the target game application, wherein a UI interaction object for identifying the second game mode is displayed on the game preparation interface; A target operation performed on the UI interaction object is obtained in the target game application, wherein the target operation is used to select the second game mode.
14. A computer-readable storage medium, the computer-readable storage medium comprising a stored program, wherein: When the program is executed, the method described in any one of claims 1 to 7 is executed.
15. 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 execute the method according to any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Method and device for loading resource files
CN106155750A
Processing method and device of data in game, storage medium and electronic device
CN108553897A