Method and device for generating continuous runways in games, storage medium, and electronic device

By locating the target virtual character in the game and loading pre-baked runway segment data, a continuous infinite runway is dynamically generated, solving the problem of circular runways being easily discovered, and improving resource utilization and player experience.

CN114225404BActive Publication Date: 2025-09-12SHANGHAI PERFECT WORLD SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111580293.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-09-12
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

In the prior art, the infinite runway in the game is usually simulated by a circular runway, which is easy for players to find flaws and difficult to adjust, and cannot meet the needs of the game.

Method used

By locating the target virtual character's position on the runway, calculating the remaining length, and loading pre-baked runway segment data, a continuous infinite runway is dynamically generated. A random algorithm is used to select and splice runway segments to improve resource utilization.

Benefits of technology

The dynamic generation of continuous and infinite runways in the game is realized, which improves the utilization rate of game resources. The generated runways are richer and more varied, and the player experience is better.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114225404B_ABST
    Figure CN114225404B_ABST
Patent Text Reader

Abstract

The present invention provides a method and apparatus, storage medium, and electronic device for generating a continuous runway in a game. The method comprises: locating a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment; calculating the remaining length of the first runway based on the first segment position, wherein the remaining length is the total length of the remaining runway segments not reached by the target virtual character on the first runway; and loading runway data of a second runway segment onto the first runway based on the remaining length to extend the first runway into a second runway, wherein the second runway includes at least one second runway segment, and both the first runway segment and the second runway segment are pre-baked with pathfinding data and multiple sets of splicing data, each set of splicing data corresponding to a different type of runway segment. This invention overcomes the technical problem of related arts that can only generate circular continuous runs, thereby improving the utilization of game resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for generating a continuous runway in a game, a storage medium, and an electronic device. Background Art

[0002] In some game scenarios, the runner needs to continuously run forward on a specifically shaped runway, automatically avoiding obstacles along the runway, while the pursuer flies behind to catch up. The runway needs to be randomly generated during game play and can extend indefinitely. The runner and pursuer can move horizontally between the left cliff, the middle road, and the right cliff of the cliff runway.

[0003] In related technologies, some infinite runways are simulated by using larger circular runways. However, the runways are single and fixed in changes, making them easy for players to see through and discover flaws. Furthermore, the runways rely on art production, making adjustments after production difficult and failing to meet gaming requirements.

[0004] Currently, no effective solution has been found for the above-mentioned problems existing in the related technologies. Summary of the Invention

[0005] The embodiments of the present invention provide a method and device for generating a continuous runway in a game, a storage medium, and an electronic device.

[0006] According to one embodiment of the present invention, a method for generating a continuous runway in a game is provided, comprising: locating a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment; calculating a remaining length of the first runway based on the first segment position, wherein the remaining length is the total length of the remaining runway segments that the target virtual character has not reached on the first runway; and loading runway data of a second runway segment onto the first runway according to the remaining length to extend the first runway into a second runway, wherein the second runway includes at least one second runway segment, and both the first runway segment and the second runway segment are pre-baked with pathfinding data and multiple sets of splicing data, and each set of the multiple sets of splicing data corresponds to a type of runway segment.

[0007] Optionally, loading the runway data of the second runway segment on the first runway according to the remaining length includes: determining whether the remaining length is less than a first preset threshold; if the remaining length is less than the first preset threshold, searching for a first target runway segment in a runway segment pool, wherein the first target runway segment is the second runway segment; inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain the second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target virtual character on the runway segment.

[0008] Optionally, searching the runway segment pool for the first target runway segment includes: using a random algorithm to determine a first runway type of the runway segment to be inserted; and searching the runway segment pool for the first target runway segment matching the first runway type.

[0009] Optionally, searching for the first target runway fragment that matches the first runway type from the runway fragment pool includes: determining whether there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory; if there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory, extracting the first target runway fragment that matches the first runway type from the runway fragment cache pool; if there is no runway fragment of the first runway type in the runway fragment cache pool of the game device memory, obtaining the first target runway fragment from the runway fragment library of the game server, wherein the runway fragment pool includes the runway fragment cache pool and the runway fragment library.

[0010] Optionally, inserting the first target runway segment into the remaining runway segments of the first runway includes at least one of the following: inserting the first target runway segment at the end of the terminal runway segment of the first runway; inserting the first target runway segment between any two remaining runway segments of the first runway.

[0011] Optionally, inserting the first target runway segment at the end of the terminating runway segment of the first runway includes: determining a second runway type of the terminating runway segment; searching for splicing data matching the second runway type from the baked data of the first target runway segment; and using the splicing data to splice the first target runway segment to the end of the terminating runway segment.

[0012] Optionally, after loading the runway data of the second runway segment on the first runway according to the remaining length, the method further includes: locating the second segment position of the target virtual character on the second runway; calculating the movement length of the target virtual character on the second runway based on the second segment position; if the movement length is greater than a second preset threshold, removing the second target runway segment from the starting runway segment of the second runway, and removing the pathfinding data of the second target runway segment from the pathfinding data of the second runway, wherein the second target runway segment is the first runway segment.

[0013] Optionally, after removing the second target track segment from the starting track segment of the second track, the method further includes: storing the second target track segment in a track segment cache pool in a memory of a gaming device.

[0014] Optionally, before locating the first segment position of the target virtual character on the first runway, the method further includes: determining the moving speed of the target game character in the game scene; calculating the starting runway length based on the moving speed; and generating a starting runway with the starting runway length.

[0015] Optionally, generating the starting runway of the starting runway length includes: selecting a starting runway segment from a runway segment library using a random algorithm; loading the starting runway segment at the runway origin and initializing runway pathfinding data; continuing to select runway segments from the runway segment library using the random algorithm, and looping through the following steps until the total length of all current runway segments reaches the starting runway length: splicing the current runway segment onto the previous runway segment according to the segment type of the previous runway segment, inserting the pathfinding data of the current runway segment into the pathfinding data of the previous runway segment, and calculating the total length of all current runway segments.

[0016] Optionally, before selecting the starting runway segment from the runway segment library using a random algorithm, the method further includes: generating a runway segment set, wherein the runway segment set includes the following types of runway segments: a straight segment, a left curve segment, a right curve segment, and a combined runway segment; and storing the runway segment set in the runway segment library.

[0017] According to another embodiment of the present invention, a device for generating a continuous runway in a game is provided, comprising: a first positioning module, configured to locate a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment; a first calculation module, configured to calculate a remaining length of the first runway based on the first segment position, wherein the remaining length is the total length of the remaining runway segments that the target virtual character has not reached on the first runway; and a loading module, configured to load runway data of a second runway segment onto the first runway according to the remaining length, so as to extend the first runway into a second runway, wherein the second runway includes at least one second runway segment, and both the first runway segment and the second runway segment are pre-baked with pathfinding data and multiple sets of splicing data, and each set of the multiple sets of splicing data corresponds to a type of runway segment.

[0018] Optionally, the loading module includes: a judgment unit for judging whether the remaining length is less than a first preset threshold; a search unit for searching for a first target runway segment in a runway segment pool if the remaining length is less than the first preset threshold, wherein the first target runway segment is the second runway segment; an insertion unit for inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain the second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target virtual character on the runway segment.

[0019] Optionally, the search unit includes: a determination subunit, configured to determine a first runway type of the runway segment to be inserted using a random algorithm; and a search subunit, configured to search a runway segment pool for the first target runway segment that matches the first runway type.

[0020] Optionally, the search sub-unit is also used to: determine whether there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory; if there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory, extract the first target runway fragment matching the first runway type from the runway fragment cache pool; if there is no runway fragment of the first runway type in the runway fragment cache pool of the game device memory, obtain the first target runway fragment from the runway fragment library of the game server, wherein the runway fragment pool includes the runway fragment cache pool and the runway fragment library.

[0021] Optionally, the insertion unit includes at least one of the following: a first insertion subunit, configured to insert the first target runway segment at the end of the terminal runway segment of the first runway; and a second insertion subunit, configured to insert the first target runway segment between any two remaining runway segments of the first runway.

[0022] Optionally, the first insertion subunit is further used to: determine the second runway type of the terminating runway segment; search for splicing data matching the second runway type from the baked data of the first target runway segment; and use the splicing data to splice the first target runway segment to the end of the terminating runway segment.

[0023] Optionally, the device also includes: a second positioning module, used to locate the second segment position of the target virtual character on the second runway after the loading module loads the runway data of the second runway segment on the first runway according to the remaining length; a second calculation module, used to calculate the movement length of the target virtual character on the second runway based on the second segment position; and a removal module, used to remove the second target runway segment from the starting runway segment of the second runway if the movement length is greater than a second preset threshold, and remove the pathfinding data of the second target runway segment from the pathfinding data of the second runway, wherein the second target runway segment is the first runway segment.

[0024] Optionally, the apparatus further includes: a storage module configured to store the second target track segment in a track segment cache pool of a gaming device memory after the removal module begins to remove the second target track segment from the starting track segment of the second track.

[0025] Optionally, the device also includes: a determination module, used to determine the moving speed of the target game character in the game scene before the first positioning module locates the first segment position of the target virtual character on the first runway; a third calculation module, used to calculate the starting runway length based on the moving speed; and a generation module, used to generate a starting runway with the starting runway length.

[0026] Optionally, the generation module includes: a selection unit, used to select a starting runway segment from a runway segment library using a random algorithm; a loading unit, used to load the starting runway segment at the runway origin and initialize runway routing data; a loop unit, used to continue to select runway segments from the runway segment library using the random algorithm, and loop through the following steps until the total length of all current runway segments reaches the starting runway length: splicing the current runway segment to the previous runway segment according to the segment type of the previous runway segment, inserting the routing data of the current runway segment into the routing data of the previous runway segment, and calculating the total length of all current runway segments.

[0027] Optionally, the generation module further includes: a generation unit, used to generate a runway segment set before the selection unit uses a random algorithm to select a starting runway segment from the runway segment library, wherein the runway segment set includes the following types of runway segments: straight segment, left curve segment, right curve segment, and combined runway segment; and a storage unit, used to store the runway segment set in the runway segment library.

[0028] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.

[0029] According to another embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

[0030] Through the present invention, a first segment position of a target virtual character on a first runway is located, wherein the first runway includes at least one first runway segment; a remaining length of the first runway is calculated based on the first segment position, wherein the remaining length is the total length of the remaining runway segments that the target virtual character has not reached on the first runway; runway data of a second runway segment is loaded onto the first runway according to the remaining length to extend the first runway into a second runway, wherein the second runway includes at least one second runway segment, and both the first runway segment and the second runway segment are pre-baked with pathfinding data and multiple sets of splicing data, each set of the multiple sets of splicing data corresponding to a type of runway segment; by calculating the remaining length of the first runway and extending the first runway into the second runway according to the remaining length, a solution for real-time generation of a continuous infinite runway is implemented, which solves the technical problem that related technologies can only generate circular continuous runs. Only limited runway segment data needs to be updated each time, thereby improving the utilization rate of game resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] 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:

[0032] Figure 1 This is a hardware structure block diagram of a server for generating a continuous runway in a game according to an embodiment of the present invention;

[0033] Figure 2 is a flow chart of a method for generating a continuous runway in a game according to an embodiment of the present invention;

[0034] Figure 3 is a schematic diagram of the movement of a target virtual character in a continuous runway in an embodiment of the present invention;

[0035] Figure 4 is a schematic diagram of runway segments of different pathfinding types according to an embodiment of the present invention;

[0036] Figure 5 This is a structural block diagram of a device for generating a continuous runway in a game according to an embodiment of the present invention;

[0037] Figure 6 It is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this application. It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0040] Example 1

[0041] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, tablet, server, computer or similar electronic terminal. Taking running on a server as an example, Figure 1 This is a hardware structure diagram of a server for generating a continuous runway in a game according to an embodiment of the present invention. Figure 1 As shown, the server may include one or more ( Figure 1Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data. Optionally, the server may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0042] Memory 104 can be used to store server programs, such as application software programs and modules, such as the server program corresponding to a method for generating a continuous racetrack in a game according to an embodiment of the present invention. Processor 102 executes the server program stored in memory 104 to execute various functional applications and data processing, thereby implementing the aforementioned method. Memory 104 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some embodiments, memory 104 may further include memory remotely located from processor 102, which can be connected to the server via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. In this embodiment, processor 104 is configured to respond to human-computer interaction instructions and game strategies, controlling the target virtual character to perform designated operations to complete game tasks. Memory 104 is configured to store electronic game program scripts, configuration information, and virtual character attribute information.

[0043] The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by the server's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0044] Optionally, the input and output device 108 further includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface and for presenting images in a virtual scene;

[0045] In this embodiment, a method for generating a continuous runway in a game is provided. Figure 2FIG. 1 is a flow chart of a method for generating a continuous runway in a game according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0046] Step S202, locating a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment;

[0047] Optionally, this embodiment can be applied to virtual scenes such as virtual game scenes, virtual teaching scenes, and virtual demonstration scenes. The virtual scene includes multiple virtual characters, which can be controlled by user operations or system AI to move in the virtual scene such as the game scene. The virtual characters can be controlled by users, such as PCCs (Player-Controlled Characters) in a virtual game controlled by a main controller. In this embodiment, the virtual scene is described as a virtual game scene.

[0048] Optionally, the first runway includes one or more first runway segments, and the first runway is a runway generated by loading in the first loading cycle of the runway resource.

[0049] Step S204, calculating the remaining length of the first runway based on the first segment position, wherein the remaining length is the total length of the remaining runway segments that the target virtual character has not reached on the first runway;

[0050] Figure 3 is a schematic diagram of the movement of the target virtual character in the continuous runway in an embodiment of the present invention, s is the total movement length of the target virtual character in the continuous runway, s1 is the total length of the remaining runway segments that the target virtual character has not reached on the first runway, and s2 is the movement length that the target virtual character has already moved.

[0051] Step S206: Load the track data of the second track segment onto the first track based on the remaining length to extend the first track into the second track. The second track includes at least one second track segment. Both the first track segment and the second track segment are pre-baked with pathfinding data and multiple sets of splicing data. Each set of the multiple sets of splicing data corresponds to a type of track segment.

[0052] Optionally, the second runway includes one or more second runway fragments, and may also include one or more first runway fragments. The second runway is a runway generated by loading the runway resources in the second loading cycle. The runway resources in the second loading cycle and the first loading cycle may have some repeated runway resources.

[0053] Through the above steps, the first segment position of the target virtual character on the first runway is located, wherein the first runway includes at least one first runway segment; the remaining length of the first runway is calculated based on the first segment position, wherein the remaining length is the total length of the remaining runway segments that the target virtual character has not reached on the first runway; and the runway data of the second runway segment is loaded onto the first runway according to the remaining length to extend the first runway into the second runway, wherein the second runway includes at least one second runway segment, and the first runway segment and the second runway segment are both pre-baked with pathfinding data and multiple sets of splicing data, each set of the multiple sets of splicing data corresponding to a type of runway segment. By calculating the remaining length of the first runway and extending the first runway into the second runway according to the remaining length, a solution for real-time generation of a continuous infinite runway is implemented, which solves the technical problem that the related art can only generate a circular continuous runway. Only a limited amount of runway segment data needs to be updated each time, thereby improving the utilization of game resources.

[0054] In one implementation of this embodiment, loading the runway data of the second runway segment onto the first runway according to the remaining length includes:

[0055] S11, determining whether the remaining length is less than a first preset threshold;

[0056] Optionally, the first preset threshold is determined by the depth of field length of the virtual camera of the target virtual character in the game scene, and is greater than or equal to the depth of field length of the virtual camera, which can ensure the visual continuity of the runway while saving resource overhead of the runway resources during the rendering process.

[0057] S12, if the remaining length is less than a first preset threshold, searching for a first target runway segment in the runway segment pool, wherein the first target runway segment is the second runway segment;

[0058] In one example, searching for the first target runway segment in the runway segment pool includes: using a random algorithm to determine a first runway type of the runway segment to be inserted; and searching for a first target runway segment matching the first runway type from the runway segment pool.

[0059] Optionally, the runway segments of this embodiment are classified by pathfinding direction, and runway segments with different pathfinding directions correspond to different runway types. In addition, they can also correspond to the landscape on the runway, the game plot mapped by the runway, the game skills, etc. For example, when the target virtual character triggers the first skill, the first type of runway segment is loaded in front of the first runway, and when the second skill is triggered, the second type of runway segment is loaded in front of the first runway.

[0060] Based on the above example, searching for the first target runway fragment that matches the first runway type from the runway fragment pool includes: determining whether there is a runway fragment of the first runway type in the runway fragment cache pool in the game device memory; if there is a runway fragment of the first runway type in the runway fragment cache pool in the game device memory, extracting the first target runway fragment that matches the first runway type from the runway fragment cache pool; if there is no runway fragment of the first runway type in the runway fragment cache pool in the game device memory, obtaining the first target runway fragment from the runway fragment library of the game server, wherein the runway fragment pool includes a runway fragment cache pool and a runway fragment library.

[0061] Because tracks are infinitely generated, to ensure the game device's memory resources are not exhausted, deleted track segments can be stored in a track segment cache pool. When a track segment of a certain type is needed, the cache pool is first checked to see if there is a corresponding track segment. If so, the track segment is extracted from the cache pool and used directly; if not, the corresponding track segment is retrieved from the track segment library.

[0062] S13, inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain a second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target virtual character on the runway segment.

[0063] In this embodiment, the runway data of the first target runway segment includes: runway mapping, pathfinding data, and splicing data. In addition, it can also include game plot data on the runway segment (the main game process uses the identification information of the runway segment as an index to load the game plot synchronized with the first target runway segment in the plot library, such as dialogue, NPC, etc.), and the associated data of the first target runway segment and other runway segments (such as forks, intersections, etc.).

[0064] In some other embodiments, in addition to determining by remaining length, the determination can also be made by calculating the number of remaining segments. This solution includes: calculating the number of remaining segments of the first runway based on the position of the first segment; if the number of remaining segments is less than a predetermined number, executing S13: inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain a second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target avatar on the runway segment. In this embodiment, the length of each first runway segment is the same, or the same within a certain error range.

[0065] In one example, inserting the first target runway segment into the remaining runway segments of the first runway may include, but is not limited to: inserting the first target runway segment at the end of the terminal runway segment of the first runway; or inserting the first target runway segment between any two remaining runway segments of the first runway.

[0066] like Figure 3 As shown, s1 is less than the first preset threshold, and the first target runway segment is inserted at the end of the termination runway segment of the first runway. The total length of the first runway is extended, and the first runway becomes the second runway.

[0067] Optionally, inserting the first target runway segment at the end of the terminating runway segment of the first runway includes: determining the second runway type of the terminating runway segment; searching for splicing data matching the second runway type from the baked data of the first target runway segment; and using the splicing data to splice the first target runway segment to the end of the terminating runway segment.

[0068] In this embodiment, the splicing data is used to indicate the offset value and the angular rotation value between the runway segment to be spliced ​​(eg, the first target runway segment) and the source runway segment (eg, the end runway segment).

[0069] In another aspect of this embodiment, after loading the runway data of the second runway segment on the first runway according to the remaining length, the method further includes:

[0070] S21, locating the second segment position of the target virtual character on the second runway;

[0071] S22, calculating the movement length of the target virtual character on the second runway based on the second segment position;

[0072] like Figure 3 As shown, s2 is the moving length of the target virtual character on the second runway. When s2 is greater than a second preset threshold, the second target runway segment is removed, and the runway data of the second target runway segment is unloaded from the runway data of the second runway.

[0073] S23: If the movement length is greater than a second preset threshold, remove the second target runway segment from the starting runway segment of the second runway, and remove the pathfinding data of the second target runway segment from the pathfinding data of the second runway, wherein the second target runway segment is the first runway segment.

[0074] In some examples, it is further determined whether the target virtual character is the virtual character at the end of the second runway. If not, the virtual character at the end of the second runway is searched and located at the second segment position on the second runway, and then steps S22 and S23 are continued.

[0075] When the distance between the last player position and the last runway segment of the runway is greater than the set second preset threshold, the last segment of the runway will be removed, and the corresponding runway segment's pathfinding data will be deleted from the existing pathfinding data, and the pathfinding data will be updated.

[0076] In some examples, after removing the second target track segment from the starting track segment of the second track, the process further includes storing the second target track segment in a track segment cache pool in the gaming device's memory. Because the track segment cache pool is stored in the gaming device's memory, the cache allows the second target track segment to be directly accessed upon subsequent loading, thereby speeding up game resource loading.

[0077] In this embodiment, before locating the first segment position of the target virtual character on the first runway, the method further includes: determining the moving speed of the target game character in the game scene; calculating the starting runway length according to the moving speed; and generating a starting runway with the starting runway length.

[0078] In one implementation of this embodiment, generating a starting runway having a starting runway length includes: selecting a starting runway segment from a runway segment library using a random algorithm; loading the starting runway segment at the runway origin and initializing runway pathfinding data; continuing to select runway segments from the runway segment library using the random algorithm, and looping through the following steps until the total length of all current runway segments reaches the starting runway length: splicing the current runway segment onto the previous runway segment based on the segment type of the previous runway segment, inserting the pathfinding data of the current runway segment into the pathfinding data of the previous runway segment, and calculating the total length of all current runway segments.

[0079] When the game starts, a starting runway of a certain length is pre-generated based on the player character's movement speed, such as the target virtual character's maximum movement speed. The starting runway is generated as follows:

[0080] A runway segment is selected from the previously configured runway segment library according to a pre-set random algorithm.

[0081] If it is the first runway segment, that is, the starting runway segment, it is generated at the runway origin and the runway pathfinding data is initialized; if it is not the first runway segment, the current runway is spliced ​​to the previous runway according to the splicing data of the runway segment type recorded in the runway segment, and the pathfinding data of the new runway segment is inserted into the existing pathfinding data to update the pathfinding data.

[0082] Optionally, before selecting the starting runway segment from the runway segment library using a random algorithm, the method further includes: generating a runway segment set, wherein the runway segment set includes the following types of runway segments: a straight segment, a left curve segment, a right curve segment, and a combined runway segment; and storing the runway segment set in the runway segment library.

[0083] In the early stages, artists created a library of track segments for randomly generating tracks. The library includes track segments of types such as straights, left bends, right bends, and complex combinations of tracks. Splicing rules are set at the joints of track segments so that they can be connected to other types of track segments. For each type of track segment, data is pre-baked and saved in the attribute data of the corresponding track segment for use in subsequent track generation. This includes the following baked data: splicing data, which is used to indicate how to splice with other types of track segments, including parameters such as offset and rotation. The splicing data for each track segment includes multiple sets, each set corresponding to a type of track segment (straight, left bend, right bend, etc.); pathfinding data, which is used to indicate how the virtual character in the game passes through the track segment, including three lanes: the left straight, the middle straight, and the right straight.

[0084] Figure 4 1 is a schematic diagram of track segments of different pathfinding types in an embodiment of the present invention, including straight segments in the first column, right curve segments in the second column, and left curve segments in the third column.

[0085] Using the solution of this embodiment, a random algorithm selects matching track segments from pre-created track segments, correctly splices them onto the existing track, and then inserts the pathfinding data of the new segments into the existing pathfinding data to generate new pathfinding data, thus creating a continuously winding and extending track. Compared to fixed tracks, the generated tracks are richer and more random, allowing players to experience a different track every time. Artists only need to create basic track segments, and the final track is automatically and randomly generated by the program. This improves the efficiency of continuous track generation and reduces track resources when generating infinite tracks.

[0086] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0087] Example 2

[0088] This embodiment also provides a device for generating a continuous runway in a game, which is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0089] Figure 5 is a structural block diagram of a device for generating a continuous runway in a game according to an embodiment of the present invention. Figure 5 As shown, the device includes: a first positioning module 50, a first calculation module 52, and a loading module 54, wherein:

[0090] A first positioning module 50 is configured to locate a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment;

[0091] a first calculation module 52 for calculating a remaining length of the first runway based on the first segment position, wherein the remaining length is a total length of remaining runway segments that the target virtual character has not reached on the first runway;

[0092] A loading module 54 is configured to load track data of a second track segment onto the first track based on the remaining length, thereby extending the first track into a second track, wherein the second track includes at least one second track segment, and both the first track segment and the second track segment are pre-baked with pathfinding data and multiple sets of splicing data, where each set of the multiple sets of splicing data corresponds to a type of track segment.

[0093] Optionally, the loading module includes: a judgment unit for judging whether the remaining length is less than a first preset threshold; a search unit for searching for a first target runway segment in a runway segment pool if the remaining length is less than the first preset threshold, wherein the first target runway segment is the second runway segment; an insertion unit for inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain the second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target virtual character on the runway segment.

[0094] Optionally, the search unit includes: a determination subunit, configured to determine a first runway type of the runway segment to be inserted using a random algorithm; and a search subunit, configured to search a runway segment pool for the first target runway segment that matches the first runway type.

[0095] Optionally, the search sub-unit is also used to: determine whether there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory; if there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory, extract the first target runway fragment matching the first runway type from the runway fragment cache pool; if there is no runway fragment of the first runway type in the runway fragment cache pool of the game device memory, obtain the first target runway fragment from the runway fragment library of the game server, wherein the runway fragment pool includes the runway fragment cache pool and the runway fragment library.

[0096] Optionally, the insertion unit includes at least one of the following: a first insertion subunit, configured to insert the first target runway segment at the end of the terminal runway segment of the first runway; and a second insertion subunit, configured to insert the first target runway segment between any two remaining runway segments of the first runway.

[0097] Optionally, the first insertion subunit is further used to: determine the second runway type of the terminating runway segment; search for splicing data matching the second runway type from the baked data of the first target runway segment; and use the splicing data to splice the first target runway segment to the end of the terminating runway segment.

[0098] Optionally, the device also includes: a second positioning module, used to locate the second segment position of the target virtual character on the second runway after the loading module loads the runway data of the second runway segment on the first runway according to the remaining length; a second calculation module, used to calculate the movement length of the target virtual character on the second runway based on the second segment position; and a removal module, used to remove the second target runway segment from the starting runway segment of the second runway if the movement length is greater than a second preset threshold, and remove the pathfinding data of the second target runway segment from the pathfinding data of the second runway, wherein the second target runway segment is the first runway segment.

[0099] Optionally, the apparatus further includes: a storage module configured to store the second target track segment in a track segment cache pool of a gaming device memory after the removal module begins to remove the second target track segment from the starting track segment of the second track.

[0100] Optionally, the device also includes: a determination module, used to determine the moving speed of the target game character in the game scene before the first positioning module locates the first segment position of the target virtual character on the first runway; a third calculation module, used to calculate the starting runway length based on the moving speed; and a generation module, used to generate a starting runway with the starting runway length.

[0101] Optionally, the generation module includes: a selection unit, used to select a starting runway segment from a runway segment library using a random algorithm; a loading unit, used to load the starting runway segment at the runway origin and initialize runway routing data; a loop unit, used to continue to select runway segments from the runway segment library using the random algorithm, and loop through the following steps until the total length of all current runway segments reaches the starting runway length: splicing the current runway segment to the previous runway segment according to the segment type of the previous runway segment, inserting the routing data of the current runway segment into the routing data of the previous runway segment, and calculating the total length of all current runway segments.

[0102] Optionally, the generation module further includes: a generation unit, used to generate a runway segment set before the selection unit uses a random algorithm to select a starting runway segment from the runway segment library, wherein the runway segment set includes the following types of runway segments: straight segment, left curve segment, right curve segment, and combined runway segment; and a storage unit, used to store the runway segment set in the runway segment library.

[0103] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0104] Example 3

[0105] The embodiment of the present application also provides an electronic device, Figure 6 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 6 As shown, it includes a processor 61, a communication interface 62, a memory 63 and a communication bus 64, wherein the processor 61, the communication interface 62, and the memory 63 communicate with each other through the communication bus 64, and the memory 63 is used to store computer programs;

[0106] Processor 61 is configured to, when executing a program stored in memory 63, implement the following steps: locating a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment; calculating a remaining length of the first runway based on the first segment position, wherein the remaining length is the total length of the remaining runway segments that the target virtual character has not reached on the first runway; and loading runway data of a second runway segment onto the first runway based on the remaining length to extend the first runway into a second runway, wherein the second runway includes at least one second runway segment, and both the first runway segment and the second runway segment are pre-baked with pathfinding data and multiple sets of splicing data, where each set of the multiple sets of splicing data corresponds to a type of runway segment.

[0107] Optionally, loading the runway data of the second runway segment on the first runway according to the remaining length includes: determining whether the remaining length is less than a first preset threshold; if the remaining length is less than the first preset threshold, searching for a first target runway segment in a runway segment pool, wherein the first target runway segment is the second runway segment; inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain the second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target virtual character on the runway segment.

[0108] Optionally, searching the runway segment pool for the first target runway segment includes: using a random algorithm to determine a first runway type of the runway segment to be inserted; and searching the runway segment pool for the first target runway segment matching the first runway type.

[0109] Optionally, searching for the first target runway fragment that matches the first runway type from the runway fragment pool includes: determining whether there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory; if there is a runway fragment of the first runway type in the runway fragment cache pool of the game device memory, extracting the first target runway fragment that matches the first runway type from the runway fragment cache pool; if there is no runway fragment of the first runway type in the runway fragment cache pool of the game device memory, obtaining the first target runway fragment from the runway fragment library of the game server, wherein the runway fragment pool includes the runway fragment cache pool and the runway fragment library.

[0110] Optionally, inserting the first target runway segment into the remaining runway segments of the first runway includes at least one of the following: inserting the first target runway segment at the end of the terminal runway segment of the first runway; inserting the first target runway segment between any two remaining runway segments of the first runway.

[0111] Optionally, inserting the first target runway segment at the end of the terminating runway segment of the first runway includes: determining a second runway type of the terminating runway segment; searching for splicing data matching the second runway type from the baked data of the first target runway segment; and using the splicing data to splice the first target runway segment to the end of the terminating runway segment.

[0112] Optionally, after loading the runway data of the second runway segment on the first runway according to the remaining length, the method further includes: locating the second segment position of the target virtual character on the second runway; calculating the movement length of the target virtual character on the second runway based on the second segment position; if the movement length is greater than a second preset threshold, removing the second target runway segment from the starting runway segment of the second runway, and removing the pathfinding data of the second target runway segment from the pathfinding data of the second runway, wherein the second target runway segment is the first runway segment.

[0113] Optionally, after removing the second target track segment from the starting track segment of the second track, the method further includes: storing the second target track segment in a track segment cache pool in a memory of a gaming device.

[0114] Optionally, before locating the first segment position of the target virtual character on the first runway, the method further includes: determining the moving speed of the target game character in the game scene; calculating the starting runway length based on the moving speed; and generating a starting runway with the starting runway length.

[0115] Optionally, generating the starting runway of the starting runway length includes: selecting a starting runway segment from a runway segment library using a random algorithm; loading the starting runway segment at the runway origin and initializing runway pathfinding data; continuing to select runway segments from the runway segment library using the random algorithm, and looping through the following steps until the total length of all current runway segments reaches the starting runway length: splicing the current runway segment onto the previous runway segment according to the segment type of the previous runway segment, inserting the pathfinding data of the current runway segment into the pathfinding data of the previous runway segment, and calculating the total length of all current runway segments.

[0116] Optionally, before selecting the starting runway segment from the runway segment library using a random algorithm, the method further includes: generating a runway segment set, wherein the runway segment set includes the following types of runway segments: a straight segment, a left curve segment, a right curve segment, and a combined runway segment; and storing the runway segment set in the runway segment library.

[0117] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0118] The communication interface is used for communication between the above terminal and other devices.

[0119] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0120] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0121] In another embodiment provided by the present application, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method for generating a continuous runway in the game described in any of the above embodiments.

[0122] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the method for generating a continuous runway in a game as described in any one of the above embodiments.

[0123] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0124] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0125] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as 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.

[0127] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0128] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0129] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0130] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating a continuous runway in a game, characterized in that: include: Locating a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment; Calculating a remaining length of the first runway based on the first segment position, wherein the remaining length is a total length of remaining runway segments that the target virtual character has not reached on the first runway; Loading track data of a second track segment onto the first track according to the remaining length to extend the first track into a second track, wherein the second track includes at least one second track segment, and both the first track segment and the second track segment are pre-baked with pathfinding data and multiple sets of splicing data, each set of the multiple sets of splicing data corresponding to a type of track segment; Before locating the first segment position of the target virtual character on the first runway, the method further includes: determining the moving speed of the target game character in the game scene; calculating the starting runway length according to the moving speed; and generating a starting runway with the starting runway length.

2. The method according to claim 1, characterized in that Loading the runway data of the second runway segment on the first runway according to the remaining length includes: Determining whether the remaining length is less than a first preset threshold; If the remaining length is less than a first preset threshold, searching for a first target runway segment in a runway segment pool, wherein the first target runway segment is the second runway segment; Inserting the first target runway segment into the remaining runway segments of the first runway, and inserting the pathfinding data of the first target runway segment into the pathfinding data of the first runway to obtain the second runway, wherein the pathfinding data is used to indicate the pathfinding direction of the target virtual character on the runway segment.

3. The method according to claim 2, characterized in that Finding the first target runway segment in the runway segment pool includes: Using a random algorithm to determine the first runway type of the runway segment to be inserted; The first target runway segment matching the first runway type is searched from a runway segment pool.

4. The method according to claim 3, characterized in that Searching for the first target runway segment matching the first runway type from a runway segment pool includes: Determining whether a track segment of the first track type exists in a track segment cache pool in a memory of a gaming device; If the track fragment cache pool in the game device memory contains track fragments of the first track type, extract the first target track fragment that matches the first track type from the track fragment cache pool; if the track fragment cache pool in the game device memory does not contain track fragments of the first track type, obtain the first target track fragment from the track fragment library of the game server, wherein the track fragment pool includes the track fragment cache pool and the track fragment library.

5. The method according to claim 2, characterized in that Inserting the first target runway segment into the remaining runway segments of the first runway includes at least one of the following: inserting the first target runway segment at the end of the terminal runway segment of the first runway; The first target runway segment is inserted between any two remaining runway segments of the first runway.

6. The method according to claim 5, characterized in that Inserting the first target runway segment at the end of the terminal runway segment of the first runway includes: determining a second runway type for the terminating runway segment; searching for splicing data matching the second runway type from the baked data of the first target runway segment; The first target runway segment is spliced ​​to the end of the termination runway segment using the splicing data.

7. The method according to claim 1, characterized in that After loading the runway data of the second runway segment onto the first runway according to the remaining length, the method further includes: locating a second segment position of the target virtual character on the second runway; Calculating a moving length of the target virtual character on the second runway based on the second segment position; If the movement length is greater than a second preset threshold, a second target runway segment is removed from the starting runway segment of the second runway, and the pathfinding data of the second target runway segment is removed from the pathfinding data of the second runway, wherein the second target runway segment is the first runway segment.

8. The method according to claim 7, characterized in that After removing the second target runway segment from the start runway segment of the second runway, the method further includes: The second target track segment is stored in a track segment cache pool in the game device memory.

9. The method according to claim 1, characterized in that Generating the starting runway of the starting runway length includes: A random algorithm is used to select the starting runway segment from the runway segment library; Loading the starting runway segment at the runway origin and initializing the runway pathfinding data; Continue to use the random algorithm to select runway segments from the runway segment library, and loop the following steps until the total length of all current runway segments reaches the starting runway length: splice the current runway segment to the previous runway segment according to the segment type of the previous runway segment, insert the pathfinding data of the current runway segment into the pathfinding data of the previous runway segment, and calculate the total length of all current runway segments.

10. The method according to claim 9, characterized in that Before selecting the starting runway segment from the runway segment library using a random algorithm, the method further includes: Generate a runway segment set, wherein the runway segment set includes the following types of runway segments: a straight segment, a left curve segment, a right curve segment, and a combined runway segment; The runway segment set is stored in the runway segment library.

11. A device for generating a continuous runway in a game, characterized in that: include: A first positioning module is configured to locate a first segment position of a target virtual character on a first runway, wherein the first runway includes at least one first runway segment; a first calculation module, configured to calculate a remaining length of the first runway based on the first segment position, wherein the remaining length is a total length of remaining runway segments that the target virtual character has not reached on the first runway; a loading module, configured to load track data of a second track segment onto the first track according to the remaining length, so as to extend the first track into a second track, wherein the second track includes at least one second track segment, and the first track segment and the second track segment are both pre-baked with pathfinding data and multiple sets of splicing data, each set of the multiple sets of splicing data corresponding to a type of track segment; The device further includes: a determination module for determining the moving speed of the target game character in the game scene before the first positioning module locates the first segment position of the target virtual character on the first runway; a third calculation module for calculating the starting runway length based on the moving speed; and a generation module for generating a starting runway of the starting runway length.

12. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 10 when executed.

13. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Game data acquisition method based on virtual racing track, processor and electronic device

    CN111185013A