WO2019128381A1 - 三维游戏场景中虚拟资源的生成方法及装置 - Google Patents

三维游戏场景中虚拟资源的生成方法及装置 Download PDF

Info

Publication number
WO2019128381A1
WO2019128381A1 PCT/CN2018/109863 CN2018109863W WO2019128381A1 WO 2019128381 A1 WO2019128381 A1 WO 2019128381A1 CN 2018109863 W CN2018109863 W CN 2018109863W WO 2019128381 A1 WO2019128381 A1 WO 2019128381A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual object
resource
grid
cuboid
plane
Prior art date
Application number
PCT/CN2018/109863
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 网易(杭州)网络有限公司
Priority to JP2019562457A priority Critical patent/JP6783957B2/ja
Priority to US16/638,143 priority patent/US11090562B2/en
Publication of WO2019128381A1 publication Critical patent/WO2019128381A1/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/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • 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/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
    • A63F13/63Generating 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 by the player, e.g. authoring using a level editor
    • 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
    • A63F13/69Generating 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 by enabling or updating specific game elements, e.g. unlocking hidden features, items, levels or versions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images

Definitions

  • the present disclosure relates to the field of game technologies, and in particular, to a method and an apparatus for generating virtual resources in a three-dimensional game scene.
  • At least some embodiments of the present disclosure provide a method and apparatus for generating virtual resources in a three-dimensional game scene to at least partially solve the technical problem of low efficiency of generating virtual resources in a 3D game in the related art.
  • a method for generating a virtual resource in a three-dimensional game scenario where the three-dimensional game scenario includes at least one virtual object and a virtual resource, where the virtual resource includes an existing resource and a new resource.
  • the space of the three-dimensional game scene is divided into a plurality of cuboid grids, and the new resource is a part of the virtual resources generated by the construction instruction in response to the user input, and the method includes:
  • the vertical plane of the cuboid grid is constructed, constructed along the horizontal plane of each cuboid grid and along the inner slope of each cuboid grid;
  • the new resource is generated by rendering on the target mesh surface.
  • a virtual resource generating apparatus in a three-dimensional game scene, the three-dimensional game scene including at least one virtual object and a virtual resource, the virtual resource including an existing resource and a new one.
  • the resource, the space of the three-dimensional game scene is divided into a plurality of cuboid grids, and the new resource is a part of the virtual resources generated by the construction instruction in response to the user input, and the device includes:
  • An acquiring unit configured to acquire a current location and orientation of the virtual object in response to the building instruction, where the construction instruction includes spatial type information of the newly created resource, and the spatial type of the newly created resource includes at least the following One: construction along the vertical plane of the cuboid grid, construction along the horizontal plane of the cuboid grid and construction along the inner slope of the cuboid grid;
  • a determining unit configured to determine, in the plurality of cuboid grids, a target mesh surface as a construction location of the new resource according to the space type information, a current position and an orientation of the virtual object;
  • a rendering unit configured to render the new resource on the target mesh surface.
  • an electronic device comprising: a processor; and a memory configured to store executable instructions of the processor; wherein the processor is configured to perform the above by executing executable instructions method.
  • a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the above method.
  • the construction instruction in response to the construction instruction, acquiring a current location and orientation of the virtual object, includes spatial type information of the newly created resource, and the spatial type of the newly created resource includes At least one of: constructing along a vertical plane of each cuboid grid, constructing along a horizontal plane of each cuboid grid, and constructing an inner slope along each cuboid grid; according to the space type information, the virtual object is currently Position and orientation, determining a target mesh surface as the construction location of the new resource in the plurality of cuboid meshes; and generating the new resource on the target mesh surface to solve the virtual resource in the 3D game
  • the technical problem of low generation efficiency includes
  • FIG. 1 is a flowchart of a method for generating a virtual resource in a three-dimensional game scene according to an embodiment of the present disclosure.
  • FIG. 2 is a perspective schematic view of a rectangular parallelepiped grid in accordance with an exemplary embodiment of the present disclosure.
  • FIG. 3 is a schematic diagram of determining vertical candidate mesh face positions on a horizontal reference plane in accordance with an exemplary embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of determining a position of a vertical target mesh face in a vertical direction in accordance with an exemplary embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of determining a plane of a horizontal target mesh surface according to an orientation of a virtual object, according to an exemplary embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of determining a horizontal target mesh face position on a horizontal reference surface in accordance with an exemplary embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of determining a target mesh face position of an inner slope type on a horizontal reference plane, according to an exemplary embodiment of the present disclosure.
  • FIG. 8 is a composition diagram of one generation device of a virtual resource according to an exemplary embodiment of the present disclosure.
  • FIG. 9 is a block diagram of an electronic device in accordance with an exemplary embodiment of the present disclosure.
  • FIG. 10 is a schematic diagram of a computer readable storage medium in accordance with an exemplary embodiment of the present disclosure.
  • an embodiment of a method for generating a virtual resource in a three-dimensional game scene is provided. It should be noted that the steps shown in the flowchart of the drawing may be in a set of computer executable instructions. The execution is performed in a computer system, and although the logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
  • FIG. 1 is a flowchart of a method for generating a virtual resource in a three-dimensional game scene, where the game scene includes at least one virtual object and a virtual resource, where the virtual resource includes an existing resource and a newly created resource, according to an embodiment of the present disclosure.
  • the space of the three-dimensional game scene is divided into a plurality of cuboid grids, and the new resource is a virtual resource generated by the construction instruction in response to a user input, and the method may include the following steps:
  • Step S110 Acquire, according to the construction instruction, a current location and orientation of the virtual object, where the construction instruction includes spatial type information of the newly created resource, and the spatial type of the newly created resource includes at least one of the following: Constructed along the vertical plane of each cuboid grid, along the horizontal plane of each cuboid grid and along the inner slope of each cuboid grid;
  • Step S120 Determine, according to the space type information, the current position and orientation of the virtual object, a target mesh surface in the plurality of cuboid grids as a construction location of the newly created resource;
  • Step S130 generating the new resource on the target mesh surface.
  • the method for generating virtual resources in the three-dimensional game scene in this embodiment on the one hand, since the construction location of the newly created resource is located in the rectangular parallelepiped grid dividing the game scene space, the calculation amount in the process of generating the new resource is greatly reduced, and the player is solved. In the game, the efficiency of self-built virtual resources is solved.
  • the virtual resource's construction position can be determined quickly and conveniently according to the position and orientation of the virtual object, which greatly reduces the player's position. The operational burden.
  • the plurality of cuboid meshes are only for facilitating determination of the construction location of the virtual resources, and dividing the game scene space into a plurality of cuboid subspaces of the same size, that is, the grid is only a dividing boundary of the game scene space, and is not an entity in the game.
  • the rectangular parallelepiped mesh may be a cube (the same length, width and height), or a rectangular parallelepiped whose length, width and height are not identical. The following embodiments are described by taking a rectangular parallelepiped mesh with the same length and width and different height and length. For example, the rectangular parallelepiped mesh has a length and a width of 5 meters and a height of 3.5 meters.
  • Step S110 Acquire, according to the construction instruction, a current location and orientation of the virtual object, where the construction instruction includes spatial type information of the newly created resource, and the spatial type of the newly created resource includes at least one of the following: Constructed along the vertical plane of each cuboid grid, along the horizontal plane of each cuboid grid and along the inner slope of each cuboid grid.
  • the construction of the newly created resource is triggered by the player's construction instruction, and the construction instruction includes at least the space type of the virtual resource (ie, the newly created resource) that the player intends to build, and may also include the material of the newly created resource. Attributes (such as wood, concrete, bricks, etc.) and quantities.
  • the spatial type of the newly created resource that is, the geometric position of the newly created resource relative to the rectangular parallelepiped mesh, may be built along the vertical plane of the rectangular parallelepiped mesh, constructed along the horizontal plane of the rectangular parallelepiped mesh, and constructed along the inner slope surface of the rectangular parallelepiped mesh surface. .
  • the vertical plane that is, the four planes in the cuboid grid perpendicular to the plane of the game scene
  • the water plane is two planes parallel to the plane of the game scene in the cuboid grid
  • the inner slope surface is within the rectangular grid Diagonal section (the plane of the diagonal section passes through two sides of the horizontal plane of the cuboid and intersects the two perpendicular faces of the cuboid grid).
  • the new resource built along the vertical plane of the rectangular parallelepiped grid is a vertical wall
  • the new resource built horizontally along the rectangular parallelepiped grid is a horizontal wall
  • the inner slope surface along the construction position is a rectangular parallelepiped grid.
  • the new resources built are up or down slopes.
  • 2 is a schematic view of the rectangular parallelepiped mesh, the mesh faces 202, 203, 204, and 206 are vertical mesh faces, the mesh faces 201 and 205 are horizontal mesh faces, and the mesh face 207 is one of the inner slope faces. .
  • Step S120 Determine, according to the spatial type information, the current position and orientation of the virtual object, a target mesh surface as the construction location of the newly created resource in the plurality of cuboid meshes.
  • the spatial type of the newly created resource is used to determine the geometric position of the newly created resource relative to the cuboid mesh, rather than determining the absolute position of the newly created resource in the game scene. Determining the construction location of the newly created resource requires determining the specific location of the cuboid mesh face where the new resource is located. In order to obtain the construction location of the newly created resource, it is also necessary to obtain the current position and orientation of the virtual object in the game scene, so as to be in the plurality of rectangular parallelepiped grids according to the spatial type information, the current position and orientation of the virtual object.
  • the target mesh surface (that is, the specific face of the specific rectangular mesh in which the new resource is located) is determined as the construction location of the new resource.
  • the orientation of the virtual object controlled by the player is generally the same as the orientation of the virtual camera in the game.
  • the target mesh surface is selected according to the spatial type of the newly created resource from the rectangular mesh surface near the virtual object and within the field of view thereof. The specific method of determination will be detailed in the examples below.
  • Step S130 generating the new resource on the target mesh surface.
  • the new resource is generated and generated at the position, thereby completing the construction of the new resource according to the player's construction instruction.
  • the spatial types of the existing resources include construction along a vertical plane of the cuboid grid, construction along a horizontal plane of the cuboid grid, and construction along an inner slope of the cuboid grid.
  • the existing virtual resource ie, the existing resource
  • the existing resource has the same spatial type as the newly created type, and is also generated along the vertical, horizontal, or inner slope of the rectangular grid. Since the newly created resource has the same space type as the existing resource, it is easier to match the existing resource when generating the new resource, which also greatly reduces the calculation amount and improves the running efficiency of the game.
  • the target mesh face is at least one cuboid mesh face.
  • the construction instruction can also protect the number of new resources.
  • the rectangular mesh surface on which the new resource is built may be multiple. For example, if the player intends to build a vertical wall with a height of 5 meters (relative to the ground plane of the game scene) and a length of 15 meters, it is necessary to produce a new resource on the vertical surface of three consecutive rectangular grids, that is, the target mesh surface is three.
  • the generating, by the target mesh surface, the generating the new resource comprising: generating preview information of the newly created resource on the target mesh surface; and determining, according to the confirmation command sent by the player
  • the new resource is generated by rendering on the target mesh surface.
  • the preview information of the newly created resource is first rendered on the target mesh surface, and the new resource is built after receiving the confirmation information sent by the player.
  • the game system controls the virtual resource according to the player. The current position and orientation of the character automatically determines the construction location of the new resource, which reduces the operational burden of the player.
  • it can also provide the player with the opportunity to modify the construction location of the newly created resource, that is, when the player finds that the newly built resource is automatically determined by the system. Construction may be abandoned when the desired construction location is made, and construction instructions are issued to select other construction locations.
  • Determining the target mesh surface in the plurality of cuboid grids as the construction location of the new resource includes the following steps:
  • Step S210 Calculate, according to the current location of the virtual object, a current location of the virtual object and a first location of the virtual object in the current grid;
  • Step S220 determining, according to the current grid and the first position, a second position of the candidate mesh face of the construction position in a horizontal reference plane, wherein the horizontal reference plane is parallel to the game scenario.
  • Step S230 determining, according to the projection of the orientation of the virtual object in the horizontal reference plane, the third position of the target mesh plane in the horizontal reference plane from the second position;
  • Step S240 determining a fourth position of the target mesh surface in a vertical direction according to a current position and orientation of the virtual object and the third position, wherein the vertical direction is perpendicular to the three-dimensional game scene. horizon;
  • Step S250 obtaining the construction position according to the third position and the fourth position.
  • a three-dimensional coordinate system XYZ can be established in the game scene, and the plane XZ plane formed by the X-axis and the Z-axis is parallel to the ground plane of the game scene (ie, the above-mentioned horizontal reference plane, coordinate X and coordinate Z are determined together)
  • the Z axis is perpendicular to the ground plane of the game scene (the position in the above vertical direction, that is, the coordinate on the Z axis).
  • the current position of the virtual object in the game scene described in step S210 can be determined by its coordinates in the coordinate system, and each cuboid grid also has corresponding coordinates in the game scene to determine the position.
  • the relative position of the virtual object in the grid in step S210 refers to the spatial position of the virtual object with the grid in which the virtual object is located.
  • determining, according to the current mesh and the relative position, determining a second candidate mesh surface of the construction location in a horizontal reference plane according to step S220 Position including: in the top view (ie, in the horizontal reference plane), the grid in which the virtual object is currently located (ie, the large square in the middle, and the eight large squares around represent the grid adjacent to the grid in which the virtual object is currently located) It is divided into nine small squares.
  • the four vertical planes corresponding to the four sides of the middle large square are used as the candidate mesh surface of the new resource construction position; when the virtual object is located in the small square 2, 4, 6, and 8 are four small squares near the midpoint of the four sides of the middle large square, and the middle large square and the six grids adjacent to the small square where the virtual object is currently located are not shared.
  • the vertical plane (the six sides of the two large squares that are seen as a "day” in the top view) is the candidate mesh surface for the new resource construction location; when the virtual object is located in the small square 1, 3, 5, 7
  • the eight sides of the four large squares arranged in a "Tian" shape are used as candidate mesh faces for new resource construction locations.
  • the grid represented by the six square sides of the middle large square and the large square 302 is used as the candidate grid; when the virtual object is represented by the small square 1 In the grid, the grid represented by the eight square sides of the middle large square and the large squares 301, 302, 308 is used as the candidate grid.
  • the mesh surface within a suitable distance range near the virtual object can be determined as the candidate mesh surface of the newly created resource, and the appropriate distance is greater than 1/3 of the square side of the mesh surface, which is smaller than the mesh side length of the mesh surface. 4/3.
  • the above appropriate distance can also be adjusted according to factors such as the relative size of the virtual character and the grid.
  • the method for determining the relative position of the virtual object in the grid is not limited to the above-mentioned nine-square grid judgment method, and other methods, for example, determining whether the distance between the virtual object and the four faces of the current grid is within a predetermined threshold range .
  • the projection according to the orientation of the virtual object in the horizontal reference plane according to step S230 determines a third position of the target mesh plane in the horizontal reference plane from the second position.
  • the method includes: acquiring a projection of a ray whose direction is a direction of the virtual object starting from a position of the virtual object in a horizontal reference plane, and a candidate mesh surface intersecting the projection in a horizontal reference plane, that is, a target mesh surface a position in the horizontal reference plane of the target mesh surface, that is, a third position, that is, a third position is determined from the plurality of the second positions obtained in step S220, thereby obtaining the target mesh surface in the horizontal reference plane position.
  • the connecting line dividing the 360-degree area around the virtual object into the number of candidate mesh faces.
  • the line of sight of the virtual object (the position where the virtual object is located as the starting point, the direction of the virtual object is the direction of the ray) is located in the above-mentioned sub-angle area, and then the sub-angle area where the line of sight is located corresponds
  • the candidate mesh face is used as the target mesh face.
  • step S240 The current position and orientation of the virtual object and the third position determine a fourth position of the target mesh surface in the vertical direction, including: the candidate position of the target mesh surface in the vertical direction includes three high, medium, and low positions. (ie, the mesh faces 406, 405, 404 in FIG.
  • the position of the median candidate mesh face 405 in the vertical direction is the same as the mesh in which the virtual object 401 is located (ie, the Z coordinate is the same), and the candidate in the high position
  • the position of the mesh surface 406 in the vertical direction is higher than the mesh in which the virtual object 401 is located, the position of the candidate mesh surface 404 located in the lower position in the vertical direction is lower than the mesh in which the virtual object 401 is located; the line of sight 402 and the candidate of the virtual object are acquired.
  • An intersection point 407 of a plane of the mesh plane calculating a distance between a midpoint of the candidate mesh plane at the three candidate positions of the high, medium, and low positions and the intersection point 407; and a candidate mesh surface having the shortest distance between the midpoint and the intersection 407 Target mesh surface. From the block of Fig. 4, the midpoint of the mesh face 406 is closest to the intersection 407, and the mesh face 406 is determined as the target mesh face.
  • the absolute value of the pitch angle of the virtual object is limited to 80 degrees, but it can also be set to other angles as needed.
  • the selected target mesh surface in order to prevent the selected target mesh surface from being able to construct a new resource (for example, not connected to the game scene or connected to other virtual resources), it may be determined whether the selected target mesh surface can be Construction of new resources; if new resources cannot be built, continue to select one of the other two mesh faces of the three candidate mesh faces in the vertical direction adjacent to the previously determined target mesh face to determine whether or not to build a new one. Resources; if the second target mesh face can build a new resource, it is determined to be the final target mesh face; if the second target mesh face cannot build a new resource, the player is prompted to build a new resource at the current location.
  • step S250 according to the third position of the target mesh surface acquired in step S230 in the horizontal reference plane and the fourth position of the target mesh surface acquired in step S240 in the vertical direction,
  • the construction position is determined in three-dimensional coordinates of the three-dimensional game scene.
  • Determining the target mesh surface as the construction location in the plurality of cuboid grids includes the following steps:
  • Step S310 calculating, according to the current location of the virtual object, a grid in which the virtual object is currently located;
  • Step S320 determining a first position of the target mesh surface in a vertical direction according to the orientation of the virtual object and the current grid, wherein the vertical direction is perpendicular to a ground plane of the three-dimensional game scene.
  • Step S330 determining a second position of the target mesh surface in a horizontal reference plane according to a current position and orientation of the virtual object, the current grid, and the first location, wherein the horizontal reference a plane parallel to a ground plane of the game scene;
  • Step S340 obtaining the construction position according to the first position and the second position.
  • the target mesh surface is also the current mesh and the adjacent mesh in the virtual object.
  • a horizontal plane so it is also necessary to first calculate the current grid of the virtual object according to the current location of the virtual object.
  • the first position of the target mesh surface in the vertical direction is determined, that is, the plane where the target mesh surface where the new resource is located is determined, and the plane where the target mesh surface is located will be from the mesh where the virtual object is located.
  • the selection method may be: determining the pitch angle of the virtual object's line of sight. If the pitch angle is greater than zero (ie, the virtual object is looking up), the vertical position is selected as The plane on which the upper horizontal plane is located (such as plane 503 in Fig. 4); if the elevation angle is less than zero (that is, the virtual object is viewed from above), the plane in which the horizontal plane is located below the vertical plane (such as plane 504 in Fig. 4) is selected. As shown in FIG. 5, if the pitch angle of the line of sight 502 of the virtual object 501 is greater than zero, it is determined that the horizontal plane 503 in the grid in which the virtual object is located is the plane in which the target mesh plane is located.
  • the pitch angle between 0 and 5 degrees may be set to 5 degrees, and the pitch between -5 degrees and 0 degrees.
  • the angle is set to -5 degrees.
  • step S330 the position of the target mesh surface in the horizontal reference plane is the same as the position of the target mesh surface in the plane in which it is located, because the planes of the horizontal reference plane and the target mesh plane are parallel to the ground plane of the game scene.
  • the plane (the coordinates X and the coordinates Z of the two are the same).
  • determining the position of the target mesh surface in the horizontal reference plane may be: calculating a line of sight 602 of the virtual object 601 and a plane of the target mesh surface.
  • intersection point 603 An intersection point 603; calculating a distance between the intersection point 603 and the grid of the virtual object 601 and the midpoint of the grid surface of the adjacent grid in the plane of the target grid plane; and selecting the grid surface with the midpoint closest to the intersection point (eg The mesh face 604 in Fig. 6 serves as the target mesh face.
  • the target mesh surface may be located first. Select three mesh faces from the adjacent mesh of the virtual object in the plane as the candidate mesh face according to the orientation of the virtual object. For example, when the orientation of the virtual object is northeast, select three meshes in the northeast direction. Faces (604, 605, 607 in Fig. 6) are used as candidate mesh faces.
  • the target mesh surface as the construction location in the plurality of cuboid grids, including:
  • Step S410 determining an extension direction of the target mesh surface on a horizontal reference plane according to a projection of the orientation of the virtual object in a horizontal reference plane, wherein the horizontal reference plane is parallel to a ground plane of the three-dimensional game scene. ;
  • Step S420 Calculate, according to the current location of the virtual object, a current location of the virtual object and a first location in the current grid;
  • Step S430 determining a second position of the target mesh surface in the horizontal reference plane according to the orientation of the virtual object, the current grid, and the first location;
  • Step S440 determining a third position of the target mesh surface in a vertical direction according to the orientation of the virtual object and the current grid, wherein the vertical direction is perpendicular to a ground plane of the three-dimensional game scene. ;
  • Step S450 the construction position is obtained according to the second position and the third position.
  • the first position in the currently located grid in step S420 may be within the horizontal reference plane, and the current direction of the target mesh plane is 702.
  • the mesh is divided into two parts, the front part 703 occupies 70% on the horizontal reference plane, the rear part 704 occupies 30% on the horizontal reference plane; the current grid is in the direction perpendicular to the extension direction Divided into the left, middle and right parts (such as 705, 704, 706 in Figure 4), which account for 30%, 40% and 30% respectively on the horizontal reference plane.
  • the direction in which the target mesh surface extends is expressed as the front direction, and the opposite direction is the rear direction, and the direction perpendicular to the extending direction of the target mesh surface is divided into left and right sides.
  • determining, in step S430, the second position of the target mesh surface in the horizontal reference plane comprises: using the position of the current grid in the horizontal reference plane as a reference, according to Determining whether the relative position of the virtual object 701 in the current grid and the orientation of the virtual object 701 (ie, the line of sight of the virtual object 701) determine whether to perform front-to-back and left-right offset (offset in units of one grid), thereby determining The position of the target mesh surface within the horizontal reference plane.
  • the virtual object 701 When the virtual object 701 is in the left part and the line of sight is shifted to the left by more than 15 degrees, it is shifted to the left by one grid; when the virtual object 701 is located in the right part and the line of sight is shifted to the right by more than 15 degrees, it is shifted to the right. A grid; in other cases, there is no need to make left and right offsets.
  • the virtual object 701 When the virtual object 701 is located at the front portion and the absolute value of the pitch angle of the line of sight is less than 30 degrees, it is shifted forward by one grid; when the virtual object 701 is located at the rear portion or the virtual object 701 is located at the front portion and the pitch angle of the line of sight is absolute When the value is greater than 30 degrees, no front-to-back offset is required.
  • determining a third position of the target mesh surface in the vertical direction in step S440 including: determining, according to the position of the current mesh in the vertical direction, according to the virtual object Orientation (ie, the line of sight of the virtual object), determining whether to perform up-and-down offset (offset in units of one grid), thereby determining the position of the target mesh surface in the vertical direction; when the pitch angle of the virtual object's line of sight is greater than At 30 degrees, it is offset upward by a grid; when the pitch angle of the virtual object's line of sight is less than -30 degrees, it is offset downward by a grid; in other cases, no up and down offset is needed.
  • the construction instruction includes an extending direction of the new resource in a vertical direction; when the extending direction is upper, a current position of the virtual object is a head of the virtual object. a current position; when the extending direction is downward, a current position of the virtual object is a current position of a foot of the virtual object.
  • a current position of the virtual object is a current position of a foot of the virtual object.
  • the current position of the head of the virtual object is used as the current position of the virtual object to determine the target mesh surface; when the player determines that the newly built resource is downwardly extended
  • the slope of the virtual object uses the current position of the foot of the virtual object as the current position of the virtual object to determine the target mesh face.
  • the position of the mesh where the target mesh face is located can be offset.
  • the position of the target mesh is forwardly offset by one mesh; if the target mesh position is not determined, the upper and lower offsets are not performed. Offset a grid upward; if you make an up/down offset when determining the target grid position, cancel the up and down offset so that the height of the target grid is the same as the height of the grid where the virtual object is located.
  • a virtual resource generating apparatus in a three-dimensional game scene, where the game scene includes at least one virtual object and a virtual resource, the virtual resource including an existing resource and a new one.
  • the resource, the space of the three-dimensional game scene is divided into a plurality of cuboid grids, and the new resource is a part of the virtual resources generated by the construction instruction in response to the user input, and the device includes:
  • An acquiring unit configured to acquire a current location and orientation of the virtual object in response to the building instruction, where the construction instruction includes spatial type information of the newly created resource, and the spatial type of the newly created resource includes at least the following One: construction along the vertical plane of the cuboid grid, construction along the horizontal plane of the cuboid grid and construction along the inner slope of the cuboid grid;
  • a determining unit configured to determine, in the plurality of cuboid grids, a target mesh surface as a construction location of the new resource according to the space type information, a current position and an orientation of the virtual object;
  • a rendering unit configured to render the new resource on the target mesh surface.
  • an electronic device comprising: a processing component, further comprising at least one processor, and a memory resource represented by the memory, configured to store the processable component Executed instructions, such as applications.
  • An application stored in the memory may include one or more modules each corresponding to a set of instructions.
  • the processing component is configured to execute instructions to perform the above-described method of generating a virtual resource.
  • the electronic device includes: a processor; and a memory configured to store executable instructions of the processor; wherein the processor is configured to perform the following steps by executing executable instructions:
  • the construction instruction includes spatial type information of the newly created resource
  • the spatial type of the newly created resource includes at least one of: following each The vertical plane of the cuboid grid is constructed, constructed along the horizontal plane of each cuboid grid and along the inner slope of each cuboid grid;
  • the new resource is generated by rendering on the target mesh surface.
  • the spatial type of the existing resource includes at least one of: constructing along a vertical plane of each cuboid grid, constructing along a horizontal plane of each cuboid grid, and constructing an inner slope along each cuboid grid .
  • the target mesh surface is at least one cuboid mesh surface.
  • generating the new resource on the target mesh surface including:
  • the plurality of rectangular parallelepiped grids Determining the target mesh surface as the construction location includes:
  • the construction position is obtained from the third position and the fourth position.
  • the space type of the newly created resource is built along a horizontal plane of the rectangular parallelepiped mesh, according to the spatial type of the newly created resource, the current position and orientation of the virtual object, in the plurality of rectangular parallelepiped grids Determining the target mesh surface as the construction location, including:
  • the construction position is obtained based on the first position and the second position.
  • the space type of the newly created resource is built along an inner slope surface of the rectangular parallelepiped mesh
  • the current location and orientation of the virtual object, and the plurality of rectangular parallelepiped networks Determining the target mesh surface as the construction location, including:
  • the construction location is derived from the second location and the third location.
  • the building instruction includes an extending direction of the new resource in a vertical direction; when the extending direction is a vertical direction, a current position of the virtual object is a current position of a head of the virtual object; When the extending direction is vertically downward, the current position of the virtual object is the current position of the foot of the virtual object.
  • the electronic device can also include: a power component configured to perform power management of the executing electronic device; a wired or wireless network interface configured to connect the electronic device to the network; and an input/output (I/O) interface.
  • the electronic device can operate based on an operating system stored in the memory, such as Android, iOS, Windows, Mac OS X, Unix, Linux, FreeBSD or the like.
  • a computer readable storage medium having stored thereon a program product capable of implementing the above method of the present specification.
  • various aspects of the present disclosure may also be embodied in the form of a program product comprising program code for causing said program product to run on a terminal device The terminal device performs the following steps:
  • the construction instruction includes spatial type information of the newly created resource
  • the spatial type of the newly created resource includes at least one of: following each The vertical plane of the cuboid grid is constructed, constructed along the horizontal plane of each cuboid grid and along the inner slope of each cuboid grid;
  • the new resource is generated by rendering on the target mesh surface.
  • the spatial type of the existing resource includes at least one of: constructing along a vertical plane of each cuboid grid, constructing along a horizontal plane of each cuboid grid, and constructing an inner slope along each cuboid grid .
  • the target mesh surface is at least one cuboid mesh surface.
  • generating the new resource on the target mesh surface including:
  • the plurality of rectangular parallelepiped grids Determining the target mesh surface as the construction location includes:
  • the construction position is obtained from the third position and the fourth position.
  • the space type of the newly created resource is built along a horizontal plane of the rectangular parallelepiped mesh, according to the spatial type of the newly created resource, the current position and orientation of the virtual object, in the plurality of rectangular parallelepiped grids Determining the target mesh surface as the construction location, including:
  • the construction position is obtained based on the first position and the second position.
  • the space type of the newly created resource is built along an inner slope surface of the rectangular parallelepiped mesh
  • the current location and orientation of the virtual object, and the plurality of rectangular parallelepiped networks Determining the target mesh surface as the construction location, including:
  • the construction location is derived from the second location and the third location.
  • the building instruction includes an extending direction of the new resource in a vertical direction; when the extending direction is a vertical direction, a current position of the virtual object is a current position of a head of the virtual object; When the extending direction is vertically downward, the current position of the virtual object is the current position of the foot of the virtual object.
  • the computer readable storage medium may employ a portable compact disk read only memory (CD-ROM) and include program code and may run on a terminal device such as a personal computer.
  • CD-ROM portable compact disk read only memory
  • the program product of the present disclosure is not limited thereto, and in this document, the readable storage medium may be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
  • the program product can employ any combination of at least one readable medium.
  • the readable medium can be a readable signal medium or a readable storage medium.
  • the readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive lists) of readable storage media include: electrical connections having at least one wire, portable disk, hard disk, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • the method, device, electronic device and computer readable storage medium for generating virtual resources in the 3D game scene in the above exemplary embodiment on the one hand, since the construction location of the newly created resource is located in the rectangular parallelepiped grid dividing the game scene space, the number of the grid is greatly reduced.
  • the calculation amount in the process of generating new resources solves the problem of the efficiency of the player's own construction of virtual resources in the game; on the other hand, in the process of controlling the virtual object to generate virtual resources, the player can directly and quickly according to the position and orientation of the virtual object.
  • the location of the virtual resource is determined to greatly reduce the operational burden of the player.
  • the disclosed technical contents may be implemented in other manners.
  • the device embodiments described above are only schematic.
  • the division of the unit may be a logical function division.
  • there may be another division manner for example, 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 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 various embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present disclosure may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (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 disclosure.
  • a computer device which may be a personal computer, server or network device, etc.

Abstract

一种三维游戏场景中虚拟资源的生成方法及装置,其中方法包括:将游戏场景的空间划分为多个长方体网格;响应于建造指令,获取虚拟对象的当前位置及朝向;建造指令包含新建资源的空间类型信息,新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;根据空间类型信息、虚拟对象的当前位置及朝向,在多个长方体网格中确定目标网格面作为新建资源的建造位置;在目标网格面渲染生成新建资源。

Description

三维游戏场景中虚拟资源的生成方法及装置 技术领域
本公开涉及游戏技术领域,具体而言,涉及一种三维游戏场景中虚拟资源的生成方法及装置。
背景技术
在互联网的浪潮下,硬件和软件技术的不断发展和演进,促进了终端和软件的出现。与此同时,涌现出大量的、不同题材的游戏,以满足玩家的需求。在3D游戏场景中,除了由玩家所控制的虚拟对象外,还包括一系列虚拟资源,例如由墙面、木板所构筑的各类建筑物,所述游戏场景中的虚拟对象在游戏玩家的控制下除了进行一般的游戏操作,例如移动、跳跃、与其他玩家控制的虚拟对象进行互动等,部分游戏还可以让玩家控制虚拟对象在游戏场景中建造虚拟资源。然而上述游戏中,根据玩家指令建造虚拟资源往往要消耗大量的计算资源,对于硬件设备的要求较高,且玩家需要通过繁杂的操作指令确定虚拟资源的位置,玩家的操作负担较重,上述问题在移动设备中尤为突出。
针对上述的问题,目前尚未提出有效的解决方案。
需要说明的是,在上述背景技术部分公开的信息仅用于加强对本公开的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。
发明内容
本公开至少部分实施例提供了一种三维游戏场景中虚拟资源的生成方法及装置,以至少部分地解决相关技术中在3D游戏中虚拟资源的生成效率低的技术问题。
在本公开的其中一实施例中,提供了一种三维游戏场景中虚拟资源的生成方法,所述三维游戏场景中包括至少一个虚拟对象和虚拟资源,所述虚拟资源包括已有资源和新建资源,所述三维游戏场景的空间被划分为多个长方体网格,所述新建资源为响应于用户输入的建造指令渲染生成的部分虚拟资源,所述方法包括:
响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一: 沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;
根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
在所述目标网格面渲染生成所述新建资源。
在本公开的另一个实施例中,提供了一种在三维游戏场景中虚拟资源的生成装置,所述三维游戏场景中包括至少一个虚拟对象和虚拟资源,所述虚拟资源包括已有资源和新建资源,所述三维游戏场景的空间被划分为多个长方体网格,所述新建资源为响应于用户输入的建造指令渲染生成的部分虚拟资源,所述装置包括:
获取单元,设置为响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿长方体网格的垂直面建造、沿长方体网格的水平面建造和沿长方体网格的内坡面建造中;
确定单元,设置为根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
渲染单元,设置为在所述目标网格面渲染生成所述新建资源。
在本公开的另一个实施例中,还提供了一种电子设备,包括:处理器;以及存储器,设置为存储处理器的可执行指令;其中,处理器配置为经由执行可执行指令来执行上述方法。
在本公开的另一个实施例中,还提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述方法。
在本公开的至少一个实施例中,响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;根据所述空间类型信息、所述虚拟对象当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;在所述目标网格面渲染生成所述新建资源,从而解决了在3D游戏中虚拟资源的生成效率低的技术问题。
附图说明
图1是根据本公开其中一实施例的一种三维游戏场景中虚拟资源的生成方法的流程图。
图2是根据本公开其中一示例性实施例中长方体网格的立体示意图。
图3是根据本公开其中一示例性实施例中在水平参考面上确定垂直的候选网格面位置的示意图。
图4是根据本公开其中一示例性实施例中确定垂直的目标网格面在垂直方向上位置的示意图。
图5是根据本公开其中一示例性实施例中根据虚拟对象的朝向确定水平的目标网格面所在平面的的示意图。
图6是根据本公开其中一示例性实施例中在水平参考面上确定水平的目标网格面位置的示意图。
图7是根据本公开其中一示例性实施例中在水平参考面上确定内坡面类型·的目标网格面位置的示意图。
图8是根据本公开其中一示例性实施例的其中一种虚拟资源的生成装置的组成图。
图9是根据本公开其中一示例性实施例中的一种电子设备的框图。
图10是根据本公开其中一示例性实施例中的一种计算机可读存储介质的示意图。
具体实施方式
为了使本技术领域的人员更好地理解本公开方案,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分的实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本公开保护的范围。
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或 对于这些过程、方法、产品或设备固有的其它步骤或单元。
根据本公开其中一实施例,提供了一种三维游戏场景中虚拟资源的生成方法的实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
图1是根据本公开其中一实施例的三维游戏场景中虚拟资源的生成方法的流程图,所述游戏场景中包括至少一个虚拟对象和虚拟资源,所述虚拟资源包括已有资源和新建资源,所述三维游戏场景的空间被划分为多个长方体网格,所述新建资源为响应于用户输入的建造指令渲染生成的虚拟资源,所述方法可以包括如下步骤:
步骤S110,响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;
步骤S120,根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
步骤S130,在所述目标网格面渲染生成所述新建资源。
通过本实施例中的三维游戏场景中虚拟资源的生成方法,一方面由于新建资源的建造位置位于划分游戏场景空间的长方体网格,大大降低了生成新建资源过程中的计算量,解决了玩家在游戏中自行建造虚拟资源的效率问题;另一方面,在玩家控制虚拟对象生成虚拟资源的过程中,可以直接根据虚拟对象的位置和朝向快速便捷地确定虚拟资源的建造位置,极大减轻了玩家的操作负担。
下面,将对本示例性实施例中虚拟资源的生成方法的各步骤作进一步地说明。
所述多个长方体网格仅仅为了便于确定虚拟资源的建造位置,将游戏场景空间划分为尺寸相同的多个长方体子空间,即网格仅是游戏场景空间的划分界限,并非游戏中的实体。所述长方体网格既可以是立方体(长宽高相同),也可以是长宽高不完全相同的长方体。以下实施例以长宽相同,高与长宽不同的长方体网格为例进行说明,例如,长方体网格的长与宽均为5米,高为3.5米。
步骤S110,响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每 个长方体网格的内坡面建造。
所述新建资源的建造(即在游戏画面中渲染生成)由玩家的建造指令所触发,建造指令中至少包含玩家拟建造的虚拟资源(即新建资源)的空间类型,还可以包含新建资源的材料属性(如木材、混凝土、砖块等)和数量。所述新建资源的空间类型即新建资源相对于所述长方体网格的几何位置,可以是沿长方体网格的垂直面建造,沿长方体网格的水平面建造,沿长方体网格面的内坡面建造。所述垂直面即长方体网格中垂直于游戏场景地平面的四个面,所述水平面即长方体网格中平行于游戏场景地平面的两个面,所述内坡面即长方体网格内的对角截面(所述对角截面所在平面经过长方体网格水平面的两个边,并与长方体网格的两个垂直面相交)。以新建资源的材料属性为砖块为例,沿长方体网格垂直面建造的新建资源为垂直墙,沿长方体网格水平建造的新建资源为水平墙,沿建造位置为长方体网格的内坡面建造的新建资源为向上或向下的斜坡。图2是所述长方体网格的示意图,网格面202、203、204、206为垂直网格面,网格面201、205为水平网格面,网格面207则为其中一个内坡面。
步骤S120,根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置。
新建资源的空间类型用于确定新建资源的相对于长方体网格的几何位置,而并非是确定新建资源的在游戏场景中的绝对位置。确定新建资源的建造位置需要确定新建资源所在的长方体网格面的具体位置。为获取新建资源的建造位置还需要取得所述虚拟对象在游戏场景中的当前位置及朝向,从而根据所述空间类型信息、所述虚拟对象当前位置及朝向,在所述多个长方体网格中确定目标网格面(即新建资源所在的具体长方体网格的具体面)作为所述新建资源的建造位置。在第一人称视角或第三人称视角的3D游戏中,玩家所控制的虚拟对象的朝向一般与游戏中的虚拟摄像机的朝向相同。为了使得玩家在发出建造指令时在其所控制的虚拟对象面前生成新建资源,目标网格面是根据新建资源的空间类型从虚拟对象附近且处于其视野范围内的长方体网格面中选择确定,具体的确定方法将在下文的实施例中详述。
步骤S130,在所述目标网格面渲染生成所述新建资源。
通过步骤S110和步骤S120确定目标网格面后,在该位置渲染生成新建资源,从而完成根据玩家的建造指令对新建资源的建造。
在可选的实施例中,所述已有资源的空间类型包括沿长方体网格的垂直面建造、沿长方体网格的水平面建造和沿长方体网格的内坡面建造。本实施例中,游戏中已有的虚拟资源(即已有资源)的空间类型与新建类型相同,也是沿长方体网格的垂直面、 水平面或内坡面渲染生成。由于新建资源与已有资源具有相同的空间类型,在生成新建资源时更容易与已有资源进行契合,同样也大大降低了计算量,提高了游戏的运行效率。
在可选的实施例中,所述目标网格面为至少一个长方体网格面。所述建造指令还可以保护新建资源的数量,当玩家在建造指令中确定生成多个新建资源时,建造新建资源所在的长方体网格面可以是多个。例如,玩家拟建造一面高5米(相对于游戏场景的地平面),长15米的垂直墙,则需要在三个连续的长方体网格垂直面上生产新建资源,即目标网格面为三个长方体网格面。
在可选的实施例中,所述在所述目标网格面渲染生成所述新建资源,包括:在所述目标网格面渲染生成所述新建资源的预览信息;根据玩家所发送的确认指令在所述目标网格面渲染生成所述新建资源。目标网格面正式建造所述新建资源之前,先在目标网格面渲染生成新建资源的预览信息,当收到玩家发送的确认信息后再建造新建资源,一方面由游戏系统根据玩家控制的虚拟角色的当前位置及朝向自动确定新建资源的建造位置,减轻了玩家的操作负担,另一方面还可以提供玩家修正新建资源建造位置的机会,即当玩家发现系统自动确定的新建资源的建造位置不是想要的建造位置时可以放弃建造,另行发出建造指令以选择其他建造位置。
根据本公开提供的另一实施例,当所述新建资源的空间类型为沿长方体网格的垂直面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置,包含以下步骤:
步骤S210,根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及所述虚拟对象在当前所处网格中的第一位置;
步骤S220,根据所述当前所处网格及所述第一位置确定所述建造位置的候选网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述游戏场景的地平面;
步骤S230,根据所述虚拟对象的朝向在水平参考面内的投影从所述第二位置中确定所述目标网格面在水平参考面内的第三位置;
步骤S240,根据所述虚拟对象的当前位置及朝向和所述第三位置,确定所述目标网格面在垂直方向上的第四位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
步骤S250,根据所述第三位置和第四位置得到所述建造位置。
为便于空间位置的判断,可在游戏场景中建立三维坐标系XYZ,X轴和Z轴所构 成的平面XZ平面平行于游戏场景的地平面(即上述水平参考面,坐标X和坐标Z一起确定在水平参考面内的位置),Z轴垂直于游戏场景的地平面(上述垂直方向上的位置即在Z轴上的坐标)。步骤S210所述的虚拟对象在游戏场景中的当前位置可以通过其在该坐标系中的坐标来确定,每个长方体网格也有在游戏场景中也有对应的坐标来确定位置。步骤S210所述的虚拟对象在网格中的相对位置是指虚拟对象以其所处的网格为参照系的空间位置。
根据图3所示,在可选的实施例中,步骤S220所述的根据所述当前所处网格及所述相对位置确定所述建造位置的候选网格面在水平参考面内的第二位置,包括:在俯视图中(即水平参考面内),将虚拟对象当前所处网格(即中间的大正方形,周围八个大正方形代表与虚拟对象当前所处网格相邻的网格)均分为九个小正方形,当虚拟对象位于中间的小正方形9内时,将中间大正方形四条边所对应的四个垂直面作为新建资源建造位置的候选网格面;当虚拟对象位于小正方形2、4、6、8这四个靠近中间大正方形四条边中点的四个小正方形内时,将中间大正方形以及与虚拟对象当前所处小正方形相邻的一个网格非共有的六个垂直面(在俯视图上看为呈“日”字形排列的两个大正方形外围的六个边)作为新建资源建造位置的候选网格面;当虚拟对象位于小正方形1、3、5、7这四个靠近大正方形四个角的四个小正方形内时,将中间大正方形以及以及与虚拟对象当前所处的小正方形相邻的三个网格非共有的八个垂直面(在俯视图上看为呈“田”字形排列的四个大正方形外围的八个边)作为新建资源建造位置的候选网格面。例如,当虚拟对象处于小正方形2所代表的网格中时,将中间大正方形和大正方形302外围的六个正方形边所代表的网格作为候选网格;当虚拟对象处于小正方形1所代表的网格中时,将中间大正方形和大正方形301、302、308外围的八个正方形边所代表的网格作为候选网格。
通过上述方法,可以将虚拟对象附近适宜距离范围内的网格面确定为新建资源的候选网格面,所述适当距离为大于网格面正方形边长1/3,小于网格面正方形边长的4/3。当然,上述适当距离也可以根据虚拟角色与网格的相对尺寸等因素进行调整。确定虚拟对象在网格中的相对位置的方法并不限于上述九宫格的判断方法,还可以通过其他方法,例如判断虚拟对象与当前所处网格四个面的距离是否在预定的阈值范围之内。
在可选的实施例中,步骤S230所述的根据所述虚拟对象的朝向在水平参考面内的投影从所述第二位置中确定所述目标网格面在水平参考面内的第三位置,包括:获取以所述虚拟对象所在位置为起点所述虚拟对象的朝向为方向的射线在水平参考面内的投影,在水平参考面内与该投影相交的候选网格面即目标网格面,目标网格面在水平 面参考面内的位置即第三位置,即从步骤S220所获得的多个所述第二位置中确定第三位置,由此得到目标网格面在水平参考面内的位置。从俯视图上来看,也可以看作是从虚拟对象所在位置向代表候选网格面的各个正方形边的端点连续,所述连线将虚拟对象周围的360度区域划分成与候选网格面个数相同的子角区域,再判断虚拟对象的视线(所述虚拟对象所在位置为起点所述虚拟对象的朝向为方向的射线)位于上述哪个子角区域,然后将视线所处的子角区域所对应的候选网格面作为目标网格面。
通过上述步骤获得目标网格面在水平参考面的位置后,还需要确定目标网格面在垂直方向上的位置,根据图4所示,在可选的实施例中,步骤S240所述的根据所述虚拟对象的当前位置及朝向和所述第三位置,确定所述目标网格面在垂直方向上的第四位置,包括:目标网格面在垂直方向上的候选位置包括高中低三个(即图4中的网格面406、405、404),位于中位的候选网格面405在垂直方向上的位置与虚拟对象401所在网格相同(即Z坐标相同),位于高位的候选网格面406在垂直方向上的位置高于虚拟对象401所在网格,位于低位的候选网格面404在垂直方向上的位置低于虚拟对象401所在网格;获取虚拟对象的视线402与候选网格面所在平面的交点407;计算上述高中低三个候选位置上的候选网格面的中点与上述交点407的距离;将中点与上述交点407的距离最短的候选网格面作为目标网格面。从图4来块,网格面406的中点距离交点407最近,则将网格面406确定为目标网格面。
在可选的实施例中,为了避免虚拟对象与候选网格面所在平面的夹角太小(即虚拟对象视线的俯仰角的绝对值接近90度)从而导致上述交点的位置太远,可以将虚拟对象的俯仰角的绝对值限制在80度之内,当然也可以根据需要设置为其他角度。
在可选的实施例中,为了避免选中的目标网格面无法建造新建资源(如既不与游戏场景相连,也不与其他虚拟资源相连),可以先判断已选中的目标网格面能否建造新建资源;如果不能建造新建资源,则继续在垂直方向上的三个候选网格面的另外两个网格面中选取与先前确定的目标网格面相邻的一个,判断能否建造新建资源;如果第二个目标网格面可以建造新建资源,则确定为最终的目标网格面;如果第二个目标网格面不能建造新建资源,则提示玩家当前位置无法建造新建资源。
在步骤S250,根据步骤S230中所获取的所述目标网格面在在水平参考面内的第三位置和步骤S240中所获取的目标网格面在垂直方向上的第四位置,可以在上述三维游戏场景的三维坐标中确定所述建造位置。
在本公开的另一可选实施例中,当所述新建资源的空间类型为沿长方体网格的水平面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所 述多个长方体网格中确定目标网格面作为所述建造位置,包括以下步骤:
步骤S310,根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格;
步骤S320,根据所述虚拟对象的朝向及所述当前所处网格确定所述目标网格面在垂直方向上的第一位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
步骤S330,根据所述虚拟对象的当前位置及朝向、所述当前所处网格、所述第一位置确定所述目标网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述游戏场景的地平面;
步骤S340,根据所述第一位置和所述第二位置得到所述建造位置。
当新建资源的空间类型为沿长方体网格的水平面建造时,例如平行于游戏场景的地平面的水平墙面,则目标网格面也是虚拟对象当前所处网格及相邻网格中的其中一个水平面,故也需要先根据所述虚拟对象当前位置计算所述虚拟对象当前所处网格。
步骤S320中所述确定目标网格面在垂直方向上的第一位置,即确定新建资源所处的目标网格面所在的平面,所述目标网格面所在的平面将从虚拟对象所在网格的上下两个水平面所在的平面中选取,在可选的实施例中选取方法可以为:判断虚拟对象的视线的俯仰角,如俯仰角大于零(即虚拟对象仰视),则选取垂直方向位置为上的水平面所在的平面(如图4中的平面503);如俯仰角小于零(即虚拟对象俯视),则选取垂直方向位置为下的水平面所在的平面(如图4中的平面504)。如图5所示,虚拟对象501的视线502的俯仰角大于零,则确定虚拟对象所处网格中位置为上的水平面503作为目标网格面所在的平面。
在可选的实施例中,为了避免虚拟对象的俯仰角接近零时上述交点接近无限远,可以将0至5度之间的俯仰角设置为5度,-5度至0度之间的俯仰角设置为-5度。当然,也可以根据需要设置为其他角度。
步骤S330中所述目标网格面在水平参考面内的位置与目标网格面在其在所在平面中的位置相同,因为水平参考面和目标网格面所在平面都是平行于游戏场景地平面的平面(二者的坐标X和坐标Z相同)。如图6所示,在可选的实施例中,所述确定所述目标网格面在水平参考面内的位置可以为:计算虚拟对象601的视线602与所述目标网格面所在平面的交点603;计算上述交点603与虚拟对象601所在网格及相邻网格在目标网格面所在平面内的网格面的中点的距离;选取中点与上述交点最近的网格面(如图6中的网格面604)作为目标网格面。
在可选的实施例中,在计算上述交点与虚拟对象所在网格及相邻网格在目标网格 面所在平面内的网格面的中点的距离之前,可以先在目标网格面所在平面内根据虚拟对象的朝向从虚拟对象所在网格的相邻网格中选取三个网格面作为候选网格面,例如当虚拟对象的朝向为东北方向时,选择东北方向的三个网格面(如图6中的604、605、607)作为候选网格面。
在本公开的其中一可选实施例中,当所述新建资源的空间类型为沿长方体网格的内坡面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述建造位置,包括:
步骤S410,根据所述虚拟对象的朝向在水平参考面内的投影确定所述目标网格面在水平参考面上的延伸方向,其中,所述水平参考面平行于所述三维游戏场景的地平面;
步骤S420,根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及其在当前所处网格中的第一位置;
步骤S430,根据所述虚拟对象的朝向、所述当前所处网格及所述第一位置确定所述目标网格面在水平参考面内的第二位置;
步骤S440,根据所述虚拟对象的朝向和所述当前所处网格确定所述目标网格面在垂直方向上的第三位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
步骤S450,根据所述第二位置及所述第三位置得出所述建造位置。
沿长方体网格的内坡面建造的新建资源(如云梯、斜坡)的建造位置除了需要确定水平面参考面上的位置和垂直方向上的位置外,还需要确定其在水平参考面上的延伸方向。
如图7所示,在一可选实施例中,步骤S420中所述当前所处网格中的第一位置,可以是在水平参考面内,在目标网格面的延伸方向702上将当前所处网格划分为前后两部分,前部分703在水平参考面上占70%,后部分704在水平参考面上占30%;在垂直于所述延伸方向的方向上将当前所处网格划分为左中右三部分(如图4中的705、704、706),在水平参考面上分别占30%、40%和30%。为方便论述,将目标网格面延伸方向表述为前方,相反方向为后方,将垂直于目标网格面延伸方向的方向分为为左方和右方。
在一可选实施例中,步骤S430中确定所述目标网格面在水平参考面内的第二位置,包括:以所述当前所处网格在水平参考面内的位置为基准,根据所述虚拟对象701在当前所处网格中的相对位置及虚拟对象701的朝向(即虚拟对象701的视线),判断是 否进行前后左右偏移(偏移以一个网格为单位),从而确定所述目标网格面在水平参考面内的位置。当虚拟对象701位于左部分且视线向左偏移超过15度时,则向左偏移一个网格;当虚拟对象701位于右部分且视线向右偏移超过15度时,则向右偏移一个网格;其他情况下,则无需进行左右偏移。当虚拟对象701位于前部分且视线的俯仰角的绝对值小于30度时,向前偏移一个网格;当虚拟对象701位于后部分时或虚拟对象701位于前部分且视线的俯仰角的绝对值大于30度时,则无需进行前后偏移。
在一可选实施例中,步骤S440中确定所述目标网格面在垂直方向上的第三位置,包括:以所述当前所处网格在垂直方向上的位置为基准,根据虚拟对象的朝向(即虚拟对象的视线),判断是否进行上下偏移(偏移以一个网格为单位),从而确定所述目标网格面在垂直方向上的位置;当虚拟对象的视线的俯仰角大于30度时,向上偏移一个网格;当虚拟对象的视线的俯仰角小于-30度时,向下偏移一个网格;其他情况下,则无需进行上下偏移。
在一可选实施例中,所述建造指令包含所述新建资源在垂直方向上的延伸方向;当所述延伸方向为上时,所述虚拟对象的当前位置为所述虚拟对象的头部的当前位置;当所述延伸方向为下时,所述虚拟对象的当前位置为所述虚拟对象的脚部的当前位置。例如,当玩家确定建造的新建资源为向上延伸的云梯,则将虚拟对象的头部的当前位置作为虚拟对象的当前位置用于确定目标网格面;当玩家确定建造的新建资源为向下延伸的斜坡,则将虚拟对象的脚部的当前位置作为虚拟对象的当前位置用于确定目标网格面。
如上述方法所确定的目标网格面无法建造新建资源(例如,已有一个云梯或斜坡),则可以对目标网格面所在网格的位置进行偏移。在一可选的实施例中,如遇目标网格面无法建造新建资源,则将目标网格的位置向前偏移一个网格;如在确定目标网格位置时未进行上下偏移,则向上偏移一个网格;如在确定目标网格位置时进行过上下偏移,则取消上下偏移,使得目标网格的高度与虚拟对象所处网格的高度相同。
在本公开的另一个实施例中,还提供了一种在三维游戏场景中虚拟资源的生成装置,所述游戏场景中包括至少一个虚拟对象和虚拟资源,所述虚拟资源包括已有资源和新建资源,所述三维游戏场景的空间被划分为多个长方体网格,所述新建资源为响应于用户输入的建造指令渲染生成的部分虚拟资源,所述装置包括:
获取单元,设置为响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿长方体网格的垂直面建造、沿长方体网格的水平面建造和沿长方 体网格的内坡面建造中;
确定单元,设置为根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
渲染单元,设置为在所述目标网格面渲染生成所述新建资源。
在本公开的另一个实施例中,还提供了一种电子设备,该电子设备包括:处理组件,其进一步可以包括至少一个处理器,以及由存储器所代表的存储器资源,设置为存储可由处理组件执行的指令,例如应用程序。存储器中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件被配置为执行指令,以执行上述的虚拟资源的生成方法。
在一可选实施例中,所述电子设备包括:处理器;以及存储器,设置为存储处理器的可执行指令;其中,处理器配置为经由执行可执行指令来执行如下步骤:
响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;
根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
在所述目标网格面渲染生成所述新建资源。
可选地,所述已有资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造。
可选地,所述目标网格面为至少一个长方体网格面。
可选地,在所述目标网格面渲染生成所述新建资源,包括:
在所述目标网格面渲染生成所述新建资源的预览信息;
响应于所述用户根据所述预览信息输入的确认指令,在所述目标网格面渲染生成所述新建资源。
可选地,当所述新建资源的空间类型为沿长方体网格的垂直面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及所述虚拟对象在当前所处网格中的第一位置;
根据所述当前所处网格及所述第一位置确定所述建造位置的候选网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述三维游戏场景的地平面;
根据所述虚拟对象的朝向在所述水平参考面内的投影从所述第二位置中确定所述目标网格面在所述水平参考面内的第三位置;
根据所述虚拟对象的当前位置及朝向和所述第三位置,确定所述目标网格面在垂直方向上的第四位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
根据所述第三位置和所述第四位置得到所述建造位置。
可选地,当所述新建资源的空间类型为沿长方体网格的水平面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格;
根据所述虚拟对象的朝向及所述当前所处网格确定所述目标网格面在垂直方向上的第一位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
根据所述虚拟对象的当前位置及朝向、所述当前所处网格、所述第一位置确定所述目标网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述三维游戏场景的地平面;
根据所述第一位置和所述第二位置得到所述建造位置。
可选地,当所述新建资源的空间类型为沿长方体网格的内坡面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
根据所述虚拟对象的朝向在水平参考面内的投影确定所述目标网格面在水平参考面上的延伸方向,其中,所述水平参考面平行于所述三维游戏场景的地平面;
根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及其在当前所处网格中的第一位置;
根据所述虚拟对象的朝向、所述当前所处网格及所述第一位置确定所述目标网格面在水平参考面内的第二位置;
根据所述虚拟对象的朝向和所述当前所处网格确定所述目标网格面在垂直方向上的第三位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
根据所述第二位置及所述第三位置得出所述建造位置。
可选地,所述建造指令包含所述新建资源在垂直方向上的延伸方向;当所述延伸方向为垂直向上时,所述虚拟对象的当前位置为所述虚拟对象的头部的当前位置;当所述延伸方向为垂直向下时,所述虚拟对象的当前位置为所述虚拟对象的脚部的当前位置。
该电子设备还可以包括:一个电源组件,电源组件被配置成对执行电子设备进行电源管理;一个有线或无线网络接口,被配置成将电子设备连接到网络;以及一个输入输出(I/O)接口。该电子设备可以操作基于存储在存储器的操作系统,例如Android、iOS、Windows,Mac OS X,Unix,Linux,FreeBSD或类似。
在本公开的另一个实施例中,还提供了一种计算机可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施方式中,本公开的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行以下步骤:
响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;
根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
在所述目标网格面渲染生成所述新建资源。
可选地,所述已有资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造。
可选地,所述目标网格面为至少一个长方体网格面。
可选地,在所述目标网格面渲染生成所述新建资源,包括:
在所述目标网格面渲染生成所述新建资源的预览信息;
响应于所述用户根据所述预览信息输入的确认指令,在所述目标网格面渲染生成所述新建资源。
可选地,当所述新建资源的空间类型为沿长方体网格的垂直面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及所述虚拟对象在当前所处网格中的第一位置;
根据所述当前所处网格及所述第一位置确定所述建造位置的候选网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述三维游戏场景的地平面;
根据所述虚拟对象的朝向在所述水平参考面内的投影从所述第二位置中确定所述目标网格面在所述水平参考面内的第三位置;
根据所述虚拟对象的当前位置及朝向和所述第三位置,确定所述目标网格面在垂直方向上的第四位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
根据所述第三位置和所述第四位置得到所述建造位置。
可选地,当所述新建资源的空间类型为沿长方体网格的水平面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格;
根据所述虚拟对象的朝向及所述当前所处网格确定所述目标网格面在垂直方向上的第一位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
根据所述虚拟对象的当前位置及朝向、所述当前所处网格、所述第一位置确定所述目标网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述三维游戏场景的地平面;
根据所述第一位置和所述第二位置得到所述建造位置。
可选地,当所述新建资源的空间类型为沿长方体网格的内坡面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
根据所述虚拟对象的朝向在水平参考面内的投影确定所述目标网格面在水平参考面上的延伸方向,其中,所述水平参考面平行于所述三维游戏场景的地平面;
根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及其在当前所处网 格中的第一位置;
根据所述虚拟对象的朝向、所述当前所处网格及所述第一位置确定所述目标网格面在水平参考面内的第二位置;
根据所述虚拟对象的朝向和所述当前所处网格确定所述目标网格面在垂直方向上的第三位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
根据所述第二位置及所述第三位置得出所述建造位置。
可选地,所述建造指令包含所述新建资源在垂直方向上的延伸方向;当所述延伸方向为垂直向上时,所述虚拟对象的当前位置为所述虚拟对象的头部的当前位置;当所述延伸方向为垂直向下时,所述虚拟对象的当前位置为所述虚拟对象的脚部的当前位置。
所述计算机可读存储介质可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本公开的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
所述程序产品可以采用至少一个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有至少一个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。
通过上述示例性实施例中的3D游戏场景中虚拟资源的生成方法、装置、电子设备及计算机可读存储介质,一方面由于新建资源的建造位置位于划分游戏场景空间的长方体网格,大大降低了生成新建资源过程中的计算量,解决了玩家在游戏中自行建造虚拟资源的效率问题;另一方面,在玩家控制虚拟对象生成虚拟资源的过程中,可以直接根据虚拟对象的位置和朝向快速便捷地确定虚拟资源的建造位置,极大减轻了玩家的操作负担。
上述本公开实施例序号仅仅为了描述,不代表实施例的优劣。
在本公开的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本公开所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,可以为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务端或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。
以上所述仅是本公开的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本公开原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本公开的保护范围。

Claims (11)

  1. 一种三维游戏场景中虚拟资源的生成方法,所述三维游戏场景中包括至少一个虚拟对象和虚拟资源,所述虚拟资源包括已有资源和新建资源,所述三维游戏场景的空间被划分为多个长方体网格,所述新建资源为响应于用户输入的建造指令渲染生成的部分虚拟资源,所述方法包括:
    响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造;
    根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
    在所述目标网格面渲染生成所述新建资源。
  2. 根据权利要求1所述的方法,其中,所述已有资源的空间类型包括以下至少之一:沿每个长方体网格的垂直面建造、沿每个长方体网格的水平面建造和沿每个长方体网格的内坡面建造。
  3. 根据权利要求1所述的方法,其中,所述目标网格面为至少一个长方体网格面。
  4. 根据权利要求1所述的方法,其中,在所述目标网格面渲染生成所述新建资源,包括:
    在所述目标网格面渲染生成所述新建资源的预览信息;
    响应于所述用户根据所述预览信息输入的确认指令,在所述目标网格面渲染生成所述新建资源。
  5. 根据权利要求1所述的方法,其中,当所述新建资源的空间类型为沿长方体网格的垂直面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
    根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及所述虚拟对象在当前所处网格中的第一位置;
    根据所述当前所处网格及所述第一位置确定所述建造位置的候选网格面在水平参 考面内的第二位置,其中,所述水平参考面平行于所述三维游戏场景的地平面;
    根据所述虚拟对象的朝向在所述水平参考面内的投影从所述第二位置中确定所述目标网格面在所述水平参考面内的第三位置;
    根据所述虚拟对象的当前位置及朝向和所述第三位置,确定所述目标网格面在垂直方向上的第四位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
    根据所述第三位置和所述第四位置得到所述建造位置。
  6. 根据权利要求1所述的方法,其中,当所述新建资源的空间类型为沿长方体网格的水平面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
    根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格;
    根据所述虚拟对象的朝向及所述当前所处网格确定所述目标网格面在垂直方向上的第一位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
    根据所述虚拟对象的当前位置及朝向、所述当前所处网格、所述第一位置确定所述目标网格面在水平参考面内的第二位置,其中,所述水平参考面平行于所述三维游戏场景的地平面;
    根据所述第一位置和所述第二位置得到所述建造位置。
  7. 根据权利要求1所述的方法,其中,当所述新建资源的空间类型为沿长方体网格的内坡面建造时,根据所述新建资源的空间类型、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定所述目标网格面作为所述建造位置,包括:
    根据所述虚拟对象的朝向在水平参考面内的投影确定所述目标网格面在水平参考面上的延伸方向,其中,所述水平参考面平行于所述三维游戏场景的地平面;
    根据所述虚拟对象的当前位置计算所述虚拟对象当前所处网格及其在当前所处网格中的第一位置;
    根据所述虚拟对象的朝向、所述当前所处网格及所述第一位置确定所述目标网格面在水平参考面内的第二位置;
    根据所述虚拟对象的朝向和所述当前所处网格确定所述目标网格面在垂直方向上的第三位置,其中,所述垂直方向垂直于所述三维游戏场景的地平面;
    根据所述第二位置及所述第三位置得出所述建造位置。
  8. 根据权利要求7所述的方法,其中,所述建造指令包含所述新建资源在垂直方向上的延伸方向;当所述延伸方向为垂直向上时,所述虚拟对象的当前位置为所述虚拟对象的头部的当前位置;当所述延伸方向为垂直向下时,所述虚拟对象的当前位置为所述虚拟对象的脚部的当前位置。
  9. 一种在三维游戏场景中虚拟资源的生成装置,所述三维游戏场景中包括至少一个虚拟对象和虚拟资源,所述虚拟资源包括已有资源和新建资源,所述三维游戏场景的空间被划分为多个长方体网格,所述新建资源为响应于用户输入的建造指令渲染生成的部分虚拟资源,所述装置包括:
    获取单元,设置为响应于所述建造指令,获取所述虚拟对象的当前位置及朝向,其中,所述建造指令包含所述新建资源的空间类型信息,所述新建资源的空间类型包括以下至少之一:沿长方体网格的垂直面建造、沿长方体网格的水平面建造和沿长方体网格的内坡面建造中;
    确定单元,设置为根据所述空间类型信息、所述虚拟对象的当前位置及朝向,在所述多个长方体网格中确定目标网格面作为所述新建资源的建造位置;
    渲染单元,设置为在所述目标网格面渲染生成所述新建资源。
  10. 一种电子设备,包括:
    处理器;以及
    存储器,设置为存储所述处理器的可执行指令;
    其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1-8任一项所述的方法
  11. 一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-8任一项所述的方法。
PCT/CN2018/109863 2017-12-29 2018-10-11 三维游戏场景中虚拟资源的生成方法及装置 WO2019128381A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2019562457A JP6783957B2 (ja) 2017-12-29 2018-10-11 三次元ゲームシーンにおける仮想リソース生成方法及び装置
US16/638,143 US11090562B2 (en) 2017-12-29 2018-10-11 Method and apparatus for generating virtual resources in three-dimensional game scene

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711484201.3A CN108211354A (zh) 2017-12-29 2017-12-29 3d游戏场景中虚拟资源的生成方法及装置
CN201711484201.3 2017-12-29

Publications (1)

Publication Number Publication Date
WO2019128381A1 true WO2019128381A1 (zh) 2019-07-04

Family

ID=62647301

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/109863 WO2019128381A1 (zh) 2017-12-29 2018-10-11 三维游戏场景中虚拟资源的生成方法及装置

Country Status (4)

Country Link
US (1) US11090562B2 (zh)
JP (1) JP6783957B2 (zh)
CN (1) CN108211354A (zh)
WO (1) WO2019128381A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112402981A (zh) * 2020-11-11 2021-02-26 完美世界(北京)软件科技发展有限公司 游戏场景的控制方法和装置、存储介质和电子设备

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108211354A (zh) * 2017-12-29 2018-06-29 网易(杭州)网络有限公司 3d游戏场景中虚拟资源的生成方法及装置
CN109087402B (zh) * 2018-07-26 2021-02-12 上海莉莉丝科技股份有限公司 在3d场景的特定表面上覆盖特定表面形态的方法、系统、设备和介质
CN109316750B (zh) * 2018-11-21 2022-01-11 北京像素软件科技股份有限公司 游戏场景区域划分方法及装置
CN109173253A (zh) * 2018-11-21 2019-01-11 北京像素软件科技股份有限公司 游戏角色位置判定方法及装置
CN109663346A (zh) * 2019-01-07 2019-04-23 网易(杭州)网络有限公司 一种游戏中的建造控制方法和装置
CN109731329B (zh) * 2019-01-31 2022-06-14 网易(杭州)网络有限公司 一种针对游戏中虚拟组件的放置位置的确定方法和装置
CN110193190B (zh) * 2019-06-03 2023-02-28 网易(杭州)网络有限公司 游戏对象的创建方法、触控终端设备、电子设备及介质
CN111298431B (zh) * 2020-02-26 2023-08-22 网易(杭州)网络有限公司 一种游戏中的建造方法和装置
CN111617475B (zh) * 2020-05-28 2022-03-01 腾讯科技(深圳)有限公司 一种交互对象的构建方法、装置、设备和存储介质
CN112717382A (zh) * 2020-12-04 2021-04-30 网易(杭州)网络有限公司 游戏虚拟对象建造方法、装置、存储介质及计算机设备
CN112465946B (zh) * 2020-12-08 2023-07-14 网易(杭州)网络有限公司 波纹的渲染方法、装置、电子设备及计算机可读介质
CN112494937A (zh) * 2020-12-16 2021-03-16 北京冰封互娱科技有限公司 一种游戏场景搭建方法及装置、存储介质、计算设备
CN113769397B (zh) * 2021-09-28 2024-03-22 腾讯科技(深圳)有限公司 虚拟物体的设置方法、装置、设备、介质及程序产品
CN115588070B (zh) * 2022-12-12 2023-03-14 南方科技大学 一种三维图像风格化迁移方法及终端
CN117274505B (zh) * 2023-11-20 2024-03-05 广州中鸣数码科技有限公司 图像映射到搭建图的显示方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020069261A1 (en) * 2000-12-01 2002-06-06 Bellare Kiran Gurudutt Methods and systems for rule-based distributed and personlized content delivery
CN104001329A (zh) * 2012-12-06 2014-08-27 索尼在线娱乐有限责任公司 用于数字对象的用户创建的系统和方法
CN104331587A (zh) * 2012-12-06 2015-02-04 索尼在线娱乐有限责任公司 用于以群组进行建造的系统和方法
CN105935493A (zh) * 2015-03-05 2016-09-14 株式会社万代南梦宫娱乐 计算机系统、游戏装置及用于控制角色的方法
US20170046882A1 (en) * 2015-08-11 2017-02-16 Amazon Technologies, Inc. Virtual area generation and manipulation
CN108211354A (zh) * 2017-12-29 2018-06-29 网易(杭州)网络有限公司 3d游戏场景中虚拟资源的生成方法及装置

Family Cites Families (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1077431A1 (en) * 1999-08-16 2001-02-21 Mtu Motoren- Und Turbinen-Union MàœNchen Gmbh Generating a three-dimensional mesh for finite element analysis
US20050153766A1 (en) * 2000-12-05 2005-07-14 Harmon Matthew C. E-Commerce Role Playing Platform
EP1727093A1 (en) * 2003-12-19 2006-11-29 Tdvision Corporation S.A. DE C.V. 3d videogame system
US8814679B2 (en) * 2010-06-14 2014-08-26 Nintendo Co., Ltd. Rivet mechanisms
US8692827B1 (en) * 2011-01-24 2014-04-08 Google Inc. Carving buildings from a three-dimensional model, and applications thereof
US9773074B2 (en) * 2012-12-06 2017-09-26 Daybreak Game Company Llc System and method for building digital objects with blocks
CA2925906A1 (en) * 2013-10-01 2015-04-09 Aaron DISHNO Three-dimensional (3d) browsing
CN104794756A (zh) * 2014-01-20 2015-07-22 鸿富锦精密工业(深圳)有限公司 点云模型贴图系统及方法
US10217278B1 (en) * 2015-03-03 2019-02-26 Amazon Technologies, Inc. Three dimensional terrain modeling
EP3268938A1 (en) * 2015-03-12 2018-01-17 Happy L-Lord AB System, method and device for three-dimensional voxel-based modeling
US20170053457A1 (en) * 2015-08-20 2017-02-23 Angle Technologies, Inc. Automatic logic application based upon user input shapes
US10956625B2 (en) * 2015-09-01 2021-03-23 Siemens Industry Software Inc. Mesh generation system and method
WO2018007369A1 (en) * 2016-07-05 2018-01-11 Lego A/S Method for creating a virtual object
US20180031719A1 (en) * 2016-07-29 2018-02-01 Hao Huang Method and System for Generating a Subsurface Model
CN106326554A (zh) * 2016-08-24 2017-01-11 中天建设集团有限公司天津分公司 一种砌体模型排版施工方法
US10726611B1 (en) * 2016-08-24 2020-07-28 Electronic Arts Inc. Dynamic texture mapping using megatextures
CN106295063B (zh) * 2016-08-24 2019-03-22 大连都市发展设计有限公司 建筑物节点等效面传热系数计算方法
US10773179B2 (en) * 2016-09-08 2020-09-15 Blocks Rock Llc Method of and system for facilitating structured block play
US20180068574A1 (en) * 2016-09-08 2018-03-08 Jim LaCrosse Method of and system for facilitating structured block play in a virtual reality environment
US10275941B2 (en) * 2016-11-01 2019-04-30 Dg Holdings, Inc. Multi-layered depth and volume preservation of stacked meshes
US10282551B2 (en) * 2017-05-12 2019-05-07 Linden Research, Inc. Systems and methods to control publication of user content in a virtual world
EP3729376A4 (en) * 2017-12-22 2021-01-20 Magic Leap, Inc. PROCESS OF RENDERING OF OCCLUSION USING A RAY THROWING AND ACTUAL DEPTH
US10984587B2 (en) * 2018-07-13 2021-04-20 Nvidia Corporation Virtual photogrammetry

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020069261A1 (en) * 2000-12-01 2002-06-06 Bellare Kiran Gurudutt Methods and systems for rule-based distributed and personlized content delivery
CN104001329A (zh) * 2012-12-06 2014-08-27 索尼在线娱乐有限责任公司 用于数字对象的用户创建的系统和方法
CN104331587A (zh) * 2012-12-06 2015-02-04 索尼在线娱乐有限责任公司 用于以群组进行建造的系统和方法
CN105935493A (zh) * 2015-03-05 2016-09-14 株式会社万代南梦宫娱乐 计算机系统、游戏装置及用于控制角色的方法
US20170046882A1 (en) * 2015-08-11 2017-02-16 Amazon Technologies, Inc. Virtual area generation and manipulation
CN108211354A (zh) * 2017-12-29 2018-06-29 网易(杭州)网络有限公司 3d游戏场景中虚拟资源的生成方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112402981A (zh) * 2020-11-11 2021-02-26 完美世界(北京)软件科技发展有限公司 游戏场景的控制方法和装置、存储介质和电子设备

Also Published As

Publication number Publication date
US20200316465A1 (en) 2020-10-08
US11090562B2 (en) 2021-08-17
JP6783957B2 (ja) 2020-11-11
CN108211354A (zh) 2018-06-29
JP2020509512A (ja) 2020-03-26

Similar Documents

Publication Publication Date Title
WO2019128381A1 (zh) 三维游戏场景中虚拟资源的生成方法及装置
US20230010973A1 (en) Virtual Resource Processing Method in Game Scene and Apparatus, Terminal, and Storage-Medium
US20200368623A1 (en) Processing Method and Apparatus for Virtual Resource in Game Scene
JP2020513948A (ja) 情報処理方法及び装置、記憶媒体、電子機器
CN105825493B (zh) 图像配准方法和装置
JP2021520579A (ja) オブジェクトのロード方法及び装置、記憶媒体、電子装置、並びにコンピュータプログラム
WO2019128358A1 (zh) 信息处理方法及装置、存储介质、电子设备
CN106027962B (zh) 视频监控的覆盖率计算方法及装置、布点方法及系统
WO2018077071A1 (zh) 一种全景图像的生成方法及装置
WO2017092430A1 (zh) 基于虚拟现实应用的用户界面控件实现方法和装置
CN113538706B (zh) 基于数字沙盘的房景展示方法、装置、设备及存储介质
WO2023165315A1 (zh) 技能指示器的显示方法及装置、电子设备和存储介质
US20220040859A1 (en) Footstep planning method, robot and computer-readable storage medium
US9600151B2 (en) Interactive design variations interface
CN114021222A (zh) 建筑物的建模方法、电子设备及计算机存储介质
WO2020034086A1 (zh) 一种场景的三维重建方法、装置、电子设备及存储介质
EP4246452A1 (en) Three-dimensional point cloud densification device, three-dimensional point cloud densification method, and program
CN113144607A (zh) 游戏中虚拟对象的寻路方法、装置及电子设备
CN112287432A (zh) 目标区域获取方法、装置、计算机设备和存储介质
CN112002007A (zh) 基于空地影像的模型获取方法及装置、设备、存储介质
CN113470169B (zh) 游戏场景生成方法、装置、计算机设备及可读存储介质
CN106846498B (zh) 激光点云渲染方法和装置
CN115779424A (zh) 一种导航网格寻路方法、装置、设备及介质
CN106600694B (zh) 一种地形数据的平滑处理方法及装置
CN111617475B (zh) 一种交互对象的构建方法、装置、设备和存储介质

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2019562457

Country of ref document: JP

Kind code of ref document: A

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

Ref document number: 18897178

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: 18897178

Country of ref document: EP

Kind code of ref document: A1