WO2023134276A1 - 资源预加载方法和装置、存储介质及计算机设备 - Google Patents

资源预加载方法和装置、存储介质及计算机设备 Download PDF

Info

Publication number
WO2023134276A1
WO2023134276A1 PCT/CN2022/129496 CN2022129496W WO2023134276A1 WO 2023134276 A1 WO2023134276 A1 WO 2023134276A1 CN 2022129496 W CN2022129496 W CN 2022129496W WO 2023134276 A1 WO2023134276 A1 WO 2023134276A1
Authority
WO
WIPO (PCT)
Prior art keywords
game
resource
static
resources
loading
Prior art date
Application number
PCT/CN2022/129496
Other languages
English (en)
French (fr)
Inventor
梁志铭
边江
邓君
张斯铭
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2023134276A1 publication Critical patent/WO2023134276A1/zh
Priority to US18/357,678 priority Critical patent/US20230364515A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • A63F13/77Game security or game management aspects involving data related to game devices or game servers, e.g. configuration data, software version or amount of memory
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/45Controlling the progress of the video game
    • A63F13/48Starting a game, e.g. activating a game device or waiting for other players to join a multiplayer session
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/53Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game
    • A63F13/533Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game for prompting the player, e.g. by displaying a game menu
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Definitions

  • the present application relates to the technical field of the Internet, in particular, to a resource preloading method and device, storage medium and computer equipment.
  • the basic process of the game usually includes the game preparation stage and the battle stage, for example: a MOBA (Multiplayer Online Battle Arena, multiplayer online Tactical competitive games) games, before entering the battle phase of the game, at least include processes such as the role selection phase and the resource loading phase.
  • the resource loading stage is to load the required resources after the resources required for the current game are analyzed according to the character selection stage.
  • a resource preloading method which is executed by a computer device, including: loading a static resource set of a game during the role selection phase of a game, wherein the role selection phase is used for Select a virtual character to participate in a game, and the static resource set includes resources to be used in a game that are not related to the character configuration information determined in the character selection stage; when the static resource set is loaded in the role selection stage, the In the resource loading phase of a game, the dynamic resource set of a game is loaded, wherein the dynamic resource set includes resources to be used in a game and related to the character configuration information determined in the character selection phase.
  • the above resource preloading method further includes: in the case that some static resources in the static resource collection are loaded in the role selection stage, loading the dynamic resource collection of a game in the resource loading stage of a game, and Load static resources except some static resources in the static resource collection.
  • loading a dynamic resource set of a game, and loading static resources in the static resource set except some static resources include: in the resource loading phase of a game, Parallel loading of the dynamic resource collection of a game and the static resources in the static resource collection except some static resources.
  • the above resource preloading method further includes: in the case of loading a static resource set of a game in the role selection phase of a game, displaying first prompt information during the role selection phase, wherein the first prompt information is used for Prompt that some resources of a game have been loaded in advance; or in the case of loading a static resource collection of a game in the role selection phase of a game, display a second prompt message during the resource loading phase, wherein the second prompt message is used for Prompt that some resources of a game have been loaded in advance.
  • the first prompt information is used to dynamically display the loading progress of the static resources
  • the second prompt information is used to display the proportion of the static resources that have been loaded in advance to the total resources.
  • the above-mentioned loading of the static resource set of a game in the role selection phase of a game includes: sequentially loading or parallel loading each static resource subset in the static resource set in the role selection phase, wherein each static resource
  • the resource subset includes at least one of the following: a scene resource subset in a game, wherein the scene resource subset includes resources of virtual objects appearing on a game map in a game; NPC (Non- Player Character, non-player character) resource subset, wherein, the NPC resource subset includes resources of one or more NPCs in a game.
  • loading each static resource subset in the static resource collection sequentially or in parallel includes: repeatedly performing the following operations until the role selection phase ends or each static resource subset is loaded: If the current static resource is to be used in a game and the resource path information of the current static resource is not stored in the target resource list, store the resource path information of the current static resource in the target resource list; sequentially or in parallel Obtain the resource path information of some static resources that have not been loaded from the target resource list, and load some static resources according to the resource path information of some static resources; perform intra-office object instantiation on some of the loaded static resources, and obtain the location of some static resources Instantiate objects; store instantiated objects of some static resources in the object buffer pool.
  • Static resources other than resources including: when the character selection phase ends when some static resources are loaded, the loading of static resources is suspended, and when the resource loading phase begins, the dynamic resource collection of a game starts to be loaded , and continue to load static resources except some static resources in the static resource collection.
  • the above resource preloading method further includes: storing the loaded static resource set in the target cache in one game; and reusing the static resources from the target cache in the role selection phase of the next game in one game Some or all of the static resources in the resource collection.
  • some or all of the static resources in the static resource collection are reused from the target cache, including: In the case of the same game mode, reuse all static resources in the static resource collection from the target cache; and/or
  • the resource preloading method further includes: after the resource loading phase is over, displaying a game screen of a battle phase of a game according to the loaded static resource set and dynamic resource set.
  • a resource preloading device including: a first loading unit, configured to load a static resource set of a game during the role selection phase of a game, wherein the role The selection phase is used to select a virtual character to participate in a game, and the static resource set includes resources to be used in a game and not related to the character configuration information determined in the role selection phase; the second loading unit is used for character selection When the static resource set is loaded in stages, in the resource loading stage of a game, load the dynamic resource set of a game, wherein the dynamic resource set includes the characters to be used in a game and determined in the character selection stage Resources related to configuration information.
  • a computer device including a memory and one or more processors, wherein computer-readable instructions are stored in the memory, and the one or more processors are configured to The readable instructions execute the resource preloading method described above.
  • a computer program product or computer program where the computer program product or computer program includes computer-readable instructions, and the computer-readable instructions are stored in a computer-readable storage medium.
  • One or more processors of the computer device read the computer-readable instructions from the computer-readable storage medium, and one or more processors execute the computer-readable instructions, so that the computer device executes the resource preloading method above.
  • FIG. 1 is a schematic diagram of an application environment scenario of an optional resource preloading method according to an embodiment of the present application
  • FIG. 2 is a flow chart of an optional resource preloading method according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an optional resource preloading method according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of an optional static resource set and a dynamic resource set according to an embodiment of the present application
  • FIG. 5 is a schematic diagram of an optional loading state of a static resource set and a dynamic resource set according to an embodiment of the present application
  • FIG. 6 is a schematic diagram of another optional loading state of a static resource set and a dynamic resource set according to an embodiment of the present application
  • FIG. 7 is a schematic diagram of yet another optional loading state of a static resource set and a dynamic resource set according to an embodiment of the present application
  • FIG. 8 is a schematic diagram of yet another optional loading state of a static resource set and a dynamic resource set according to an embodiment of the present application
  • FIG. 9 is an optional flowchart for generating offline static resources according to an embodiment of the present application.
  • FIG. 10 is a schematic diagram of key coroutines in an optional resource loading phase according to an embodiment of the present application.
  • Fig. 11 is a schematic diagram of an optional end mode of the role selection phase according to an embodiment of the present application.
  • FIG. 12 is a schematic diagram of an optional release/save resource cache according to an embodiment of the present application.
  • Fig. 13 is a schematic diagram of an optional static resource preloading in different game modes according to an embodiment of the present application.
  • FIG. 14 is an overall flowchart of an optional resource preloading method according to an embodiment of the present application.
  • FIG. 15 is an effect diagram of an optional resource preloading method for testing according to an embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of an optional resource preloading device according to an embodiment of the present application.
  • Fig. 17 is a schematic structural diagram of an optional computer device according to an embodiment of the present application.
  • a resource preloading method is provided.
  • the above resource preloading method can be applied to but not limited to the application scenario shown in FIG. 1
  • the resource preloading system may include but not limited to a client 102 , a network 104 , a server 106 , and a database 108 .
  • the above client 102 includes a human-computer interaction screen, a processor and a memory.
  • the human-computer interaction screen is used to display the game interface of the client (a display interface for resource loading used by a current game as shown in Figure 3); The human-computer interaction operation of the game.
  • the processor is configured to generate an interaction instruction in response to the above human-computer interaction operation, and send the interaction instruction to the server 106 .
  • the memory is used to store relevant attribute data, such as resource path information, character selection information, and game battle screen information.
  • the above-mentioned client 102 can also be referred to as a terminal 102.
  • the terminal 102 can be, but not limited to, various desktop computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices.
  • the Internet of Things devices can be smart speakers, smart TV, smart air conditioner, smart car equipment, etc.
  • Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, and the like.
  • the above server 106 may be implemented by an independent server or a server cluster or cloud server composed of multiple servers.
  • step S102 analyze the resources required by the current game, and generate a resource list
  • step S104 obtain resource paths and other information from the resource list
  • steps S106-108 the server 106 sends resources through the network 104 Information such as the list and resource path is sent to the client 102
  • step S110 the client 102 receives the resource list and resource path, and loads the resources to be referenced by the current game, including static resources and dynamic resources.
  • the static resource collection of the game is preloaded in advance by using the idle time of the role selection stage, and then the dynamic resource collection of the game is loaded in the resource loading stage when the static resource collection is loaded. It avoids the frame rate freeze caused by too long resource loading time in the game, and achieves the purpose of reducing the resource loading time, thereby achieving the technical effect of improving resource loading efficiency, and further solving the resource loading consumption caused by the large amount of game resources. Long technical issues.
  • this embodiment does not limit the execution subject of the above steps S102 to S110 , for example, the above steps S102 to S110 can all be executed on the client 102 .
  • the resource preloading method provided in this application is applied to a computer device as an example.
  • the computer device can be a terminal or a server, and the terminal or server can be executed independently, or can be realized through the interaction between the terminal and the server.
  • FIG. 2 is a flow chart of a resource preloading method according to an embodiment of the present application, and the process includes the following steps:
  • Step S202 in the role selection phase of a game, load the static resource set of a game, wherein, the role selection phase is used to select the virtual character participating in a game, the static resource set includes to be used in a game, and Resources not associated with role configuration information determined during the role selection phase.
  • the above-mentioned static resource collection includes but is not limited to resources that are not related to the role configuration information determined in the role selection stage, wherein the above-mentioned role configuration information may include, but is not limited to, roles and skills determined in the role selection stage , or skins, etc.
  • the above-mentioned character configuration information can continuously change with the input instructions, and the above-mentioned character configuration information can be partially or completely different in two different games.
  • the above-mentioned resources that are not related to role configuration information can be understood as that these static resources and role configuration information are independent of each other.
  • the resources in the static resource set in this embodiment are roles that are not determined during the role selection stage. Resources whose configuration information changes, for example, the static resource set includes resources corresponding to the grass 408 in FIG. 4 .
  • Step S204 when the static resource set is loaded in the character selection stage, load the dynamic resource set of a game in the resource loading stage of a game, wherein the dynamic resource set includes the resources to be used in a game and is related to The resources related to the role configuration information determined in the role selection phase.
  • the above-mentioned dynamic resource collection includes resources related to the character configuration information determined in the role selection stage, that is to say, the dynamic resources in the above-mentioned dynamic resource collection will change with the selected character, skills, skin Or Xingyuan and other players actively choose to change, and the dynamic resources of each game may be different.
  • the resources in the dynamic resource set in this embodiment are resources that will change as the role configuration information changes.
  • the dynamic resource set includes resources corresponding to the role 300 and the skill 303 in FIG. 3 .
  • the resources to be used in a game include but are not limited to static resources and dynamic resources.
  • the static resource collection and dynamic resource collection after loading are rendered to display the game screen of the battle phase of the game.
  • the loading of static resources and dynamic resources is completed in the resource loading stage.
  • the role selection stage only the resources to be used in the current game are analyzed offline, and different tags are set for the resources analyzed offline. To distinguish its category, and then generate the corresponding resource list.
  • the complexity of the game increases, the amount of resources required for a single game will also increase, resulting in a long time-consuming resource loading phase, which reduces the user experience.
  • the static resource collection of the game is preloaded in advance by using the idle time of the character selection phase, and then the When the loading of the static resource collection is completed, the dynamic resource collection of the game is loaded in the resource loading phase.
  • the player selects a character 300 from a character list 301 (such as a hero list) as required in the character selection stage, and can select the skin of the character 300 from the skin list 302 , and at the same time select the skills possessed by the character 300 in the current game (such as skills 303 and skills 305-307 in the figure).
  • a character list 301 such as a hero list
  • the skills possessed by the character 300 in the current game such as skills 303 and skills 305-307 in the figure.
  • roles 1 to 5 form a team
  • roles 6 to 10 form a team
  • role 300 can be, but not limited to, the resource loading stage.
  • the static resource set of this round of game can be loaded in advance
  • the above static resource set can include but not limited to include information that is not related to the role configuration information determined in the role selection stage in Figure 3 Resources
  • the above character configuration information may include but not limited to the character 300 determined in the character selection stage, the skin corresponding to the character 300, the skills 303 used by the character 300 in this game, etc.
  • the above static resource collection may but not limited to include the The scene elements (such as grass, walls) in the map displayed in the combat stage and the resources corresponding to the NPC.
  • a thumbnail map 307 may also be displayed.
  • the resources corresponding to the above-mentioned scene elements (such as grass and walls) and NPCs can be understood as the resources needed to display (or render) the above-mentioned scene elements and NPCs in the combat phase.
  • the above-mentioned dynamic resource set may include, but is not limited to, resources related to the character configuration information determined in the character selection stage in FIG. The skills 303 used by the character 300 in this game, etc.
  • the above dynamic resource collection is used to display corresponding screen elements during the battle phase, for example, the virtual button corresponding to skill 303, the virtual button corresponding to skill 305, the virtual button corresponding to skill 306, the virtual button corresponding to skill 307, the virtual joystick 304, etc.
  • the above dynamic resource set may be understood as the resources needed to display (or render) the above corresponding screen elements in the combat phase.
  • the static resources in the above embodiments may be, but not limited to, resources that are not related to the role configuration information determined in the role selection phase; dynamic resources may be, but not limited to, resources that are related to the role configuration information determined in the role selection phase .
  • static resources are resources that will not change when entering a fixed level game such as matching or ranking; dynamic resources will change with the selected character Changes in , summoner skills, skins or stars, etc. change due to different players' active choices, and the dynamic resources of each round may be different.
  • the static resource is a resource that does not change with the change of the role configuration information
  • the dynamic resource is a resource that changes with the change of the role configuration information.
  • the resource preloading process in this embodiment, a detailed description will be made below in conjunction with FIG. 4 .
  • the above character configuration information can include, but is not limited to: the character 400 selected in the character list 401, the character in the skin list 402 The skin selected by 400, the skills 403 and skills 405-407 used by the character 400 in this game. Before the end of the character selection stage, some or all of the information in the character configuration information can be changed. Therefore, the resources corresponding to the above-mentioned character 400, the skin selected for the character 400, and the skill 403 used by the character 400 in this game are dynamic resources.
  • the static resource collection that needs to be preloaded in advance during the character selection phase may include, but is not limited to, resources that are not related to the above character configuration information, for example, scene elements (such as grass 408, wall body) and resources corresponding to NPCs, the above scene elements and resources corresponding to NPCs will not change with the change of the above role configuration information, therefore, the above scene elements and resources corresponding to NPCs are all static resources.
  • scene elements such as grass 408, wall body
  • the static resource collection is preloaded during the idle time of the character selection stage, and when the static resource collection is loaded, the dynamic resource collection of the game is loaded during the resource loading stage, avoiding The frame rate freeze caused by too long resource loading time in the game achieves the purpose of reducing the resource loading time, thereby achieving the technical effect of improving resource loading efficiency, and further solving the problem of resource loading due to the large amount of game resources. long technical question
  • the resource preloading method above further includes:
  • the loading status of static resources includes at least the following two situations:
  • the first method all static resources are loaded in advance in the role selection stage;
  • the second method load some static resources in advance during the role selection phase.
  • the type and amount of resources to be loaded in the resource loading stage can be determined according to the completion of loading the static resource collection in the role selection stage, which reduces the amount of resources to be loaded in the resource loading stage and saves Resource loading time improves user experience.
  • different coroutines shown in FIG. 5 are used in the resource loading phase to respectively load the dynamic resource set and the remaining static resources in the static resource set.
  • This embodiment can also use other methods to load the remaining static resources in the dynamic resource collection and the static resource collection in the resource loading phase, for example, in the resource loading phase, use the coroutine 1 to sequentially load the dynamic resource collection and the static resource collection The rest of the static resources in the .
  • loading the dynamic resource set of a game, and loading static resources in the static resource set except some static resources include: In the resource loading phase of the game, the dynamic resource collection of a game and the static resources except some static resources in the static resource collection are loaded in parallel.
  • the resource loading stage there are at least the following two loading methods for some static resources and all dynamic resources that have not been loaded in the role selection stage:
  • any one of the above two different loading methods can be selected according to the situation, for example, the above two different loading methods can be selected according to the proportion of static resources not loaded in the role selection stage One of. For example, when the unloaded static resources in the role selection stage are less than or equal to 50%, the above loading method (1) can be selected; when the unloaded static resources in the role selection stage are greater than 50%, the above loading method (2) can be selected .
  • both loading methods reduce the amount of resources that need to be loaded in the resource loading stage.
  • the loading of all resources is completed by adopting parallel loading of static resources and dynamic resources or asynchronous loading in the resource loading phase, thereby improving
  • the flexibility of the resource loading method is improved, the resource loading time is reduced, and the technical effect of improving the resource loading efficiency is realized.
  • the resource preloading method above further includes:
  • a first prompt message is displayed during the character selection phase, wherein the first prompt message is used to prompt that some resources of a game game have been loaded in advance;
  • the second prompt information is displayed during the resource loading phase, wherein the second prompt information is used to prompt that some resources of a game have been loaded in advance.
  • the first prompt information for preloading static resources is set in the display interface of the role selection stage in this embodiment, which is used to dynamically display the loading progress of static resources; or, in The display interface of the resource loading stage is provided with second prompt information, which is used to display the proportion of the resources that have been preloaded in advance at the current moment to the total resources.
  • a progress bar of "30% loaded in advance” may be displayed on the display interface of the role selection phase. It is easy to understand that as the resource loading progress changes, the numbers in the progress bar will also change. For example, as the loading amount of static resources increases, it will dynamically display "40% loaded in advance", “loaded in advance Loading 50%” and other prompt information.
  • second prompt information may also be displayed on the display interface of the resource loading stage, and the second prompt information may be, but not limited to, used to prompt that the static resources that have been loaded in advance in the role selection stage account for the total game resources
  • the above-mentioned total game resources may include the above-mentioned static resource collection and dynamic resource collection.
  • the above-mentioned second prompt information may be displayed, but not limited to, when the character selection phase ends and the resource loading phase is skipped, for example, as shown in (b) in FIG. %".
  • the second prompt information is used to indicate that the The proportion of the loaded static resources to the total resources, in other words, the second prompt information may be the same as the first prompt information at the end of the role selection phase.
  • the display methods of the first prompt information and the second prompt information At least one of the following is present:
  • the first prompt message is only displayed during the character selection stage, and the second prompt message is not displayed during the resource selection stage;
  • the first prompt information is displayed during the character selection stage, and/or the second prompt information is displayed during the resource loading stage, which intuitively reflects the state of resource preloading, so that the resource loading time can be reduced.
  • a progress bar as shown in FIG. 7 to prompt resource preloading is only an example.
  • This embodiment can also use other methods to display the above-mentioned first prompt information and second prompt information, for example, use text, icons, audio or animation or various combinations of the above methods to prompt the preloading of resources during the character selection stage. Condition.
  • the above-mentioned static resource collection of a game is loaded in the role selection phase of a game, including:
  • each static resource subset in the static resource collection is loaded sequentially or in parallel, wherein each static resource subset includes at least one of the following:
  • a subset of scene resources in a game wherein the subset of scene resources includes resources of virtual objects appearing on a game map in a game;
  • a non-player character NPC resource subset in a game wherein the NPC resource subset includes resources of one or more NPCs in a game.
  • classification method is only an example.
  • other classification methods can be used to classify static resources, for example, some of the above four classifications can be included, or according to different Other classification conditions of the above four classification conditions classify static resources.
  • the static resource set includes static resource subsets 803 and 804.
  • a definition for example, may include 3 or 4 or 5 subsets of static resources.
  • the label of the static resource subset 803 is set as the scene resource subset, wherein the scene resource subset 803 includes, but is not limited to, resources corresponding to virtual objects appearing on the game map in the game, for example
  • the resources corresponding to the grass 802 appearing on the game map in the battle phase may also be the resources corresponding to the walls appearing on the game map, the resources corresponding to the lights appearing on the game map, and the like.
  • the label of the static resource subset 804 is set as a non-player NPC resource subset, wherein the NPC resource subset includes resources corresponding to one or more NPCs in a game, for example, the NPC resource subset includes but not Resources limited to NPC 801 as shown in FIG. 8 . It is easy to understand that the number of non-player character NPCs in a game is not limited, and can be one or more as required.
  • the loading methods for the scene resource subset 803 and the non-player NPC resource subset 804 include but are not limited to the following two methods:
  • the first method sequentially loading the scene resource subset 803 and the non-player NPC resource subset 804;
  • the first method loading scene resource subset 803 and non-player NPC resource subset 804 at the same time;
  • the above scene resource subset 803 and non-player NPC resource subset 804 are only exemplary.
  • the number of static resource subsets in the static resource set required for a game is and types are not limited.
  • the manner of loading multiple static resource subsets also includes, but is not limited to loading each static resource subset sequentially or in parallel.
  • managers usually pre-configure resources to be used in different game modes in the editor stage, and generate static resource configuration tables referenced with game levels. For example, the resource corresponding to the color of the grass on the game map in the above embodiment, the resource corresponding to the position of the NPC, and the like.
  • a special editing panel for resource loading has been developed in the editor, through which relevant data during the loading process of game resources can be displayed.
  • the administrator before entering the role selection stage, the administrator needs to generate offline static resources in the editor stage in advance. Specifically, refer to the flow chart shown in FIG. 9 .
  • resource preloading can be performed on each static resource subset in the static resource collection in the role selection stage.
  • the static resource configuration table is generated according to the offline static resources analyzed in the editor stage, and then the various static resources in the static resource configuration table are loaded in advance by using the idle time in the role selection stage, reducing the The amount of resources in the resource loading stage reduces the loading time of the resource loading stage and achieves the technical effect of improving resource loading efficiency.
  • each static resource subset in the static resource collection is sequentially loaded or loaded in parallel, including:
  • Intra-office object instantiation is performed on some loaded static resources to obtain instantiated objects of some static resources;
  • Resource analysis coroutine The analysis coroutine will continuously analyze the resources to be referenced by the game and save them in the resource list;
  • Resource loading coroutine the loading coroutine cycle obtains resource path and other information from the resource list, and starts loading;
  • the instantiation coroutine obtains the loaded resource from the resource list and instantiates the intra-office object;
  • Resource pool recycling coroutine The recycling coroutine reclaims resources and loads instantiated objects to the object buffer pool.
  • the resource analysis coroutine all the resources needed for the current game will be analyzed, the analyzed resources will be numbered, and the classification labels of "static resources” or “dynamic resources” will be set for resources with different numbers. Then generate a resource list as shown in FIG. 10 . Among them, the type of resource 1, resource 2 and resource 4 is “static resource”, and the type of resource 3 is “dynamic resource”. According to the resource number and classification label, the current static resource to be used in the current game is determined, and the resource path information of the current static resource is stored in the resource list.
  • the resource loading coroutine obtain the resource path information of some unloaded static resources from the resource list sequentially or in parallel, for example: suppose the static resources not loaded at the current moment include resource 1 and resource 2, then first Obtain the path information of resource 1 and load resource 1; then obtain the path information of resource 2 and load resource 2; or obtain the path information of resource 1 and resource 2 at the same time and load resource 1 and resource 2 at the same time.
  • resource 1 and resource 2 After resource 1 and resource 2 are loaded, enter the resource instantiation coroutine to instantiate the intra-office objects corresponding to the loaded resource 1 and resource 2 to obtain instantiated objects.
  • the intra-office object corresponding to resource 1 is NPC
  • the in-game object corresponding to resource 2 is the grass on the game map
  • the instantiated object 1 (for example, NPC) and instantiated object 2 as shown in Figure 10 can be obtained (for example, grass).
  • the instantiated object 1 and instantiated object 2 are stored in the object buffer pool through the resource pool recovery coroutine, so that the preloaded resource 1 and resource 2 can be obtained directly from the object buffer pool in the next game.
  • S1 determine the current static resources (resource 1 and resource 2) to be used through the resource analysis coroutine, and store the resource path information of resource 1 and resource 2 in the resource list;
  • the four coroutines shown in FIG. 10 and the working manner of the four coroutines are used to load resources, which is just an example.
  • This embodiment can also use other numbers of coroutines and/or other working methods to load resources.
  • the difference from the method shown in FIG. 10 is that one coroutine is used to complete the above steps S3 and S4.
  • multiple key coroutines in the role selection stage are used to sequentially load or parallel load each static resource subset in the static resource set required by the game in the resource loading coroutine, and then through resource instances
  • the coroutines and resource pool recycling coroutines store the instantiated objects corresponding to the loaded static resource subsets in the object buffer pool, so that the static resources preloaded in advance can be reused in the next game, reducing the The resource loading time is shortened, the frame rate freeze caused by the long resource loading time is avoided, and the user experience is improved.
  • the maximum allowable selection time t1 is pre-configured for the role selection phase of a game, that is, all players are required to complete the determination of role configuration information within the maximum allowable selection time t1.
  • the time of the resource loading phase is t2.
  • the conditions for jumping from the role selection phase to the resource loading phase include but are not limited to the following two situations:
  • a reminder message that the character selection phase is about to end will be given in the display interface of the character selection phase in the form of a timer, for example, sequentially in the interface Dynamically display the numbers 10, 9, 8...1, and then enter the display interface of the resource loading stage.
  • the corresponding role configuration information will be automatically determined for the player when the predetermined time t1 is reached, for example, the corresponding role, role skins, character skills.
  • the resource loading phase when the resource loading phase is over, the resources used in other phases of the game will be released.
  • the resources required by the next game and the current game have overlapping parts. For this part of resources, If the resources loaded in the current game are directly reused in the next game, the loading efficiency of the next game can be effectively improved.
  • the resource cache release method shown in Figure 12 can be used to realize the reuse of resources loaded in the current game, specifically, including: a collection of static resources to be loaded in a game Stored in the target cache; in the role selection phase of the next game in one game, part or all of the static resources in the static resource collection are reused from the target cache.
  • the static resource collection and dynamic resource collection required by the game are loaded through the role selection phase and the resource loading phase (such as steps S1202, S1206-S1214-1), and after all resources are loaded, the loaded The static resource collection is stored in the target cache (such as step S1214-2).
  • the resources of the overlapping part of the current game and the next game are not limited.
  • the resources of the repeated part may be some or all of the static resources in the static resource set required by the current game. resource.
  • step S1210 when leaving the battle phase, the resources generated in the combat phase are stored in the target cache, and the resources generated in the combat phase of the next game can be directly obtained from the target cache Obtaining the battle data of the current game provides reference data for the battle stage of the next game, which helps to improve the combat ability of the next game.
  • some or all of the static resources in the static resource collection are reused from the target cache, including:
  • the game modes include mode 1 (ranking) and mode 2 (matching), as shown in (a) in Figure 13, when the game mode of the current game is the same as that of the next game, And when both are in qualifying mode, when loading the static resources of the next game, all the pre-stored static resources of the current game that have been loaded can be directly obtained from the target cache.
  • the resources related to the game mode of a game mainly include scene elements in the game and resources corresponding to NPCs, for example, resources corresponding to grass, lamps, walls or other virtual objects appearing on the game map, and resources corresponding to different NPCs. corresponding resources. That is to say, the resources related to the game mode are usually the static resources of a game. Therefore, when the game modes of the two games are the same, it means that the static resources required by the two games are also the same. Conversely, when the game modes of the two games are different, the static resources required by the two games may be partly the same.
  • the resource preloading method above further includes:
  • the game screen of the battle phase of a game is displayed.
  • all resources of a game are loaded, including all static resources and all dynamic resources, and then according to the loaded static resources and loaded dynamic resources, rendering Images corresponding to each resource are generated to form an image set, and finally the game screen of the battle stage of the game is dynamically displayed according to the images in the image set.
  • the static resource collection and the dynamic resource collection are loaded.
  • the dynamic resource in the dynamic resource collection, the scene element (grass) in Fig. 3 belongs to the static resource in the static resource collection.
  • the virtual button corresponding to the skill 303 can be displayed on the game screen of the battle phase; by rendering the resource corresponding to the character 300, the character can be displayed on the game screen of the battle phase 300.
  • some or all of the static resources of a game are preloaded in advance in the role selection stage, which reduces the amount of resources to be loaded in the resource loading stage and reduces the time for resource loading, thereby improving the ability to understand the loaded resources.
  • the rendering efficiency of resources reduces the frame rate freeze caused by resource loading in the game, improves the display effect of the game screen in the battle stage, and thus improves the user experience.
  • the present application also provides an overall flow chart of a resource preloading method, specifically, as shown in FIG. 14 , including the following steps:
  • the pre-loading system runs the loading coroutine, and enters the resource loading phase of the game after the selection phase ends, as shown in Figure 11 above, jumping from t0 or t1 to the resource loading phase shown in t2.
  • step S1412 determine whether the early loading is completed, and if the early loading is completed, execute step S1414, and load the remaining resources (including unloaded static resources and dynamic resources) normally, for details, please refer to the above resource loading shown in Figure 5 stage, load dynamic resources and static resources not loaded in the role selection stage;
  • step S1422 to judge whether the early loading has timed out, and if the judgment result is no timeout, execute step S1414 to load the remaining resources normally; otherwise, execute step S1418;
  • step S1418 is executed.
  • the resource preloading method in the embodiment of the present application is used to test the resource loading duration of a certain game, and the effect diagram shown in FIG. 15 is obtained.
  • the coordinates t1 ⁇ tn on the horizontal axis indicate the time of game testing, and the vertical axis indicates the average resource loading time of the same game at different test times during the actual game, for example, the average daily resource loading time.
  • a resource preloading device for implementing the above resource preloading method. As shown in Figure 16, the device includes:
  • the first loading unit 1602 is configured to load a static resource set of a game during the role selection phase of a game, wherein the role selection phase is used to select virtual characters participating in a game, and the static resource set includes Resources to be used that are not related to the role configuration information determined in the role selection stage;
  • the second loading unit 1604 is configured to load the dynamic resource set of a game in the resource loading phase of a game when the static resource set is loaded in the role selection phase, wherein the dynamic resource set includes the waiting list in a game Resources used and related to the role configuration information determined during the role selection phase.
  • the resource preloading device above also includes:
  • the third loading unit is used to load the dynamic resource set of a game in the resource loading phase of a game when some static resources in the static resource set are loaded in the role selection stage, and load the static resource set except Static resources other than some static resources.
  • loading the dynamic resource set of a game and loading static resources in the static resource set except some static resources include:
  • the first loading module is used for loading the dynamic resource set of a game and static resources in the static resource set except some static resources in parallel during the resource loading phase of a game.
  • the resource preloading device above also includes:
  • the first display unit is used to display the first prompt information in the role selection phase when loading the static resource set of a game in the role selection phase of a game, wherein the first prompt information is used to prompt that a game has been loaded in advance part of the game's resources; or
  • the second display unit is used to display the second prompt information in the resource loading phase when the static resource set of a game is loaded in the role selection phase of a game, wherein the second prompt information is used to prompt that a game has been loaded in advance Some resources of the game.
  • the first prompt information is used to dynamically display the loading progress of the static resources
  • the second prompt information is used to display the proportion of the static resources that have been loaded in advance to the total resources.
  • the above-mentioned first loading unit includes:
  • the first processing module is configured to sequentially load or parallelly load each static resource subset in the static resource collection during the role selection phase, wherein each static resource subset includes at least one of the following:
  • a subset of scene resources in a game wherein the subset of scene resources includes resources of virtual objects appearing on a game map in a game;
  • a non-player character NPC resource subset in a game wherein the NPC resource subset includes resources of one or more NPCs in a game.
  • the above-mentioned first processing module includes:
  • the processing submodule is used to repeatedly perform the following operations until the role selection phase ends or each static resource subset is loaded:
  • Intra-office object instantiation is performed on some loaded static resources to obtain instantiated objects of some static resources;
  • the above-mentioned third loading unit includes:
  • the second processing module is used to suspend the loading of static resources when the role selection phase ends when some static resources are loaded in the role selection phase, and start loading a dynamic resource set of a game when the resource loading phase starts, and Continue to load static resources except some static resources in the static resource collection.
  • the resource preloading device above also includes:
  • the storage unit is used to store the loaded static resource set in the target cache in a game
  • the fourth loading unit is configured to reuse part or all of the static resources in the static resource collection from the target cache during the character selection phase of the next game in one game.
  • the above-mentioned fourth loading unit includes:
  • the second loading module is used to multiplex all the static resources in the static resource collection from the target cache when the game mode of one game is the same as the game mode of the next game; and/or
  • the third loading module is used to reuse some static resources in the static resource set from the target cache when the game mode of one game is different from that of the next game, wherein some of the static resources are the next Static resources to be used in the game.
  • the resource preloading device above also includes:
  • the display unit is configured to display the game screen of a battle stage of a game according to the loaded static resource set and dynamic resource set after the resource loading stage ends.
  • the computer device for implementing the resource preloading method above, and the computer device may be the terminal device or the server shown in FIG. 17 .
  • This embodiment is described by taking the computer device as a server as an example.
  • the computer device includes a memory 1702 and a processor 1704, the memory 1702 stores computer-readable instructions, and the processor 1704 is configured to execute any one of the method embodiments described above through the computer-readable instructions. step.
  • the foregoing computer device may be located in at least one network device among multiple network devices of the computer network.
  • the above-mentioned processor may be configured to execute the following steps through computer-readable instructions:
  • the static resource set is loaded in the role selection stage, load the dynamic resource set of a game in the resource loading stage of a game, wherein the dynamic resource set includes to be used in a game and is related to the character Resources related to role configuration information determined in the selection stage.
  • FIG. 17 does not limit the structure of the above-mentioned computer equipment.
  • the computer device may also include more or fewer components than shown in FIG. 17 (such as network interfaces, etc.), or have a different configuration than that shown in FIG. 17 .
  • the memory 1702 can be used to store software programs and modules, such as the program instructions/modules corresponding to the resource preloading method and device in the embodiment of the present application, and the processor 1704 runs the software programs and modules stored in the memory 1702 to execute Various functional applications and data processing are to implement the resource preloading method mentioned above.
  • the memory 1702 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 1702 may further include a memory that is remotely located relative to the processor 1704, and these remote memories may be connected to the terminal through a network.
  • the memory 1702 may specifically be, but not limited to, information such as a static resource set and a dynamic resource set required for a game.
  • the memory 1702 may include, but is not limited to, the first processing unit 1602 and the second processing unit 1604 in the resource preloading apparatus. In addition, it may also include but not limited to other module units in the above resource preloading device, which will not be repeated in this example.
  • the transmission means 1706 is used to receive or send data via a network.
  • the specific examples of the above-mentioned network may include a wired network and a wireless network.
  • the transmission device 1706 includes a network adapter (Network Interface Controller, NIC), which can be connected with other network devices and a router through a network cable so as to communicate with the Internet or a local area network.
  • the transmission device 1706 is a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.
  • RF Radio Frequency
  • the above-mentioned computer equipment also includes: a display 1708 for displaying the game screen of the above-mentioned combat stage; and a connection bus 1710 for connecting various module components in the above-mentioned computer equipment.
  • the above-mentioned terminal device or server may be a node in a distributed system, wherein the distributed system may be a block chain system, and the block chain system may be composed of the multiple nodes communicating through the network A distributed system formed by connections in the form of .
  • nodes can form a peer-to-peer (P2P, Peer To Peer) network, and any form of computer equipment, such as servers and terminals, can become a node in the blockchain system by joining the peer-to-peer network.
  • P2P peer-to-peer
  • Peer To Peer Peer To Peer
  • a computer program product or computer program comprising computer instructions stored in a computer readable storage medium.
  • One or more processors of the computer device read the computer instructions from the computer-readable storage medium, and the one or more processors execute the computer instructions, so that the computer device performs the resource preloading provided in the above various optional implementation manners
  • the method enables the computer device to execute the steps in any one of the above method embodiments.
  • the above-mentioned computer-readable storage medium may be configured to store computer-readable instructions for performing the following steps:
  • the static resource set is loaded in the role selection stage, load the dynamic resource set of a game in the resource loading stage of a game, wherein the dynamic resource set includes to be used in a game and is related to the character Resources related to role configuration information determined in the selection stage.
  • the storage medium may include: a flash disk, a read-only memory (Read-Only Memory, ROM), a random access device (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.
  • the integrated units in the above embodiments are realized in the form of software function units and sold or used as independent products, they can be stored in the above computer-readable storage medium.
  • the technical solution of the present application is essentially or part of the contribution 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.
  • Several instructions are included to enable one or more computer devices (which may be personal computers, servers or network devices, etc.) to execute all or part of the steps of the methods in the various embodiments of the present application.
  • the disclosed client can be implemented in other ways.
  • the device embodiments described above are only schematic, such as the division of units, which is only a logical function division, and 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 may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of units or modules may be in electrical or other forms.
  • a unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • General Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Optics & Photonics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种资源预加载方法和装置、存储介质及计算机设备。其中,该方法包括:在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源(S202);在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源(S204)。

Description

资源预加载方法和装置、存储介质及计算机设备
本申请要求于2022年01月12日提交中国专利局,申请号为202210033926.5,申请名称为“资源预加载方法和装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及互联网技术领域,具体而言,涉及一种资源预加载方法和装置、存储介质及计算机设备。
背景技术
随着游戏行业的不断发展,越来越多的游戏受到大众的喜爱,游戏的基本过程通常包括游戏准备阶段和战斗阶段,例如:一种手机上运行的MOBA(Multiplayer Online Battle Arena,多人在线战术竞技游戏)游戏,在进入游戏战斗阶段之前,至少还包括角色选择阶段和资源加载阶段等过程。其中,资源加载阶段是根据角色选择阶段分析出的当前局游戏所需资源后,对所需资源进行加载。
相关技术中,通常是在资源加载阶段完成当前局游戏所需要的所有资源,但随着游戏单局对局的复杂度逐渐提升,单局游戏的资源量也越来越大,导致了资源加载耗时过长的技术问题。
针对上述的问题,目前尚未提出有效的解决方案。
发明内容
根据本申请提供的各种实施例,提出了一种资源预加载方法和装置、存储介质及计算机设备。
根据本申请实施例的一个方面,提供了一种资源预加载方法,由计算机设备执行,包括:在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源;在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源。
可选地,上述资源预加载方法,还包括:在角色选择阶段加载完成静态资源集合中的部分静态资源的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源。
可选地,在上述一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源,包括:在一局游戏的资源加载阶段,并行加载一局游戏的动态资源集合以及静态资源集合中除部分静态资源之外的静态资源。
可选地,上述资源预加载方法还包括:在一局游戏的角色选择阶段加载一局游戏的静态资源集合的情况下,在角色选择阶段显示第一提示信息,其中,第一提示信息用于提示已提前加载一局游戏的部分资源;或者在一局游戏的角色选择阶段加载一局游戏的静态资源集合的情况下,在资源加载阶段显示第二提示信息,其中,第二提示信息用于提示已提前加载一局游戏的部分资源。
可选地,第一提示信息用于动态显示静态资源的加载进度,第二提示信息用于显示已提前加载的静态资源占总资源的比例。
可选地,上述在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,包括:在角色选择阶段,依次加载或并行加载静态资源集合中的各个静态资源子集,其中,各个静态资源子集包括以下至少之一:一局游戏中的场景资源子集,其中,场景资源子集包括一局游戏中的游戏地图上出现的虚拟物体的资源;一局游戏中的NPC(Non-Player Character, 非玩家角色)资源子集,其中,NPC资源子集包括一局游戏中的一个或多个NPC的资源。
可选地,在上述角色选择阶段,依次加载或并行加载静态资源集合中的各个静态资源子集,包括:重复执行以下操作,直到角色选择阶段结束或者加载完成各个静态资源子集:在确定出一局游戏中待使用的当前静态资源、且当前静态资源的资源路径信息未被存储到目标资源列表中的情况下,将当前静态资源的资源路径信息存储到目标资源列表中;依次或并行地从目标资源列表中获取未加载的部分静态资源的资源路径信息,并根据部分静态资源的资源路径信息,加载部分静态资源;对加载好的部分静态资源进行局内对象实例化,得到部分静态资源的实例化对象;将部分静态资源的实例化对象存储到对象缓冲池中。
可选地,上述在角色选择阶段加载完成静态资源集合中的部分静态资源的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源,包括:在角色选择阶段加载完成部分静态资源时角色选择阶段结束的情况下,暂停静态资源的加载,并在资源加载阶段开始时,开始加载一局游戏的动态资源集合,并继续加载静态资源集合中除部分静态资源之外的静态资源。
可选地,上述资源预加载方法还包括:在一局游戏中将加载的静态资源集合存储在目标缓存中;在一局游戏的下一局游戏的角色选择阶段,从目标缓存中复用静态资源集合中的部分或全部静态资源。
可选地,在上述一局游戏的下一局游戏的角色选择阶段,从目标缓存中复用静态资源集合中的部分或全部静态资源,包括:在一局游戏的游戏模式与下一局游戏的游戏模式相同的情况下,从目标缓存中复用静态资源集合中的全部静态资源;和/或
在一局游戏的游戏模式与下一局游戏的游戏模式不同的情况下,从目标缓存中复用静态资源集合中的部分静态资源,其中,部分静态资源是下一局游戏中待使用的静态资源。
可选地,上述资源预加载方法还包括:在资源加载阶段结束之后,根据加载的静态资源集合和动态资源集合,显示一局游戏的战斗阶段的游戏画面。
根据本申请实施例的另一方面,还提供了一种资源预加载装置,包括:第一加载单元,用于在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源;第二加载单元,用于在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源。
根据本申请实施例的又一方面,还提供了一种计算机可读的存储介质,该计算机可读的存储介质中存储有计算机可读指令,其中,该计算机可读指令被设置为运行时执行上述资源预加载方法。
根据本申请实施例的又一方面,还提供了一种计算机设备,包括存储器和一个或多个处理器,上述存储器中存储有计算机可读指令,上述一个或多个处理器被设置为通过计算机可读指令执行上述资源预加载方法。
根据本申请实施例的又一方面,还提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机可读指令,该计算机可读指令存储在计算机可读存储介质中。计算机设备的一个或多个处理器从计算机可读存储介质读取该计算机可读指令,一个或多个处理器执行该计算机可读指令,使得该计算机设备执行上述资源预加载方法。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本 领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是根据本申请实施例的一种可选的资源预加载方法的应用环境场景的示意图;
图2是根据本申请实施例的一种可选的资源预加载方法的流程图;
图3是根据本申请实施例的一种可选的资源预加载方法的示意图;
图4是根据本申请实施例的一种可选的静态资源集合和动态资源集合的示意图;
图5是根据本申请实施例的一种可选的静态资源集合和动态资源集合的加载状态的示意图;
图6是根据本申请实施例的另一种可选的静态资源集合和动态资源集合的加载状态的示意图;
图7是根据本申请实施例的又一种可选的静态资源集合和动态资源集合的加载状态的示意图;
图8是根据本申请实施例的又一种可选的静态资源集合和动态资源集合的加载状态的示意图;
图9是根据本申请实施例的一种可选的生成离线静态资源的流程图;
图10是根据本申请实施例的一种可选的资源加载阶段的关键协程的示意图;
图11是根据本申请实施例的一种可选的角色选择阶段结束方式的示意图;
图12是根据本申请实施例的一种可选的释放/保存资源缓存的示意图;
图13是根据本申请实施例的一种可选的不同游戏模式下的静态资源预加载的示意图;
图14是根据本申请实施例的一种可选的资源预加载方法的整体流程图;
图15是根据本申请实施例的一种可选的利用资源预加载方法进行测试的效果图;
图16是根据本申请实施例的一种可选的资源预加载装置的结构示意图;
图17是根据本申请实施例的一种可选的计算机设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
根据本申请实施例的一个方面,提供了一种资源预加载方法,可选地,作为一种可选的实施方式,上述资源预加载方法可以但不限于应用于如图1所示的应用场景中的资源预加载系统。其中,该资源预加载系统可以包括但不限于客户端102、网络104、服务器106、数据库108。上述客户端102包括人机交互屏幕,处理器及存储器。人机交互屏幕用于显示客户端的游戏界面(如图3所示的一种当前局游戏所用到的资源加载的显示界面);还用于提供人机交互接口以接收用于用户使用游戏软件进行游戏对局的人机交互操作。处理器用于响应上述人机交互操作生成交互指令,并将该交互指令发送给服务器106。存储器用于存储相关属性数据,如资源路径信息、角色选择信息及游戏战斗画面信息等。上述客户端102也可以称为终端102,终端102可以但不限于是各种台式计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能 电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。上述服务器106可以用独立的服务器或者是多个服务器组成的服务器集群或者云服务器来实现。
具体过程如下:步骤S102,对当前局游戏所需要的资源进行分析,并生成资源列表;步骤S104,从资源列表中获取资源路径等信息;然后如步骤S106-108,服务器106通过网络104发送资源列表及资源路径等信息至客户端102;步骤S110,客户端102接收资源列表及资源路径,并加载当前局游戏将要引用的资源,其中,包括静态资源和动态资源。上述仅是一种示例,本实施例中对此不作任何限定。
在本发明实施例中,通过利用角色选择阶段的空闲时间对游戏的静态资源集合进行提前预加载,然后在静态资源集合加载完成的情况下,在资源加载阶段对游戏的动态资源集合进行加载,避免了局内因为资源加载时间过长导致的帧率卡顿,达到了降低资源加载时长的目的,从而实现了提高资源加载效率的技术效果,进而解决了由于游戏资源量较大造成的资源加载耗时过长的技术问题。
作为一种可选的示例,本实施例对上述步骤S102至S110的执行主体不做限定,例如,上述步骤S102至S110都可以在客户端102上执行。
本申请提供的资源预加载方法应用于计算机设备来举例说明,计算机设备可以是终端或服务器,由终端或服务器自身单独执行,也可以通过终端和服务器之间的交互来实现。
根据本申请实施例的一个方面,如图2所示,提供了一种资源预加载方法,以该方法应用于计算机设备来举例说明,计算机设备可以是终端或服务器,由终端或服务器自身单独执行,也可以通过终端和服务器之间的交互来实现。图2是根据本申请实施例的资源预加载方法的流程图,该流程包括如下步骤:
步骤S202,在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源。
作为一种可选的示例,上述静态资源集合包括但不限于与角色选择阶段确定的角色配置信息不相关的资源,其中,上述角色配置信息可以但不限包括在角色选择阶段确定的角色、技能、或皮肤等,在角色选择阶段,上述角色配置信息可以随着输入的指令而不断发生变化,在不同的两局游戏中上述角色配置信息可以部分不同或全部不同。进一步,上述与角色配置信息不相关的资源,可以被理解为,这些静态资源与角色配置信息相互独立,换句话说,本实施例中的静态资源集合中的资源是不随角色选择阶段确定的角色配置信息变化而变化的资源,例如,静态资源集合包括图4中的草408对应的资源。
步骤S204,在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源。
作为一种可选的示例,上述动态资源集合包括与角色选择阶段确定的角色配置信息相关的资源,也就是说,上述动态资源集合中的动态资源会随着所选角色的变化、技能、皮肤或者星元等玩家主动选择的不同而改变,并且每一局的动态资源都可能不同。可见,本实施例中的动态资源集合中的资源是会随着角色配置信息的变化而变化的资源,例如,动态资源集合包括图3中的角色300和技能303对应的资源。
在本实施例中,一局游戏所要使用的资源包括但不限于静态资源和动态资源,在进入游戏战斗阶段之前,需要将当前局游戏所需要的静态资源和动态资源全部加载完成,然后通过对加载完成后的静态资源集合和动态资源集合进行渲染,才能显示游戏的战斗阶段的游戏画面。
相关技术中,静态资源和动态资源的加载均是在资源加载阶段完成的,在角色选择阶段,仅对当前局游戏所要使用的资源进行离线分析,并通过对离线分析出的资源设置不同 的标签来区分其类别,然后生成对应的资源列表。但值得留意的是,随着游戏的复杂度越来越高,单局游戏所需要使用的资源量也会随之增加,导致了资源加载阶段耗费时间过长,降低了用户的体验感。
作为一种可选的实施方式,为了解决上述资源加载阶段耗时过长的问题,在本申请实施例中,通过利用角色选择阶段的空闲时间对游戏的静态资源集合进行提前预加载,然后在静态资源集合加载完成的情况下,在资源加载阶段对游戏的动态资源集合进行加载。
具体地,如图3所示,在角色选择阶段,假设玩家在角色选择阶段根据需要从角色列表301(如英雄列表)中选择角色300,并可以从皮肤列表302中对角色300的皮肤进行选择,同时对角色300在当前局游戏中所具备的技能(如图中的技能303和技能305-307)进行选择。以5对5的MOBA类游戏(如图3中的资源加载阶段所示,角色1至角色5为一队,角色6至角色10为一队,角色300可以但不限于是资源加载阶段上的角色1)为例,在角色选择阶段,可以提前对这一局游戏的静态资源集合进行加载,上述静态资源集合可以但不限于包括与图3中的角色选择阶段确定的角色配置信息不相关的资源,上述角色配置信息可以但不限于包括在角色选取阶段确定的角色300、角色300对应的皮肤、角色300在本局游戏中使用的技能303等,上述静态资源集合可以但不限于包括图3中的战斗阶段显示的地图中的场景元素(如,草,墙体)和NPC对应的资源。在战斗阶段,还可以显示缩略地图307。可选地,上述场景元素(如,草,墙体)和NPC对应的资源,可以被理解为在战斗阶段显示(或称渲染)上述场景元素和NPC所需要用到的资源。
在静态资源集合加载完成的情况下,在资源加载阶段,对游戏的动态资源集合进行加载。上述动态资源集合可以但不限于包括与图3中的角色选择阶段确定的角色配置信息相关的资源,上述角色配置信息可以但不限于包括在角色选取阶段确定的角色300、角色300对应的皮肤、角色300在本局游戏中使用的技能303等。上述动态资源集合用于在战斗阶段显示对应的画面元素,例如,技能303对应的虚拟按钮,技能305对应的虚拟按钮,技能306对应的虚拟按钮,技能307对应的虚拟按钮,虚拟摇杆304等。可选地,上述动态资源集合,可以被理解为在战斗阶段显示(或称渲染)上述对应的画面元素所需要用到的资源。
如上述描述可知,上述实施例中的静态资源可以但不限于是与角色选择阶段确定的角色配置信息不相关的资源;动态资源可以但不限于是与角色选择阶段确定的角色配置信息相关的资源。例如,静态资源是在游戏模式(如匹配或排位)确定的情况下,在进入到匹配或排位这种固定关卡对局,就不会发生变化的资源;动态资源会随着所选角色的变化、召唤师技能、皮肤或者星元等由于玩家主动选择的不同而改变,并且每一局的动态资源都可能不同。由此可见,静态资源是不会随着角色配置信息的变化而变化的资源,而动态资源是会随着角色配置信息的变化而变化的资源。
为了进一步说明本实施例中的资源预加载过程,下面结合附图4进行详细描述。如图4所示,在角色选择阶段,玩家可以根据个人喜好确定对应的角色配置信息,上述角色配置信息可以但不限于包括:在角色列表401中选择的角色400、在皮肤列表402中为角色400选择的皮肤、角色400在本局游戏中使用的技能403和技能405-407等。在角色选择阶段结束之前,可以改变角色配置信息中的部分或全部信息,因此,上述角色400、为角色400选择的皮肤、角色400在本局游戏中使用的技能403所对应的资源属于动态资源。需要在角色选择阶段进行提前预加载的静态资源集合可以但不限于包括与上述角色配置信息不相关的资源,例如,图4中的战斗阶段显示的地图中的场景元素(如,草408,墙体)和NPC对应的资源,上述场景元素和NPC对应的资源不会随上述角色配置信息变化发生变化,因此,上述场景元素和NPC对应的资源均属于静态资源。
通过本申请提供的上述实施例,利用角色选择阶段的空闲时间对静态资源集合进行预加载,并在静态资源集合加载完成的情况下,在资源加载阶段对游戏的动态资源集合进行 加载,避免了局内因为资源加载时间过长导致的帧率卡顿,达到了降低资源加载时长的目的,从而实现了提高资源加载效率的技术效果,进而解决了由于游戏资源量较大造成的资源加载耗时过长的技术问题
作为一种可选的实施方式,上述资源预加载方法还包括:
在角色选择阶段加载完成静态资源集合中的部分静态资源的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源。
可以理解的是,在进入资源加载阶段之前,对静态资源的加载状态至少包括以下两种情况:
第一种:在角色选择阶段提前加载完成所有静态资源;
第二种:在角色选择阶段提前加载部分静态资源。
对于第二种情况中在角色选择阶段没有加载完成的剩余部分静态资源则在资源加载阶段进行加载。
为了进一步说明本实施例中的上述第二种情况,下面结合附图5进行详细描述。如图5所示,在角色选择阶段,仅对静态资源集合中50%的静态资源进行了加载。这样,在资源加载阶段,需要通过协程1和协程2分别对动态资源集合中的全部动态资源及静态资源集合中剩余的50%静态资源进行加载。
通过本申请提供的上述实施例,可以根据角色选择阶段对静态资源集合进行加载的完成情况,确定资源加载阶段所要加载的资源类型及资源量,减少了资源加载阶段即将加载的资源量,节约了资源加载时间,提高了用户体验感。
在本实施例中,在资源加载阶段采用图5所示的不同协程分别加载动态资源集合以及静态资源集合中剩余的静态资源,这只是一种示例。本实施例还可以采用其他的方式来在资源加载阶段对动态资源集合以及静态资源集合中剩余的静态资源进行加载,例如,在资源加载阶段,采用协程1依次加载动态资源集合以及静态资源集合中剩余的静态资源。
作为另一种可选的实施方式,在上述一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源,包括:在一局游戏的资源加载阶段,并行加载一局游戏的动态资源集合以及静态资源集合中除部分静态资源之外的静态资源。
在本实施例中,在资源加载阶段,除了对角色选择阶段未加载完成的部分静态资源进行加载之外,还会对动态资源集合中的全部动态资源进行加载。
为了进一步说明本实施例中的在资源加载阶段并行加载资源的过程,下面结合附图6进行详细描述。具体地,如图6所示,在角色选择阶段,仅对静态资源集合中50%的静态资源进行了加载。在资源加载阶段,通过协程1和协程2对全部动态资源及静态资源集合中剩余的50%静态资源进行并行加载,直至加载完成。
根据本申请提供的上述实施例可知,在资源加载阶段,对于角色选择阶段未完成加载的部分静态资源及全部动态资源来讲,至少存在以下两种加载方式:
(1)先加载剩余部分未加载的静态资源(或动态资源),再加载动态资源(或静态资源),即两种类型的资源进行串行加载;
(2)同时加载剩余部分未加载的静态资源和动态资源,即并行加载两种类型的资源。
在一种可选的示例中,可以根据情况选择上述两种不同的加载方式中的任意一种,例如,可以根据在角色选择阶段未加载的静态资源的比例,选择上述两种不同的加载方式中的一种。举例来说,在角色选择阶段未加载的静态资源小于或等于50%时,可以选择上述加载方式(1);在角色选择阶段未加载的静态资源大于50%时,选择上述加载方式(2)。但需要说明的是,由于两种加载方式中的角色选择阶段均提前预加载了部分或全部静态资源,因此,两种加载方式均减少了资源加载阶段需要加载的资源量。
通过本申请提供的上述实施例,在角色选择阶段未完成静态资源的加载的情况下,通过在资源加载阶段采用静态资源和动态资源并行加载、或者异步加载的方式,完成所有资源的加载,提高了资源加载方式的灵活性,降低了资源加载时长,实现了提高资源加载效率的技术效果。
作为一种可选的实施方式,上述资源预加载方法还包括:
在一局游戏的角色选择阶段加载一局游戏的静态资源集合的情况下,在角色选择阶段显示第一提示信息,其中,第一提示信息用于提示已提前加载一局游戏的部分资源;或者
在一局游戏的角色选择阶段加载一局游戏的静态资源集合的情况下,在资源加载阶段显示第二提示信息,其中,第二提示信息用于提示已提前加载一局游戏的部分资源。
为了更加直观地反映资源的加载状态,在本实施例中的角色选择阶段的显示界面中设置了对静态资源进行预加载的第一提示信息,用于动态显示静态资源的加载进度;或者,在资源加载阶段的显示界面中设置了第二提示信息,用于显示当前时刻已经提前预加载的资源占总资源的比例。
为了进一步说明本实施例中的上述提示过程,下面结合附图7进行详细描述。具体地,如图7中(a)所示,在角色选择阶段已加载30%的静态资源时,可以在角色选择阶段的显示界面中显示“已提前加载30%”的进度条。容易理解的是,当随着资源加载进度的变化,进度条中的数字也会随着变化,例如,随着静态资源的加载量的提升,动态显示“已提前加载40%”、“已提前加载50%”等提示信息。
作为一种可选的示例,还可以在资源加载阶段的显示界面中显示第二提示信息,该第二提示信息可以但不限于用于提示在角色选择阶段已提前加载的静态资源占游戏总资源的比例,上述游戏总资源可以包括上述静态资源集合和动态资源集合。可选的,上述第二提示信息可以但不限于在角色选择阶段结束,并跳转至资源加载阶段的时刻开始显示,例如,如图7中(b)所示的“已为您提前加载70%”。
作为一种可选的示例,由于第一提示信息用于指示在角色选择阶段的过程中实时更新的已加载的静态资源占游戏总资源的比例,第二提示信息用于指示在角色选择阶段已加载完成的静态资源占总资源比例,换言之,第二提示信息与角色选择阶段结束时的第一提示信息可以相同。
因此,基于第一提示信息与第二提示信息分别指示的含义,以及两者之间的关系,在角色选择阶段和资源加载阶段的显示界面中,第一提示信息和第二提示信息的显示方式至少存在以下之一:
(1)仅在角色选择阶段显示第一提示信息,在资源选择阶段不显示第二提示信息;
(2)在角色选择阶段不显示第一提示信息,但资源选择阶段显示第二提示信息;
(3)在角色选择阶段显示第一提示信息,且在资源选择阶段显示第二提示信息。
通过本申请提供的上述实施例,采用角色选择阶段显示第一提示信息,和/或在资源加载阶段显示第二提示信息的方式,直观地反映了资源预加载的状态,使得在减少资源加载时间的同时,还可以实时了解资源加载的进度,提高资源加载效率,提高了用户体验感。
需要说明的是,如图7所示的采用进度条的方式来提示资源预加载的情况,这仅是一种示例。本实施例还可以采用其他的方式来显示上述的第一提示信息和第二提示信息,例如,在角色选择阶段采用文字、图标、音频或动画或上述方式的各种结合来提示资源预加载的情况。
作为一种可选地实施方式,上述在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,包括:
在角色选择阶段,依次加载或并行加载静态资源集合中的各个静态资源子集,其中,各个静态资源子集包括以下至少之一:
一局游戏中的场景资源子集,其中,场景资源子集包括一局游戏中的游戏地图上出现 的虚拟物体的资源;
一局游戏中的非玩家角色NPC资源子集,其中,NPC资源子集包括一局游戏中的一个或多个NPC的资源。
在本申请各实施例中,对于静态资源集合中的所有静态资源,均按照资源类型的分类设置有不同的标签,例如,将所有静态资源按照类型划分为四类,并生成四张离线静态资源配置表,包括:
1)提前加载离线基础资源配置表,包含字段:ID、资源路径、资源类型、资源实例化数量等;
2)提前加载离线技能资源配置表,包含字段:资源类型、资源路径、玩家ID、配置ID、皮肤ID等;
3)提前加载离线兵线(如,NPC)资源配置表,包含字段:配置ID、角色类型、角色阵营等;
4)提前加载场景资源配置表,包含字段:ID、资源场景路径等。
可以理解的是,上述分类方式仅是一种示例,在本实施例中,可以采用其他的分类方式对静态资源进行分类,例如,可以包括上述四种分类中的部分分类,或者,按照不同于上述四种分类条件的其他分类条件对静态资源进行分类。
为了进一步说明本实施例中的上述不同类型的资源预加载过程,下面结合附图8进行详细描述。具体地,如图8所示,在角色选择阶段,静态资源集合中包括静态资源子集803和804,需要说明的是,本实施例对静态资源集合中包括的静态资源子集的数量不做限定,例如,可以包括3个或4个或5个静态资源子集。可选地,按照资源类型,将静态资源子集803的标签设置为场景资源子集,其中,场景资源子集中803包括但不限于依据游戏中的游戏地图上出现的虚拟物体对应的资源,例如在战斗阶段的游戏地图上出现的草802对应的资源,也可以是游戏地图上出现的墙体对应的资源、游戏地图上出现的灯对应的资源等。
按照资源类型,将静态资源子集804的标签设置为非玩家NPC资源子集,其中,NPC资源子集中包括一局游戏中的一个或多个NPC对应的资源,例如NPC资源子集中包括但不限于如图8中所示的NPC 801的资源。容易理解的是,一局游戏中的非玩家角色NPC的数量不做限定,根据需要可以是一个或多个。
在角色选择阶段,对于场景资源子集803和非玩家NPC资源子集804的加载方式包括但不限于以下两种方式:
第一种:依次加载场景资源子集803和非玩家NPC资源子集804;
第一种:同时加载场景资源子集803和非玩家NPC资源子集804;
需要说明的是,上述场景资源子集803和非玩家NPC资源子集804仅为示例性的,实际游戏对局过程中,一局游戏所需要使用的静态资源集合中的静态资源子集的数量和类型均不做限定。对应地,对于多个静态资源子集的加载方式也包括但不限于依次加载或并行加载各个静态资源子集。
进一步地,在游戏开发阶段,管理人员通常会在编辑器阶段预先配置不同游戏模式下需要使用的资源,并生成随游戏关卡相关引用的静态资源配置表。例如上述实施例中游戏地图上的草的颜色所对应的资源、NPC的位置对应的资源等。并且在编辑器中还开发了资源加载专用的编辑面板,通过编辑面板可以展示游戏资源加载过程中的相关数据。
作为一种可选的实施方式,在进入角色选择阶段之前,还需要管理人员预先在编辑器阶段生成离线静态资源,具体地,可参考如图9所示的流程图。
开发资源加载专用面板,在编辑器阶段通过打开资源加载专用面板中的“是否生成离线与分析文件模式”为所有的资源加载分析函数设置不同的标签,以区分资源分析函数内分析的资源是静态资源还是动态资源,如果无法区分,则定义为动态资源。在打开“是否 生成离线与分析文件模式”之后,在资源预加载阶段会关闭所有动态资源的分析函数,只运行标签为静态资源的分析函数,具体地,如步骤S902-S914。
在通过“是否生成离线与分析文件模式”分析出所有静态资源之后,资源加载结束,点击资源加载专用面板中的按钮“执行生成离线数据”,将上述资源分析函数分析出的所有静态资源按照类型分类,生成四张离线静态资源配置表。具体地,如步骤S916-S920。
进一步地,在编辑器阶段生成离线静态资源之后,即可在角色选择阶段对静态资源集合中的各个静态资源子集进行资源预加载。
通过本申请提供的上述实施例,根据在编辑器阶段分析出的离线静态资源,生成静态资源配置表,然后利用角色选择阶段的空闲时间提前加载静态资源配置表中的各类静态资源,减少了资源加载阶段的资源量,降低了资源加载阶段的加载时长,实现了提高资源加载效率的技术效果。
作为一种可选地实施例,在上述角色选择阶段,依次加载或并行加载静态资源集合中的各个静态资源子集,包括:
重复执行以下操作,直到角色选择阶段结束或者加载完成各个静态资源子集:
在确定出一局游戏中待使用的当前静态资源、且当前静态资源的资源路径信息未被存储到目标资源列表中的情况下,将当前静态资源的资源路径信息存储到目标资源列表中;
依次或并行地从目标资源列表中获取未加载的部分静态资源的资源路径信息,并根据部分静态资源的资源路径信息,加载部分静态资源;
对加载好的部分静态资源进行局内对象实例化,得到部分静态资源的实例化对象;
将部分静态资源的实例化对象存储到对象缓冲池中。
在本实施例中,进入角色选择阶段时,会触发资源预加载阶段的四个关键协程,具体地,如图10所示:
1)资源分析协程:分析协程会不断分析出本局游戏将要引用的资源,并保存至资源列表中;
2)资源加载协程:加载协程循环从资源列表中获取资源路径等信息,并开始加载;
3)资源实例化协程:实例化协程从资源列表中获取已经加载好了的资源并进行局内对象实例化;
4)资源池回收协程:回收协程回收资源加载实例化对象到对象缓冲池。
需要说明的是,通过资源分析协程会分析出当前局游戏需要使用的所有资源,对分析出的资源进行编号,并对不同编号的资源设置“静态资源”或“动态资源”的分类标签,然后生成如图10所示的资源列表。其中,资源1、资源2和资源4的类型为“静态资源”,资源3的类型为“动态资源”。根据资源编号和分类标签,确定出当前局游戏中待使用的当前静态资源,并将当前静态资源的资源路径信息存储至资源列表中。
在角色选择阶段,通过资源加载协程,依次或并行地从资源列表中获取未加载的部分静态资源的资源路径信息,例如:假设当前时刻未加载的静态资源包括资源1、资源2,那么先获取资源1的路径信息,并对资源1进行加载;然后获取资源2的路径信息,并对资源2进行加载;或者同时获取资源1和资源2的路径信息,并同时加载资源1和资源2。
当加载完成资源1和资源2之后,进入资源实例化协程,对已加载好的资源1和资源2所对应的局内对象进行实例化,得到实例化对象,例如资源1所对应的局内对象为NPC,资源2所对应的局内对象为游戏地图上的草,那么通过对资源1和资源2进行对象实例化,得到如图10所示的实例化对象1(例如,NPC)和实例化对象2(例如,草)。然后通过资源池回收协程将实例化对象1和实例化对象2存储至对象缓冲池中,以便于在下一局游戏中可以直接从对象缓冲池中获取已提前预加载的资源1和资源2。
进一步地,在角色选择阶段,会同时触发本实施例中的上述四个协程,对于四个协程 的执行顺序,仍以如图10所示的实施例进行解释说明,例如:
S1,通过资源分析协程确定待使用的当前静态资源(资源1和资源2),并将资源1和资源2的资源路径信息存储至资源列表中;
S2,通过资源加载协程,根据资源1和资源2的资源路径信息,加载资源1和资源2;
S3,通过资源实例化协程,对已加载的资源1和资源2进行局内对象实例化;
S4,通过资源池回收协程,将实例化对象1和对象2回收至对象缓冲池;
重复执行S1至S4中的步骤,直至角色选择阶段结束或者加载完成当前局游戏所需要的所有静态资源。
需要说明的是,采用如图10所示的四个协程以及四个协程的工作方式对资源进行加载,这只是一种示例。本实施例还可以采用其他数量的协程和/或其他工作方式对资源进行加载,例如,与图10所示的方式不同之处在于,采用一个协程完成上述的步骤S3和S4。
通过本申请提供的上述实施例,利用角色选择阶段的多个关键协程,在资源加载协程中依次加载或并行加载游戏所需要的静态资源集合中的各个静态资源子集,然后通过资源实例化协程和资源池回收协程,将已加载的各个静态资源子集对应的实例化对象存储至对象缓冲池中,使得在下一局游戏中可以重复利用该部分提前预加载的静态资源,降低了资源加载时间,避免了资源加载时间过长导致的帧率卡顿,提高了用户体验感。
作为一种可选地实施例,在上述角色选择阶段加载完成静态资源集合中的部分静态资源的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源,包括:在角色选择阶段加载完成部分静态资源时角色选择阶段结束的情况下,暂停静态资源的加载,并在资源加载阶段开始时,开始加载一局游戏的动态资源集合,并继续加载静态资源集合中除部分静态资源之外的静态资源。
为了进一步说明本实施例中的上述阶段跳转过程,下面结合附图11进行详细描述。具体地,如图11所示,为一局游戏的角色选择阶段预先配置了最大允许选择时间t1,即要求所有玩家在最大允许选择时间t1内完成角色配置信息的确定,超过上述t1,则直接跳转到资源加载阶段。如图11所示,资源加载阶段的时间为t2。在图11所示的场景中,从角色选择阶段跳转至资源加载阶段的条件包括但不限于以下两种情况:
(1)参与本局游戏的所有玩家在时间t0内均已完成角色配置信息的确定,此时将直接结束角色选择阶段,并跳转至资源加载阶段,其中t0<t1;
(2)参与本局游戏的所有玩家在预定的时间t1内没有完成角色配置信息的确定,或者,在到达预定的时间t1时刚好完成了角色配置信息的确定,则在达到时间t1时,将自动结束角色选择阶段,并跳转至资源加载阶段。
需要说明的是,在第(1)种条件下结束角色选择阶段时,会在角色选择阶段的显示界面中以定时器的方式给出即将结束角色选择阶段的提示消息,例如,依次在界面中动态显示数字10、9、8…1,然后进入资源加载阶段的显示界面。
可以理解的是,针对第(2)种条件下角色选择阶段没有完成角色选择的情况,在到达预定的时间t1时将为玩家自动确定对应的角色配置信息,例如,自动选择对应的角色、角色的皮肤、角色的技能。
进一步地,在执行上述跳转条件(1)或(2)的情况下,只要角色选择阶段结束,即停止对静态资源的预加载,然后在资源加载阶段,开始加载当前局游戏的动态资源集合,并继续加载在角色选择阶段未加载完成的静态资源集合中剩余的部分静态资源。
通过本申请提供的上述实施例,采用两种不同的结束条件实现角色选择阶段到资源加载阶段的转换,并将两种不同的结束条件应用于不同的场景,在提高资源加载效率的同时,还可以实现提高资源加载灵活性的技术效果。
相关技术中,资源加载阶段结束时,会对游戏的其他阶段用到的资源进行释放,而通 常情况下,下一局游戏与当前局游戏所需要的资源存在重复的部分,对于该部分资源,如果在下一局游戏中直接重复利用当前局游戏中已加载的资源,可以有效提高下一局游戏的加载效率。
作为一种可选的实施方式,可以采用如图12所示的释放资源缓存的方式实现对当前局游戏已加载资源的重复利用,具体地,包括:在一局游戏中将加载的静态资源集合存储在目标缓存中;在一局游戏的下一局游戏的角色选择阶段,从目标缓存中复用静态资源集合中的部分或全部静态资源。
在本实施例中,通过角色选择阶段和资源加载阶段对游戏所需要的静态资源集合和动态资源集合进行加载(如步骤S1202、S1206-S1214-1),并全部资源加载完成后,将加载的静态资源集合存储至目标缓存中(如步骤S1214-2)。
在下一局游戏的资源加载过程中,通过在编辑器阶段对离线静态资源设置的标签,直接从目标缓存中获取与当前局游戏存在重复部分的资源,节约了下一局游戏需要加载的资源量,减少了下一局游戏的资源加载时间。
需要说明的是,本实施例中的当前局与下一局游戏的重复部分的资源不做限定,换言之,重复部分的资源可能是当前局游戏所需要的静态资源集合中的部分资源或全部静态资源。
进一步地,对于战斗阶段生成的资源(例如战斗数据)来说,如果在离开战斗阶段时(步骤S1210),通过执行步骤S1212将战斗阶段用到的资源进行释放,那么在下一局游戏中将无法参考当前局游戏的战斗数据。因此,在本申请的实施例中,通过步骤S1210和步骤S1214-2,在离开战斗阶段时,将战斗阶段生成的资源存储至目标缓存中,在下一局游戏的战斗阶段可以直接从目标缓存中获取当前局游戏的战斗数据,为下一局游戏的战斗阶段提供了参考数据,有助于提升下一局游戏的战斗能力。
作为一种可选的实施方式,在一局游戏的下一局游戏的角色选择阶段,从目标缓存中复用静态资源集合中的部分或全部静态资源,包括:
在一局游戏的游戏模式与下一局游戏的游戏模式相同的情况下,从目标缓存中复用静态资源集合中的全部静态资源;和/或
在一局游戏的游戏模式与下一局游戏的游戏模式不同的情况下,从目标缓存中复用静态资源集合中的部分静态资源,其中,部分静态资源是下一局游戏中待使用的静态资源。
具体地,在假设游戏模式包括模式1(排位)和模式2(匹配)两种的前提下,如图13中(a)所示,当前局游戏与下一局游戏的游戏模式相同时,且均为排位赛模式时,在对下一局游戏的静态资源进行加载时,可以直接从目标缓存中获取预先存储的当前局游戏已加载的全部静态资源。
如图13中(b)所示,当前局游戏的模式为排位赛模式,下一局游戏的模式为匹配赛模式时,由于二者游戏模式不同,因此,两局游戏所用到的静态资源中可能存在部分相同的资源。在下一局游戏的静态资源进行加载时,可以直接从目标缓存中获取该相同部分的已加载静态资源。
需要说明的是,与一局游戏的游戏模式相关的资源主要包括游戏中的场景元素和NPC对应的资源,例如,游戏地图上出现的草、灯、墙壁或其他虚拟物体对应的资源、不同NPC对应的资源。也就是说,与游戏模式相关的资源通常为一局游戏的静态资源,因此,当两局游戏的游戏模式相同时,也就意味着两局游戏所需要使用的静态资源也相同。反之,当两局游戏的游戏模式不同时,则两局游戏所需要使用的静态资源可以部分相同。
通过本申请提供的上述实施例,通过在一局游戏中将加载的静态资源集合存储至目标缓存中,然后在对下一局游戏的静态资源加载时,根据静态资源的标签,直接从目标缓存中获取静态资源集合中的全部或部分静态资源,实现了游戏资源的重复利用,降低了下一局游戏的资源加载时间,提高了资源加载效率。
作为一种可选的实施方式,上述资源预加载方法还包括:
在资源加载阶段结束之后,根据加载的静态资源集合和动态资源集合,显示一局游戏的战斗阶段的游戏画面。
在本实施例中,通过角色选择阶段和资源加载阶段,加载完成一局游戏的全部资源,其中,包括全部静态资源和全部动态资源,然后根据已加载的静态资源和已加载的动态资源,渲染出与各个资源对应的图像,构成图像集合,最后根据图像集合中的图像动态显示该局游戏的战斗阶段的游戏画面。
具体地,如图3所示,通过角色选择阶段和资源加载阶段,加载完成了静态资源集合和动态资源集合,例如,图3中所示的角色300、角色300所具备的技能303等均属于动态资源集合中的动态资源,图3中的场景元素(草)属于静态资源集合中的静态资源。通过对已加载的技能303的资源进行渲染,即可在战斗阶段的游戏画面中显示技能303对应的虚拟按钮;通过对角色300对应的资源进行渲染,即可在战斗阶段的游戏画面中显示角色300。
基于相同的原理,根据角色选择阶段和资源加载阶段已加载的静态资源集合,对静态资源集合中的静态资源进行渲染,即可在战斗阶段的游戏画面中显示所有静态资源所对应的局内对象,例如游戏地图上的草、灯、NPC等。
通过本申请提供的上述实施例,在角色选择阶段提前预加载一局游戏的部分或全部静态资源,减少了资源加载阶段待加载的资源量,减少了资源加载的时间,从而提高了对已加载资源的渲染效率,降低了局内由于资源加载带来的帧率卡顿,提升了战斗阶段的游戏画面的显示效果,进而提高了用户体验感。
为了更好地理解上述各实施方案,本申请还提供了一种资源预加载方法的整体流程图,具体地,如图14所示,包括如下步骤:
S1402,进入一局游戏的选将阶段,如上述图3所示的角色选择阶段;
S1404,判断是否开启提前预加载离线静态资源;在确定开启离线预加载静态资源的情况下,执行步骤S1406;否则执行步骤S1420。
S1406,读取离线数据。
S1408-S1410,提前加载系统运行加载协程,并在选将阶段结束后进入游戏的资源加载阶段,如上述图11所示的,从t0或t1跳转至t2所示的资源加载阶段。
S1412,判断提前加载是否完成,并在完成提前加载的情况下,执行步骤S1414,正常加载剩下的资源(包括未加载的静态资源和动态资源),具体可参考上述图5所示的资源加载阶段,对动态资源和角色选择阶段未加载的静态资源进行加载;
否则,执行步骤S1422,判断提前加载是否超时,在判断结果为没有超时的情况下,执行步骤S1414,正常加载剩下的资源;否则,执行步骤S1418;
S1416,在完成游戏资源的加载后,执行步骤S1418。
S1418,进入游戏。
S1420,传统加载。
采用本申请实施例中的资源预加载方法对某游戏的资源加载时长进行测试,得到如图15所示的效果图。在图15中,横轴坐标t1~tn表示游戏测试的时间,纵坐标表示实际对局过程中,同一款游戏不同测试时间的平均资源加载时长,例如:平均每天的资源加载时长。
从图15中的资源加载时长的曲线图,可以直观地看出,通过采用本申请实施例中的资源预加载方法,同一款游戏的资源加载时长会随着测试时间的变化逐渐降低。也即,通过利用角色选择阶段(选将阶段)的空闲时间,对一局游戏的部分或全部静态资源进行预加载,减少了资源加载时间,提高了资源加载效率,解决了相关技术中资源加载时间过长的技术问题。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
根据本申请实施例的另一个方面,还提供了一种用于实施上述资源预加载方法的资源预加载装置。如图16所示,该装置包括:
第一加载单元1602,用于在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源;
第二加载单元1604,用于在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源。
可选地,上述资源预加载装置还包括:
第三加载单元,用于在角色选择阶段加载完成静态资源集合中的部分静态资源的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源。
可选地,上述在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,以及加载静态资源集合中除部分静态资源之外的静态资源,包括:
第一加载模块,用于在一局游戏的资源加载阶段,并行加载一局游戏的动态资源集合以及静态资源集合中除部分静态资源之外的静态资源。
可选地,上述资源预加载装置还包括:
第一显示单元,用于在一局游戏的角色选择阶段加载一局游戏的静态资源集合的情况下,在角色选择阶段显示第一提示信息,其中,第一提示信息用于提示已提前加载一局游戏的部分资源;或者
第二显示单元,用于在一局游戏的角色选择阶段加载一局游戏的静态资源集合的情况下,在资源加载阶段显示第二提示信息,其中,第二提示信息用于提示已提前加载一局游戏的部分资源。
可选地,第一提示信息用于动态显示静态资源的加载进度,第二提示信息用于显示已提前加载的静态资源占总资源的比例。
可选地,上述第一加载单元,包括:
第一处理模块,用于在角色选择阶段,依次加载或并行加载静态资源集合中的各个静态资源子集,其中,各个静态资源子集包括以下至少之一:
一局游戏中的场景资源子集,其中,场景资源子集包括一局游戏中的游戏地图上出现的虚拟物体的资源;
一局游戏中的非玩家角色NPC资源子集,其中,NPC资源子集包括一局游戏中的一个或多个NPC的资源。
可选地,上述第一处理模块包括:
处理子模块,用于重复执行以下操作,直到角色选择阶段结束或者加载完成各个静态资源子集:
在确定出一局游戏中待使用的当前静态资源、且当前静态资源的资源路径信息未被存储到目标资源列表中的情况下,将当前静态资源的资源路径信息存储到目标资源列表中;
依次或并行地从目标资源列表中获取未加载的部分静态资源的资源路径信息,并根据部分静态资源的资源路径信息,加载部分静态资源;
对加载好的部分静态资源进行局内对象实例化,得到部分静态资源的实例化对象;
将部分静态资源的实例化对象存储到对象缓冲池中。
可选地,上述第三加载单元包括:
第二处理模块,用于在角色选择阶段加载完成部分静态资源时角色选择阶段结束的情况下,暂停静态资源的加载,并在资源加载阶段开始时,开始加载一局游戏的动态资源集合,并继续加载静态资源集合中除部分静态资源之外的静态资源。
可选地,上述资源预加载装置还包括:
存储单元,用于在一局游戏中将加载的静态资源集合存储在目标缓存中;
第四加载单元,用于在一局游戏的下一局游戏的角色选择阶段,从目标缓存中复用静态资源集合中的部分或全部静态资源。
可选地,上述第四加载单元,包括:
第二加载模块,用于在一局游戏的游戏模式与下一局游戏的游戏模式相同的情况下,从目标缓存中复用静态资源集合中的全部静态资源;和/或
第三加载模块,用于在一局游戏的游戏模式与下一局游戏的游戏模式不同的情况下,从目标缓存中复用静态资源集合中的部分静态资源,其中,部分静态资源是下一局游戏中待使用的静态资源。
可选地,上述资源预加载装置还包括:
显示单元,用于在资源加载阶段结束之后,根据加载的静态资源集合和动态资源集合,显示一局游戏的战斗阶段的游戏画面。
需要说明的是,这里的资源预加载装置的实施例可以参考上述资源预加载方法的实施例,这里不再赘述。
根据本申请实施例的又一个方面,还提供了一种用于实施上述资源预加载方法的计算机设备,该计算机设备可以是图17所示的终端设备或所示服务器。本实施例以该计算机设备为服务器为例来说明。如图17所示,该计算机设备包括存储器1702和处理器1704,该存储器1702中存储有计算机可读指令,该处理器1704被设置为通过计算机可读指令执行上述任一项方法实施例中的步骤。
可选地,在本实施例中,上述计算机设备可以位于计算机网络的多个网络设备中的至少一个网络设备。
可选地,在本实施例中,上述处理器可以被设置为通过计算机可读指令执行以下步骤:
S1,在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源;
S2,在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源。
可选地,本领域普通技术人员可以理解,图17所示的结构仅为示意,计算机设备也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图17其并不对上述计算机设备的结构造成限定。例如,计算机设备还可包括比图17中所示更多或者更少的组件(如网络接口等),或者具有与图17所示不同的配置。
其中,存储器1702可用于存储软件程序以及模块,如本申请实施例中的资源预加载方法和装置对应的程序指令/模块,处理器1704通过运行存储在存储器1702内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的资源预加载方法。存储器1702可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器1702可进一步包括相对于处理器1704远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述 网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。其中,存储器1702具体可以但不限于用于一局游戏所需要的静态资源集合和动态资源集合等信息。作为一种示例,如图17所示,上述存储器1702中可以但不限于包括上述资源预加载装置中的第一处理单元1602、第二处理单元1604。此外,还可以包括但不限于上述资源预加载装置中的其他模块单元,本示例中不再赘述。
可选地,传输装置1706用于经由一个网络接收或者发送数据。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置1706包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置1706为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。
此外,上述计算机设备还包括:显示器1708,用于显示上述战斗阶段的游戏画面;和连接总线1710,用于连接上述计算机设备中的各个模块部件。
在其他实施例中,上述终端设备或者服务器可以是一个分布式系统中的一个节点,其中,该分布式系统可以为区块链系统,该区块链系统可以是由该多个节点通过网络通信的形式连接形成的分布式系统。其中,节点之间可以组成点对点(P2P,Peer To Peer)网络,任意形式的计算机设备,比如服务器、终端等计算机设备都可以通过加入该点对点网络而成为该区块链系统中的一个节点。
根据本申请的一个方面,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的一个或多个处理器从计算机可读存储介质读取该计算机指令,一个或多个处理器执行该计算机指令,使得该计算机设备执行上述各种可选实现方式中提供的资源预加载方法,使得该计算机设备执行上述任一项方法实施例中的步骤。
可选地,在本实施例中,上述计算机可读的存储介质可以被设置为存储用于执行以下步骤的计算机可读指令:
S1,在一局游戏的角色选择阶段,加载一局游戏的静态资源集合,其中,角色选择阶段用于选择参与一局游戏的虚拟角色,静态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息不相关的资源;
S2,在角色选择阶段加载完成静态资源集合的情况下,在一局游戏的资源加载阶段,加载一局游戏的动态资源集合,其中,动态资源集合包括一局游戏中待使用的、且与角色选择阶段确定的角色配置信息相关的资源。
可选地,在本实施例中,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如单元的划分,仅仅为一种逻 辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。

Claims (15)

  1. 一种资源预加载方法,其特征在于,由计算机设备执行,包括:
    在一局游戏的角色选择阶段,加载所述一局游戏的静态资源集合,其中,所述角色选择阶段用于选择参与所述一局游戏的虚拟角色,所述静态资源集合包括所述一局游戏中待使用的、且与所述角色选择阶段确定的角色配置信息不相关的资源;
    在所述角色选择阶段加载完成所述静态资源集合的情况下,在所述一局游戏的资源加载阶段,加载所述一局游戏的动态资源集合,其中,所述动态资源集合包括所述一局游戏中待使用的、且与所述角色选择阶段确定的角色配置信息相关的资源。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在所述角色选择阶段加载完成所述静态资源集合中的部分静态资源的情况下,在所述一局游戏的资源加载阶段,加载所述一局游戏的动态资源集合,以及加载所述静态资源集合中除所述部分静态资源之外的静态资源。
  3. 根据权利要求2所述的方法,其特征在于,所述在所述一局游戏的资源加载阶段,加载所述一局游戏的动态资源集合,以及加载所述静态资源集合中除所述部分静态资源之外的静态资源,包括:
    在所述一局游戏的资源加载阶段,并行加载所述一局游戏的动态资源集合以及所述静态资源集合中除所述部分静态资源之外的静态资源。
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在一局游戏的角色选择阶段加载所述一局游戏的静态资源集合的情况下,在所述角色选择阶段显示第一提示信息,其中,所述第一提示信息用于提示已提前加载所述一局游戏的部分资源;或者
    在一局游戏的角色选择阶段加载所述一局游戏的静态资源集合的情况下,在所述资源加载阶段显示第二提示信息,其中,所述第二提示信息用于提示已提前加载所述一局游戏的部分资源。
  5. 根据权利要求4所述的方法,其特征在于,所述第一提示信息用于动态显示静态资源的加载进度,所述第二提示信息用于显示已提前加载的静态资源占总资源的比例。
  6. 根据权利要求1所述的方法,其特征在于,所述在一局游戏的角色选择阶段,加载所述一局游戏的静态资源集合,包括:
    在所述角色选择阶段,依次加载或并行加载所述静态资源集合中的各个静态资源子集,其中,所述各个静态资源子集包括以下至少之一:
    所述一局游戏中的场景资源子集,其中,所述场景资源子集包括所述一局游戏中的游戏地图上出现的虚拟物体的资源;
    所述一局游戏中的非玩家角色NPC资源子集,其中,所述NPC资源子集包括所述一局游戏中的一个或多个NPC的资源。
  7. 根据权利要求6所述的方法,其特征在于,所述在所述角色选择阶段,依次加载或并行加载所述静态资源集合中的各个静态资源子集,包括:
    重复执行以下操作,直到所述角色选择阶段结束或者加载完成所述各个静态资源子集:
    在确定出所述一局游戏中待使用的当前静态资源、且所述当前静态资源的资源路径信息未被存储到目标资源列表中的情况下,将所述当前静态资源的资源路径信息存储到所述目标资源列表中;
    依次或并行地从所述目标资源列表中获取未加载的部分静态资源的资源路径信息,并根据所述部分静态资源的资源路径信息,加载所述部分静态资源;
    对加载好的所述部分静态资源进行局内对象实例化,得到所述部分静态资源的实例化对象;
    将所述部分静态资源的实例化对象存储到对象缓冲池中。
  8. 根据权利要求2所述的方法,其特征在于,所述在所述角色选择阶段加载完成所述静态资源集合中的部分静态资源的情况下,在所述一局游戏的资源加载阶段,加载所述一局游戏的动态资源集合,以及加载所述静态资源集合中除所述部分静态资源之外的静态资源,包括:
    在所述角色选择阶段加载完成所述部分静态资源时所述角色选择阶段结束的情况下,暂停静态资源的加载,并在所述资源加载阶段开始时,开始加载所述一局游戏的动态资源集合,并继续加载所述静态资源集合中除所述部分静态资源之外的静态资源。
  9. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在所述一局游戏中将加载的所述静态资源集合存储在目标缓存中;
    在所述一局游戏的下一局游戏的角色选择阶段,从所述目标缓存中复用所述静态资源集合中的部分或全部静态资源。
  10. 根据权利要求9所述的方法,其特征在于,所述在所述一局游戏的下一局游戏的角色选择阶段,从所述目标缓存中复用所述静态资源集合中的部分或全部静态资源,包括:
    在所述一局游戏的游戏模式与所述下一局游戏的游戏模式相同的情况下,从所述目标缓存中复用所述静态资源集合中的全部静态资源;和/或
    在所述一局游戏的游戏模式与所述下一局游戏的游戏模式不同的情况下,从所述目标缓存中复用所述静态资源集合中的部分静态资源,其中,所述部分静态资源是所述下一局游戏中待使用的静态资源。
  11. 根据权利要求1至10中任一项所述的方法,其特征在于,所述方法还包括:
    在所述资源加载阶段结束之后,根据加载的所述静态资源集合和所述动态资源集合,显示所述一局游戏的战斗阶段的游戏画面。
  12. 一种资源预加载装置,其特征在于,包括:
    第一加载单元,用于在一局游戏的角色选择阶段,加载所述一局游戏的静态资源集合,其中,所述角色选择阶段用于选择参与所述一局游戏的虚拟角色,所述静态资源集合包括所述一局游戏中待使用的、且与所述角色选择阶段确定的角色配置信息不相关的资源;
    第二加载单元,用于在所述角色选择阶段加载完成所述静态资源集合的情况下,在所述一局游戏的资源加载阶段,加载所述一局游戏的动态资源集合,其中,所述动态资源集合包括所述一局游戏中待使用的、且与所述角色选择阶段确定的角色配置信息相关的资源。
  13. 一种计算机可读的存储介质,所述计算机可读的存储介质包括存储的程序,其中,所述程序运行时执行所述权利要求1至11任一项中所述的方法。
  14. 一种计算机设备,包括存储器和处理器,其特征在于,所述存储器中存储有计算机可读指令,所述处理器被设置为通过所述计算机可读指令执行所述权利要求1至11任一项中所述的方法。
  15. 一种计算机程序产品,包括计算机可读指令,所述计算机可读指令被一个或多个处理器执行时实现权利要求1-11中任一项所述的方法的步骤。
PCT/CN2022/129496 2022-01-12 2022-11-03 资源预加载方法和装置、存储介质及计算机设备 WO2023134276A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/357,678 US20230364515A1 (en) 2022-01-12 2023-07-24 Resource preloading method and apparatus, storage medium, and computer device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210033926.5A CN114428921A (zh) 2022-01-12 2022-01-12 资源预加载方法和装置、存储介质及电子设备
CN202210033926.5 2022-01-12

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/357,678 Continuation US20230364515A1 (en) 2022-01-12 2023-07-24 Resource preloading method and apparatus, storage medium, and computer device

Publications (1)

Publication Number Publication Date
WO2023134276A1 true WO2023134276A1 (zh) 2023-07-20

Family

ID=81310882

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/129496 WO2023134276A1 (zh) 2022-01-12 2022-11-03 资源预加载方法和装置、存储介质及计算机设备

Country Status (3)

Country Link
US (1) US20230364515A1 (zh)
CN (1) CN114428921A (zh)
WO (1) WO2023134276A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114428921A (zh) * 2022-01-12 2022-05-03 腾讯科技(深圳)有限公司 资源预加载方法和装置、存储介质及电子设备

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502670A (zh) * 2016-10-20 2017-03-15 网易(杭州)网络有限公司 一种游戏场景切换方法与装置
CN106651747A (zh) * 2016-12-30 2017-05-10 腾讯科技(深圳)有限公司 一种应用中模拟对象的资源处理方法以及装置
CN111897596A (zh) * 2020-07-21 2020-11-06 珠海剑心互动娱乐有限公司 Unity游戏资源加载优化方法及系统
WO2020251608A1 (en) * 2019-06-14 2020-12-17 Roblox Corporation Predictive data preloading
CN112612982A (zh) * 2021-01-05 2021-04-06 上海哔哩哔哩科技有限公司 网页预加载方法、装置及计算机设备
CN113018866A (zh) * 2021-03-31 2021-06-25 完美世界(北京)软件科技发展有限公司 地图资源的加载方法和装置、存储介质、电子装置
CN113158098A (zh) * 2020-01-07 2021-07-23 百度在线网络技术(北京)有限公司 页面生成方法、装置、设备和介质
CN114428921A (zh) * 2022-01-12 2022-05-03 腾讯科技(深圳)有限公司 资源预加载方法和装置、存储介质及电子设备

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502670A (zh) * 2016-10-20 2017-03-15 网易(杭州)网络有限公司 一种游戏场景切换方法与装置
CN106651747A (zh) * 2016-12-30 2017-05-10 腾讯科技(深圳)有限公司 一种应用中模拟对象的资源处理方法以及装置
WO2020251608A1 (en) * 2019-06-14 2020-12-17 Roblox Corporation Predictive data preloading
CN113158098A (zh) * 2020-01-07 2021-07-23 百度在线网络技术(北京)有限公司 页面生成方法、装置、设备和介质
CN111897596A (zh) * 2020-07-21 2020-11-06 珠海剑心互动娱乐有限公司 Unity游戏资源加载优化方法及系统
CN112612982A (zh) * 2021-01-05 2021-04-06 上海哔哩哔哩科技有限公司 网页预加载方法、装置及计算机设备
CN113018866A (zh) * 2021-03-31 2021-06-25 完美世界(北京)软件科技发展有限公司 地图资源的加载方法和装置、存储介质、电子装置
CN114428921A (zh) * 2022-01-12 2022-05-03 腾讯科技(深圳)有限公司 资源预加载方法和装置、存储介质及电子设备

Also Published As

Publication number Publication date
US20230364515A1 (en) 2023-11-16
CN114428921A (zh) 2022-05-03

Similar Documents

Publication Publication Date Title
CN110141864B (zh) 一种游戏自动测试方法、装置及终端
CN110898428B (zh) 多虚拟对象交互的方法、装置、服务器及存储介质
CN110162726B (zh) 页面资源的加载方法、装置及存储介质
CN110772799B (zh) 会话消息处理方法、装置和计算机可读存储介质
CN109876440B (zh) 对象展示方法和装置、存储介质及电子装置
CN112988400B (zh) 显存优化方法、装置、电子设备以及可读存储介质
CN105740010B (zh) 一种开机方法及终端设备
CN113101652A (zh) 信息展示方法、装置、计算机设备及存储介质
US20230306694A1 (en) Ranking list information display method and apparatus, and electronic device and storage medium
CN112316439A (zh) 物品获取方法、装置、电子设备以及存储介质
CN113018848B (zh) 一种游戏画面的显示方法、相关装置、设备以及存储介质
WO2023134276A1 (zh) 资源预加载方法和装置、存储介质及计算机设备
JP7098846B2 (ja) 仮想キャラクタ使用データの処理方法並びにその、装置、機器及びコンピュータプログラム
CN107172501A (zh) 一种直播房间推荐展示方法及系统
WO2023046102A1 (zh) 行为壁纸解锁方法、装置及电子设备
CN111880845A (zh) 控制目标应用的方法、系统及装置
CN112169327A (zh) 一种云游戏的控制方法以及相关装置
CN112799622A (zh) 一种应用的控制方法、装置及电子设备
CN109815407A (zh) 一种信息资源推送方法、装置、设备及存储介质
US20240091643A1 (en) Method and apparatus for controlling virtual objects in game, and electronic device and storage medium
CN114257827B (zh) 游戏直播间显示方法、装置、设备及存储介质
CN114390017B (zh) 一种会话提醒方法、装置及设备
CN111766992B (zh) 信息显示方法、装置、电子设备及存储介质
CN112691369A (zh) 显示方法、装置、电子设备及存储介质
CN111228818A (zh) 通信交互方法、装置、存储介质、处理器及电子装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22919910

Country of ref document: EP

Kind code of ref document: A1