WO2018205872A1 - 目标对象的处理方法、装置、存储介质及电子装置 - Google Patents

目标对象的处理方法、装置、存储介质及电子装置 Download PDF

Info

Publication number
WO2018205872A1
WO2018205872A1 PCT/CN2018/085340 CN2018085340W WO2018205872A1 WO 2018205872 A1 WO2018205872 A1 WO 2018205872A1 CN 2018085340 W CN2018085340 W CN 2018085340W WO 2018205872 A1 WO2018205872 A1 WO 2018205872A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
pixel bit
target
distance
target object
Prior art date
Application number
PCT/CN2018/085340
Other languages
English (en)
French (fr)
Inventor
王杰
王毅
祝清鲁
桂宇怀
夏可
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018205872A1 publication Critical patent/WO2018205872A1/zh

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/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • 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/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor

Definitions

  • the present invention relates to the field of computers, and in particular, to a method, an apparatus, a storage medium, and an electronic device for processing a target object.
  • the target object is a game character.
  • the target object is a game character.
  • the embodiments of the present invention provide a method, an apparatus, a storage medium, and an electronic device for processing a target object, so as to at least solve the technical problem that the processing process of the target object in the related art is very time consuming.
  • a method of processing a target object includes: determining a first target object to enter a first position in the game scene; acquiring a pre-stored target distance between the first location and the second location, wherein the second location is a second target object in the game a position in the scene, the second target object is an object in the game scene that is closest to the first target object; and in a case where the target distance is smaller than a preset size of the first target object in the game scene, determining the first target object and The second target object has a coincident region; the first target object is subjected to preset processing according to the coincident region.
  • a processing apparatus of a target object includes: a first determining unit configured to determine a first target object to enter a first position in the game scene; and a first obtaining unit configured to acquire a pre-position between the first position and the second position a stored target distance, wherein the second location is a location of the second target object in the game scene, the second target object is an object closest to the first target object in the game scene; and the second determining unit is set to be at If the target distance is smaller than the preset size of the first target object in the game scene, determining that the first target object and the second target object have a coincident region; the first processing unit is configured to perform the first target object according to the coincident region Preset processing.
  • determining that the first target object enters the first position in the game scene acquiring a pre-stored target distance between the first position and the second position, wherein the second position is the second target object a position in the game scene, the second target object is an object closest to the first target object in the game scene; and the first target object is determined if the target distance is smaller than a preset size of the first target object in the game scene And a second target object having a coincidence region; a manner of performing preset processing on the first target object according to the coincidence region.
  • the purpose of quickly determining whether the first target object coincides with the second target object is achieved.
  • the technical problem that the processing process of the target object in the related art is very time-consuming can be solved, thereby achieving the technical effect of quickly processing the first target object.
  • FIG. 1 is a schematic diagram of a hardware environment of a method for processing a target object according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for processing a target object according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method of determining a first target object entering a first location in a game scene, in accordance with an embodiment of the present invention
  • FIG. 4 is a flowchart of another method for processing a target object according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of another method for processing a target object according to an embodiment of the present invention.
  • FIG. 6 is a flowchart of a method for acquiring a pixel bit distance between pixel bits corresponding to a plurality of preset objects, respectively, according to an embodiment of the present invention
  • FIG. 7 is a flowchart of a method for processing a target object according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a processing apparatus of a target object according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of another processing apparatus of a target object according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of another processing apparatus of a target object according to an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of a processing apparatus of a target object according to an embodiment of the present invention.
  • FIG. 12 is a schematic diagram of another processing apparatus of a target object according to an embodiment of the present invention.
  • FIG. 13 is a structural block diagram of an electronic device according to an embodiment of the present invention.
  • an embodiment of a method for processing a target object is provided.
  • the processing method of the target object may be applied to a hardware environment formed by the server 102 and the terminal 104 as shown in FIG. 1 .
  • 1 is a schematic diagram of a hardware environment of a method of processing a target object according to an embodiment of the present invention.
  • the server 102 is connected to the terminal 104 through a network.
  • the network includes but is not limited to a wide area network, a metropolitan area network, or a local area network.
  • the terminal 104 is not limited to a PC, a mobile phone, a tablet, or the like.
  • the processing method of the target object in the embodiment of the present invention may be performed by the server 102, may be performed by the terminal 104, or may be performed by the server 102 and the terminal 104 in common.
  • the method for processing the target object by the terminal 104 in the embodiment of the present invention may also be performed by a client installed thereon.
  • FIG. 2 is a flow chart of a method of processing a target object according to an embodiment of the present invention. As shown in FIG. 2, the method may include the following steps:
  • Step S202 determining that the first target object enters the first position in the game scene.
  • step S202 of the present application it is determined that the first target object enters the first position in the game scene.
  • the first target object may be an object that can be moved in the game scene, for example, the first target object is a game actor in the game scene, and optionally, the game scene is a game in a two-dimensional game. Scenes. During the display of the game screen, the first target object that is in the game scene is drawn. When the first target object enters the game scene, it is determined that the first target object enters the first position in the game scene.
  • the game screen in the game scene is composed of pixels, and the pixel position of the first target object entering the game scene is determined.
  • Step S204 Acquire a pre-stored target distance between the first location and the second location.
  • a pre-stored target distance between the first location and the second location is acquired, wherein the second location is a location where the second target object is located in the game scene, and second The target object is the object in the game scene that is closest to the first target object.
  • the game scene includes a plurality of preset objects, not only the first target object that can be moved, but also a fixed object that can be used to block the first target object.
  • the first target object can be a game character, and can pass Objects such as trees, rocks, and ponds are occluded.
  • the game scene in addition to the first pair of target objects, there may be n objects capable of occluding the first target object, and the second target object is a distance from the first target object among the n objects of the game scene.
  • the most recent object can be some areas in the game scene, such as trees, rocks, ponds, and the like in the game scene, which are not limited herein.
  • the position in the game scene can be represented by pixel bits in the game scene.
  • all the pixel bits in the scene may be represented in a matrix form to determine the position in the game scene, and the position of the pixel bit corresponding to the n objects capable of occluding the first target object in the matrix position is according to the first identifier.
  • the information is identified, and the matrix positions other than the n objects capable of occluding the first target object are marked as 0.
  • the pixel position distance relationship between each position in the game scene and an object that can be used to occlude other objects is stored in advance, and the first target object is in the first position and the first position in the game scene.
  • the pixel position distance between the second positions where the two target objects are located in the game scene is stored in advance.
  • the target distance being the object of the first target object and the object closest to the first target object
  • the shortest distance between them makes the complexity of determining whether the first target object coincides with the second target object is reduced from O(n) to O(1), which greatly improves the smoothness of the game screen and avoids the first target.
  • the first location and the second location are pixel bits in the game scene, and may be used to determine the location of the first target object and the second target object in the game scene.
  • Step S206 if the target distance is smaller than a preset size of the first target object in the game scene, determining that the first target object and the second target object have a coincident region.
  • step S206 of the present application in a case where the target distance is smaller than a preset size of the first target object in the game scene, it is determined that the first target object and the second target object have a coincident region.
  • the preset size of the first target object in the game scene can be used to measure the position of the area where the first target object is located in the game scene, for example, the size of the first target object in the game scene itself.
  • the size of the first target object itself may be the width of the first target object in the game scene.
  • the display screen of the first target object in the game scene is normally drawn.
  • Step S208 performing preset processing on the first target object according to the overlapping area.
  • the first target object is subjected to preset processing according to the overlap region.
  • the first target object In the process of displaying the game screen of the game application, after determining that the first target object and the second target object have overlapping regions, determining that the first target object is occluded by the second target object, and the first target object is preset according to the coincident region. Processing, that is, the first target object can be specially drawn according to the coincident region.
  • the coincident area is processed on the first target object, the coincident area on the first target object is not displayed at all, or the coincident area is semi-transparently processed on the first target object to indicate that the first target object is in Behind the second target object.
  • the third target object is obtained, and the third target object is an incomplete display object of the first target object, thereby presenting a game screen in which the first target object is occluded by the second target object.
  • the first target object by determining that the first target object enters the first position in the game scene; acquiring a pre-stored target distance between the first position and the second position, wherein the second position is the second target object At a position in the game scene, the second target object is an object closest to the first target object in the game scene; and the first target is determined if the target distance is smaller than a preset size of the first target object in the game scene
  • the object has a coincidence area with the second target object; the first target object is preset according to the coincident area, and the first target object directly acquires the first position and the second position when entering the first position in the game scene
  • the pre-stored target distance achieves the purpose of quickly determining whether the first target object coincides with the second target object, and can solve the technical problem that the processing process of the target object is very time-consuming in the related art, thereby achieving the first target.
  • step S202 determining that the first target object enters the first location in the game scene comprises: determining that the first target object enters a first target pixel position in the game scene, wherein the first location includes a target pixel bit;
  • step S204 acquiring a pre-stored target distance between the first location and the second location comprises: acquiring a pre-stored pixel-bit distance between the first target pixel and the second target pixel, and The acquired pixel bit distance is the target distance, wherein the second position includes the second target pixel bit.
  • FIG. 3 is a flow chart of a method of determining a first target object entering a first location in a game scene, in accordance with an embodiment of the present invention. The method includes the following steps:
  • Step S301 determining that the first target object enters the first target pixel bit in the game scene.
  • step S301 of the present application determining that the first target object enters the first target pixel bit in the game scene, wherein the first location includes the first target pixel bit.
  • the position of the game scene can be represented by pixel bits.
  • the first target object enters the game scene determining that the first target object enters the first target pixel position in the game scene, that is, determining the pixel position of the position after the first target object enters the game scene, the first The target pixel bits can be determined using the (row, column) in the matrix.
  • Step S302 acquiring a pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit, and using the acquired pixel bit distance as the target distance.
  • the pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit is obtained, and the acquired pixel bit distance is used as the target distance, wherein the second position A second target pixel bit is included.
  • the pixel bit distance between each pixel bit in the game scene and the pixel bit corresponding to the preset object is calculated in advance, and the pixel bit between each pixel and the pixel bit corresponding to the nearest preset object is found. Distance and store it.
  • the second target object includes a second target pixel bit in the second position in the game scene, that is, the second target pixel position can represent the position of the second target object in the game scene, and the first target pixel bit and the first The pixel bit distance between the two target pixels.
  • the first target object After determining that the first target object enters the first target pixel bit in the game scene, acquiring a pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit, and using the pixel bit distance as the first target object Target distance.
  • the embodiment determines that the first target object enters a first target pixel bit in the game scene, wherein the first location includes a first target pixel bit; and pre-stored between the first target pixel bit and the second target pixel bit is obtained a pixel bit distance, and the acquired pixel bit distance is used as a target distance, wherein the second position includes a second target pixel bit, and further, if the target distance is smaller than a preset size of the first target object in the game scene, determining A target object and a second target object have a coincident region; and the first target object is pre-processed according to the coincident region, and the technical effect of fast processing the first target object is achieved.
  • the acquiring the game scene includes the first target pixel bit and the plurality of pre-preparations. Setting all pixel bits of the pixel bit corresponding to the object and a plurality of preset objects including the second target object; acquiring a pixel bit distance between each pixel bit and a pixel bit corresponding to the plurality of preset objects, to obtain a plurality of pixels Bit distance; the target distance corresponding to each pixel bit is determined and stored from a plurality of pixel bit distances.
  • FIG. 4 is a flow chart of another method of processing a target object according to an embodiment of the present invention. As shown in FIG. 4, the method further includes the following steps:
  • Step S401 Acquire all pixel bits and a plurality of preset objects in the game scene.
  • all the pixel bits and the plurality of preset objects in the game scene are acquired, wherein all the pixel bits include the first target pixel bit and the pixel bit corresponding to the plurality of preset objects, and more The preset objects include a second target object.
  • pre-calculating the pixel bit distance between each pixel bit in the game scene and the pixel bit corresponding to the preset object Obtaining all pixel bits and a plurality of preset objects in the game scene when the pixel bit distance between each pixel and the pixel bit corresponding to the nearest preset object is obtained, the pixel bit including the first target object entering the game.
  • the first target pixel bit of the scene, the pixel bit corresponding to the plurality of preset objects that is, the pixel bits of the position where the plurality of preset objects are located in the game scene.
  • the plurality of preset objects include some areas in the game, such as trees, rocks, ponds, etc., when the first target object enters these areas, a part of the body or body may be blocked by the area.
  • Step S402 obtaining a pixel bit distance between each pixel bit and a pixel bit corresponding to the plurality of preset objects, to obtain a plurality of pixel bit distances.
  • the pixel bit distance between each pixel bit and the pixel bit corresponding to the plurality of preset objects is obtained, and a plurality of pixel bit distances are obtained.
  • the distance between each pixel bit and the pixel bit corresponding to the preset object is calculated to obtain a plurality of pixel bit distances.
  • the game scene has a first preset object and a second preset object, and the distance between the pixel bit 1 and the first preset object is calculated as a, and the pixel position 1 and the second preset object are calculated.
  • the distance is b, the distance between the pixel position 2 and the first preset object is c, and the distance d between the pixel bit 2 and the second preset object, thereby obtaining a plurality of pixel bit distances.
  • Step S403 determining a target distance corresponding to each pixel bit from a plurality of pixel bit distances.
  • a target distance corresponding to each pixel bit is determined from a plurality of pixel bit distances, wherein a target distance corresponding to each pixel bit is each pixel bit and a plurality of preset objects.
  • the pixel bit distance between the pixel bits corresponding to the preset object closest to each pixel bit in the middle distance is determined from a plurality of pixel bit distances, wherein a target distance corresponding to each pixel bit is each pixel bit and a plurality of preset objects.
  • determining a target distance corresponding to each pixel bit from the plurality of pixel bit distances determining a target distance corresponding to each pixel bit from the plurality of pixel bit distances.
  • the target distance corresponding to each pixel bit is the distance between each pixel bit and the pixel bit corresponding to the object closest to each pixel bit among the plurality of preset objects, thereby determining each pixel bit and the preset object closest thereto.
  • the distance between the pixel bits is obtained to obtain a plurality of pixel bit distances.
  • the pixel bit distance is stored.
  • calculating the pixel bit distance between the pixel bit and the pixel bit corresponding to the next preset object comparing the currently calculated pixel bit distance corresponding to the pixel bit with the last calculated pixel bit distance, If the currently calculated pixel bit distance is smaller than the pixel bit distance calculated last time, the currently calculated pixel bit distance corresponding to the pixel bit is stored, otherwise, no storage is performed, so each time the pixel bit is currently stored. The bit distance is compared to the next calculated pixel bit distance until the target distance corresponding to the pixel bit is found.
  • Step S404 storing a target distance corresponding to each pixel bit.
  • the target distance corresponding to each pixel bit is stored.
  • the target distance of each pixel bit is stored, thereby achieving the purpose of pre-storing the target distance corresponding to each pixel bit.
  • the pixel bit distance between the first target pixel and the second target pixel corresponding to the second target object is directly taken out, and the obtained pixel bit distance is obtained.
  • the target distance corresponding to each pixel bit is obtained.
  • the embodiment acquires all pixel bits and a plurality of preset objects in the game scene before acquiring the pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit; acquiring each pixel bit respectively a pixel distance between pixel positions corresponding to the preset object, obtaining a plurality of pixel bit distances; determining a target distance corresponding to each pixel bit from the plurality of pixel bit distances; storing a target distance corresponding to each pixel bit, realizing Pre-acquiring the distance between each pixel bit and the preset object, finding the distance between each pixel bit and the pixel bit corresponding to the preset object closest to each pixel bit, and storing it, so as to be in the target object
  • the target distance is smaller than the preset size of the first target object in the game scene, Determining that the first target object and the second target object have
  • the identification information identifies pixel bits corresponding to the plurality of preset objects, and identifies, by the second identification information, a third target pixel bit of all the pixel bits except the pixel bits corresponding to the plurality of preset objects, where the third target pixel bit includes A target pixel bit.
  • FIG. 5 is a flowchart of another method of processing a target object according to an embodiment of the present invention. As shown in FIG. 5, the method further includes the following steps:
  • Step S501 acquiring a first matrix for representing all pixel bits.
  • the first matrix for identifying all pixel bits is obtained, and all the pixel bits in the game scene may be first represented by the first matrix.
  • the matrix is a 2*2 matrix.
  • the first row of the first matrix represents the first pixel bit
  • the first row and the second column represent the second pixel bit
  • the second row and the first column represent the third pixel bit.
  • the second row of the second row represents the fourth pixel bit.
  • Step S502 Identify, on the first matrix, the pixel bits corresponding to the plurality of preset objects by using the first identifier information, and identify, by using the second identifier information, the pixel bits of all the pixel bits except the plurality of preset objects.
  • the third target pixel bit includes a first target pixel bit.
  • the pixel bits corresponding to the plurality of preset objects are identified by the first identification information, and the plurality of presets are identified by the second identification information.
  • All the pixel bits in the game scene include the pixel bits corresponding to the preset object, and the pixel positions corresponding to the plurality of preset objects are identified by the first identification information, for example, the pixel identifier of the mask area in all the pixel bits is used by the first identifier.
  • the information "1" is identified and is not limited herein.
  • the third target pixel bit of all the pixel bits except the pixel bit corresponding to the preset object may be identified by the second identification information, for example, for the non-mask area in all the pixel bits, the second identification information “0” "Identification, not limited here.
  • the third target pixel bit includes the first target pixel bit, that is, the first target object may be on the third target pixel bit after entering the game scene.
  • the distance between each pixel bit and the pixel bit corresponding to the preset object may be calculated in advance according to the identification information in the first matrix, and the pixel bit corresponding to each pixel and the preset object closest to each pixel bit is found. The distance between them is stored down. When the actor enters a certain pixel position, the distance between the pixel bit and the nearest mask area is directly taken out.
  • the method further includes: acquiring a first matrix for indicating all the pixel bits; and identifying, by the first identification information, the plurality of Presetting the pixel bit corresponding to the object, and identifying, by the second identification information, a third target pixel bit of all the pixel bits except the pixel bit corresponding to the plurality of preset objects, where the third target pixel bit includes the first target pixel bit.
  • a pixel bit distance between each pixel bit and a pixel bit corresponding to the plurality of preset objects is obtained, and obtaining a plurality of pixel bit distances includes: when traversing to the first When identifying the information, the width-first search algorithm obtains the pixel bit distance between the pixel bit corresponding to the first first identification information and all the pixel bits; when traversing to the second first identification information, the width-first search algorithm Obtaining a pixel bit distance between the pixel bit corresponding to the second first identification information and all the pixel bits.
  • FIG. 6 is a flowchart of a method for acquiring a pixel bit distance between pixel bits corresponding to a plurality of preset objects, respectively, according to an embodiment of the present invention. As shown in FIG. 6, the method includes the following steps:
  • Step S601 traversing identification information corresponding to all pixel bits in the first matrix.
  • step S601 of the present application the identification information corresponding to all the pixel bits in the first matrix is traversed.
  • All the pixel bits in the first matrix are identified by the identification information, for example, the first identification information identifies the pixel bits corresponding to the plurality of preset objects, and the second identification information identifies all the pixel bits corresponding to the plurality of preset objects.
  • step S602 when traversing the first first identification information, the pixel-bit distance between the pixel bit corresponding to the first first identification information and all the pixel bits is obtained by the width-first search algorithm.
  • Step S603 when traversing to the second first identification information, obtaining a pixel bit distance between the pixel bit corresponding to the second first identification information and all the pixel bits by using the width first search algorithm.
  • the first identifier information corresponding to the plurality of preset objects in the first matrix is searched, and when the first first identifier information is found, the pixel bits corresponding to the first preset object are obtained. a pixel bit distance, wherein the first first identifier information is used to identify a first preset object of the plurality of preset objects, and when the second identifier information is found, all pixel bits are acquired to correspond to the second preset object.
  • the second first identification information is used to identify a second preset object among the plurality of preset objects, and so on, until each pixel bit in the game scene is acquired
  • the distance between the plurality of preset objects determines a pixel bit distance between each pixel bit and a pixel bit corresponding to the preset object closest to each pixel bit, thereby acquiring a target distance corresponding to each pixel bit.
  • the pixel-bit distance between each pixel bit and the pixel bit corresponding to the plurality of preset objects is obtained by the width-first search algorithm to obtain a plurality of pixel bit distances, and then the first pixel bit distance and the second pixel distance are obtained.
  • the minimum pixel bit distance among the pixel bit distances is determined as the target distance corresponding to the first target pixel bit, wherein the breadth-first search algorithm has universality for different game scenes, which avoids problems such as stack overflow in a large game scene.
  • this embodiment can utilize two arrays instead of queues.
  • the traversal process using the array is as follows: each time the A array is traversed, the successor node of each element in the A array is placed in the B array, the A array is traversed, the A array is emptied, and then the B array is traversed, and then B is The successor node of each element in the array is placed in the A array. After the B array is traversed, the B array is emptied, and then the A array is traversed. This loops back and forth, where the A array and the B array store the result of the traversal. Because it is a pre-processing of the game, the array can be directly released after the pre-processing, so there is no need to consider the cost of the space.
  • the first identifier information when traversing the identification information corresponding to the first target pixel bit, the first identifier information is searched in the first matrix. Since the preset object is identified by the first identification information, the pixel bit corresponding to the preset object is searched for. When the first first identifier information is found in the first matrix, the first distance between the identifier information corresponding to the first target pixel bit and the first first identifier information is obtained, and the first distance is used as the first a first pixel bit distance between the target pixel bit and the pixel bit corresponding to the first preset object, wherein the first first identification information is used to identify the first preset object.
  • the second first identifier information is found in the first matrix, obtaining a second distance between the identifier information corresponding to the first target pixel bit and the second first identifier information, and using the second distance as the first a second pixel bit distance between the target pixel bit and the pixel bit corresponding to the second preset object, wherein the second first identification information is used to identify the second preset object.
  • width-first search algorithm is only an optional implementation manner of the embodiment of the present invention, and is not limited to the method for obtaining the pixel bit distance between the pixel bit corresponding to the identifier information and all the pixel bits in the embodiment of the present invention. Any method that can obtain the pixel bit distance between the pixel bit corresponding to the identification information and all the pixel bits, and then obtain the target distance corresponding to each pixel bit is within the protection scope of the present invention, and is no longer An example.
  • the pixel-bit distance between the pixel bit corresponding to the first first identification information and all the pixel bits is obtained by the width-first search algorithm; when traversing to the second When the first identification information is obtained, the pixel-bit distance between the pixel bit corresponding to the second first identification information and all the pixel bits is obtained by the width-first search algorithm, so that each pixel bit is respectively corresponding to the plurality of preset objects.
  • the pixel bit distance between pixel bits for the purpose of obtaining a plurality of pixel bit distances.
  • step S208 performing preset processing on the first target object according to the overlapping area includes: performing translucent processing on the overlapping area of the first target object.
  • the target distance is smaller than the preset size of the first target object in the game scene, determining that the first target object and the second target object have a coincident region, when the first target object is preset according to the coincident region, The coincident region of the first target object is translucently processed, that is, to indicate that the first target object is behind the second target object.
  • the target distance is not less than a preset size of the first target object in the game scene.
  • the game screen corresponding to the first target object is normally drawn in the game scene, thereby ensuring that the first target object in the game screen is normally displayed.
  • the first target object is a game object actor
  • the second target object is a mask area
  • 3D games can solve this problem with depth, while 2D games have no depth concept, so they can only be marked in advance. Some areas, and stipulate that when the game characters are in these areas, they do some special effects such as semi-transparent effects to indicate that the character is behind the object.
  • FIG. 7 is a flowchart of a method of processing a target object according to an embodiment of the present invention. As shown in FIG. 7, the method includes the following steps:
  • step S701 all pixel bits in the game scene are represented in a matrix form.
  • Step S702 in the matrix, all the mask regions in the game scene are represented by "1", and the matrix positions of the non-mask regions are all marked as 0.
  • step S703 the matrix is traversed, and the position identified as "1" in the matrix is searched.
  • Step S704 calculating the pixel bit distance of each pixel and the mask area in advance by using the width first search.
  • the pixel-bit distance between each pixel bit and the pixel bit of the mask area is calculated in advance by the width-first search.
  • Step S705 finding the pixel bit distance between each pixel bit and the pixel bit of the nearest mask area.
  • Step S706 acquiring a target pixel bit that the actor enters into the game scene.
  • Step S707 acquiring a target distance between the target pixel bit and the pixel bit of the mask area closest to the target pixel bit.
  • the target distance between the target pixel bit and the pixel bit of the mask region closest to the target pixel bit is acquired.
  • step S708 it is determined whether the target distance is larger than the size of the actor itself.
  • step S709 After obtaining the target distance between the target pixel bit and the pixel bit of the mask region closest to the target pixel bit, it is determined whether the target distance is larger than the size of the actor itself. If it is determined that the target distance is larger than the size of the actor itself, step S709 is performed, and if it is determined that the target distance is less than or equal to the size of the actor itself, step S710 is performed.
  • step S709 the actor is normally drawn.
  • the target distance is judged to be larger than the size of the actor itself, the actor is drawn normally.
  • step S710 the actor is drawn semi-transparently.
  • the target distance is less than or equal to the actor itself, it means that the actor has a semi-transparent effect on the actor in some mask areas.
  • This embodiment uses breadth-first search because it is universal for different game scene sizes, and other such as depth-first search, which causes stack overflow in large scenes. Considering that the width-first search must borrow the data structure queue, in order to avoid the complexity of implementing the queue, this embodiment directly releases the array, so there is no need to consider the space cost.
  • the traversal process using arrays is as follows: each time the A array is traversed, the successor node of each element in the A array is placed in the B array, the A array is traversed, the A array is emptied, and then the B array is traversed, and each element in the B array is traversed. The successor node is placed in the A array, the B array is traversed after the B array is traversed, and then the A array is traversed.
  • the width-first search is used to determine the distance relationship between each pixel and the mask area in advance, so that the time complexity of the actor in the mask area is reduced to O(1), thereby quickly determining. Whether the actor is in the mask area, and then determines whether the actor is drawn by determining whether the game object actor is in the mask area.
  • the application environment of the embodiment of the present invention may be, but is not limited to, the reference to the application environment in the foregoing embodiment, which is not described in this embodiment.
  • An embodiment of the present invention provides an optional application for implementing the processing method of the target object.
  • the game scene is composed of 3*3 total 9 pixel bits.
  • a matrix is used to represent all the pixel bits in the game scene. "0" can be used to represent the pixels of the non-mask area in the game scene, and "1" is used to represent the pixel bits of the mask area in the game scene.
  • Table 1 is an identification table for identifying pixel bits in a scene instance.
  • Table 1 identifies the identification table for the pixel bits in the scene instance.
  • the width-first search for the distance between the pixel bits (1, 2) and all other pixel bits is used.
  • the distance between the pixel bit (1, 1) and the pixel bit (1, 2) is 1;
  • the distance between the pixel bit (1, 2) and the pixel bit (1, 2) is 0;
  • the distance between the pixel bit (1, 3) and the pixel bit (1, 2) is 1;
  • the distance between the pixel bit (2, 2) and the pixel bit (1, 2) is 1;
  • the distance between the pixel bit (3, 1) and the pixel bit (1, 2) is
  • the distance between the pixel bit (3, 2) and the pixel bit (1, 2) is 2;
  • the distance between the pixel bit (1, 1) and the pixel bit (3, 1) is 2;
  • the distance between the pixel bit (2, 1) and the pixel bit (3, 1) is 1;
  • the distance between the pixel bit (3, 1) and the pixel bit (3, 1) is 0;
  • the distance between the pixel bit (3, 2) and the pixel bit (3, 1) is 1;
  • the distance between the pixel bit (3, 3) and the pixel bit (3, 1) is 2.
  • Table 4 The shortest distance minDis table between each pixel bit and the pixel position of the nearest mask area
  • Table 4 is a table of the shortest distance minDis between the pixel bits of each pixel bit and the nearest mask area, as shown in Table 4:
  • the "1" in the first column of the first row is the distance 1 between the pixel bit (1, 1) and the pixel bit (1, 2) in Table 2 and the pixel bit (1, 1) and pixel in Table 3.
  • the minimum value 1 is obtained from the distance 2 between the bits (3, 1);
  • the "0" in the second column of the first row is the distance 0 between the pixel bit (1, 2) and the pixel bit (1, 2) in Table 2 and the pixel bit (1, 2) and pixel in Table 3.
  • Distance between bits (3, 1) Take the minimum value of 0 to get;
  • the "1" in the first row and the third column is the distance 1 between the pixel bit (1, 3) and the pixel bit (1, 2) in Table 2 and the pixel bit (1, 3) and pixel in Table 3.
  • Distance between bits (3, 1) Take the minimum value of 1 to get;
  • the "1" in the first column of the second row is the distance between the pixel bit (2, 1) and the pixel bit (1, 2) in Table 2. Taking the minimum value 1 from the distance 1 between the pixel bit (2, 1) and the pixel bit (3, 1) in Table 3;
  • the "1" in the second row and the second column is determined by the distance 1 between the pixel bit (2, 2) and the pixel bit (1, 2) in Table 2 and the image pixel bit (2, 2) in Table 3. Distance between pixel bits (3, 1) Take the minimum value of 1 to get;
  • the "0" in the first column of the third row is the distance between the image pixel bit (3, 1) and the pixel bit (1, 2) in Table 2. Obtaining a minimum value of 0 from the distance 0 between the pixel bit (3, 1) and the pixel bit (3, 1) in Table 3;
  • the "1" in the second row and the second column is the distance 2 between the pixel bit (3, 2) and the pixel bit (1, 2) in Table 2 and the pixel bit (3, 2) and pixel in Table 3.
  • the minimum value 1 is obtained from the distance 1 between the bits (3, 1);
  • the "2" in the third row and the third column is the distance between the pixel bits (3, 3) and the pixel bits (1, 2) in Table 2.
  • a minimum value of 2 is obtained from the distance 2 between the pixel bit (3, 3) and the pixel bit (3, 1) in Table 3.
  • the size of the actor itself is 1.5. If the position of the actor in the game scene corresponds to the first column (1, 1) in the first row of the matrix, O(1) queries the pixel position and distance corresponding to the actor. The distance between the pixel bits corresponding to the nearest mask area of the actor is 1, and the distance 1 is smaller than the actor size of 1.5, so the actor is in the mask area and the actor is semi-transparent; for example, if the actor is in the game scene The position corresponds to the third row and the third column (3, 3) in the matrix, and the distance between the pixel position corresponding to the mask region corresponding to the pixel bit corresponding to the actor is O(1). 2, the distance 2 is greater than the actor's own size of 1.5, so the actor is not in the mask area, the actor can be drawn normally.
  • the width-first search may be used to determine the distance relationship between each pixel and the mask area in advance, so as to determine whether the actor is in the mask area.
  • the time complexity is reduced to O(1), which in turn achieves the technical effect of quickly determining whether the actor is in the mask area, thereby greatly improving the fluency of the picture.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention in essence or the contribution to the related art can be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM).
  • the instructions include a number of instructions for causing a terminal device (which may be a cell phone, computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention.
  • FIG. 8 is a schematic diagram of a processing apparatus of a target object according to an embodiment of the present invention. As shown in FIG. 8, the apparatus may include: a first determining unit 10, a first obtaining unit 20, a second determining unit 30, and a first processing unit 40.
  • the first determining unit 10 is arranged to determine that the first target object enters the first position in the game scene.
  • the first obtaining unit 20 is configured to acquire a pre-stored target distance between the first location and the second location, where the second location is a location where the second target object is located in the game scene, and the second target object is The object in the game scene that is closest to the first target object.
  • the second determining unit 30 is configured to determine that the first target object and the second target object have a coincident region if the target distance is smaller than a preset size of the first target object in the game scene.
  • the first processing unit 40 is configured to perform preset processing on the first target object according to the coincident region.
  • the apparatus may include: a first determining unit 10, a first obtaining unit 20, a second determining unit 30, and a first processing unit 40.
  • the first determining unit 10 includes: a first determining module 11
  • the first acquiring unit 20 includes: a first acquiring module 21 .
  • first determining unit 10 the first obtaining unit 20, the second determining unit 30, and the first processing unit 40 of this embodiment have the same functions as those of the processing device of the target object of the embodiment shown in FIG. I will not repeat them here.
  • the first determining module 11 is configured to determine that the first target object enters a first target pixel bit in the game scene, wherein the first location includes the first target pixel bit.
  • the first obtaining module 21 is configured to acquire a pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit, and take the acquired pixel bit distance as a target distance, wherein the second location includes Two target pixel bits.
  • FIG. 10 is a schematic diagram of another processing apparatus of a target object according to an embodiment of the present invention.
  • the apparatus may include: a first determining unit 10, a first obtaining unit 20, a second determining unit 30, and a first processing unit 40.
  • the first determining unit 10 includes: a first determining module 11 , where the first acquiring unit 20 includes: a first acquiring module 21 .
  • the apparatus further includes a second acquisition unit 50, a third acquisition unit 60, a third determination unit 70, and a storage unit 80.
  • first determining unit 10 the first obtaining unit 20, the second determining unit 30, the first processing unit 40, the first determining module 11 and the first obtaining module 21 of the embodiment are implemented as shown in FIG.
  • the functions of the processing device of the target object of the example are the same, and are not described herein again.
  • the second obtaining unit 50 is configured to acquire all the pixel bits and the plurality of preset objects in the game scene before acquiring the pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit, where All of the pixel bits include a first target pixel bit, a pixel bit corresponding to the plurality of preset objects, and the plurality of preset objects include the second target object.
  • the third obtaining unit 60 is configured to acquire a pixel bit distance between each pixel bit and a pixel bit corresponding to the plurality of preset objects, to obtain a plurality of pixel bit distances.
  • the third determining unit 70 is configured to determine a target distance corresponding to each pixel bit from the plurality of pixel bit distances, wherein the target distance corresponding to each pixel bit is a distance between each pixel bit and the plurality of preset objects.
  • the storage unit 80 is arranged to store a target distance corresponding to each pixel bit.
  • the apparatus may include: a first determining unit 10, a first obtaining unit 20, a second determining unit 30, and a first processing unit 40.
  • the first determining unit 10 includes: a first determining module 11 , where the first acquiring unit 20 includes: a first acquiring module 21 .
  • the apparatus further includes a second acquisition unit 50, a third acquisition unit 60, a third determination unit 70, and a storage unit 80.
  • the apparatus further includes: a fourth acquisition unit 90 and an identification unit 100.
  • the first determining unit 10 the first obtaining unit 20, the second determining unit 30, the first processing unit 40, the first determining module 11, the first obtaining module 21, and the second obtaining unit 50 of this embodiment
  • the third obtaining unit 60, the third determining unit 70, and the storage unit 80 have the same functions as those of the processing device of the target object of the embodiment shown in FIG. 10, and details are not described herein again.
  • the fourth obtaining unit 90 is configured to acquire a first matrix for representing all the pixel bits after acquiring all the pixel bits and the plurality of preset objects in the game scene.
  • the identification unit 100 is configured to identify, on the first matrix, the pixel bits corresponding to the plurality of preset objects by using the first identification information, and identify the pixel bits corresponding to the plurality of preset objects in all the pixel bits by using the second identification information.
  • a third target pixel bit, the third target pixel bit includes a first target pixel bit.
  • FIG. 12 is a schematic diagram of another processing apparatus of a target object according to an embodiment of the present invention.
  • the apparatus may include: a first determining unit 10, a first obtaining unit 20, a second determining unit 30, and a first processing unit 40.
  • the first determining unit 10 includes: a first determining module 11 , where the first acquiring unit 20 includes: a first acquiring module 21 .
  • the apparatus further includes a second acquisition unit 50, a third acquisition unit 60, a third determination unit 70, and a storage unit 80.
  • the apparatus further includes: a fourth acquisition unit 90 and an identification unit 100.
  • the third obtaining unit 60 includes: a traversing module 61, a second obtaining module 62, and a third obtaining module 63.
  • the first determining unit 10 the first obtaining unit 20, the second determining unit 30, and the first processing unit 40 of the embodiment, the first determining module 11, the first obtaining module 21, and the second obtaining unit 50
  • the third obtaining unit 60, the third determining unit 70, and the storing unit 80, the fourth obtaining unit 90 and the identifying unit 100 have the same functions as those of the processing device of the target object of the embodiment shown in FIG. 11, and are not described herein again.
  • the traversal module 61 is arranged to traverse the identification information corresponding to all pixel bits in the first matrix.
  • the second obtaining module 62 obtains, by the breadth-first search algorithm, the pixel bit distance between the pixel bit corresponding to the first first identification information and all the pixel bits when traversing to the first first identification information.
  • the third obtaining module 63 obtains the pixel bit distance between the pixel bit corresponding to the second first identification information and all the pixel bits by the width-first search algorithm when traversing the second first identification information.
  • the first processing unit 40 includes: a translucent processing module configured to perform translucent processing on the coincident region of the first target object.
  • the apparatus further includes: a second processing unit configured to: after acquiring the pre-stored target distance between the first location and the second location, the target distance is not less than the first In the case where the target object is in the preset size in the game scene, the game screen corresponding to the first target object is normally drawn in the game scene.
  • the first determining unit 10 in this embodiment may be configured to perform step S202 in Embodiment 1 of the present application
  • the first obtaining unit 20 in this embodiment may be configured to perform Embodiment 1 of the present application
  • the second determining unit 30 in this embodiment may be configured to perform step S206 in Embodiment 1 of the present application
  • the first processing unit 40 in this embodiment may be configured to perform Embodiment 1 of the present application.
  • the first determining unit 10 determines that the first target object enters the first position in the game scene, and acquires the pre-stored target distance between the first position and the second position by the first acquiring unit 20, wherein
  • the second position is a position where the second target object is located in the game scene, and the second target object is an object that is closest to the first target object in the game scene, and the target distance is smaller than the first target object by the second determining unit 30.
  • the first target unit performs preset processing according to the coincident area by the first processing unit 40, because the first target object When entering the first position in the game scene, the target distance pre-stored between the first position and the second position is directly obtained, and the purpose of quickly determining whether the first target object coincides with the second target object is achieved, and the related technology can be solved.
  • the process of processing the target object is a very time consuming technical problem, and thus the first target object is achieved. A technical effect of processing speed.
  • the above-mentioned units and modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above embodiment 1.
  • the foregoing module may be implemented in a hardware environment as shown in FIG. 1 as part of the device, and may be implemented by software or by hardware. Among them, the hardware environment includes the network environment.
  • an electronic device for implementing the processing method of the target object described above is also provided.
  • FIG. 13 is a structural block diagram of an electronic device according to an embodiment of the present invention.
  • the electronic device may include one or more (only one shown in the figure) processor 131, a memory 133, and a transmission device 135.
  • the electronic device may further include an input and an output.
  • Device 137 may be any suitable device that can be used to control the electronic device.
  • the memory 133 can be used to store a computer program and a module, such as a processing method of a target object and a program instruction/module corresponding to the device in the embodiment of the present invention, and the processor 131 is configured to run the software program stored in the memory 133 and The module, thereby performing various functional applications and data processing, that is, implementing the processing method of the target object described above.
  • Memory 133 may include high speed random access memory, and may also include non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory.
  • memory 133 can further include memory remotely located relative to processor 131, which can be connected to the terminal over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the transmission device 135 described above is arranged to receive or transmit data via a network, and may also be configured as a data transmission between the processor and the memory. Examples of network options described above may include wired networks and wireless networks.
  • transmission device 135 includes a Network Interface Controller (NIC) that can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network.
  • NIC Network Interface Controller
  • transmission device 135 is a Radio Frequency (RF) module that is configured to communicate with the Internet wirelessly.
  • RF Radio Frequency
  • the memory 133 is configured to store an application.
  • the processor 131 can call the application stored in the memory 133 through the transmission device 135 to perform the following steps:
  • the first target object is subjected to preset processing according to the coincident area.
  • the processor 131 is further configured to perform the steps of: determining that the first target object enters a first target pixel bit in the game scene, wherein the first location comprises a first target pixel bit; acquiring the first target pixel bit and the second target A pre-stored pixel bit distance between pixel bits, and the acquired pixel bit distance is taken as a target distance, wherein the second position includes a second target pixel bit.
  • the processor 131 is further configured to perform the steps of: acquiring all pixel bits and a plurality of preset objects in the game scene before acquiring a pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit Wherein all the pixel bits include a first target pixel bit, a pixel bit corresponding to the plurality of preset objects, the plurality of preset objects include the second target object, and acquire pixel bits corresponding to the plurality of preset objects respectively.
  • a distance between the pixel bits to obtain a plurality of pixel bit distances determining a target distance corresponding to each pixel bit from the plurality of pixel bit distances, wherein each pixel bit corresponds to a target distance of each pixel bit and a plurality of pre- The pixel bit distance between the pixel bits corresponding to the preset object closest to each pixel bit in the object is set; the target distance corresponding to each pixel bit is stored.
  • the processor 131 is further configured to perform the steps of: after acquiring all the pixel bits and the plurality of preset objects in the game scene, acquiring a first matrix for representing all the pixel bits; on the first matrix, passing the first
  • the identification information identifies pixel bits corresponding to the plurality of preset objects, and identifies, by the second identification information, a third target pixel bit of all the pixel bits except the pixel bits corresponding to the plurality of preset objects, where the third target pixel bit includes A target pixel bit.
  • the processor 131 is further configured to perform the following steps: when traversing to the first first identification information, obtaining a pixel bit between the pixel bit corresponding to the first first identification information and all the pixel bits by the width first search algorithm The distance between the pixel bit corresponding to the second first identification information and the pixel bit distance between all the pixel bits is obtained by the width-first search algorithm when traversing to the second first identification information.
  • the processor 131 is also arranged to perform the step of translucent processing of the coincident regions of the first target object.
  • the processor 131 is further configured to perform the step of: after acquiring the pre-stored target distance between the first location and the second location, the target distance is not less than a preset size of the first target object in the game scene Next, the game screen corresponding to the first target object is normally drawn in the game scene.
  • An embodiment of the present invention provides a method for processing a target object. Determining a first target object into a first position in the game scene; acquiring a pre-stored target distance between the first location and the second location, wherein the second location is a location of the second target object in the game scene.
  • the second target object is an object that is closest to the first target object in the game scene; and if the target distance is smaller than a preset size of the first target object in the game scene, determining that the first target object and the second target object have coincidence Area; a method of performing preset processing on the first target object according to the coincident area.
  • the purpose of quickly determining whether the first target object coincides with the second target object is achieved.
  • the technical problem that the processing process of the target object in the related art is very time-consuming can be solved, thereby achieving the technical effect of quickly processing the first target object.
  • FIG. 13 is merely illustrative, and the electronic device can be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palmtop computer, and a mobile Internet device (MID). Terminal equipment such as PAD.
  • FIG. 13 does not limit the structure of the above electronic device.
  • the electronic device may also include more or fewer components (such as a network interface, display device, etc.) than shown in FIG. 13, or have a different configuration than that shown in FIG.
  • Embodiments of the present invention also provide a storage medium.
  • a computer program is stored in the storage medium, wherein the computer program is set as a processing method for executing a target object at runtime.
  • the foregoing storage medium may be located on at least one of the plurality of network devices in the network shown in the foregoing embodiment.
  • the storage medium is arranged to store program code for performing the following steps:
  • the first target object is subjected to preset processing according to the coincident area.
  • the storage medium is further configured to store program code for: determining that the first target object enters a first target pixel bit in the game scene, wherein the first location includes the first target pixel bit; A pre-stored pixel bit distance between a target pixel bit and a second target pixel bit, and the acquired pixel bit distance is taken as a target distance, wherein the second position includes a second target pixel bit.
  • the storage medium is further configured to store program code for performing: acquiring all of the game scenes before acquiring a pre-stored pixel bit distance between the first target pixel bit and the second target pixel bit a pixel bit and a plurality of preset objects, wherein all the pixel bits include a first target pixel bit, a pixel bit corresponding to the plurality of preset objects, and the plurality of preset objects include the second target object; a pixel distance between pixel positions corresponding to the preset object, to obtain a plurality of pixel bit distances; determining a target distance corresponding to each pixel bit from the plurality of pixel bit distances, wherein the target distance corresponding to each pixel bit is a pixel bit distance between each pixel bit and a pixel bit corresponding to a preset object closest to each pixel bit among the plurality of preset objects; storing a target distance corresponding to each pixel bit.
  • the storage medium is further configured to store program code for performing the following steps: after acquiring all pixel bits and a plurality of preset objects in the game scene, acquiring a first matrix for representing all pixel bits; Identifying, by the first identifier information, the pixel bits corresponding to the plurality of preset objects, and identifying, by the second identifier information, the third target pixel bits of the pixel bits other than the plurality of preset objects
  • the third target pixel bit includes a first target pixel bit.
  • the storage medium is further configured to store program code for performing the following steps: when traversing to the first first identification information, obtaining a pixel bit corresponding to the first first identification information by using a width-first search algorithm The pixel bit distance between all the pixel bits; when traversing to the second first identification information, the pixel bit distance between the pixel bit corresponding to the second first identification information and all the pixel bits is obtained by the width-first search algorithm.
  • the storage medium is further arranged to store program code for performing the step of translucent processing of the coincident regions of the first target object.
  • the storage medium is further configured to store program code for performing the following steps: after acquiring the pre-stored target distance between the first location and the second location, the target distance is not less than the first target object in the game In the case of a preset size in the scene, the game screen corresponding to the first target object is normally drawn in the game scene.
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the integrated unit in the above embodiment if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in the above-described computer readable storage medium.
  • the technical solution of the present invention may be embodied in the form of a software product in the form of a software product, or the whole or part of the technical solution, which is stored in a storage medium, including
  • the instructions are used to cause one or more computer devices (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the disclosed client may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, unit or module, and may be electrical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one first processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the present invention directly obtains the target distance pre-stored between the first location and the second location when the first target object enters the first position in the game scene, thereby quickly determining whether the first target object is
  • the purpose of the second target object coincidence can solve the technical problem that the processing process of the target object is very time-consuming in the related art, thereby achieving the technical effect of quickly processing the first target object.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)
  • Image Analysis (AREA)

Abstract

一种目标对象的处理方法、装置、存储介质及电子装置。其中,该方法包括:确定第一目标对象进入游戏场景中的第一位置;获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理。

Description

目标对象的处理方法、装置、存储介质及电子装置
本申请要求于2017年05月11日提交中国专利局、申请号为201710332072.X、发明名称“目标对象的处理方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机领域,具体而言,涉及一种目标对象的处理方法、装置、存储介质及电子装置。
背景技术
目前,在游戏运行环境中,目标对象每走进一个像素位,都会穷举出场景中所有的区域(mask),检测该目标对象和每个区域的像素位距离是否小于目标对象自身的大小,例如,目标对象为游戏人物。这样,在目标对象每走进游戏场景中的一个像素位,都需要判断该像素位和所有区域之间的关系,然后选出与目标对象的像素位距离最近的区域,其时间复杂度为O(n),其中,n为游戏场景中的区域的数目。
由于在游戏中,上述n值普遍较大,因而时间复杂度O(n)不可接受,导致对目标对象的处理过程非常耗时的问题。另外,再考虑到距离计算非常耗时,会导致客户端的画面不流畅的问题。
针对上述对目标对象的处理过程非常耗时的问题,目前尚未提出有效的解决方案。
发明内容
本发明实施例提供了一种目标对象的处理方法、装置、存储介质及电子装置,以至少解决相关技术中对目标对象的处理过程非常耗时的技术问题。
根据本发明实施例的一个方面,提供了一种目标对象的处理方法。该目标对象处理方法包括:确定第一目标对象进入游戏场景中的第一位置;获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理。
根据本发明实施例的另一方面,还提供了一种目标对象的处理装置。该目标对象的处理装置包括:第一确定单元,被设置为确定第一目标对象进入游戏场景中的第一位置;第一获取单元,被设置为获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;第二确定单元,被设置为在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;第一处理单元,被设置为根据重合区域对第一目标对象进行预设处理。
在本发明实施例中,采用确定第一目标对象进入游戏场景中的第一位置;获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理的方式。由于当第一目标对象进入游戏场景中的第一位置时,直接获取第一位置与第二位置之间预先存储的目标距离,达到了快速确定第一目标对象是否与第二目标对象重合的目的,可以解决了相关技术中对目标对象的处理过程非常耗时的技术问题,进而达到了对第一目标对象进行快速处理的技术效果。
附图说明
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一 部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是根据本发明实施例的一种目标对象的处理方法的硬件环境的示意图;
图2是根据本发明实施例的一种目标对象的处理方法的流程图;
图3是根据本发明实施例的一种确定第一目标对象进入游戏场景中的第一位置的方法的流程图;
图4是根据本发明实施例的另一种目标对象的处理方法的流程图;
图5是根据本发明实施例的另一种目标对象的处理方法的流程图;
图6是根据本发明实施例的一种获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离的方法的流程图;
图7是根据本发明实施例的一种目标对象的处理方法的流程图;
图8是根据本发明实施例的一种目标对象的处理装置的示意图;
图9是根据本发明实施例的另一种目标对象的处理装置的示意图;
图10是根据本发明实施例的另一种目标对象的处理装置的示意图;
图11是根据本发明实施例的一种目标对象的处理装置的示意图;
图12是根据本发明实施例的另一种目标对象的处理装置的示意图;以及
图13是根据本发明实施例的一种电子装置的结构框图。
具体实施方式
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施 例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
根据本发明实施例,提供了一种目标对象的处理方法实施例。
可选地,在本实施例中,上述目标对象的处理方法可以应用于如图1所示的由服务器102和终端104所构成的硬件环境中。图1是根据本发明实施例的一种目标对象的处理方法的硬件环境的示意图。如图1所示,服务器102通过网络与终端104进行连接,上述网络包括但不限于:广域网、城域网或局域网,终端104并不限定于PC、手机、平板电脑等。本发明实施例的目标对象的处理方法可以由服务器102来执行,也可以由终端104来执行,还可以是由服务器102和终端104共同执行。其中,终端104执行本发明实施例的目标对象的处理方法也可以是由安装在其上的客户端来执行。
图2是根据本发明实施例的一种目标对象的处理方法的流程图。如图2所示,该方法可以包括以下步骤:
步骤S202,确定第一目标对象进入游戏场景中的第一位置。
在本申请上述步骤S202提供的技术方案中,确定第一目标对象进入游戏场景中的第一位置。
在游戏场景中,第一目标对象可以为游戏场景中能够移动的对象,比 如,第一目标对象为游戏场景中的游戏人物(actor),可选地,该游戏场景为二维游戏中的游戏场景。在游戏画面显示的过程中,对处于游戏场景中的第一目标对象进行绘制。在第一目标对象进入游戏场景中时,确定第一目标对象进入游戏场景中的第一位置。可选地,游戏场景中的游戏画面由像素构成,确定第一目标对象进入游戏场景中的像素位。
步骤S204,获取第一位置与第二位置之间的预先存储的目标距离。
在本申请上述步骤S204提供的技术方案中,获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象。
游戏场景中包括多个预设对象,不仅有可以移动的第一目标对象,还可以有固定的、可以用于遮挡第一目标对象的对象,比如,第一目标对象可以为游戏人物,可以通过树、岩石、池塘等对象进行遮挡。
在该实施例中,在游戏场景中,除了第一对目标对象之外,还可以有能够遮挡第一目标对象的n个对象,第二目标对象为游戏场景n个对象中距离第一目标对象最近的对象,可以为游戏场景中的一些区域,比如,游戏场景中的树、岩石、池塘等对象,此处不做限定。
游戏场景中的位置可以通过游戏场景中的像素位表示。在游戏运行之前,可以先用矩阵形式表示场景中所有像素位以确定游戏场景中的位置,并将能够遮挡第一目标对象的n个对象对应的像素位在矩阵位置中的位置按照第一标识信息进行标识,将除能够遮挡第一目标对象的n个对象之外的矩阵位置都标记为0。利用宽度优先搜索提前计算出每一个像素位和能够遮挡第一目标对象的n个对象之间的像素位距离,得到多个像素位距离,从多个像素位距离中找出每个像素位对应的最短距离,并进行存储。
在确定第一目标对象进入游戏场景中的第一位置之后,获取第一位置与第二位置之间的预先存储的目标距离,第二位置为第二目标对象在游戏 场景中所处的位置,也即,在游戏程序运行之前,提前存储游戏场景中每个位置与可以用于遮挡其它对象的对象之间的像素位距离关系,第一目标对象在游戏场景中所处的第一位置和第二目标对象在游戏场景中所处的第二位置之间的像素位距离预先存储过。在确定第一目标对象进入游戏场景中的第一位置之后,直接调取第一位置与第二位置之间的目标距离,该目标距离为第一目标对象与距离第一目标对象最近的对象之间的最短距离,使得判断第一目标对象是否与第二目标对象重合的时间的复杂度由O(n)降为O(1),大大提高了游戏画面的流畅度,避免了在第一目标对象每处于游戏场景中的一个位置时,都需要遍历游戏场景中所有除第一目标对象之外的其它对象,重新计算第一目标对象与其它对象之间的像素位距离,比如,避免了在游戏人物actor每进入一个像素时,遍历游戏场景中的所有mask区域,计算游戏人物actor与所有mask区域之间的像素位距离,所导致的目标对象处理耗时的问题。
可选地,第一位置和第二位置为游戏场景中的像素位,可以用于确定第一目标对象和第二目标对象在游戏场景中的位置。
步骤S206,在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域。
在本申请上述步骤S206提供的技术方案中,在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域。
第一目标对象在游戏场景中的预设尺寸可以用于衡量第一目标对象在游戏场景中所处区域的位置,比如,第一目标对象在游戏场景中自身的大小。该第一目标对象自身的大小可以为第一目标对象在游戏场景中的宽度。在获取预先存储的第一目标对象在游戏场景中所处的第一位置与第二目标对象在游戏场景中所处的第二位置之间的目标距离之后,判断该目标距离是否小于第一目标对象在游戏场景中的预设尺寸。在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二 目标对象具有重合区域,也即,第一目标对象能够被第二目标对象遮挡。
可选地,在目标距离大于等于第一目标对象在游戏场景中的预设尺寸的情况下,对第一目标对象在游戏场景中的显示画面正常绘制。
步骤S208,根据重合区域对第一目标对象进行预设处理。
在本申请上述步骤S208提供的技术方案中,根据重合区域对第一目标对象进行预设处理。
在游戏应用的游戏画面显示的过程中,在确定第一目标对象与第二目标对象具有重合区域之后,确定第一目标对象被第二目标对象遮挡,根据重合区域对第一目标对象进行预设处理,也即,可以根据重合区域对第一目标对象进行特殊的绘制方式。
可选地,在第一目标对象上对重合区域进行处理,第一目标对象上的重合区域完全不显示,或者在第一目标对象上对重合区域进行半透处理,以表明第一目标对象处于第二目标对象的后面。
在对第一目标对象进行预设处理之后,得到第三目标对象,该第三目标对象为第一目标对象的不完全显示对象,从而呈现出第一目标对象被第二目标对象遮挡的游戏画面。
通过上述步骤S202至步骤S208,通过确定第一目标对象进入游戏场景中的第一位置;获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理,由于第一目标对象进入游戏场景中的第一位置时,直接获取第一位置与第二位置之间的预先存储的目标距离,达到了快速确定第一目标对象是否与第二目标对象重合的目的,可以解决了相关技术中对目标对象的处理过程非常耗时的技术问题,进而达到了对第一目标对象进行快速处理的技术效果。
作为一种可选的实施方式,步骤S202,确定第一目标对象进入游戏场景中的第一位置包括:确定第一目标对象进入游戏场景中的第一目标像素位,其中,第一位置包括第一目标像素位;步骤S204,获取第一位置与第二位置之间的预先存储的目标距离包括:获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离作为目标距离,其中,第二位置包括第二目标像素位。
图3是根据本发明实施例的一种确定第一目标对象进入游戏场景中的第一位置的方法的流程图。该方法包括以下步骤:
步骤S301,确定第一目标对象进入游戏场景中的第一目标像素位。
在本申请上述步骤S301提供的技术方案中,确定第一目标对象进入游戏场景中的第一目标像素位,其中,第一位置包括第一目标像素位。
在显示游戏场景的画面时,可以通过像素位表示游戏场景的位置。在第一目标对象进入游戏场景中时,确定第一目标对象进入游戏场景中的第一目标像素位,也即,确定第一目标对象进入游戏场景后,所处位置的像素位,该第一目标像素位可以用矩阵中的(行,列)进行确定。
步骤S302,获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离作为目标距离。
在本申请上述步骤S302提供的技术方案中,获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离作为目标距离,其中,第二位置包括第二目标像素位。
在该实施例中,预先计算游戏场景中每一个像素位和预设对象对应的像素位之间的像素位距离,找出每个像素和最近的预设对象对应的像素位之间的像素位距离,并存储下来。第二目标对象在游戏场景中的第二位置包括第二目标像素位,也即,通过第二目标像素位可以表示第二目标对象在游戏场景中的位置,预先存储第一目标像素位和第二目标像素之间的像素位距离。
在确定第一目标对象进入游戏场景中的第一目标像素位之后,获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将像素位距离作为第一目标对象的目标距离。
该实施例通过确定第一目标对象进入游戏场景中的第一目标像素位,其中,第一位置包括第一目标像素位;获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离作为目标距离,其中,第二位置包括第二目标像素位,进而在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理,达到了对第一目标对象进行快速处理的技术效果。
作为一种可选的实施方式,在步骤S302,获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,获取游戏场景中包括第一目标像素位、多个预设对象对应的像素位的所有像素位和包括第二目标对象的多个预设对象;获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离;从多个像素位距离中确定并存储每个像素位对应的目标距离。
图4是根据本发明实施例的另一种目标对象的处理方法的流程图。如图4所示,该方法还包括以下步骤:
步骤S401,获取游戏场景中的所有像素位和多个预设对象。
在本申请上述步骤S401提供的技术方案中,获取游戏场景中的所有像素位和多个预设对象,其中,所有像素位包括第一目标像素位、多个预设对象对应的像素位,多个预设对象包括第二目标对象。
在获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,在预先计算游戏场景中每一个像素位和预设对象对应的像素位之间的像素位距离,找出每个像素和最近的预设对象对应的像素位之间的像素位距离时,获取游戏场景中的所有像素位和多个预设对象,该所述有 像素位包括第一目标对象进入游戏场景的第一目标像素位,多个预设对象对应的像素位,也即,多个预设对象在游戏场景中所处位置的像素位。多个预设对象包括游戏中的一些区域,比如,树、岩石、池塘等,当第一目标对象进入这些区域,其身体或者身体的一部分可能会被区域遮挡。
步骤S402,获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离。
在本申请上述步骤S402提供的技术方案中,获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离。
在获取游戏场景中的所有像素位和多个预设对象之后,计算每个像素位和预设对象对应的像素位之间的距离,得到多个像素位距离。举例而言,游戏场景中有第一预设对象和第二预设对象,计算像素位1与第一预设对象之间的距离为a,计算像素位1与第二预设对象之间的距离为b,计算像素位2与第一预设对象之间的距离为c,像素位2与第二预设对象之间的距离d,从而得到多个像素位距离。
步骤S403,从多个像素位距离中确定每个像素位对应的目标距离。
在本申请上述步骤S403提供的技术方案中,从多个像素位距离中确定每个像素位对应的目标距离,其中,每个像素位对应的目标距离为每个像素位与多个预设对象中距离每个像素位最近的预设对象对应的像素位之间的像素位距离。
在获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离之后,从多个像素位距离中确定每个像素位对应的目标距离,该每个像素位对应的目标距离为每个像素位与多个预设对象中距离每个像素位最近的对象对应的像素位之间的距离,从而确定每个像素位和与其最近的预设对象之间的像素位距离,得到多个像素位距离。
可选地,在从多个像素位距离中确定每个像素位对应的目标距离时,每次计算出一个像素位与预设对象对应的像素位之间的像素位距离时,对 其进行存储,当计算出该像素位与下一个预设对象对应的像素位之间的像素位距离时,将当前计算出的该像素位对应的像素位距离与上一次计算出的像素位距离进行比较,如果当前计算出的像素位距离小于上一次计算出的像素位距离,则存储当前计算出的该像素位对应的像素位距离,否则,不进行存储,如此每次将该像素位当前存储的像素位距离与下一个计算出的像素位距离进行比较,直至找到该像素位对应的目标距离。
步骤S404,存储每个像素位对应的目标距离。
在本申请上述步骤S404提供的技术方案中,存储每个像素位对应的目标距离。
在从多个像素位距离中确定每个像素位对应的目标距离之后,存储每个像素位的目标距离,从而实现了预先存储每个像素位对应的目标距离的目的。当第一目标对象进入预设场景的第一目标像素位时,直接取出该第一目标像素和第二目标对象对应的第二目标像素位之间的像素位距离,并将获取的像素位距离作为每个像素位对应的目标距离。
该实施例通过获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,获取游戏场景中的所有像素位和多个预设对象;获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离;从多个像素位距离中确定每个像素位对应的目标距离;存储每个像素位对应的目标距离,实现了预先获取每一个像素位和预设对象之间的距离,找出每个像素位和距离每个像素位最近的预设对象对应的像素位之间的距离,并存储下来,从而在目标对象进入游戏场景中的像素位时,直接获取该像素位和距离最近的预设对象对应的像素位之间的距离,进而在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理,达到了对第一目标对象进行快速处理的技术效果。
作为一种可选的实施方式,在步骤S401,获取游戏场景中的所有像素位和多个预设对象之后,获取用于表示所有像素位的第一矩阵;在第一 矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
图5是根据本发明实施例的另一种目标对象的处理方法的流程图。如图5所示,该方法还包括以下步骤:
步骤S501,获取用于表示所有像素位的第一矩阵。
在本申请上述步骤S501提供的技术方案中,获取用于表示所有像素位的第一矩阵。
在游戏应用运行之前,获取用于标识所有像素位的第一矩阵,可以先用第一矩阵表示游戏场景中所有像素位。比如,该矩阵为2*2矩阵第一矩阵的第一行第一列表示第一像素位,第一行第二列表示第二像素位,第二行第一列表示第三像素位,第二行第二列表示第四像素位。
步骤S502,在第一矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
在本申请上述步骤S502提供的技术方案中,在第一矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
游戏场景中的所有像素位包括预设对象对应的像素位,通过第一标识信息标识多个预设对象对应的像素位,比如,对于所有像素位中的mask区域的像素位,用第一标识信息“1”进行标识,此处不做限定。对于所有像素位中除预设对象对应的像素位之外的第三目标像素位,可以通过第二标识信息进行标识,比如,对于所有像素位中的非mask区域,通过第二标识信息“0”进行标识,此处不做限定。第三目标像素位包括第一目标像素位,也即,第一目标对象在进入游戏场景之后,可以处于第三目标 像素位上。进而可以根据第一矩阵中的标识信息提前计算出每一个像素位和预设对象对应的像素位之间的距离,找出每个像素和距离每个像素位最近的预设对象对应的像素位之间的距离,并存储下来。当actor进入某个像素位时,直接取出该像素位和最近mask区域的距离,
该实施例通过获取游戏场景中的所有像素位和多个预设对象之后,方法还包括:获取用于表示所有像素位的第一矩阵;在第一矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
作为一种可选的实施方式,步骤S402,获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离包括:当遍历到第一个第一标识信息时,通过宽度优先搜索算法获取第一个第一标识信息对应的像素位与所有像素位之间的像素位距离;当遍历到第二个第一标识信息时,通过宽度优先搜索算法获取第二个第一标识信息对应的像素位与所有像素位之间的像素位距离。
图6是根据本发明实施例的一种获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离的方法的流程图。如图6所示,该方法包括以下步骤:
步骤S601,遍历第一矩阵中的所有像素位对应的标识信息。
在本申请上述步骤S601提供的技术方案中,遍历第一矩阵中的所有像素位对应的标识信息。
第一矩阵中的所有像素位通过标识信息进行标识,比如,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位。遍历第一矩阵中的所有像素位对应的标识信息。
步骤S602,当遍历到第一个第一标识信息时,通过宽度优先搜索算 法获取第一个第一标识信息对应的像素位与所有像素位之间的像素位距离。
步骤S603,当遍历到第二个第一标识信息时,通过宽度优先搜索算法获取第二个第一标识信息对应的像素位与所有像素位之间的像素位距离。
该实施例查找第一矩阵中的多个预设对象对应的第一标识信息,当查找到第一个第一标识信息时,获取所有像素位与第一预设对象对应的像素位之间的像素位距离,其中,第一个第一标识信息用于标识多个预设对象中的第一预设对象,当查找到第二个标识信息时,获取所有像素位与第二预设对象对应的像素位之间的像素位距离,其中,第二个第一标识信息用于标识多个预设对象中的第二预设对象,以此类推,直至获取到游戏场景中每一个像素位与多个预设对象之间的距离,确定每一个像素位与距离每一个像素位最近的预设对象对应的像素位之间的像素位距离,进而获取到每一个像素位对应的目标距离。
该实施例通过宽度优先搜索算法获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离的目的,进而将第一像素位距离和第二像素位距离中最小的像素位距离确定为第一目标像素位对应的目标距离,其中,宽度优先搜索算法对不同的游戏场景具有普适性,会避免在大游戏场景时导致栈溢出等问题。考虑到宽度优先搜索必须借用数据结构队列,为了规避实现队列的复杂性,该实施例可以利用两个数组代替队列。可选地,利用数组的遍历过程如下:每次遍历A数组时,将A数组中每个元素的后继节点放入B数组,遍历完A数组后清空A数组,然后再遍历B数组,将B数组中每个元素后继节点放入A数组,遍历完B数组后清空B数组,然后再遍历A数组,如此循环往复,其中,A数组和B数组存储的是遍历的结果。因为是游戏运行的预处理,在预处理完之后可以直接释放数组,因而不需要考虑空间的成本。
可选地,在该实施例中,当遍历到第一目标像素位对应的标识信息时, 在第一矩阵中查找第一标识信息。由于预设对象通过第一标识信息进行标识,因而查找预设对象对应的像素位。当在第一矩阵中查找到第一个第一标识信息时,获取第一目标像素位对应的标识信息与第一个第一标识信息之间的第一距离,并将第一距离作为第一目标像素位与第一预设对象对应的像素位之间的第一像素位距离,其中,第一个第一标识信息用于标识第一预设对象。当在第一矩阵中查找到第二个第一标识信息时,获取第一目标像素位对应的标识信息与第二个第一标识信息之间的第二距离,并将第二距离作为第一目标像素位与第二预设对象对应的像素位之间的第二像素位距离,其中,第二个第一标识信息用于标识第二预设对象。
需要说明的是,上述宽度优先搜索算法仅为本发明实施例的可选实施方式,并不限于本发明实施例获取标识信息对应的像素位与所有像素位之间的像素位距离仅限于上述方式,任何可以实现获取标识信息对应的像素位与所有像素位之间的像素位距离,进而获取到每一个像素位对应的目标距离的方法都在本发明的保护范围之内,此处不再一一举例说明。
该实施例通过当遍历到第一个第一标识信息时,通过宽度优先搜索算法获取第一个第一标识信息对应的像素位与所有像素位之间的像素位距离;当遍历到第二个第一标识信息时,通过宽度优先搜索算法获取第二个第一标识信息对应的像素位与所有像素位之间的像素位距离,实现了获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离的目的。
作为一种可选的实施方式,步骤S208,根据重合区域对第一目标对象进行预设处理包括:对第一目标对象的重合区域进行半透明处理。
在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域,在根据重合区域对第一目标对象进行预设处理时,可以对第一目标对象的重合区域进行半透明处理,也即,以表明第一目标对象在第二目标对象的后面。
作为一种可选的实施方式,在步骤S204,获取第一位置与第二位置 之间的预先存储的目标距离之后,在目标距离不小于第一目标对象在游戏场景中的预设尺寸的情况下,在游戏场景中正常绘制第一目标对象对应的游戏画面,从而确保游戏画面中的第一目标对象正常显示。
下面结合可选的实施例对本发明的技术方案进行说明,以第一目标对象为游戏对象actor,第二目标对象为mask区域进行举例说明。
在游戏场景中,游戏人物和物体之间的前后关系在二维和三维游戏中具有不同的处理方式,三维游戏可以利用深度解决这个问题,而二维游戏没有深度概念,所以只能通过提前标记一些区域,并规定当游戏人物处于这些区域时,对其做些半透效果等特殊化处理,以表明该人物是在物体后面。
图7是根据本发明实施例的一种目标对象的处理方法的流程图。如图7所示,该方法包括以下步骤:
步骤S701,用矩阵形式表示游戏场景中的所有像素位。
在游戏运行之前,先用矩阵表示场景中的所有像素位。
步骤S702,在矩阵中,将游戏场景中的所有mask区域用“1”表示,将非mask区域的矩阵位置都标记为0。
在用矩阵形式表示游戏场景中的所有像素位时,将mask区域的矩阵位置都标记为1,非mask区域的矩阵位置都标记为0。
步骤S703,遍历矩阵,查找矩阵中标识为“1”的位置。
在将游戏场景中的所有mask区域用“1”表示,将非mask区域的矩阵位置都标记为0之后,遍历矩阵,查找矩阵中标识为“1”的位置。
步骤S704,利用宽度优先搜索提前计算出每一个像素和mask区域的像素位距离。
在遍历矩阵,查找到矩阵中标识为“1”的位置时,利用宽度优先搜索提前计算出每一个像素位和mask区域的像素位之间的像素位距离。
步骤S705,找出每个像素位和最近mask区域的像素位之间的像素位距离。
找出每个像素位和最近mask区域的像素位之间的像素位距离,并存储下来。
步骤S706,获取actor进入游戏场景中的目标像素位。
当游戏物actor进入游戏场景中的某个像素位时,直接取出该像素和最近mask区域的像素位距离,时间复杂度为O(1)。
步骤S707,获取目标像素位与距离目标像素位最近的mask区域的像素位之间的目标距离。
在获取actor进入游戏场景中的目标像素位之后,获取目标像素位与距离目标像素位最近的mask区域的像素位之间的目标距离。
步骤S708,判断目标距离是否比actor自身的大小大。
在获取目标像素位与距离目标像素位最近的mask区域的像素位之间的目标距离之后,判断目标距离是否比actor自身的大小大。如果判断目标距离比actor自身的大小大,则执行步骤S709,如果判断出目标距离小于等于actor自身的大小,则执行步骤S710。
步骤S709,正常绘制actor。
如果判断目标距离比actor自身的大小大,正常绘制actor。
步骤S710,半透绘制actor。
如果判断目标距离小于等于actor自身,则说明actor在某些mask区域中,对actor做半透效果等。
该实施例采用宽度优先搜索,是因为其对不同的游戏场景大小具有普适性,其它的譬如深度优先搜索,在大场景时会导致栈溢出等问题。考虑到宽度优先搜索必须借用数据结构队列,为了规避实现队列的复杂性,本 文该实施例直接释放数组,所以不需要考虑空间成本。利用数组的遍历过程如下:每次遍历A数组时,将A数组中每个元素后继节点放入B数组,遍历完A数组后清空A数组,然后再遍历B数组,将B数组中每个元素后继节点放入A数组,遍历完B数组后清空B数组,然后再遍历A数组,如此循环往复。
该实施例在游戏画面的显示过程中,利用宽度优先搜索,提前判断每个像素和mask区域之间距离关系,使得判断actor是否在mask区域的时间复杂度降为O(1),从而快速判断actor是否在mask区域,进而通过判断游戏对象actor是否在mask区域来确定对actor的绘制方式。
本发明实施例的应用环境可以但不限于参照上述实施例中的应用环境,本实施例中对此不再赘述。本发明实施例提供了用于实施上述目标对象的处理方法的一种可选的应用。
在该实施例中,假设游戏场景由3*3共9个像素位组成。用矩阵表示该游戏场景中的所有像素位,可以用“0”表示游戏场景中的非mask区域的像素,用“1”表示游戏场景中的mask区域的像素位。表1为一种对场景实例中的像素位进行标识的标识表。
表1对场景实例中的像素位进行标识的标识表
0 1 0
0 0 0
1 0 0
在表1中,游戏场景中的mask区域只有两个,分别为第一行第二列的像素位(1,2)和第三行第一列的像素位(3,1),其它为游戏场景中的非mask区域。遍历表1中所有的像素位的标识信息,如果像素位的标识信息为1,开始宽度优先搜索所有像素点,计算标识信息为1对应的像素位和其他所有像素位之间的距离。
首先,采用宽度优先搜索像素位(1,2)和其他所有像素位之间的距离。
表2像素位(1,2)和其他所有像素位之间的距离表
Figure PCTCN2018085340-appb-000001
采用宽度优先搜索像素位(1,2)和其他所有像素位之间的距离。如表2所示,设定矩阵中元素与元素之间的距离单位为“1”,则:
像素位(1,1)与像素位(1,2)之间的距离为1;
像素位(1,2)与像素位(1,2)之间的距离为0;
像素位(1,3)与像素位(1,2)之间的距离为1;
像素位(2,1)与像素位(1,2)之间的距离为
Figure PCTCN2018085340-appb-000002
像素位(2,2)与像素位(1,2)之间的距离为1;
像素位(2,3)与像素位(1,2)之间的距离为
Figure PCTCN2018085340-appb-000003
像素位(3,1)与像素位(1,2)之间的距离为
Figure PCTCN2018085340-appb-000004
像素位(3,2)与像素位(1,2)之间的距离为2;
像素位(3,3)与像素位(1,2)之间的距离为
Figure PCTCN2018085340-appb-000005
然后,采用宽度优先搜索像素位(3,1)和其他所有像素位之间的距离。
表3像素位(3,1)和其他所有像素位之间的距离表
Figure PCTCN2018085340-appb-000006
采用宽度优先搜索像素位(3,1)和所有其他像素的像素位距离,如表3所示:
像素位(1,1)与像素位(3,1)之间的距离为2;
像素位(1,2)与像素位(3,1)之间的距离为
Figure PCTCN2018085340-appb-000007
像素位(1,3)与像素位(3,1)之间的距离为
Figure PCTCN2018085340-appb-000008
像素位(2,1)与像素位(3,1)之间的距离为1;
像素位(2,2)与像素位(3,1)之间的距离为
Figure PCTCN2018085340-appb-000009
像素位(2,3)与像素位(3,1)之间的距离为
Figure PCTCN2018085340-appb-000010
像素位(3,1)与像素位(3,1)之间的距离为0;
像素位(3,2)与像素位(3,1)之间的距离为1;
像素位(3,3)与像素位(3,1)之间的距离为2。
然后对每个像素位,查询表2和表3(需要说明的是,在实际算法中,实时比较,每次计算出一个距离dis即和最小的距离minDis进行比较,这里为了展示方便用两个表说明),比较其与像素位(1,2)之间的像素位距离dis1和其与像素位(3,1)之间的像素位距离dis2,得到每个像素位和最近mask区域的像素位之间的最短距离minDis。
表4每个像素位和最近mask区域的像素位之间的最短距离minDis表
Figure PCTCN2018085340-appb-000011
表4为一种每个像素位和最近mask区域的像素位之间的最短距离minDis表,如表4所示:
第一行第一列中的“1”由表2中的像素位(1,1)与像素位(1,2)之间的距离1与表3中的像素位(1,1)与像素位(3,1)之间的距离2中取最小值1得到;
第一行第二列中的“0”由表2中的像素位(1,2)与像素位(1,2)之间的距离0与表3中的像素位(1,2)与像素位(3,1)之间的距离
Figure PCTCN2018085340-appb-000012
中取最小值0得到;
第一行第三列中的“1”由表2中的像素位(1,3)与像素位(1,2)之间的距离1与表3中的像素位(1,3)与像素位(3,1)之间的距离
Figure PCTCN2018085340-appb-000013
中取最小值1得到;
第二行第一列中的“1”由表2中的像素位(2,1)与像素位(1,2)之间的距离
Figure PCTCN2018085340-appb-000014
与表3中的像素位(2,1)与像素位(3,1)之间的距离1中取最小值1得到;
第二行第二列中的“1”由表2中的像素位(2,2)与像素位(1,2)之间的距离1与表3中的像像素位(2,2)与像素位(3,1)之间的距离
Figure PCTCN2018085340-appb-000015
中取最小值1得到;
第二行第三列中的
Figure PCTCN2018085340-appb-000016
由表2中的像素位(2,3)与像素位(1,2)之间的距离
Figure PCTCN2018085340-appb-000017
与表3中的像素位(2,3)与像素位(3,1)之间的距离
Figure PCTCN2018085340-appb-000018
之间的距离
Figure PCTCN2018085340-appb-000019
中取最小值
Figure PCTCN2018085340-appb-000020
得到;
第三行第一列中的“0”由表2中的像像素位(3,1)与像素位(1,2)之间的距离
Figure PCTCN2018085340-appb-000021
与表3中的像素位(3,1)与像素位(3,1)之间的距离0中取最小值0得到;
第三行第二列中的“1”由表2中的像素位(3,2)与像素位(1,2)之间的距离2与表3中的像素位(3,2)与像素位(3,1)之间的距离1中取最小值1得到;
第三行第三列中的“2”由表2中的像素位(3,3)与像素位(1,2)之间的距离
Figure PCTCN2018085340-appb-000022
与表3中的像素位(3,3)与像素位(3,1)之间的距离2中取最小值2得到。
举例而言,actor自身的大小为1.5,如果actor在游戏场景中的位置对应于矩阵中的第一行第一列(1,1),则O(1)查询到actor对应的像素位与距离actor对应的像素位最近的mask区域对应的像素位之间的距离为1,该距离1小于actor大小1.5,所以actor处于mask区域,对actor进行半透处理;再比如,如果actor在游戏场景中的位置对应于矩阵中的第三行第三列(3,3),O(1)查询到actor对应的像素位与距离actor对应的像素位最近的mask区域对应的像素位之间的距离为2,该距离2大于actor自身大小1.5,所以actor不处于mask区域,对actor进行正常绘制即可。
该实施例在游戏画面显示过程中,需要判断actor是否在mask区域来决定actor绘制方式,可以采用宽度优先搜索,提前判断每个像素和mask区域之间距离关系,使得判断actor是否在mask区域的时间复杂度降为O(1),进而达到快速判断actor是否在mask区域的技术效果,从而大大提高了画面的流畅度。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本发明所必须的。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。
根据本发明实施例,还提供了一种用于实施上述目标对象的处理方法的目标对象的处理装置。图8是根据本发明实施例的一种目标对象的处理装置的示意图。如图8所示,该装置可以包括:第一确定单元10、第一获取单元20、第二确定单元30和第一处理单元40。
第一确定单元10,被设置为确定第一目标对象进入游戏场景中的第一位置。
第一获取单元20,被设置为获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象。
第二确定单元30,被设置为在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域。
第一处理单元40,被设置为根据重合区域对第一目标对象进行预设处理。
图9是根据本发明实施例的另一种目标对象的处理装置的示意图。如图9所示,该装置可以包括:第一确定单元10、第一获取单元20、第二确定单元30和第一处理单元40。其中,第一确定单元10包括:第一确定模块11,第一获取单元20包括:第一获取模块21。
需要说明的是,该实施例的第一确定单元10、第一获取单元20、第 二确定单元30和第一处理单元40与图8所示实施例的目标对象的处理装置中的作用相同,此处不再赘述。
第一确定模块11,被设置为确定第一目标对象进入游戏场景中的第一目标像素位,其中,第一位置包括第一目标像素位。
第一获取模块21,被设置为获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离当作目标距离,其中,第二位置包括第二目标像素位。
图10是根据本发明实施例的另一种目标对象的处理装置的示意图。如图10所示,该装置可以包括:第一确定单元10、第一获取单元20、第二确定单元30和第一处理单元40。其中,第一确定单元10包括:第一确定模块11,第一获取单元20包括:第一获取模块21。该装置还包括:第二获取单元50、第三获取单元60、第三确定单元70和存储单元80。
需要说明的是,该实施例的第一确定单元10、第一获取单元20、第二确定单元30、第一处理单元40,第一确定模块11和第一获取模块21与图9所示实施例的目标对象的处理装置中的作用相同,此处不再赘述。
第二获取单元50,被设置为在获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,获取游戏场景中的所有像素位和多个预设对象,其中,所有像素位包括第一目标像素位、多个预设对象对应的像素位,多个预设对象包括第二目标对象。
第三获取单元60,被设置为获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离。
第三确定单元70,被设置为从多个像素位距离中确定每个像素位对应的目标距离,其中,每个像素位对应的目标距离为每个像素位与多个预设对象中距离每个像素位最近的预设对象对应的像素位之间的像素位距离。
存储单元80,被设置为存储每个像素位对应的目标距离。
图11是根据本发明实施例的一种目标对象的处理装置的示意图。如图11所示,该装置可以包括:第一确定单元10、第一获取单元20、第二确定单元30和第一处理单元40。其中,第一确定单元10包括:第一确定模块11,第一获取单元20包括:第一获取模块21。该装置还包括:第二获取单元50、第三获取单元60、第三确定单元70和存储单元80。该装置还包括:第四获取单元90和标识单元100。
需要说明的是,该实施例的第一确定单元10、第一获取单元20、第二确定单元30、第一处理单元40、第一确定模块11、第一获取模块21、第二获取单元50、第三获取单元60、第三确定单元70和存储单元80与图10所示实施例的目标对象的处理装置中的作用相同,此处不再赘述。
第四获取单元90,被设置为在获取游戏场景中的所有像素位和多个预设对象之后,获取用于表示所有像素位的第一矩阵。
标识单元100,被设置为在第一矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
图12是根据本发明实施例的另一种目标对象的处理装置的示意图。如图12所示,该装置可以包括:第一确定单元10、第一获取单元20、第二确定单元30和第一处理单元40。其中,第一确定单元10包括:第一确定模块11,第一获取单元20包括:第一获取模块21。该装置还包括:第二获取单元50、第三获取单元60、第三确定单元70和存储单元80。该装置还包括:第四获取单元90和标识单元100。其中,第三获取单元60包括:遍历模块61、第二获取模块62和第三获取模块63。
需要说明的是,该施例的第一确定单元10、第一获取单元20、第二确定单元30和第一处理单元40,第一确定模块11、第一获取模块21,第二获取单元50、第三获取单元60、第三确定单元70和存储单元80,第四获取单元90和标识单元100与图11所示实施例的目标对象的处理装置中 的作用相同,此处不再赘述。
遍历模块61,被设置为遍历第一矩阵中的所有像素位对应的标识信息。
第二获取模块62,当遍历到第一个第一标识信息时,通过宽度优先搜索算法获取第一个第一标识信息对应的像素位与所有像素位之间的像素位距离。
第三获取模块63,当遍历到第二个第一标识信息时,通过宽度优先搜索算法获取第二个第一标识信息对应的像素位与所有像素位之间的像素位距离。
可选地,对于上述任意一项装置,第一处理单元40包括:半透明处理模块,被设置为对第一目标对象的重合区域进行半透明处理。
可选地,对于上述任意一项装置,该装置还包括:第二处理单元,被设置为在获取第一位置与第二位置之间的预先存储的目标距离之后,在目标距离不小于第一目标对象在游戏场景中的预设尺寸的情况下,在游戏场景中正常绘制第一目标对象对应的游戏画面。
需要说明的是,该实施例中的第一确定单元10可以被设置为执行本申请实施例1中的步骤S202,该实施例中的第一获取单元20可以被设置为执行本申请实施例1中的步骤S204,该实施例中的第二确定单元30可以被设置为执行本申请实施例1中的步骤S206,该实施例中的第一处理单元40可以被设置为执行本申请实施例1中的步骤S208。
通过上述单元和模块,通过第一确定单元10确定第一目标对象进入游戏场景中的第一位置,通过第一获取单元20获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象,通过第二确定单元30在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域,通过第一处理单元40根据重合区域对第一目标对象进行预设处理,由于当第一 目标对象进入游戏场景中的第一位置时,直接获取第一位置与第二位置之间预先存储的目标距离,达到了快速确定第一目标对象是否与第二目标对象重合的目的,可以解决了相关技术中对目标对象的处理过程非常耗时的技术问题,进而达到了对第一目标对象进行快速处理的技术效果。
此处需要说明的是,上述单元和模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例1所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现。其中,硬件环境包括网络环境。
根据本发明实施例,还提供了一种用于实施上述目标对象的处理方法的电子装置。
图13是根据本发明实施例的一种电子装置的结构框图。如图13所示,该电子装置可以包括:一个或多个(图中仅示出一个)处理器131、存储器133、以及传输装置135,如图13所示,该电子装置还可以包括输入输出设备137。
其中,存储器133可用于存储计算机程序以及模块,如本发明实施例中的目标对象的处理方法和装置对应的程序指令/模块,处理器131被设置为通过运行存储在存储器133内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的目标对象的处理方法。存储器133可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器133可进一步包括相对于处理器131远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
上述的传输装置135被设置为经由一个网络接收或者发送数据,还可以被设置为处理器与存储器之间的数据传输。上述的网络可选实例可包括有线网络及无线网络。在一个实例中,传输装置135包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路 由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置135为射频(Radio Frequency,RF)模块,其被设置为通过无线方式与互联网进行通讯。
其中,可选地,存储器133被设置为存储应用程序。
处理器131可以通过传输装置135调用存储器133存储的应用程序,以执行下述步骤:
确定第一目标对象进入游戏场景中的第一位置;
获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;
在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;
根据重合区域对第一目标对象进行预设处理。
处理器131还被设置为执行下述步骤:确定第一目标对象进入游戏场景中的第一目标像素位,其中,第一位置包括第一目标像素位;获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离当作目标距离,其中,第二位置包括第二目标像素位。
处理器131还被设置为执行下述步骤:在获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,获取游戏场景中的所有像素位和多个预设对象,其中,所有像素位包括第一目标像素位、多个预设对象对应的像素位,多个预设对象包括第二目标对象;获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离;从多个像素位距离中确定每个像素位对应的目标距离,其中,每个像素位对应的目标距离为每个像素位与多个预设对象中距离每个像素位最近的预设对象对应的像素位之间的像素位距离;存储每个像素位对应的目标距离。
处理器131还被设置为执行下述步骤:在获取游戏场景中的所有像素位和多个预设对象之后,获取用于表示所有像素位的第一矩阵;在第一矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
处理器131还被设置为执行下述步骤:当遍历到第一个第一标识信息时,通过宽度优先搜索算法获取第一个第一标识信息对应的像素位与所有像素位之间的像素位距离;当遍历到第二个第一标识信息时,通过宽度优先搜索算法获取第二个第一标识信息对应的像素位与所有像素位之间的像素位距离。
处理器131还被设置为执行下述步骤:对第一目标对象的重合区域进行半透明处理。
处理器131还被设置为执行下述步骤:在获取第一位置与第二位置之间的预先存储的目标距离之后,在目标距离不小于第一目标对象在游戏场景中的预设尺寸的情况下,在游戏场景中正常绘制第一目标对象对应的游戏画面。
采用本发明实施例,提供了一种目标对象的处理方法。通过确定第一目标对象进入游戏场景中的第一位置;获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;根据重合区域对第一目标对象进行预设处理的方式。由于当第一目标对象进入游戏场景中的第一位置时,直接获取第一位置与第二位置之间预先存储的目标距离,达到了快速确定第一目标对象是否与第二目标对象重合的目的,可以解决了相关技术中对目标对象的处理过程非常耗时的技术问题,进而达到了对第一目标对象进行快速处理的技术效果。
可选地,本实施例中的可选示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。
本领域普通技术人员可以理解,图13所示的结构仅为示意,电子装置可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图13其并不对上述电子装置的结构造成限定。例如,电子装置还可包括比图13中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图13所示不同的配置。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行目标对象的处理方法。
可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:
确定第一目标对象进入游戏场景中的第一位置;
获取第一位置与第二位置之间的预先存储的目标距离,其中,第二位置为第二目标对象在游戏场景中所处的位置,第二目标对象为游戏场景中距离第一目标对象最近的对象;
在目标距离小于第一目标对象在游戏场景中的预设尺寸的情况下,确定第一目标对象与第二目标对象具有重合区域;
根据重合区域对第一目标对象进行预设处理。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:确定第一目标对象进入游戏场景中的第一目标像素位,其中,第一位置包括第一目标像素位;获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的像素位距离当作目标距离,其中,第二位置包括第二目标像素位。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:在获取第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,获取游戏场景中的所有像素位和多个预设对象,其中,所有像素位包括第一目标像素位、多个预设对象对应的像素位,多个预设对象包括第二目标对象;获取每个像素位分别与多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离;从多个像素位距离中确定每个像素位对应的目标距离,其中,每个像素位对应的目标距离为每个像素位与多个预设对象中距离每个像素位最近的预设对象对应的像素位之间的像素位距离;存储每个像素位对应的目标距离。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:在获取游戏场景中的所有像素位和多个预设对象之后,获取用于表示所有像素位的第一矩阵;在第一矩阵上,通过第一标识信息标识多个预设对象对应的像素位,且通过第二标识信息标识所有像素位中除多个预设对象对应的像素位之外的第三目标像素位,第三目标像素位包括第一目标像素位。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:当遍历到第一个第一标识信息时,通过宽度优先搜索算法获取第一个第一标识信息对应的像素位与所有像素位之间的像素位距离;当遍历到第二个第一标识信息时,通过宽度优先搜索算法获取第二个第一标识信息对应的像素位与所有像素位之间的像素位距离。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:对第一目标对象的重合区域进行半透明处理。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:在获取第一位置与第二位置之间的预先存储的目标距离之后,在目标距离不小于第一目标对象在游戏场景中的预设尺寸的情况下,在游戏场景中正常绘制第一目标对象对应的游戏画面。
可选地,本实施例中的可选示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本发明的技术方案本质上或者说对相关技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或 通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个第一处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上所述仅是本发明的可选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。
工业实用性:
通过上述描述可知,本发明由于当第一目标对象进入游戏场景中的第一位置时,直接获取第一位置与第二位置之间预先存储的目标距离,达到了快速确定第一目标对象是否与第二目标对象重合的目的,可以解决了相关技术中对目标对象的处理过程非常耗时的技术问题,进而达到了对第一目标对象进行快速处理的技术效果。

Claims (16)

  1. 一种目标对象的处理方法,包括:
    确定第一目标对象进入游戏场景中的第一位置;
    获取所述第一位置与第二位置之间的预先存储的目标距离,其中,所述第二位置为第二目标对象在所述游戏场景中所处的位置,所述第二目标对象为所述游戏场景中距离所述第一目标对象最近的对象;
    在所述目标距离小于所述第一目标对象在所述游戏场景中的预设尺寸的情况下,确定所述第一目标对象与所述第二目标对象具有重合区域;
    根据所述重合区域对所述第一目标对象进行预设处理。
  2. 根据权利要求1所述的方法,其中,
    确定所述第一目标对象进入所述游戏场景中的第一位置包括:确定所述第一目标对象进入所述游戏场景中的第一目标像素位,其中,所述第一位置包括所述第一目标像素位;
    获取所述第一位置与所述第二位置之间的预先存储的所述目标距离包括:获取所述第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的所述像素位距离作为所述目标距离,其中,所述第二位置包括所述第二目标像素位。
  3. 根据权利要求2所述的方法,其中,在获取所述第一目标像素位与第二目标像素位之间的预先存储的像素位距离之前,所述方法还包括:
    获取所述游戏场景中的所有像素位和多个预设对象,其中,所述所有像素位包括所述第一目标像素位、所述多个预设对象对应的像素位,所述多个预设对象包括所述第二目标对象;
    获取每个像素位分别与所述多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离;
    从所述多个像素位距离中确定所述每个像素位对应的目标距离, 其中,所述每个像素位对应的目标距离为所述每个像素位与所述多个预设对象中距离所述每个像素位最近的预设对象对应的像素位之间的像素位距离;
    存储所述每个像素位对应的目标距离。
  4. 根据权利要求3所述的方法,其中,在获取所述游戏场景中的所有像素位和所述多个预设对象之后,所述方法还包括:
    获取用于表示所述所有像素位的第一矩阵;
    在所述第一矩阵上,通过第一标识信息标识所述多个预设对象对应的像素位,且通过第二标识信息标识所述所有像素位中除所述多个预设对象对应的像素位之外的第三目标像素位,所述第三目标像素位包括所述第一目标像素位。
  5. 根据权利要求4中所述的方法,其中,获取所述每个像素位分别与所述多个预设对象对应的像素位之间的像素位距离,得到所述多个像素位距离包括:
    遍历所述第一矩阵中的所述所有像素位对应的标识信息;
    当遍历到第一个所述第一标识信息时,通过宽度优先搜索算法获取第一个所述第一标识信息对应的像素位与所述所有像素位之间的像素位距离;
    当遍历到第二个所述第一标识信息时,通过宽度优先搜索算法获取第二个所述第一标识信息对应的像素位与所述所有像素位之间的像素位距离。
  6. 根据权利要求1至5中任意一项所述的方法,其中,根据所述重合区域对所述第一目标对象进行预设处理包括:
    对所述第一目标对象的重合区域进行半透明处理。
  7. 根据权利要求1至5中任意一项所述的方法,其中,在获取所述第一位置与第二位置之间的预先存储的目标距离之后,所述方法还包括:
    在所述目标距离不小于所述第一目标对象在所述游戏场景中的预设尺寸的情况下,在所述游戏场景中正常绘制所述第一目标对象对应的游戏画面。
  8. 一种目标对象的处理装置,包括一个或多个处理器,以及一个或多个存储程序单元的存储器,其中,所述程序单元由所述处理器执行,所述程序单元包括:
    第一确定单元,被设置为确定第一目标对象进入游戏场景中的第一位置;
    第一获取单元,被设置为获取所述第一位置与第二位置之间的预先存储的目标距离,其中,所述第二位置为第二目标对象在所述游戏场景中所处的位置,所述第二目标对象为所述游戏场景中距离所述第一目标对象最近的对象;
    第二确定单元,被设置为在所述目标距离小于所述第一目标对象在所述游戏场景中的预设尺寸的情况下,确定所述第一目标对象与所述第二目标对象具有重合区域;
    第一处理单元,被设置为根据所述重合区域对所述第一目标对象进行预设处理。
  9. 根据权利要求8所述的装置,其中,
    所述第一确定单元包括:第一确定模块,被设置为确定所述第一目标对象进入所述游戏场景中的第一目标像素位,其中,所述第一位置包括所述第一目标像素位;
    所述第一获取单元包括:第一获取模块,被设置为获取所述第一目标像素位与第二目标像素位之间的预先存储的像素位距离,并将获取的所述像素位距离作为所述目标距离,其中,所述第二位置包括所述第二目标像素位。
  10. 根据权利要求9所述的装置,其中,所述装置还包括:
    第二获取单元,被设置为在获取所述第一目标像素位与第二目标 像素位之间的预先存储的像素位距离之前,获取所述游戏场景中的所有像素位和多个预设对象,其中,所述所有像素位包括所述第一目标像素位、所述多个预设对象对应的像素位,所述多个预设对象包括所述第二目标对象;
    第三获取单元,被设置为获取每个像素位分别与所述多个预设对象对应的像素位之间的像素位距离,得到多个像素位距离;
    第三确定单元,被设置为从所述多个像素位距离中确定所述每个像素位对应的目标距离,其中,所述每个像素位对应的目标距离为所述每个像素位与所述多个预设对象中距离所述每个像素位最近的预设对象对应的像素位之间的像素位距离;
    存储单元,被设置为存储所述每个像素位对应的目标距离。
  11. 根据权利要求10所述的装置,其中,所述装置还包括:
    第四获取单元,被设置为在获取所述游戏场景中的所有像素位和所述多个预设对象之后,获取用于表示所述所有像素位的第一矩阵;
    标识单元,被设置为在所述第一矩阵上,通过第一标识信息标识所述多个预设对象对应的像素位,且通过第二标识信息标识所述所有像素位中除所述多个预设对象对应的像素位之外的第三目标像素位,所述第三目标像素位包括所述第一目标像素位。
  12. 根据权利要求11中所述的装置,其中,所述第三获取单元包括:
    遍历模块,被设置为遍历所述第一矩阵中的所述所有像素位对应的标识信息;
    第二获取模块,被设置为当遍历到第一个所述第一标识信息时,通过宽度优先搜索算法获取第一个所述第一标识信息对应的像素位与所述所有像素位之间的像素位距离;
    第三获取模块,被设置为通过宽度优先搜索算法获取第二个所述第一标识信息对应的像素位与所述所有像素位之间的像素位距离。
  13. 根据权利要求8至12中任意一项所述的装置,其中,所述第一处理单元包括:
    半透明处理模块,被设置为对所述第一目标对象的重合区域进行半透明处理。
  14. 根据权利要求8至12中任意一项所述的装置,其中,所述装置还包括:
    第二处理单元,被设置为在获取所述第一位置与第二位置之间的预先存储的目标距离之后,在所述目标距离不小于所述第一目标对象在所述游戏场景中的预设尺寸的情况下,在所述游戏场景中正常绘制所述第一目标对象对应的游戏画面。
  15. 一种存储介质,其中,所述存储介质中存储有计算机程序,所述计算机程序被设置为运行时执行所述权利要求1至7任一项中所述的方法。
  16. 一种电子装置,包括存储器和处理器,其中,所述存储器中存储有计算机程序,所述处理器被设置为通过所述计算机程序执行所述权利要求1至7任一项中所述的方法。
PCT/CN2018/085340 2017-05-11 2018-05-02 目标对象的处理方法、装置、存储介质及电子装置 WO2018205872A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710332072.X 2017-05-11
CN201710332072.XA CN107233733B (zh) 2017-05-11 2017-05-11 目标对象的处理方法和装置

Publications (1)

Publication Number Publication Date
WO2018205872A1 true WO2018205872A1 (zh) 2018-11-15

Family

ID=59985517

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/085340 WO2018205872A1 (zh) 2017-05-11 2018-05-02 目标对象的处理方法、装置、存储介质及电子装置

Country Status (2)

Country Link
CN (1) CN107233733B (zh)
WO (1) WO2018205872A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107233733B (zh) * 2017-05-11 2018-07-06 腾讯科技(深圳)有限公司 目标对象的处理方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060258450A1 (en) * 2000-12-14 2006-11-16 Sega Corporation Game device, communication game system, and recorded medium
TW200942303A (en) * 2008-04-03 2009-10-16 Hon Hai Prec Ind Co Ltd System and method for checking collision of objects
CN105190487A (zh) * 2014-03-21 2015-12-23 三星电子株式会社 用于防止主体间冲突的方法和设备
CN106582024A (zh) * 2016-10-14 2017-04-26 网易(杭州)网络有限公司 对象发生撞击的处理方法及装置
CN107233733A (zh) * 2017-05-11 2017-10-10 腾讯科技(深圳)有限公司 目标对象的处理方法和装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102770864B (zh) * 2010-01-29 2014-05-28 香港科技大学 基于图像的建筑物图案检测以及建模
CN102662292B (zh) * 2012-04-20 2016-03-02 Tcl集团股份有限公司 一种3d场景成像方法、装置及显示终端
KR101459565B1 (ko) * 2013-04-10 2014-11-10 (주)위메이드엔터테인먼트 모바일 게임에서의 스킬 동작 수행방법 및 그 단말장치.
KR101494150B1 (ko) * 2014-01-09 2015-02-23 (주)스마일게이트엔터테인먼트 온라인 게임의 게임 승패 결정 방법 및 시스템
KR101514178B1 (ko) * 2014-01-09 2015-04-22 (주)스마일게이트엔터테인먼트 온라인 게임의 캐릭터 위치 제어 장치 및 방법
CN105243268B (zh) * 2015-09-18 2018-06-22 网易(杭州)网络有限公司 一种游戏地图定位方法、装置及用户终端
CN105488851B (zh) * 2015-11-30 2017-07-07 腾讯科技(深圳)有限公司 实时虚拟场景中碰撞体之间碰撞探测的方法和装置
CN106201266B (zh) * 2016-07-06 2019-05-28 广东小天才科技有限公司 一种虚拟角色移动的控制方法及装置、电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060258450A1 (en) * 2000-12-14 2006-11-16 Sega Corporation Game device, communication game system, and recorded medium
TW200942303A (en) * 2008-04-03 2009-10-16 Hon Hai Prec Ind Co Ltd System and method for checking collision of objects
CN105190487A (zh) * 2014-03-21 2015-12-23 三星电子株式会社 用于防止主体间冲突的方法和设备
CN106582024A (zh) * 2016-10-14 2017-04-26 网易(杭州)网络有限公司 对象发生撞击的处理方法及装置
CN107233733A (zh) * 2017-05-11 2017-10-10 腾讯科技(深圳)有限公司 目标对象的处理方法和装置

Also Published As

Publication number Publication date
CN107233733B (zh) 2018-07-06
CN107233733A (zh) 2017-10-10

Similar Documents

Publication Publication Date Title
US20210042954A1 (en) Binocular matching method and apparatus, device and storage medium
KR102459853B1 (ko) 디스패리티 추정 장치 및 방법
WO2018149292A1 (zh) 一种对象聚类方法和装置
CN107729935B (zh) 相似图片的识别方法和装置、服务器、存储介质
CN110189256B (zh) 一种全景图像拼接方法、计算机可读存储介质及全景相机
US10873900B2 (en) Method for wireless fidelity connection and related products
WO2019042419A1 (zh) 图像跟踪点获取方法、设备及存储介质
US20180225542A1 (en) Image information recognition processing method and device, and computer storage medium
US20160182816A1 (en) Preventing photographs of unintended subjects
WO2020020047A1 (zh) 关键点匹配方法、装置、终端设备以及存储介质
CN110648363A (zh) 相机姿态确定方法、装置、存储介质及电子设备
CN111291768A (zh) 图像特征匹配方法及装置、设备、存储介质
WO2020191731A1 (zh) 点云生成方法、系统和计算机存储介质
WO2018149138A1 (zh) 无线保真Wi-Fi连接方法及相关产品
CN115439543B (zh) 孔洞位置的确定方法和元宇宙中三维模型的生成方法
CN110853068A (zh) 图片处理方法、装置、电子设备及可读存储介质
US20140341475A1 (en) Image matching
US20150154736A1 (en) Linking Together Scene Scans
CN109919190B (zh) 直线段匹配方法、装置、存储介质及终端
WO2018205872A1 (zh) 目标对象的处理方法、装置、存储介质及电子装置
CN111428740A (zh) 网络翻拍照片的检测方法、装置、计算机设备及存储介质
CN111210506A (zh) 一种三维还原方法、系统、终端设备和存储介质
US8885952B1 (en) Method and system for presenting similar photos based on homographies
WO2021190331A1 (zh) 确定相机布局位置的方法、装置、终端设备及存储介质
CN111652163B (zh) 一种输电线路杆塔线段匹配方法以及设备

Legal Events

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

Ref document number: 18798243

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18798243

Country of ref document: EP

Kind code of ref document: A1