Method, device and system for generating game object in game scene

文档序号:1063490 发布日期:2020-10-16 浏览:10次 中文

阅读说明:本技术 游戏场景中生成游戏对象的方法、装置及系统 (Method, device and system for generating game object in game scene ) 是由 尚乐 于 2020-06-19 设计创作,主要内容包括:本发明的实施例公开一种游戏场景中生成游戏对象的方法、装置及系统。所述方法包括:基于控制指令在与游戏地图对应的第一数值范围内随机产生一个数值作为有效数值;所述游戏地图具有有效区域;所述有效区域由几何图形划分成至少一个子区域;所述第一数值范围中的数值与所述游戏地图中的所述子区域对应;查找与所述有效数值对应的所述子区域;其中,与所述有效数值对应的所述子区域为目标子区域;在所述目标子区域内随机生成一个坐标点作为有效坐标点;在所述游戏地图中的所述有效坐标点生成游戏对象。所述装置用于实现所述方法。所述系统包括所述装置。本发明的实施例可提高效率和响应速度。(The embodiment of the invention discloses a method, a device and a system for generating a game object in a game scene. The method comprises the following steps: randomly generating a numerical value in a first numerical value range corresponding to the game map as an effective numerical value based on the control instruction; the game map has an effective area; the active area is divided into at least one sub-area by a geometric figure; the values in the first range of values correspond to the sub-regions in the game map; searching the sub-region corresponding to the effective numerical value; wherein the sub-region corresponding to the valid numerical value is a target sub-region; randomly generating a coordinate point in the target sub-region as an effective coordinate point; generating a game object at the effective coordinate point in the game map. The device is used for realizing the method. The system comprises the device. The embodiment of the invention can improve the efficiency and the response speed.)

1. A method of generating a game object in a game scene, comprising:

c1, randomly generating a numerical value in a first numerical value range corresponding to the game map based on the control command as a valid numerical value; the game map has an effective area; the active area is divided into at least one sub-area by a geometric figure; the values in the first range of values correspond to the sub-regions in the game map;

c2, searching the sub-region corresponding to the effective numerical value; wherein the sub-region corresponding to the valid numerical value is a target sub-region;

c3, randomly generating a coordinate point in the target sub-area as an effective coordinate point;

c4, generating a game object at the effective coordinate point in the game map.

2. The method of claim 1, further comprising: the fraction of all of the values corresponding to the sub-region in the first range of values is proportional to the size of the sub-region.

3. The method according to claim 1, wherein C3 is specifically: randomly generating a coordinate point in the target sub-region as an effective coordinate point according to at least part of the marking information; the marking information marks the position of the target sub-area in the game map.

4. The method of claim 3, further comprising: the mark information includes one or more of a coordinate point, a geometric quantity of the geometric figure, and shape information of the geometric figure.

5. The method of claim 1, further comprising:

d1, dividing an effective area in the game map into at least one sub-area by using geometric figures;

d2, marking the position of each sub-area in the game map;

d3, calculating the size of each sub-region to obtain a magnitude value representing the size of the sub-region;

d4, generating the first range of values based on all of the quantities.

6. The method of claim 5, wherein the D4 comprises: accumulating all the quantity values to obtain an accumulated value; and generating the first numerical range according to the accumulated value.

7. The method of claim 6,

the generating the first numerical range according to the accumulated value specifically includes: taking a numerical range formed from zero to the accumulated value as the first numerical range;

the D4 further includes: dividing the first range of values into sub-ranges corresponding to the sub-regions, wherein the span of each sub-range is proportional to the magnitude of the magnitude corresponding to the corresponding sub-region.

8. The method of claim 7, further comprising: each of the sub-ranges spans the magnitude of the magnitude corresponding to the corresponding sub-region.

9. The method of claim 5, wherein the geometric figure is rectangular in shape;

the D2 is: marking the position of each rectangle in the game map by using coordinate points of two opposite corner points of the rectangle in the game map;

the D3 is: calculating the area of each sub-region to obtain the magnitude of the area of each sub-region;

the C3 is: and determining a coordinate random range of the target sub-area according to the shape of the target sub-area and coordinate points of two diagonal points of the rectangle in the game map, and randomly generating a coordinate point as an effective coordinate point in the coordinate random range.

10. The method of claim 9, further comprising: coordinate points of two diagonal points of the rectangle in the game map are (x1, y1) and (x2, y2), respectively; the coordinate random range of the target sub-region is [ x1, x2] and [ y1, y2 ]; randomly generating a value of x0 at [ x1, x2 ]; randomly generating a value y0 at [ y1, y2 ]; the effective coordinate point is (x0, y 0).

11. The method according to claim 5, wherein D2 is specifically: marking the position of each sub-area in the game map by using coordinate points and geometric quantities of the geometric figures; alternatively, the position of each of the sub-areas in the game map is marked with coordinate points and shape information of the geometric figure.

12. The method of claim 11,

the game objects include non-player objects and player objects; the non-player objects include non-player characters and game items;

the geometric quantities comprise a radius and a side length;

the specific forms of the shapes of the geometric figures comprise rectangles, circles, triangles and regular polygons with the number of sides being more than four;

further comprising: loading the game map;

further comprising: sending second data to a client to enable the client to display the game object;

the quantities characterizing the size of the sub-region include: a value of an area of the geometric figure, a value of a perimeter of the geometric figure, a value of a radius of the geometric figure, a value of a diameter of the geometric figure, and a value of a diagonal of the geometric figure.

13. A method of generating a game object in a game scene, comprising:

d1, dividing the effective area in the game map into at least one sub-area by using geometric figures;

d2, marking the position of each sub-area in the game map;

d3, calculating the size of each sub-region to obtain a magnitude value representing the size of the sub-region;

d4, generating a first range of values based on all of the quantities; the values in the first range of values correspond to sub-areas in the game map;

d5, transmitting the first data to the computing device to cause the computing device to, based on the first data: randomly generating a value in the first value range as a valid value to search the sub-region corresponding to the valid value; wherein the sub-region corresponding to the valid numerical value is a target sub-region; randomly generating a coordinate point in the target sub-region as an effective coordinate point; generating a game object at the effective coordinate point in the game map.

14. The method of claim 13, further comprising: the fraction of all of the values corresponding to the sub-region in the first range of values is proportional to the size of the sub-region.

15. The method of claim 13, wherein the D4 comprises: accumulating all the quantity values to obtain an accumulated value; and generating the first numerical range according to the accumulated value.

16. The method of claim 15,

the generating the first numerical range according to the accumulated value specifically includes: taking a numerical range formed from zero to the accumulated value as the first numerical range;

the D4 further includes: dividing the first range of values into sub-ranges corresponding to the sub-regions, wherein the span of each sub-range is proportional to the magnitude of the magnitude corresponding to the corresponding sub-region.

17. The method of claim 13, wherein the geometric figure is rectangular in shape;

the D2 is: marking the position of each rectangle in the game map by using coordinate points of two opposite corner points of the rectangle in the game map;

the D3 is: and calculating the area of each sub-region to obtain the magnitude of the area of each sub-region.

18. The method according to claim 13, wherein D2 is specifically: marking the position of each sub-area in the game map by using coordinate points and geometric quantities of the geometric figures; alternatively, the position of each of the sub-areas in the game map is marked with coordinate points and shape information of the geometric figure.

19. The method of claim 18,

the game objects include non-player objects and player objects; the non-player objects include non-player characters and game items;

the geometric quantities comprise a radius and a side length;

the specific forms of the shapes of the geometric figures comprise rectangles, circles, triangles and regular polygons with the number of sides being more than four;

further comprising: loading the game map;

the quantities characterizing the size of the sub-region include: a value of an area of the geometric figure, a value of a perimeter of the geometric figure, a value of a radius of the geometric figure, a value of a diameter of the geometric figure, and a value of a diagonal of the geometric figure.

20. A computing device, characterized by: comprising one or more processors, memory, and one or more programs; wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the method of any of claims 1-12.

21. A system for generating game objects in a game scene, comprising: comprising a computing device according to claim 20.

22. A computer-readable storage medium characterized by: the computer-readable storage medium has stored therein program instructions which, when executed by a processor of a computer, cause the processor to carry out the method according to any one of claims 1 to 12.

23. A computer-readable storage medium characterized by: the computer-readable storage medium has stored therein program instructions which, when executed by a processor of a computer, cause the processor to carry out the method according to any one of claims 13 to 19.

Technical Field

The invention relates to the technical field of game development, in particular to a method, a device and a system for generating game objects in game scenes.

Background

In game development, it is often necessary to randomly generate game objects such as Non-player characters (NPCs) in a large scene, and the positions of the Non-player characters must be legal coordinate points. A legitimate coordinate point is a coordinate point that is not a blocking point or is not reachable. If the generated non-player character position is an illegal coordinate point, the player may not reach the coordinate point, which may affect the game experience.

For the technical problem, a general method is to randomly generate a coordinate point on a large map, and if the coordinate point is judged to be not legal, the coordinate point is generated again until a legal coordinate point position is randomly generated.

Although effective, the above method is inefficient, and many times of random operations may be required to find a legal coordinate point when the blocked area of the map is large. An improved scheme is to fill some valid points in advance and then directly make a random in the valid points, and although the scheme can guarantee one-time everywhere valid point, the scheme needs to find the valid points in advance, which is obviously not an optimal scheme.

The direct random scheme has low efficiency, and if an extreme condition is met, an effective coordinate point can not be generated at random all the time, so that the response speed of the system is reduced; fixed coordinate points are filled in advance, and then a random scheme needs to find many coordinate points in advance.

The above background disclosure is only for the purpose of assisting understanding of the inventive concept and technical solutions of the present invention, and it is not necessarily prior art to the present invention, and should not be used for evaluating the novelty and inventive step of the present invention in the case that there is no clear evidence that the above disclosure has been made before the filing date of the present application.

Disclosure of Invention

The invention provides a method, a device and a system for generating game objects in a game scene, which can improve the efficiency and the response speed.

In a first aspect, the present invention provides a method of generating a game object in a game scene, comprising: c1, randomly generating a numerical value in a first numerical value range corresponding to the game map based on the control command as a valid numerical value; the game map has an effective area; the active area is divided into at least one sub-area by a geometric figure; the values in the first range of values correspond to the sub-regions in the game map; c2, searching the sub-region corresponding to the effective numerical value; wherein the sub-region corresponding to the valid numerical value is a target sub-region; c3, randomly generating a coordinate point in the target sub-area as an effective coordinate point; c4, generating a game object at the effective coordinate point in the game map.

In a second aspect, the present invention also provides a method for generating a game object in a game scene, including: d1, dividing the effective area in the game map into at least one sub-area by using geometric figures; d2, marking the position of each sub-area in the game map; d3, calculating the size of each sub-region to obtain a magnitude value representing the size of the sub-region; d4, generating a first range of values based on all of the quantities; the values in the first range of values correspond to sub-areas in the game map; d5, transmitting the first data to the computing device to cause the computing device to, based on the first data: randomly generating a value in the first value range as a valid value to search the sub-region corresponding to the valid value; wherein the sub-region corresponding to the valid numerical value is a target sub-region; randomly generating a coordinate point in the target sub-region as an effective coordinate point; generating a game object at the effective coordinate point in the game map.

In some preferred embodiments, the ratio of all the values corresponding to the sub-region in the first range of values is proportional to the size of the sub-region.

In some preferred embodiments, C3 is specifically: randomly generating a coordinate point in the target sub-region as an effective coordinate point according to at least part of the marking information; the marking information marks the position of the target sub-area in the game map.

In some preferred embodiments, the mark information includes one or more of a coordinate point, a geometric quantity of the geometric figure, and shape information of the geometric figure.

In some preferred embodiments, the method further comprises: d1, dividing an effective area in the game map into at least one sub-area by using geometric figures; d2, marking the position of each sub-area in the game map; d3, calculating the size of each sub-region to obtain a magnitude value representing the size of the sub-region; d4, generating the first range of values based on all of the quantities.

In some preferred embodiments, D2 is specifically: marking the position of each sub-area in the game map by using coordinate points and geometric quantities of the geometric figures; alternatively, the position of each of the sub-areas in the game map is marked with coordinate points and shape information of the geometric figure.

In some preferred embodiments, the D4 includes: accumulating all the quantity values to obtain an accumulated value; and generating the first numerical range according to the accumulated value.

In some preferred embodiments, the generating the first range of values according to the accumulated value is specifically: taking a numerical range formed from zero to the accumulated value as the first numerical range;

the D4 further includes: dividing the first range of values into sub-ranges corresponding to the sub-regions, wherein the span of each sub-range is proportional to the magnitude of the magnitude corresponding to the corresponding sub-region.

In some preferred embodiments, each of the sub-ranges spans the magnitude of the magnitude corresponding to the corresponding sub-region.

In some preferred embodiments, the quantities characterizing the size of the sub-region comprise: a value of an area of the geometric figure, a value of a perimeter of the geometric figure, a value of a radius of the geometric figure, a value of a diameter of the geometric figure, and a value of a diagonal of the geometric figure.

In some preferred embodiments, the geometric shapes are rectangular;

the D2 is: marking the position of each rectangle in the game map by using coordinate points of two opposite corner points of the rectangle in the game map;

the D3 is: calculating the area of each sub-region to obtain the magnitude of the area of each sub-region;

the C3 is: and determining a coordinate random range of the target sub-area according to the shape of the target sub-area and coordinate points of two diagonal points of the rectangle in the game map, and randomly generating a coordinate point as an effective coordinate point in the coordinate random range.

In some preferred embodiments, the coordinate points of the two diagonal points of the rectangle in the game map are (x1, y1) and (x2, y2), respectively; the coordinate random range of the target sub-region is [ x1, x2] and [ y1, y2 ]; randomly generating a value of x0 at [ x1, x2 ]; randomly generating a value y0 at [ y1, y2 ]; the effective coordinate point is (x0, y 0).

In some preferred embodiments, the specific forms of the shapes of the geometric figures include rectangles, circles, triangles and regular polygons with a number of sides greater than four.

In some preferred embodiments, the geometric quantities include radii and side lengths.

In some preferred embodiments, the game objects include non-player objects and player objects; the non-player objects include non-player characters and game items.

In some preferred embodiments, the method further comprises: and sending second data to a client to enable the client to display the game object.

In some preferred embodiments, the method further comprises: and loading the game map.

In a third aspect, the present invention provides an apparatus for generating a game object in a game scene, comprising an effective value generating unit, a searching unit, an effective coordinate generating unit and a game object generating unit;

the effective numerical value generating unit is used for randomly generating a numerical value in a first numerical value range corresponding to the game map as an effective numerical value; the game map has an effective area; the active area is divided into at least one sub-area by a geometric figure; the values in the first range of values correspond to the sub-regions in the game map;

the searching unit is used for searching the sub-area corresponding to the effective numerical value; wherein the sub-region corresponding to the valid numerical value is a target sub-region;

the effective coordinate generating unit is used for randomly generating a coordinate point in the target sub-region as an effective coordinate point;

the game object generation unit is used for generating a game object at the effective coordinate point in the game map.

In some preferred embodiments, the searching unit is specifically configured to randomly generate a coordinate point in the target sub-region as an effective coordinate point according to at least a part of the marking information; the marking information marks the position of the target sub-area in the game map.

In some preferred embodiments, the system further comprises an effective area dividing unit, a position marking unit, a size calculating unit and a numerical range generating unit;

the effective area dividing unit is used for dividing an effective area in the game map into at least one sub-area by using geometric figures;

the position marking unit is used for marking the position of each sub-area in the game map;

the size calculation unit is used for calculating the size of each sub-region and generating a quantity value representing the size of the sub-region;

the numerical range generating unit is used for generating the first numerical range based on all the quantity values.

In some preferred embodiments, the position marking unit is specifically configured to: marking the position of each sub-area in the game map by using coordinate points and geometric quantities of the geometric figures; alternatively, the position of each of the sub-areas in the game map is marked with coordinate points and shape information of the geometric figure.

In some preferred embodiments, the numerical range generating unit is specifically configured to: accumulating all the quantity values to obtain an accumulated value; and generating the first numerical range according to the accumulated value.

In some preferred embodiments, the numerical range generating unit is further configured to: dividing the first range of values into sub-ranges corresponding to the sub-regions, wherein the span of each sub-range is proportional to the magnitude of the magnitude corresponding to the corresponding sub-region.

In some preferred embodiments, the geometric shapes are rectangular;

the position marking unit is specifically configured to: marking the position of each rectangle in the game map by using coordinate points of two opposite corner points of the rectangle in the game map;

the size calculation unit is specifically configured to: calculating the area of each sub-region to obtain the magnitude of the area of each sub-region;

the effective coordinate generating unit is specifically configured to: and determining a coordinate random range of the target sub-area according to the shape of the target sub-area and coordinate points of two diagonal points of the rectangle in the game map, and randomly generating a coordinate point as an effective coordinate point in the coordinate random range.

In a fourth aspect, the invention provides a computing device comprising one or more processors, memory, and one or more programs; wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the above-described methods.

In a fifth aspect, the invention provides a development apparatus comprising one or more processors, memory, and one or more programs; wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the above-described methods.

In a sixth aspect, the present invention provides a computer readable storage medium having stored therein program instructions which, when executed by a processor of a computer, cause the processor to perform the above-mentioned method.

Compared with the prior art, the embodiment of the invention has the following beneficial effects:

dividing an effective area in the game map by using a geometric figure to obtain a subarea corresponding to a numerical value in a first numerical value range; randomly generating a value within a first range of values as a valid value; based on the corresponding relation between the first numerical range and the sub-region, searching the sub-region corresponding to the effective numerical value to be used as a target sub-region and randomly generating a coordinate point in the target sub-region to be used as an effective coordinate point; subsequently generating a game object at the effective coordinate point in the game map; the method can ensure that effective coordinate points are randomly generated once, and can improve the efficiency and the response speed.

Drawings

FIG. 1 illustrates an information interaction diagram of a system for generating game objects in a game scene according to a first embodiment of the present invention;

FIG. 2 shows a flow of a method of generating a game object in a game scene according to a second embodiment of the invention;

FIG. 3 illustrates a game map of a first embodiment of the present invention;

FIG. 4 shows the correspondence between the accumulated values and the respective sub-regions of the first embodiment of the present invention;

FIG. 5 shows the correspondence between the valid value and the target sub-region for the first embodiment of the present invention;

fig. 6 shows a structure of an apparatus for generating a game object in a game scene according to a second embodiment of the present invention;

fig. 7 shows the structure of a development apparatus of the first embodiment of the present invention;

fig. 8 shows the structure of a computing apparatus of the first embodiment of the present invention.

Detailed Description

In order to make the technical problems, technical solutions and advantageous effects to be solved by the embodiments of the present invention more clearly apparent, the present invention is further described in detail below with reference to fig. 1 to 8 and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

It will be understood that when an element is referred to as being "secured to" or "disposed on" another element, it can be directly on the other element or be indirectly on the other element. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or be indirectly connected to the other element. The connection may be for fixation or for circuit connection.

It is to be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like are used in an orientation or positional relationship indicated in the drawings for convenience in describing the embodiments of the present invention and to simplify the description, and are not intended to indicate or imply that the referenced device or element must have a particular orientation, be constructed in a particular orientation, and be in any way limiting of the present invention.

Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of the present invention, "a plurality" means two or more unless specifically limited otherwise.

First embodiment

The embodiment provides a method for generating game objects in a game scene, which comprises a preprocessing part and a post-processing part. Wherein the post-processing section is performed based on a processing result of the pre-processing section.

Referring to fig. 1, the present embodiment provides a system for generating a game object in a game scene; the system includes a development device 10, a computing device 20, and a client 30. The pre-processing part and the post-processing part are executed on different devices: the preprocessing section first generates a processing result on the development device 10, and then the processing result is transmitted to the computing device 20 in the form of data, and the post-processing section operates on the computing device 20 based on the processing result; the computing device 20 communicates with the client 30, and in particular, sends data to the client 30 to cause the corresponding game object to be displayed on the client 30.

The present embodiment will be described in detail below with reference to the method and system of the present embodiment.

The game object is a non-player object, specifically a non-player character. In other embodiments, the non-player objects are game items, such as totes and drugs in a game. In other embodiments, the game object is a player object; the player object includes, among others, a player character and an object for assisting the player character, such as a pet or the avatar of the player character.

Referring to fig. 1, the preprocessing section of the method of generating game objects in a game scene of the present embodiment includes steps D1 through D5. As described above, steps D1 to D5 are performed by the development device 10. The development device 10 is a micro server or a personal computer.

Step D1, dividing the effective area in the game map into at least one sub-area by using geometric figures.

The development device 10 loads the game map to be processed, for example, reads data of the game map or displays the game map on a screen; the effective area in the game map is then divided by a rectangle. Wherein, the rectangle can be a rectangle or a square. Based on the distribution of the effective areas, a plurality of rectangles, such as a plurality of rectangles with different sizes, are required to mark the effective areas until all the effective areas are marked.

The active area marked by a rectangle is a sub-area. The shape of the sub-regions is rectangular. The number of sub-regions is plural.

In other embodiments, the active area in the game map is divided by a circle, a triangle, or a regular polygon having a number of sides greater than four. In addition, geometric figures with different shapes, such as rectangles and circles, can be combined to divide the effective area in the game map.

And D2, marking the position of each sub-area in the game map.

In particular, the position of the target sub-area in the game map is marked by the marking information. Wherein the mark information includes one or more of a coordinate point, a geometric quantity of the geometric figure, and shape information of the geometric figure.

For a sub-area of the rectangle, marking the position of the sub-area in the game map by a coordinate point; specifically, the position of each rectangle in the game map is marked by coordinate points of two opposite corner points of the rectangle in the game map.

Since the shape of the sub-area is rectangular, two diagonal coordinate points may define its position in the game map.

Referring to fig. 3, the rectangle 1 at the outer boundary represents the entire game map (or the entire large map scene), the hatched irregular area represents the blocked area 2, and the rectangle within the outer boundary represents the effective area (in fig. 3, the effective area is not marked in its entirety, and only a part is drawn for illustration); only two diagonal coordinate points are needed to describe one sub-region 3, for example: the r1 rectangular region in fig. 3 is represented by two points, P1(x1, y1) and P2(x2, y 2).

And D3, calculating the size of each sub-region to obtain a magnitude value representing the size of the sub-region.

Calculating the area of each rectangular subregion; specifically, the area is calculated according to two diagonal coordinate points of each rectangular sub-area, and the numerical value of the area of each rectangular sub-area is obtained; for example: r1 the area of the rectangular region s1 (| x1-x2| y1-y2 |). Thus, the magnitude characterizing the size of the sub-region is the value of the area of the rectangle.

In other embodiments, the size of each sub-region is calculated by calculating the perimeter of the geometry, the radius of the geometry, the diameter of the geometry, or the diagonal of the geometry, such as: the radius or diameter of a circle, the diagonal of a constant aspect ratio rectangle such as a square; as such, the quantities characterizing the size of the sub-region include: a value of a perimeter of the geometry, a value of a radius of the geometry, a value of a diameter of the geometry, and a value of a diagonal of the geometry.

Step D4, a first range of values is generated based on all the quantities.

Referring to fig. 3 and 4, assuming that there are m rectangular sub-regions 3, all the magnitudes are accumulated, that is, the values of the areas of all the rectangular sub-regions are accumulated together to obtain an accumulated value t, where t is s1+ s2+. + sm; the accumulated value t is the sum of the values of the areas of all the rectangular sub-regions. Then, a first numerical range is generated from the accumulated value t. The first numerical range is corresponding to a specified game map.

One way to generate the first range of values from the accumulated values is to: taking a numerical range formed from zero to the accumulated value t as a first numerical range; for example, if the accumulated value t is 18, 0 to 18 (i.e., [0,18]) are used as the first numerical range (i.e., [0, t ]). In other embodiments, a numerical range of numbers greater than zero to the accumulated value t is taken as the first numerical range.

The values in the first value range correspond to sub-areas in the game map; for example, the fraction of all values corresponding to a sub-region in the first range of values is proportional to the size of the sub-region, i.e.: the larger the size (e.g., the value of the area) of a sub-region, the more values in the first range of values that correspond to the sub-region (or the larger the range of values that correspond to the sub-region).

All the values in the first range of values corresponding to a sub-area in the game map may be connected together, or may be disconnected or dispersed. Referring to fig. 4, one implementation of all the values taken together is: dividing the first numerical range into sub-ranges corresponding to the sub-regions, wherein the span of each sub-range is in direct proportion to the magnitude of the corresponding sub-region; such as: the span of each sub-range is the size of the corresponding magnitude of the corresponding sub-region; or, the span of each sub-range is a value obtained by reducing or enlarging the magnitude value corresponding to the corresponding sub-region.

After obtaining the first numerical range, the development device 10 stores the first numerical range in its own memory in association with the designated game map as first data.

And D5, transmitting the first data to the computing device.

After the pre-processing portion is completed, the post-processing portion can be run. The development device 10 transmits the first data to the computing device 20; and in particular to computing device 20 via a network. In other embodiments, the development device 10 transmits the first data to the computing device 20 through a storage medium. After the computing device 20 receives the first data, a post-processing portion is performed based on the first data. For example, the first data includes data of the first numerical range and data of the game map having the sub-area as long as the computing device 20 can be caused to execute the post-processing section based on the first data. Wherein the computing device 20 is a server.

Referring to fig. 1, the post-processing part of the method of generating game objects in a game scene of the present embodiment includes steps C1 through C4.

And step C1, randomly generating a numerical value in the first numerical value range corresponding to the game map as a valid numerical value based on the control command.

Each game map that requires the generation of a non-player character corresponds to a first range of values. The first numerical ranges corresponding to different game maps may be the same or different.

The computing device 20, upon receiving a control instruction, such as an instruction triggered by a game administrator to generate a non-player character, randomly generates values within a first range of values with the same precision, such as all to one decimal place or all integers. Take the first numerical range [0,18] as an example: randomly generating a value, such as 3.1, as a valid value r when a non-player character is first generated; at the second generation of the non-player character, a value such as 8.8 is randomly generated as the valid value r.

Step C2, searching a sub-region corresponding to the effective numerical value; and the sub-region corresponding to the effective numerical value is the target sub-region.

As mentioned above, the values in the first range of values correspond to sub-areas in the game map, so that the corresponding sub-areas can be found according to the generated valid values r. Referring to fig. 5, the found sub-region is taken as the target sub-region sn.

And step C3, randomly generating a coordinate point in the target sub-area as an effective coordinate point.

According to the position of the target sub-area sn in the game map, a coordinate point can be randomly generated in the target sub-area as an effective coordinate point.

Since each sub-area is rectangular, the position of each sub-area in the game map is defined by two diagonal coordinate points of the rectangle, and after the target sub-area sn is found, the coordinate random range of the target sub-area is determined according to the shape of the target sub-area sn and the coordinate points of the two diagonal points of the rectangle in the game map. Then, a coordinate point is randomly generated as an effective coordinate point within the coordinate random range. Specifically, referring to fig. 3, it is assumed that coordinate points of two diagonal points of a certain rectangle in the game map are (x1, y1) and (x2, y2), respectively, where x1 is smaller than x2, and y1 is smaller than y 2; then, the random range of x coordinate of the target sub-region sn is [ x1, x2], and the random range of y coordinate is [ y1, y2 ]; randomly generating a value of x0 at [ x1, x2 ]; randomly generating a value y0 at [ y1, y2 ]; the valid coordinate point (x0, y0) is obtained.

Step C4, generating a game object at the effective coordinate point in the game map.

And after the effective coordinate points are obtained, generating the non-player character at the effective coordinate points in the game map according to requirements. Further, the computing device 20 transmits second data, such as data containing valid coordinate points, to the client 30, so that the client 30 displays the generated non-player character at the valid coordinate points on the screen; the client 30 may be a mobile terminal or a personal computer, among others. In this way, the user controls, via the client 30, the coordinate point at which the player character can reach the non-player character. For example, in a Massively Multiplayer Online Role Playing Game (MMORPG), after a plurality of player characters complete their mission in a game copy map (i.e., the aforementioned game map), the computing device 20 randomly generates a non-player character in the active area of the game copy map, and the player character that first reaches the location of the non-player character can receive an additional award in addition to the mission award.

In other embodiments, the location of each sub-area in the game map is marked with coordinate points and geometric quantities of the geometric figure; wherein the geometric quantities comprise radius and side length; for example, the circle center coordinate point and the radius are used for marking the position of the circular sub-area in the game map. In the subsequent step C3, a coordinate point is calculated as an effective coordinate point based on the central angle and the distance to the center of the circle, which are obtained at random, as a random range of coordinates.

In other embodiments, for circular sub-areas, the position of each sub-area in the game map is marked with two coordinate points and shape information that is geometrically circular; that is, the position of each sub-area in the game map is marked with the coordinate points and the shape information of the geometric figure; wherein the two coordinate points are located on the sides of the circle. In the subsequent step C3, a circle center coordinate point is calculated from the two coordinate points, the central angle and the distance to the circle center are used as a coordinate random range, and then a coordinate point is calculated as an effective coordinate point from the central angle and the distance to the circle center obtained at random.

Referring to fig. 7, one form of the development apparatus 10 of the present embodiment is: includes one or more processors 301A, memory 302A, and one or more programs; wherein one or more programs are stored in the memory 302A and configured to be executed by the one or more processors 301A, the one or more programs including instructions for performing the method of generating game objects in the game scene described above.

Referring to fig. 8, one form of the computing device 20 of the present embodiment is: includes one or more processors 301B, memory 302B, and one or more programs; wherein one or more programs are stored in the memory 302B and configured to be executed by the one or more processors 301B, the one or more programs including instructions for performing the method of generating game objects in the game scene described above.

According to the above, the effective area in the game map is divided by using the geometric figure to obtain the subarea 3 corresponding to the numerical value in the first numerical value range; the proportion of all numerical values corresponding to the sub-area 3 in the first numerical value range is in direct proportion to the size of the sub-area 3; randomly generating a value within a first range of values as a valid value; based on the corresponding relation between the first numerical range and the sub-region 3, searching the sub-region 3 corresponding to the effective numerical value to be used as a target sub-region, and randomly generating a coordinate point in the target sub-region to be used as an effective coordinate point; subsequently generating a non-player character at the effective coordinate points in the game map; even if the map area is a continuous space, a set of coordinate points of all the effective areas can be formed; the method can ensure that effective coordinate points can be randomly generated in the effective area of the game map at one time, the probability that the non-player character appears in each coordinate point of the effective area is equal, the efficiency and the response speed of the system can be improved, and therefore the user experience is improved.

Second embodiment

The present embodiment differs from the first embodiment in that: the pre-processing portion and the post-processing portion are executed on the same device, such as computing device 20; on the same device, the preprocessing portion first generates a processing result, and the post-processing portion then operates based on the processing result, that is, the preprocessing portion is operated first, and then the post-processing portion is operated.

Specifically, referring to fig. 2, in the present embodiment, the preprocessing section includes the aforementioned step D1 through step D4, and the post-processing section includes the aforementioned step C1 through step C4.

The embodiment also provides a device for generating the game object in the game scene; the device is the aforementioned computing device 20. Referring to fig. 6, the calculation apparatus 20 of the present embodiment includes an effective region dividing unit 101, a position marking unit 102, a size calculation unit 103, a numerical range generation unit 104, an effective numerical value generation unit 201, a search unit 202, an effective coordinate generation unit 203, and a game object generation unit 204.

Step D1 is implemented by the effective area dividing unit 101. Step D2 is implemented by the position labeling unit 102. Step D3 is implemented by the size calculation unit 103. Step D4 is implemented by the numerical range generating unit 104. Step C1 is implemented by the valid value generation unit 201. Step C2 is implemented by the lookup unit 202. Step C3 is implemented by the effective coordinate generation unit 203. Step C4 is implemented by the game object generating unit 204.

The method for generating the game object in the game scene of the embodiment of the invention randomly generates the effective coordinate point in the effective area by taking the area of the rectangle as the random weight, and is a method for generating the position of the game object based on the area with the weight.

The embodiment of the invention does not need to mark all the effective points, and only needs to mark the effective area by using the rectangular area; finding out a target sub-region by using the rectangular area at random, and then generating effective coordinate points in the target sub-region at random; in the random process, the probability of each coordinate point being selected is equal, so that the random fairness can be ensured, and effective coordinate points can be randomly generated in the effective area of the game map at one time; the workload and the occupied system resources can be reduced, the efficiency and the response speed can be greatly improved, and the user experience can be improved.

Those skilled in the art will appreciate that all or part of the processes of the embodiments methods may be performed by a computer program, which may be stored in a computer-readable storage medium and executed to perform the processes of the embodiments methods. And the aforementioned storage medium includes: various media capable of storing program codes, such as ROM or RAM, magnetic or optical disks, etc.

The foregoing is a more detailed description of the invention in connection with specific/preferred embodiments and is not intended to limit the practice of the invention to those descriptions. It will be apparent to those skilled in the art that various substitutions and modifications can be made to the described embodiments without departing from the spirit of the invention, such as changes in the order of steps in the example methods, and such substitutions and modifications are to be considered as falling within the scope of the invention.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:游戏技能配置方法与装置及游戏技能控制方法与装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类