CN112843717A - Resource allocation method, device, storage medium and computer equipment - Google Patents

Resource allocation method, device, storage medium and computer equipment Download PDF

Info

Publication number
CN112843717A
CN112843717A CN202110269368.8A CN202110269368A CN112843717A CN 112843717 A CN112843717 A CN 112843717A CN 202110269368 A CN202110269368 A CN 202110269368A CN 112843717 A CN112843717 A CN 112843717A
Authority
CN
China
Prior art keywords
resource
type
designated
resources
area
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202110269368.8A
Other languages
Chinese (zh)
Other versions
CN112843717B (en
Inventor
钟康剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110269368.8A priority Critical patent/CN112843717B/en
Publication of CN112843717A publication Critical patent/CN112843717A/en
Application granted granted Critical
Publication of CN112843717B publication Critical patent/CN112843717B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/55Controlling game characters or game objects based on the game progress
    • 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/79Game security or game management aspects involving player-related data, e.g. identities, accounts, preferences or play histories

Abstract

The application discloses a resource allocation method, a resource allocation device, a computer readable storage medium and computer equipment, wherein the method comprises the following steps: obtaining preselected positions in a designated area to obtain a position set containing all the preselected positions; when a first type of resource is distributed in a designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a resource preset in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position, the first preset distance, the first radius and the second radius of the designated resource in the designated area; and determining a first position from the position set according to the first occupied area, and allocating the first type of resources to the first position. The first type of resources can be automatically allocated by determining the first position where the first type of resources can be allocated, so that the map making efficiency is improved.

Description

Resource allocation method, device, storage medium and computer equipment
Technical Field
The present application relates to the field of computers, and in particular, to a resource allocation method, device, computer-readable storage medium, and computer apparatus.
Background
In recent years, with the diversification of game applications, many games against a map of the world, for example, games against the universe, the sky, and the like, have appeared.
In such games, map resources in the games are generally randomly allocated to achieve the purpose of enriching game play, and in the process of random allocation, in order to avoid that a virtual character operated and controlled by a player leaves the birth area, that is, is attacked by monsters in the dangerous area due to the fact that the birth area is too close to the dangerous area, it is necessary to manually separate birth resources corresponding to the birth area from non-birth resources corresponding to the dangerous area on the map setting in advance.
In the research and practice process of the prior art, the inventor of the present application finds that, in the prior art, for a game with a large map, it takes a lot of time to manually separate the birth resource and the non-birth resource, which results in an overlong game production time.
Disclosure of Invention
The embodiment of the application provides a resource allocation method and device, which can avoid the problem that a large amount of time is consumed for manually separating birth resources and non-birth resources, and improve the map making efficiency.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
a method of resource allocation, comprising:
obtaining preselected positions in a designated area to obtain a position set containing all the preselected positions;
when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area;
determining a first occupied area occupied by the designated resource in the designated area based on the designated position of the designated resource in the designated area, the first preset distance, the first radius and the second radius;
and determining a first position from the position set according to the position set and the first occupied area, and allocating the first type of resources to the first position.
A resource allocation apparatus, comprising:
the first acquisition module is used for acquiring preselected positions in a designated area to obtain a position set containing all the preselected positions;
a second obtaining module, configured to obtain a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource in the designated area when the first type of resource is allocated in the designated area, where the designated resource is a resource preset in the designated area;
a first determining module, configured to determine, based on the specified position of the specified resource in the specified area, the first preset distance, the first radius, and the second radius, a first occupied area occupied by the specified resource in the specified area;
and the second determining module is used for determining a first position from the position set according to the position set and the first occupied area and allocating the first type of resources to the first position.
A computer readable storage medium, storing a plurality of instructions, the instructions being suitable for being loaded by a processor to execute the steps of the resource allocation method.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the resource allocation method as described above when executing the program.
According to the method and the device, a position set comprising all the preselected positions is obtained by obtaining the preselected positions in the designated area; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position, a first preset distance, a first radius and the second radius; and determining a first position from the position set according to the position set and the first occupied area, and allocating the first type of resources to the first position. Therefore, the first occupied area occupied by the appointed resources in the appointed area is determined, the first position capable of distributing the first type of resources is selected from the position set, the first type of resources are automatically distributed, a large amount of time consumed for manually separating the birth resources and the non-birth resources can be avoided, and the mapping efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a schematic view of a scenario of a resource allocation method according to an embodiment of the present application.
Fig. 1b is a schematic flowchart of a resource allocation method according to an embodiment of the present application.
Fig. 1c is a schematic allocation diagram for allocating a first type of resource according to an embodiment of the present application.
Fig. 1d is a schematic diagram of allocation when allocating a second type of resource according to an embodiment of the present application.
Fig. 1e is a schematic diagram of a map after the second type of resources are completely allocated according to the embodiment of the present application.
Fig. 2a is a schematic flowchart of a second resource allocation method according to an embodiment of the present application.
Fig. 2b is a third group of schematic flow diagrams of a resource allocation method according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a resource allocation apparatus according to an embodiment of the present application.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a resource allocation method, a resource allocation device and a computer readable storage medium.
Referring to fig. 1a, fig. 1a is a schematic diagram of a system of a resource allocation system according to an embodiment of the present application, which may include at least one client 1000, at least one server 2000, at least one database 3000, and a network 4000. Each application corresponds to at least one server 2000, and the client 1000 may be a terminal device such as a mobile phone, a computer, or a personal digital assistant, and the client 1000 may be connected to the server 2000 through the network 4000, or multiple servers 2000. The network 4000 may be a wireless network or a wired network, for example, the wireless network is a Wireless Local Area Network (WLAN), a Local Area Network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, or the like. In addition, different clients 1000 may be connected to the server 2000 using their own bluetooth network or hotspot network. In addition, the system may include a database 3000, the database 3000 being operable to store user information of the user or equipment information, character information, etc. of the user in the game.
The embodiment of the present application provides a resource allocation method, which may be executed by a Computer device, where the Computer device includes a server, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 1a, when receiving a map generation request sent by a client 1000 through a network 4000, the server 2000 acquires preselected locations in a designated area to obtain a location set including all the preselected locations; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position of the designated resource in the designated area, the first preset distance, the first radius and the second radius; and determining a first position from the position set according to the first occupied area, and allocating the first type of resources to the first position. Based on this, the first occupied area occupied by the designated resource in the designated area is determined, so that the first position capable of distributing the first type of resource is selected from the position set, the first type of resource is automatically distributed, a large amount of time consumption caused by manual separation of the birth resource and the non-birth resource can be avoided, and the map making efficiency is improved.
It should be noted that the scenario diagram of the resource allocation system shown in fig. 1a is only an example, and the resource allocation system and the scenario described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not form a limitation to the technical solution provided in the embodiment of the present application.
In the present embodiment, the resource allocation apparatus will be described from the perspective of a resource allocation apparatus, which may be integrated in a computer device having a storage unit and a microprocessor installed therein and having an arithmetic capability.
Referring to fig. 1b, fig. 1b is a first flowchart illustrating a resource allocation method according to an embodiment of the present disclosure. The resource allocation method comprises the following steps:
in step 101, pre-selected locations in the designated area are obtained, resulting in a location set that contains all the pre-selected locations.
The designated area refers to an area designated by a game developer in the map, such as a birth area of a virtual character or a virtual article manipulated by a player in the game. The designated area may also be designated by the player in some games that provide the player with a functional interface for the autonomous map design, and is not limited herein.
Specifically, in the map design, each position in the map corresponds to a coordinate, and the coordinate may be obtained by referring to the X axis and the Y axis. The center of the coordinate axis can be the center position of the map or the position of the lower left corner, and the like. In addition, for subsequent resource allocation, a position where the resource can be allocated needs to be screened from the designated area, that is, coordinates where the resource can be allocated are obtained from the designated area.
For example: the setting resource can be allocated only to a position having a multiple of 10 in each of the horizontal and vertical coordinates, for example, (10,10) or (20,30), and therefore a position having a multiple of 10 in each of the horizontal and vertical coordinates can be selected from the designated area based on the setting and determined as the preselected position.
In step 102, when the first type of resource is allocated in the designated area, a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource in the designated area are obtained.
The first type of resource, that is, the birth resource, is used to provide a birth area for a virtual character operated by a player, the virtual character can revive and be born in the birth area, and the virtual character can be transferred to other areas by performing a transfer operation in the birth area. In order to ensure that the birth area is far away from the resource area and the danger area, it is necessary to control a safety distance between the birth area and the resource area and between the birth area and the danger area, where the safety distance is a first preset distance between the first type of resource and the designated resource. For example, if the safe distance between the birth area and the dangerous area is set to 10 meters, the first preset distance is 10 meters. Moreover, since the birth area itself has a certain range, a first radius corresponding to the first type of resource needs to be obtained, where the first radius is the radius of the birth area (i.e., the length from the center point to the periphery of the first type of resource); similarly, the second radius is the radius of the resource region (i.e., the length from the center point to the periphery of the specified resource).
Specifically, based on the shape of the birth area and the shape of the first type of resource, when the shape of the birth area and the shape of the first type of resource are circular, the first radius and the second radius are the radius of the circular area; when the shape of the birth area and the shape of the first type of resource are squares, the first radius and the second radius are distances from the center point of the square area to the four sides.
Wherein the designated resource is a resource preset in the designated area. The game developer or the player can also preset some specified resources in a specified area, such as a resource area, where the resource area is used for the player to control the virtual character to obtain the game item, such as virtual fund, in the resource area. Since the designated resource is allocated to the designated area, the designated resource also has a corresponding designated position in the designated area, and the designated position also meets the position condition for setting the resource.
For example, the setting resource may be allocated only to a position whose horizontal and vertical coordinates are all multiples of 10, and in this setting, the coordinates of the designated position also satisfy the horizontal and vertical coordinates all multiples of 10, for example, (50,50), and the like.
In some embodiments, before the step of obtaining a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource located in the designated area when the first type of resource is allocated in the designated area, the method further includes:
(1) acquiring attribute information of resources to be allocated, wherein the attribute information comprises group identifiers of the resources;
(2) if the attribute information of the resource to be allocated has a first class identifier, determining the resource of which the attribute information includes the first class identifier in the resource to be allocated as a first class resource, and executing a step of acquiring a first preset distance between the first class resource and the specified resource, a first radius of the first class resource, and a second radius of the specified resource in the specified area when the first class resource is allocated in the specified area.
The attribute information may include information such as a radius of the resource and a group identifier. The group id is used to distinguish the type of the resource, and the resources of the same type all have the same group id, for example, the group id of the birth resource is 100, and the group id of the non-birth resource is 200. Therefore, the first type of resources (birth resources) can be screened from the resources to be allocated through the group identifier in the attribute information of the resources to be allocated, and the first type of resources are preferentially allocated.
Specifically, the reason why the first type of resource is preferentially allocated is that: due to the limitation of the safety distance of the birth resources, the occupied area of the birth resources is relatively large, and if the birth resources are put in later, the problems of space waste and the like in a map are likely to be caused.
In step 103, a first occupied area occupied by the designated resource in the designated area is determined based on the designated position, the first preset distance, the first radius and the second radius.
In order to set the first type of resources in the designated area, a first occupied area occupied by the designated resources in the designated area needs to be determined according to the designated position, the first preset distance, the first radius and the second radius.
In some embodiments, the step of determining a first occupied area occupied by the designated resource within the designated area based on the designated position, the first preset distance, the first radius and the second radius includes:
(1) calculating the sum of the first preset distance, the first radius and the second radius to obtain a first result;
(2) and determining a first occupied area occupied by the specified resource in the specified area according to the specified position and the first result.
As shown in fig. 1c, fig. 1c is a schematic diagram of allocation when allocating a first type of resource according to an embodiment of the present application. Taking the shape of the designated resource and the first type resource as a square as an example, fig. 1B shows that the designated resource a is already allocated in the designated area, and the second radius of the designated resource a in the designated area is R2, and now the first radius of the first type resource is known as R1, it can be seen from fig. 1B that if it is desired to allocate the first type resource B in the designated area, the center point coordinates of the first type resource B need to be allocated to the area boundary formed by the center point of the designated resource a and the radius of the sum of R1, L1 and R2 and the boundary are out. The area within the boundary is the first occupied area occupied by the designated resource in the designated area.
In step 104, a first location is determined from the location set according to the location set and the first occupied area, and the first type of resource is allocated to the first location.
After the first occupied area is determined, a first position where the first type of resource can be allocated can be determined from a position set where the first type of resource can be allocated in the designated area, and the first type of resource is allocated to the first position.
In some embodiments, the step of determining a first location from the set of locations according to the set of locations and the first occupied area, and allocating the first type of resource to the first location, includes:
(1) determining a first occupied position occupied by the first occupied area in the position set;
(2) determining other positions in the position set except the first occupied position as first candidate positions;
(3) and acquiring a first quantity of the first type of resources, determining any position corresponding to the first quantity in the first candidate position as a first position, and distributing the first type of resources to the first position.
The first occupation position occupied by the first occupation area is determined firstly, the first occupation position is the position in the first occupation area which accords with the resource allocation setting, and the position set is the position set which is determined according to the resource allocation setting and consists of a plurality of preselected positions, so other first candidate positions except the first occupation position in the position set are the positions where the first type of resources can be allocated.
When the first type of resource is allocated, the central point of the first type of resource is allocated to the first position, so that a situation that a partial area of the first type of resource overlaps with the first occupied area exists (an overlapping part exists between the first type of resource B in fig. 1c and the first occupied area of the dotted line part), and thus, under the condition that the safety distance between the first type of resource and the designated resource is ensured, the waste of the map space is further avoided.
Specifically, after a first candidate location where the first type of resource can be allocated is determined, a first quantity of the first type of resource is determined, a location of the first quantity is determined from the first candidate location, the location is determined as a first location, and the first type of resource is allocated to the first location.
For example, the set of positions is { (0, 0); (10, 10); (10, 20); (20, 20); (30,40) }, the first occupied position being (0, 0); (10,10), the first candidate position is (10, 20); (20, 20); (30,40), the number of the first type resources is 2, and then the number can be (10, 20); (20, 20); randomly determining 2 positions in (30,40), and determining as a first position, such as (20, 20); (30,40), and allocating the two resources of the first type to the first location.
In some embodiments, the step of allocating the first type of resource to the first location further comprises:
(1) if the attribute information of the resource to be allocated also comprises a second type group identifier, determining the resource of which the attribute information comprises the second type group identifier in the resource to be allocated as a second type resource;
(2) acquiring a third radius of each second type of resource and a second preset distance between each second type of resource and the first type of resource;
(3) dividing second resources with the same third radius and the same second preset distance in the second resources into a group to obtain a plurality of resource groups to be allocated, wherein the resource groups comprise at least one second resource;
(4) determining a target resource group to be allocated from the plurality of resource groups to be allocated;
(5) and determining a second position from the position set according to the specified resource, the first type of resource and the position set, and allocating all target second type of resources in the target resource group to be allocated to the second position.
After the first class of resources are allocated, if there are resources to be allocated that include the second class of group identifiers in the attribute information, the resources with the second class of group identifiers are determined as second class of resources, which are also Non-birth resources, and the Non-birth resources can be used to generate monsters or Non-Player characters (NPCs) in a certain area (dangerous area). For the second type of resources, the safety distances (second preset distances) between different second type of resources and the first type of resources are different, and the third radii of the different second type of resources are also different, so in order to improve the allocation efficiency, the second type of resources to be allocated may be divided in advance according to the safety distances and the third radii between the different second type of resources and the first type of resources, so as to obtain multiple groups of resource groups to be allocated, and all the second type of resources in each resource group to be allocated have the same safety distances as the first type of resources, and the third radii are also the same. Therefore, when the second type of resources are allocated, the resource groups to be allocated, which have the same second preset distance and the same third radius, can be allocated in a group form in a unified manner.
Specifically, after a plurality of resource groups to be allocated are determined, a target resource group to be allocated to be currently allocated needs to be determined from the plurality of resource groups to be allocated, a second position is determined from the position set according to the specified resource, the first type of resource and the position set, and all target second type of resources in the target resource group to be allocated are allocated to the second position.
In some embodiments, the step of determining a target resource group to be allocated from the plurality of resource groups to be allocated includes:
(1.1) acquiring a second quantity of the second type of resources in a plurality of current resource groups to be allocated;
(1.2) determining the priority of the resource groups to be allocated according to the sequence of the second number from large to small;
and (1.3) determining the resource group to be allocated with the highest priority as a target resource group to be allocated.
The method for determining the target resource to be allocated may be as follows: and determining the distribution priority of each resource group to be distributed according to the second quantity of the second type of resources in each resource group to be distributed and the sequence from the large quantity to the small quantity of the second quantity, and determining the resource group to be distributed with the highest priority (with the largest second quantity) as the target resource group to be distributed.
For example, there are three groups of resource groups to be allocated, where there are 1 second type resource in the first group of resource group to be allocated, there are 2 second type resources in the second group of resource group to be allocated, and there are 3 second type resources in the third group of resource group to be allocated, then the priority is, in order from high to low: the method comprises the steps of a third group of resource groups to be allocated, a second group of resource groups to be allocated and a first group of resource groups to be allocated. Therefore, the third group of resource groups to be allocated with the highest priority is determined as the target resource group to be allocated.
In some embodiments, the step of determining a second location from the set of locations based on the specified resource, the first type of resource, and the set of locations comprises:
(1.1) acquiring a target radius of a target second type resource in a target resource group to be allocated and a target preset distance between the target second type resource and the first type resource;
(1.2) determining a second occupied area occupied by the designated resource within the designated area based on the designated position, a second radius, and the target radius;
(1.3) determining a third occupied area occupied by the first type of resource in the designated area based on the first position, the target radius, the target preset distance and the first radius;
(1.4) determining a second location from the set of locations based on the set of locations, the second occupancy area, and the third occupancy area.
When the target resource group to be allocated is allocated, the designated resource and the first type of resource are already allocated in the designated area, so that when the target resource group to be allocated including the second type of resource is allocated, the area occupied by the designated resource and the first type of resource in the designated area also needs to be determined, and the second position which can be allocated is selected from the unoccupied area.
Specifically, since there is no restriction condition of the safety distance between the designated resource and the second type of resource, when a second occupied area of the designated resource in the designated area is determined, only the target radius of the target second type of resource in the target resource group to be allocated may be obtained, and the second occupied area is determined according to the target radius, the second radius and the designated position; and for the first type of resources, because the second type of resources need to have a safety distance of a second preset distance from the first type of resources, a target preset distance between the second type of resources and the first type of resources in the target resource group to be allocated needs to be obtained, and a third occupied area occupied by the first type of resources in the specified area is determined according to the first position, the target preset distance and the first radius. And determining a second position according to the position set, the second occupied area and the third occupied area.
In some embodiments, the step of determining a third occupied area occupied by the first type of resource in the designated area based on the first position, the target radius, the target preset distance, and the first radius includes:
(1.1) calculating the sum of the target preset distance, the target radius and the first radius to obtain a second calculation result;
(1.2) determining a third occupied area occupied by the first type of resources in the designated area according to the first position and the second calculation result.
Referring to fig. 1d, fig. 1d is a schematic diagram illustrating allocation of a second type of resource according to an embodiment of the present disclosure. And determining a third occupied area of the first type of resources, wherein the third occupied area is determined by taking the first position when the first type of resources are distributed as the center and the second calculation result as the radius. The second calculation result is the sum of the first radius R1, the target preset distance L2, and the target radius R3 of the first type of resource. Thereby determining a third occupied area occupied by the first type of resource.
In some embodiments, the step of determining a second location from the set of locations based on the set of locations, the second occupancy area, and the third occupancy area comprises:
(1.1) determining a second occupancy location of the set of locations occupied by the second occupancy area and the third occupancy area;
(1.2) determining the other positions in the position set except the second occupied position as second candidate positions;
and (1.3) acquiring the target quantity of the target second-class resources, and determining any position corresponding to the target quantity in the second candidate positions as a second position.
And determining the occupied positions occupied by the occupied areas according to the second occupied area and the third occupied area to obtain a second occupied position, and determining a second candidate position except the second occupied position from the position set. And determining positions with the same number as the target number from the second candidate positions as the second positions by acquiring the target number of the target second-class resources.
In some embodiments, after the step of determining a second location from the set of locations according to the set of locations, the second occupancy area, and the third occupancy area, further comprises:
(1.1) determining the target second type resource as a designated resource and determining the second location as a designated location;
and (1.2) returning to execute the step of determining the target resource group to be allocated from the plurality of resource groups to be allocated until each second type of resource is allocated completely.
After the target resource groups to be allocated are allocated, determining all target second-class resources in the target resource groups to be allocated as specified resources, namely allocated resources, determining the second position as a specified position, and returning to the step of determining the target resource groups to be allocated from the plurality of resource groups to be allocated until the allocation of each second-class resource is completed.
As shown in fig. 1e, fig. 1e is a schematic diagram of a map after the second type of resources are completely allocated according to the embodiment of the present application. The circular area in fig. 1e is a designated area, and the designated resource 10, the allocated first-class resource 20, and the allocated second-class resource 30 exist in the designated area, where the second-class resource 30 also includes a second-class resource 31 and a second-class resource 32 that are allocated according to different resource groups to be allocated.
As can be seen from the above, in the embodiment of the present application, a location set including all the preselected locations is obtained by acquiring the preselected locations in the designated area; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position of the designated resource in the designated area, the first preset distance, the first radius and the second radius; and determining a first position from the position set according to the first occupied area, and allocating the first type of resources to the first position. Therefore, the first occupied area occupied by the appointed resources in the appointed area is determined, so that the first position capable of distributing the first type of resources is selected from the position set, the first type of resources are automatically distributed, a large amount of time consumption caused by manual separation of the birth resources and the non-birth resources can be avoided, and the mapping efficiency is improved.
The method described in connection with the above embodiments will be described in further detail below by way of example.
Referring to fig. 2a, fig. 2a is a second flowchart illustrating a resource allocation method according to an embodiment of the present application. The method flow can comprise the following steps:
in step 201, the computer device obtains preselected locations in the designated area, resulting in a location set that includes all of the preselected locations.
The designated area refers to an area designated by a game developer in the map, for example, a birth area of a virtual character manipulated by a player in the game. The designated area may also be designated by the player in some games that provide the player with a functional interface for the autonomous map design, and is not limited herein.
Specifically, in the map design, each position in the map corresponds to a coordinate, and the coordinate may be obtained by referring to the X axis and the Y axis. The center of the coordinate axis can be the center position of the map or the position of the lower left corner, and the like. In addition, for subsequent resource allocation, a position where the resource can be allocated needs to be screened from the designated area, that is, coordinates where the resource can be allocated are obtained from the designated area.
For example: the setting resource can be allocated only to a position having a multiple of 10 in each of the horizontal and vertical coordinates, for example, (10,10) or (20,30), and therefore a position having a multiple of 10 in each of the horizontal and vertical coordinates can be selected from the designated area based on the setting and determined as the preselected position.
In step 202, the computer device obtains attribute information of the resource to be allocated, wherein the attribute information includes a group identifier of the resource.
The attribute information may include information such as a radius of the resource and a group identifier. The group id is used to distinguish the type of the resource, and the resources of the same type all have the same group id, for example, the group id of the birth resource is 100, and the group id of the non-birth resource is 200. Therefore, the first type of resources (birth resources) can be screened from the resources to be allocated through the group identifier in the attribute information of the resources to be allocated, and the first type of resources are preferentially allocated.
The game developer or the player also sets some specified resources in the specified area, such as a resource area, where the resource area is used for the player to control the virtual character to obtain the game item, such as virtual fund, in the resource area. Since the designated resource is allocated to the designated area, the designated resource also has a corresponding designated position in the designated area, and the designated position also meets the position condition for setting the resource.
For example, the setting resource may be allocated only to a position whose horizontal and vertical coordinates are all multiples of 10, and in this setting, the coordinates of the designated position also satisfy the horizontal and vertical coordinates all multiples of 10, for example, (50,50), and the like.
In step 203, if the first category identifier exists in the attribute information of the resource to be allocated, the computer device determines the resource whose attribute information includes the first category identifier in the resource to be allocated as the first category resource.
The reason for preferentially allocating the first type of resources is as follows: due to the limitation of the safety distance of the birth resources, the occupied area of the birth resources is relatively large, and if the birth resources are put in later, the problems of space waste and the like in a map are likely to be caused.
In step 204, when the first type of resource is allocated in the designated area, the computer device obtains a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource within the designated area.
The first type of resource, that is, the birth resource, is used to provide a birth area for a virtual character operated by a player, the virtual character can revive and be born in the birth area, and the virtual character can be transferred to other areas by performing a transfer operation in the birth area. In order to ensure that the birth area is far away from the resource area and the danger area, it is necessary to control a safety distance between the birth area and the resource area and between the birth area and the danger area, where the safety distance is a first preset distance between the first type of resource and the designated resource. For example, if the safe distance between the birth area and the dangerous area is set to 10 meters, the first preset distance is 10 meters. Moreover, since the birth area has a certain range, a first radius corresponding to the first type of resource needs to be obtained, and the first radius is the radius of the birth area; similarly, the second radius is the second radius of the designated resource (the radius of the resource region).
Specifically, based on the shape of the birth area and the shape of the first type of resource, when the shape of the birth area and the shape of the first type of resource are circular, the first radius and the second radius are the radius of the circular area; when the shape of the birth area and the shape of the first type of resource are squares, the first radius and the second radius are distances from the center point of the square area to the four sides.
In step 205, the computer device calculates a sum of the first preset distance, the first radius and the second radius to obtain a first result.
In order to set the first type of resources in the designated area, a first occupied area occupied by the designated resources in the designated area needs to be determined according to the designated position, the first preset distance, the first radius and the second radius.
In step 206, the computer device determines a first occupied area occupied by the designated resource within the designated area according to the designated location and the first result.
As shown in fig. 1c, taking the shape of the designated resource and the first type resource as a square as an example, fig. 1B shows that the designated resource a is already allocated in the designated area, and the second radius of the designated resource a in the designated area is R2, and now the first radius of the first type resource is known to be R1, it can be seen from fig. 1B that if it is desired to allocate the first type resource B in the designated area, the coordinates of the center point of the first type resource B need to be allocated to the area boundary formed by the center point of the designated resource a and the radius of the sum of R1, L1 and R2, and the outside of the area boundary. The area within the boundary is the first occupied area occupied by the designated resource in the designated area.
In step 207, the computer device determines a first occupancy location of the set of locations that is occupied by the first occupancy area.
After the first occupied area is determined, a first position where the first type of resource can be allocated can be determined from a position set where the first type of resource can be allocated in the designated area, and the first type of resource is allocated to the first position.
In step 208, the computer device determines locations in the set of locations other than the first occupied location as first candidate locations.
After the first occupied area is determined, a first position where the first type of resource can be allocated can be determined from a position set where the first type of resource can be allocated in the designated area, and the first type of resource is allocated to the first position.
Specifically, a first occupation position occupied by a first occupation area is determined, where the first occupation position is a position in the first occupation area that meets the resource allocation setting, and since the position set is also a position set composed of a plurality of preselected positions determined according to the resource allocation setting, other first candidate positions except the first occupation position in the position set are positions where the first type of resources can be allocated.
In step 209, the computer device obtains a first number of resources of a first type, determines any location of the first candidate locations corresponding to the first number as a first location, and allocates the resources of the first type to the first location.
After determining a first candidate position where the first type of resources can be allocated, determining a first quantity of the first type of resources, determining a position of the first quantity from the first candidate position, determining the position as a first position, and allocating the first type of resources to the first position.
For example, the set of positions is { (0, 0); (10, 10); (10, 20); (20, 20); (30,40) }, the first occupied position being (0, 0); (10,10), the first candidate position is (10, 20); (20, 20); (30,40), the number of the first type resources is 2, and then the number can be (10, 20); (20, 20); randomly determining 2 positions in (30,40), and determining as a first position, such as (20, 20); (30,40), and allocating the two resources of the first type to the first location.
In step 210, if the attribute information of the resource to be allocated further includes the second class identifier, the computer device determines the resource whose attribute information includes the second class identifier in the resource to be allocated as the second class resource.
After the first class of resources are allocated, if there are resources to be allocated that include the second class of group identifiers in the attribute information, the resources with the second class of group identifiers are determined as second class of resources, which are also Non-birth resources, and the Non-birth resources can be used to generate monsters or Non-Player characters (NPCs) in a certain area (dangerous area).
In step 211, the computer device obtains a third radius of each second type resource and a second preset distance between each second type resource and the first type resource.
After a plurality of resource groups to be allocated are determined, a target resource group to be allocated at present needs to be determined from the plurality of resource groups to be allocated, a second position is determined from the position set according to the specified resource, the first type of resource and the position set, and all target second type of resources in the target resource group to be allocated are allocated to the second position.
In step 212, the computer device divides the second type of resources with the same third radius and the same second preset distance into a group to obtain a plurality of resource groups to be allocated, including at least one second type of resource.
For the second type of resources, the safety distances (second preset distances) between different second type of resources and the first type of resources are different, and the third radii of the different second type of resources are also different, so that in order to improve the allocation efficiency, the second type of resources to be allocated may be divided in advance according to the safety distances and the third radii between the different second type of resources and the first type of resources, so as to obtain multiple groups of resource groups to be allocated, where all the second type of resources in each resource group to be allocated have the same safety distance as the first type of resources, and the third radii are also the same. Therefore, when the second type of resources are allocated, the resource groups to be allocated, which have the same second preset distance and the same third radius, can be allocated in a group form in a unified manner.
In step 213, the computer device determines a target resource group to be allocated from the plurality of resource groups to be allocated.
In order to avoid the problem of overlapping occupied areas of second-class resources or waste of space resources caused by simultaneous allocation of a plurality of resource groups to be allocated, the resource groups to be allocated need to be controlled to be allocated in batches, so that a target resource group to be allocated needs to be determined from the resource groups to be allocated.
In step 214, the computer device determines a second location from the location set according to the specified resources, the first type of resources, and the location set, and allocates all target second type of resources in the target resource group to be allocated to the second location.
After the target resource group to be allocated is determined, a second position needs to be determined from the position set according to the designated resource, the first type of resource and the position set, and all target second type of resources in the target resource group to be allocated are allocated to the second position.
Referring to fig. 2b, fig. 2b is a third flowchart illustrating a resource allocation method according to an embodiment of the present disclosure. The method flow can comprise the following steps:
in step 301, if the attribute information of the resource to be allocated further includes the second class identifier, the computer device determines the resource whose attribute information includes the second class identifier in the resource to be allocated as the second class resource.
In step 302, the computer device obtains a third radius of each second type resource and a second preset distance between each second type resource and the first type resource.
In step 303, the computer device divides the second type of resources with the same third radius and the same second preset distance into a group, and obtains a plurality of resource groups to be allocated including at least one second type of resource.
Step 301 to step 303 are the same as step 211 to step 213, and are not described herein.
In step 304, the computer device obtains a second number of resources of a second type in the current plurality of resource groups to be allocated.
The method for determining the target resource to be allocated may be as follows: and determining the target resource group to be allocated according to the second quantity of the second type of resources in each resource group to be allocated.
In step 305, the computer device determines the priorities of the plurality of resource groups to be allocated in order of the second number from large to small.
And determining the distribution priority of each resource group to be distributed according to the sequence of the second quantity from large to small.
In step 306, the computer device determines the resource group to be allocated with the highest priority as the target resource group to be allocated.
Wherein the resource group to be allocated with the highest priority (the second number is the most) is selected.
For example, there are three groups of resource groups to be allocated, where there are 1 second type resource in the first group of resource group to be allocated, there are 2 second type resources in the second group of resource group to be allocated, and there are 3 second type resources in the third group of resource group to be allocated, then the priority is, in order from high to low: the method comprises the steps of a third group of resource groups to be allocated, a second group of resource groups to be allocated and a first group of resource groups to be allocated. Therefore, the third group of resource groups to be allocated with the highest priority is determined as the target resource group to be allocated.
In step 307, the computer device obtains a target radius of a target second type resource in the target resource group to be allocated and a target preset distance from the first type resource.
When the target resource group to be allocated is allocated, the designated resource and the first type of resource are already allocated in the designated area, so that when the target resource group to be allocated including the second type of resource is allocated, the area occupied by the designated resource and the first type of resource in the designated area also needs to be determined, and the second position which can be allocated is selected from the unoccupied area.
In step 308, the computer device determines a second footprint for the specified resource within the specified area based on the specified location, the second radius, and the target radius.
Because there is no restriction condition of the safety distance between the designated resource and the second type of resource, when a second occupied area of the designated resource in the designated area is determined, only the target radius of the target second type of resource in the target resource group to be allocated can be obtained, and the second occupied area is determined according to the target radius, the second radius and the designated position.
In step 309, the computer device calculates the sum of the target preset distance, the target radius and the first radius to obtain a second calculation result.
For the first type of resource, because the second type of resource needs to have a safety distance of a second preset distance from the first type of resource, a target preset distance between the second type of resource and the first type of resource in a target resource group to be allocated needs to be obtained, and a third occupied area occupied by the first type of resource in the designated area is determined according to the first position, the target preset distance and the first radius.
In step 310, the computer device determines a third occupied area occupied by the first type of resource in the designated area according to the first position and the second calculation result.
Referring to fig. 1d, the third occupied area determined by the first type of resource is the third occupied area determined by taking the first position when the first type of resource is allocated as the center and the second calculation result as the radius. The second calculation result is the sum of the first radius R1, the target preset distance L2, and the target radius R3 of the first type of resource. Thereby determining a third occupied area occupied by the first type of resource.
In step 311, the computer device determines a second occupancy location of the set of locations that is occupied by the second occupancy area and the third occupancy area.
And determining the occupied positions occupied by the occupied areas according to the second occupied area and the third occupied area to obtain a second occupied position.
In step 312, the computer device determines other locations in the set of locations, other than the second occupied location, as second candidate locations.
Wherein a second candidate position other than the second occupied position is determined from the set of positions.
In step 313, the computer device obtains the target number of the target second type of resources, determines any position corresponding to the target number in the second candidate position as the second position, and allocates all the target second type of resources in the target resource group to be allocated to the second position.
And determining positions with the same number as the target number from the second candidate positions as the second positions by acquiring the target number of the target second-class resources.
In step 314, the computer device determines the target second type of resource as the specified resource and the second location as the specified location.
After all the target second-class resources in the target resource group to be allocated are allocated, the target second-class resources are already allocated in the map, and the target second-class resources can be determined as the designated resources, so that other resources are subsequently allocated as the designated resources, and meanwhile, the second position is also determined as the designated position.
In step 315, the computer device returns to perform the step of determining the target resource group to be allocated from the plurality of resource groups to be allocated until each resource of the second type is allocated completely.
After all target second-class resources in the target resource group to be allocated are allocated, a next target resource group to be allocated in the plurality of resource groups to be allocated needs to be allocated, and therefore the step of determining the target resource group to be allocated from the plurality of resource groups to be allocated is executed in a return mode until each second-class resource is allocated completely.
As can be seen from the above, in the embodiment of the present application, a location set including all the preselected locations is obtained by acquiring the preselected locations in the designated area; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position, a first preset distance, a first radius and the second radius; and determining a first position from the position set according to the position set and the first occupied area, and allocating the first type of resources to the first position. Therefore, the first occupied area occupied by the appointed resources in the appointed area is determined, so that the first position capable of distributing the first type of resources is selected from the position set, the first type of resources are automatically distributed, a large amount of time consumption caused by manual separation of the birth resources and the non-birth resources can be avoided, and the mapping efficiency is improved.
In some embodiments, the present application may also allocate each resource by calculating a bounding box for each resource when implemented. Bounding boxes are an algorithm for solving the optimal bounding space of a discrete set of points, the idea being to approximately replace complex geometric objects with slightly larger and characteristically simple geometries (called bounding boxes). In implementing the present application, different bounding box calculation methods, such as an AABB bounding box, a bounding sphere, a directional bounding box OBB, a fixed directional convex hull FDH, etc., may be adopted according to different shapes of resources, which is not limited herein.
When resources are put in, pre-selected positions in a designated area are obtained in advance, and a position set comprising all the pre-selected positions is obtained; acquiring attribute information of resources to be allocated, wherein the attribute information comprises group identifiers of the resources; if the attribute information of the resources to be distributed has the first type group identification, determining the resources of which the attribute information comprises the first type group identification in the resources to be distributed as the first type resources; when the first type of resources are distributed in the designated area, initializing a bounding box of the designated resources in the designated area; determining a first occupation position occupied by an enclosure box in a position set; determining other positions in the position set except the first occupied position as first candidate positions; and acquiring a first quantity of the first type of resources, determining any position corresponding to the first quantity in the first candidate position as a first position, and distributing the first type of resources to the first position. If the attribute information of the resources to be allocated also comprises a second type of group identifier, determining the resources of which the attribute information comprises the second type of group identifier in the resources to be allocated as second type of resources; acquiring a third radius of each second type of resource and a second preset distance between each second type of resource and the first type of resource; dividing second resources with the same third radius and the same second preset distance in the second resources into a group to obtain a plurality of resource groups to be allocated, wherein the resource groups comprise at least one second resource; determining a target resource group to be allocated from a plurality of resource groups to be allocated; initializing a bounding box of a specified resource and a bounding box of a first type of resource in a specified area; and a second occupation position occupied by the bounding box of the specified resource and the bounding box of the first type resource in the position set; determining other positions in the position set except the second occupied position as second candidate positions; acquiring the target quantity of the target second-class resources, determining any position corresponding to the target quantity in the second candidate position as a second position, and distributing all the target second-class resources in the target resource group to be distributed to the second position; determining the target second-type resource as a specified resource, and determining the second position as a specified position; and returning to execute the step of determining the target resource group to be allocated from the plurality of resource groups to be allocated until each second type of resource is allocated completely.
Specifically, when initializing the bounding box each time, the assigned resources need to be initialized to operate the bounding box, so as to determine the position of the currently assignable resources in the map.
In order to better implement the resource allocation method provided in the embodiments of the present application, an apparatus based on the resource allocation method is also provided in the embodiments of the present application. The terms are the same as those in the resource allocation method, and details of implementation may refer to the description in the method embodiment.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a resource allocation apparatus according to an embodiment of the present disclosure, where the resource allocation apparatus may include a first obtaining module 401, a second obtaining module 402, a first determining module 403, a second determining module 404, and the like.
A first obtaining module 401, configured to obtain preselected positions in a designated area, and obtain a position set including all the preselected positions;
a second obtaining module 402, configured to, when a first type of resource is allocated in the designated area, obtain a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource in the designated area, where the designated resource is a resource preset in the designated area;
a first determining module 403, configured to determine, based on the designated position of the designated resource in the designated area, the first preset distance, the first radius, and the second radius, a first occupied area occupied by the designated resource in the designated area;
a second determining module 404, configured to determine a first location from the location set according to the location set and the first occupied area, and allocate the first type of resource to the first location.
In some embodiments, the first determining module 403 includes:
the calculation submodule is used for calculating the sum of the first preset distance, the first radius and the second radius to obtain a first result;
and the first determining submodule is used for determining a first occupied area occupied by the specified resource in the specified area according to the specified position and the first result.
In some embodiments, the second determining module 404 includes:
a second determining submodule, configured to determine a first occupied location occupied by the first occupied area in the location set;
a third determining submodule, configured to determine, as a first candidate position, positions other than the first occupied position in the position set;
the first obtaining submodule is used for obtaining a first quantity of the first type of resources, determining any position corresponding to the first quantity in the first candidate position as a first position, and distributing the first type of resources to the first position.
In some embodiments, the resource allocation apparatus further includes:
a third obtaining module, configured to obtain attribute information of the resource to be allocated, where the attribute information includes a group identifier of the resource;
a third determining module, configured to determine, if a first type group identifier exists in the attribute information of the resource to be allocated, a resource of the resource to be allocated, where the attribute information includes the first type group identifier, as a first type resource, and perform a step of, when the first type resource is allocated in the designated area, acquiring a first preset distance between the first type resource and the designated resource, a first radius of the first type resource, and a second radius of the designated resource in the designated area.
In some embodiments, the resource allocation apparatus further includes:
a fourth determining module, configured to determine, if the attribute information of the resource to be allocated further includes a second type group identifier, a resource, of which the attribute information includes the second type group identifier, in the resource to be allocated as a second type resource;
a fourth obtaining module, configured to obtain a third radius of each second type of resource and a second preset distance between each second type of resource and the first type of resource;
the dividing module is used for dividing second resources with the same third radius and the same second preset distance in the second resources into a group to obtain a plurality of resource groups to be allocated, wherein the resource groups to be allocated comprise at least one second resource;
the fifth determining module is used for determining a target resource group to be allocated from the plurality of resource groups to be allocated;
and the sixth determining module is used for determining a second position from the position set according to the specified resource, the first type of resource and the position set, and allocating all target second type of resources in the target resource group to be allocated to the second position.
In some embodiments, the fifth determining module includes:
the second obtaining submodule is used for obtaining a second quantity of the second type of resources in the current multiple resource groups to be distributed;
the fourth determining submodule is used for determining the priority of the plurality of resource groups to be allocated according to the sequence of the second number from large to small;
and the fifth determining submodule is used for determining the resource group to be allocated with the highest priority as the target resource group to be allocated.
In some embodiments, the sixth determining module includes:
the third obtaining submodule is used for obtaining the target radius of the target second type resource in the target resource group to be distributed and the target preset distance between the target second type resource and the first type resource;
a sixth determining submodule, configured to determine, based on the designated position, the second radius, and the target radius, a second occupied area occupied by the designated resource in the designated area;
a seventh determining sub-module, configured to determine, based on the first position, the target radius, the target preset distance, and the first radius, a third occupied area occupied by the first type of resource in the designated area;
an eighth determining submodule, configured to determine a second location from the location set according to the location set, the second occupied area, and the third occupied area.
In some embodiments, the sixth determining module includes:
the third obtaining submodule is used for obtaining the target radius of the target second type resource in the target resource group to be distributed and the target preset distance between the target second type resource and the first type resource;
a sixth determining submodule, configured to determine, based on the designated position, the second radius, and the target radius, a second occupied area occupied by the designated resource in the designated area;
a seventh determining sub-module, configured to determine, based on the first position, the target radius, the target preset distance, and the first radius, a third occupied area occupied by the first type of resource in the designated area;
an eighth determining submodule, configured to determine a second location from the location set according to the location set, the second occupied area, and the third occupied area.
In some embodiments, the eighth determining submodule includes:
a second determining unit, configured to determine a second occupied location occupied by the second occupied area and the third occupied area in the location set;
a third determining unit, configured to determine, as a second candidate position, a position other than the second occupied position in the position set;
and the acquisition unit is used for acquiring the target quantity of the target second-class resources and determining any position corresponding to the target quantity in the second candidate positions as a second position.
In some embodiments, the sixth determining module further comprises:
a ninth determining submodule, configured to determine the target second-class resource as a specified resource, and determine the second location as a specified location;
and the execution submodule is used for returning to execute the step of determining the target resource group to be allocated from the plurality of resource groups to be allocated until each second type of resource is allocated completely.
As can be seen from the above, in the embodiment of the present application, the first obtaining module 401 obtains the preselected positions in the designated area, and obtains a position set including all the preselected positions; a second obtaining module 402, when a first type of resource is allocated in the designated area, obtains a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource in the designated area, where the designated resource is a resource preset in the designated area; the first determining module 403 determines a first occupied area occupied by the designated resource in the designated area based on the designated position of the designated resource in the designated area, the first preset distance, the first radius and the second radius; the second determining module 404 determines a first location from the location set according to the location set and the first occupied area, and allocates the first type of resource to the first location. Therefore, the first occupied area occupied by the appointed resources in the appointed area is determined, so that the first position capable of distributing the first type of resources is selected from the position set, the first type of resources are automatically distributed, a large amount of time consumption caused by manual separation of the birth resources and the non-birth resources can be avoided, and the mapping efficiency is improved.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Correspondingly, the embodiment of the present application further provides a Computer device, where the Computer device may be a terminal or a server, and the terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 4, fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer apparatus 600 includes a processor 601 having one or more processing cores, a memory 602 having one or more computer-readable storage media, and a computer program stored on the memory 602 and executable on the processor. The processor 601 is electrically connected to the memory 602. Those skilled in the art will appreciate that the computer device configurations illustrated in the figures are not meant to be limiting of computer devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The processor 601 is a control center of the computer apparatus 600, connects various parts of the entire computer apparatus 600 using various interfaces and lines, performs various functions of the computer apparatus 600 and processes data by running or loading software programs and/or modules stored in the memory 602, and calling data stored in the memory 602, thereby monitoring the computer apparatus 600 as a whole.
In the embodiment of the present application, the processor 601 in the computer device 600 loads instructions corresponding to processes of one or more applications into the memory 602, and the processor 601 executes the applications stored in the memory 602 according to the following steps, so as to implement various functions:
obtaining preselected positions in a designated area to obtain a position set containing all the preselected positions; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position, a first preset distance, a first radius and the second radius; and determining a first position from the position set according to the position set and the first occupied area, and allocating the first type of resources to the first position.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 4, the computer device 600 further includes: a touch display screen 603, a radio frequency circuit 604, an audio circuit 605, an input unit 606, and a power supply 407. The processor 601 is electrically connected to the touch display screen 603, the radio frequency circuit 604, the audio circuit 605, the input unit 606, and the power supply 607. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 4 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The touch display screen 603 can be used for displaying a graphical user interface and receiving operation instructions generated by a user acting on the graphical user interface. The touch display screen 603 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 601, and can receive and execute commands sent by the processor 601. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 601 to determine the type of the touch event, and then the processor 601 provides a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 603 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display screen 603 can also be used as a part of the input unit 606 to implement an input function.
In the embodiment of the present application, a game application is executed by the processor 601 to generate a graphical user interface on the touch display screen 603, where a virtual scene on the graphical user interface includes at least one function control or a wheel control. The touch display screen 603 is used for presenting a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface.
The rf circuit 604 may be used for transceiving rf signals to establish wireless communication with a network device or other computer device via wireless communication, and for transceiving signals with the network device or other computer device.
The audio circuit 605 may be used to provide an audio interface between the user and the computer device through speakers, microphones. The audio circuit 605 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 605 and converted into audio data, which is then processed by the audio data output processor 601, and then transmitted to, for example, another computer device via the radio frequency circuit 604, or output to the memory 602 for further processing. The audio circuit 605 may also include an earbud jack to provide communication of peripheral headphones with the computer device.
The input unit 606 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 607 is used to power the various components of the computer device 600. Optionally, the power supply 607 may be logically connected to the processor 601 through a power management system, so as to implement functions of managing charging, discharging, and power consumption management through the power management system. The power supply 607 may also include any component including one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown in fig. 4, the computer device 600 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
As can be seen from the above, the computer device provided in this embodiment acquires the preselected positions in the designated area, and obtains a position set including all the preselected positions; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position, a first preset distance, a first radius and the second radius; and determining a first position from the position set according to the position set and the first occupied area, and allocating the first type of resources to the first position. Therefore, the first occupied area occupied by the appointed resources in the appointed area is determined, so that the first position capable of distributing the first type of resources is selected from the position set, the first type of resources are automatically distributed, a large amount of time consumption caused by manual separation of the birth resources and the non-birth resources can be avoided, and the mapping efficiency is improved.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, where the computer programs can be loaded by a processor to execute the steps in any one of the viewing angle adjusting methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
obtaining preselected positions in a designated area to obtain a position set containing all the preselected positions; when a first type of resource is allocated in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area; determining a first occupied area occupied by the designated resource in the designated area based on the designated position, a first preset distance, a first radius and the second radius; and determining a first position from the position set according to the position set and the first occupied area, and allocating the first type of resources to the first position.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium can execute the steps in any resource allocation method provided in the embodiments of the present application, beneficial effects that can be achieved by any resource allocation method provided in the embodiments of the present application can be achieved, and detailed descriptions are omitted here for the foregoing embodiments.
The foregoing detailed description is directed to a resource allocation method, a resource allocation apparatus, a computer-readable storage medium, and a computer device provided in the embodiments of the present application, and specific examples are applied in the present application to explain the principles and implementations of the present application, and the descriptions of the foregoing embodiments are only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (13)

1. A method for resource allocation, comprising:
obtaining preselected positions in a designated area to obtain a position set containing all the preselected positions;
when a first type of resource is distributed in the designated area, acquiring a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource and a second radius of the designated resource in the designated area, wherein the designated resource is a preset resource in the designated area;
determining a first occupied area occupied by the designated resource in the designated area based on the designated position of the designated resource in the designated area, the first preset distance, the first radius and the second radius;
and determining a first position from the position set according to the first occupied area, and allocating the first type of resources to the first position.
2. The method according to claim 1, wherein the step of determining a first occupied area occupied by the designated resource in the designated area based on the designated position of the designated resource in the designated area, the first preset distance, the first radius and the second radius comprises:
calculating the sum of the first preset distance, the first radius and the second radius to obtain a first result;
and determining a first occupied area occupied by the specified resource in the specified area according to the specified position and the first result.
3. The method according to claim 1, wherein the step of determining a first location from the set of locations according to the first occupied area and allocating the first type of resource to the first location comprises:
determining a first occupied location in the set of locations occupied by the first occupied area;
determining other positions in the position set except the first occupied position as first candidate positions;
acquiring a first quantity of the first type of resources, determining any position corresponding to the first quantity in the first candidate position as a first position, and allocating the first type of resources to the first position.
4. The method according to claim 1, wherein before the step of obtaining the first preset distance between the first type of resource and the designated resource, the first radius of the first type of resource, and the second radius of the designated resource within the designated area when the first type of resource is allocated in the designated area, the method further comprises:
acquiring attribute information of resources to be allocated, wherein the attribute information comprises group identifiers of the resources;
if a first type group identifier exists in the attribute information of the resources to be allocated, determining the resources of the resources to be allocated, wherein the attribute information of the resources to be allocated includes the first type group identifier, as first type resources, and executing a step of acquiring a first preset distance between the first type resources and the specified resources, a first radius of the first type resources, and a second radius of the specified resources in the specified area when the first type resources are allocated in the specified area.
5. The method according to claim 4, further comprising, after the step of allocating the first type of resource to the first location:
if the attribute information of the resources to be allocated further includes a second type of group identifier, determining the resources of the resources to be allocated, of which the attribute information includes the second type of group identifier, as second type of resources;
acquiring a third radius of the second type of resources and a second preset distance between the second type of resources and the first type of resources;
dividing second resources with the same third radius and the same second preset distance in the second resources into a group to obtain a plurality of resource groups to be allocated, wherein the resource groups comprise at least one second resource;
determining a target resource group to be allocated from the plurality of resource groups to be allocated;
and determining a second position from the position set according to the specified resources and the first type of resources, and allocating all target second type of resources in the target resource group to be allocated to the second position.
6. The method according to claim 5, wherein the step of determining a target resource group to be allocated from the plurality of resource groups to be allocated comprises:
acquiring a second quantity of the second type of resources in a plurality of current resource groups to be allocated;
determining the priorities of the plurality of resource groups to be allocated according to the sequence of the second number from large to small;
and determining the resource group to be allocated with the highest priority as a target resource group to be allocated.
7. The method according to claim 5, wherein the step of determining the second location from the set of locations according to the specified resource, the first type of resource, comprises:
acquiring a target radius of a target second type resource in a target resource group to be allocated and a target preset distance between the target second type resource and the first type resource;
determining a second occupied area occupied by the designated resource in the designated area based on the designated position, a second radius and the target radius;
determining a third occupied area occupied by the first type of resources in the designated area based on the first position, the target radius, the target preset distance and the first radius;
and determining a second position from the position set according to the position set, the second occupied area and the third occupied area.
8. The method according to claim 7, wherein the step of determining a third occupied area occupied by the first type of resource in the designated area based on the first position, the target radius, the target preset distance, and the first radius comprises:
calculating the sum of the target preset distance, the target radius and the first radius to obtain a second calculation result;
and determining a third occupied area occupied by the first type of resources in the designated area according to the first position and the second calculation result.
9. The method according to claim 7, wherein the step of determining a second location from the set of locations according to the set of locations, the second occupancy area and the third occupancy area comprises:
determining a second occupancy location in the set of locations occupied by the second and third occupancy areas;
determining other positions in the position set except the second occupied position as second candidate positions;
and acquiring the target quantity of the target second-class resources, and determining any position corresponding to the target quantity in the second candidate positions as a second position.
10. The method of claim 7, further comprising, after the step of determining a second location from the set of locations according to the set of locations, the second footprint, and the third footprint, the step of:
determining the target second-class resource as a designated resource, and determining the second position as a designated position;
and returning to execute the step of determining the target resource group to be allocated from the plurality of resource groups to be allocated until each second type of resource is allocated completely.
11. A resource allocation apparatus, comprising:
the first acquisition module is used for acquiring preselected positions in a designated area to obtain a position set containing all the preselected positions;
a second obtaining module, configured to obtain a first preset distance between the first type of resource and the designated resource, a first radius of the first type of resource, and a second radius of the designated resource in the designated area when the first type of resource is allocated in the designated area, where the designated resource is a resource preset in the designated area;
a first determining module, configured to determine, based on the specified position of the specified resource in the specified area, the first preset distance, the first radius, and the second radius, a first occupied area occupied by the specified resource in the specified area;
and the second determining module is used for determining a first position from the position set according to the position set and the first occupied area and allocating the first type of resources to the first position.
12. A computer readable storage medium storing instructions adapted to be loaded by a processor to perform the steps of the resource allocation method according to any one of claims 1 to 10.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program performs the steps of the resource allocation method according to any one of claims 1 to 10.
CN202110269368.8A 2021-03-12 2021-03-12 Resource allocation method and device, storage medium and computer equipment Active CN112843717B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110269368.8A CN112843717B (en) 2021-03-12 2021-03-12 Resource allocation method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110269368.8A CN112843717B (en) 2021-03-12 2021-03-12 Resource allocation method and device, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN112843717A true CN112843717A (en) 2021-05-28
CN112843717B CN112843717B (en) 2024-02-13

Family

ID=75994277

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110269368.8A Active CN112843717B (en) 2021-03-12 2021-03-12 Resource allocation method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN112843717B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103106396A (en) * 2013-01-06 2013-05-15 中国人民解放军91655部队 Danger zone detection method
CN107247781A (en) * 2017-06-12 2017-10-13 中国地质大学(武汉) A kind of safety zone method of determining range
WO2018076777A1 (en) * 2016-10-25 2018-05-03 深圳光启合众科技有限公司 Robot positioning method and device, and robot
CN108434739A (en) * 2018-01-30 2018-08-24 网易(杭州)网络有限公司 The processing method and processing device of virtual resource in scene of game
CN110339554A (en) * 2019-07-22 2019-10-18 广州银汉科技有限公司 Map mirror symmetry method and system
KR20200028196A (en) * 2018-09-06 2020-03-16 펍지 주식회사 Method and apparatus for controlling gaming virtual space
US20210046651A1 (en) * 2019-08-15 2021-02-18 Dassault Systèmes Americas Corp. Modelling Operating Zones For Manufacturing Resources Using Virtual Model And Graphics Based Simulation

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103106396A (en) * 2013-01-06 2013-05-15 中国人民解放军91655部队 Danger zone detection method
WO2018076777A1 (en) * 2016-10-25 2018-05-03 深圳光启合众科技有限公司 Robot positioning method and device, and robot
CN107247781A (en) * 2017-06-12 2017-10-13 中国地质大学(武汉) A kind of safety zone method of determining range
CN108434739A (en) * 2018-01-30 2018-08-24 网易(杭州)网络有限公司 The processing method and processing device of virtual resource in scene of game
KR20200028196A (en) * 2018-09-06 2020-03-16 펍지 주식회사 Method and apparatus for controlling gaming virtual space
CN110339554A (en) * 2019-07-22 2019-10-18 广州银汉科技有限公司 Map mirror symmetry method and system
US20210046651A1 (en) * 2019-08-15 2021-02-18 Dassault Systèmes Americas Corp. Modelling Operating Zones For Manufacturing Resources Using Virtual Model And Graphics Based Simulation

Also Published As

Publication number Publication date
CN112843717B (en) 2024-02-13

Similar Documents

Publication Publication Date Title
CN112044074A (en) Method, device, storage medium and computer equipment for seeking path to non-player character
CN112802172A (en) Texture mapping method and device of three-dimensional model, storage medium and computer equipment
WO2023213037A1 (en) Hair virtual model rendering method and apparatus, computer device, and storage medium
CN113082707A (en) Virtual object prompting method and device, storage medium and computer equipment
CN112206517A (en) Rendering method, device, storage medium and computer equipment
CN113426124A (en) Display control method and device in game, storage medium and computer equipment
CN113426129A (en) User-defined role appearance adjusting method, device, terminal and storage medium
CN113332719A (en) Virtual article marking method, device, terminal and storage medium
CN113546416A (en) Game scene processing method and device, computer equipment and storage medium
CN112221151A (en) Map generation method and device, computer equipment and storage medium
CN112843717A (en) Resource allocation method, device, storage medium and computer equipment
CN112843729B (en) Operation parameter determination method and device, computer equipment and storage medium
CN113350792A (en) Contour processing method and device for virtual model, computer equipment and storage medium
CN113332722A (en) Map generation method, device, terminal and storage medium
CN112245914A (en) Visual angle adjusting method and device, storage medium and computer equipment
CN113842641A (en) Method, device, terminal and storage medium for determining nearest waypoint
CN116644933A (en) Virtual land block evaluation method and device, storage medium and computer equipment
CN112365567B (en) Scene switching method, device and equipment
CN113362348B (en) Image processing method, image processing device, electronic equipment and storage medium
CN115564916A (en) Editing method and device of virtual scene, computer equipment and storage medium
CN114159782A (en) Method and device for determining placement position of game model, terminal and storage medium
CN116954606A (en) Control drawing method, device, computer equipment and computer readable storage medium
CN116196614A (en) Resource loading method, device and equipment of game map and readable storage medium
CN117173320A (en) Curved surface model processing method, device, computer equipment and storage medium
CN116764191A (en) Virtual scene area selection method and device, storage medium and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant