Method for updating visible region of geodetic map in frames

文档序号:1944485 发布日期:2021-12-10 浏览:16次 中文

阅读说明:本技术 一种大地图可视区域分帧更新的方法 (Method for updating visible region of geodetic map in frames ) 是由 张汉东 于 2021-09-16 设计创作,主要内容包括:本发明公开了一种大地图可视区域分帧更新的方法,分若干帧逐步更新所述大地图可视区域,具体包括如下步骤:S1、运行第一帧,对屏幕范围外的地图元素进行回收;S2、运行第二帧,对屏幕范围内该加载的元素进行加载;S3、运行第三帧,对屏幕范围内该回收的元素进行回收;S4、运行第四帧,对屏幕范围内已加载的元素进行业务刷新。本发明采用分帧更新的方法实现大地图可视区域的更新,能有效缓解游戏引擎的压力,避免游戏的卡顿,提升玩家的游戏体验。(The invention discloses a method for updating a visible area of a large map in frames, which gradually updates the visible area of the large map in a plurality of frames, and specifically comprises the following steps: s1, operating the first frame and recycling the map elements outside the screen range; s2, operating a second frame, and loading the loaded elements in the screen range; s3, operating a third frame, and recovering the recovered elements in the screen range; and S4, operating the fourth frame, and refreshing the loaded elements in the screen range. The invention adopts a frame updating method to realize the updating of the visible area of the geodetic map, can effectively relieve the pressure of a game engine, avoids the pause of the game and improves the game experience of players.)

1. A method for updating a frame of a visible region of a geomap is characterized by comprising the following steps: gradually updating the large map visual area by a plurality of frames, and specifically comprising the following steps:

s1, operating the first frame and recycling the map elements outside the screen range;

s2, operating a second frame, and loading the loaded elements in the screen range;

s3, operating a third frame, and recovering the recovered elements in the screen range;

and S4, operating the fourth frame, and refreshing the loaded elements in the screen range.

2. The method for updating the frames of the visible region of the geomap as claimed in claim 1, wherein: the step S1 includes the following steps:

s11, calculating a map range of a screen visual area and a coordinate set B of the visual area;

and S12, traversing the elements loaded on the map, and judging whether the elements are in the coordinate set B, if so, retaining, and otherwise, recovering.

3. The method for updating the frame of the visible region of the geomap as claimed in claim 2, wherein: the method for calculating the map range of the visible area of the screen and the coordinate set B of the visible area comprises the following steps:

s111, acquiring the width W and the height H of a screen;

s112, calculating the difference value between the coordinate of the lower left corner of the map and the coordinate of the lower left corner of the screen to obtain an actual coordinate A in the map corresponding to the coordinate of the lower left corner of the screen;

and S113, calculating a map range of a visible area of the screen and a coordinate set B of the visible area according to the actual coordinate A, the width W and the height H of the screen.

4. A method for updating the frame of the visible region of the geomap as claimed in claim 3, wherein: the step S2 includes the following steps:

s21, recalculating the difference between the coordinates of the lower left corner of the map and the coordinates of the lower left corner of the screen to obtain the actual coordinates C in the map corresponding to the coordinates of the lower left corner of the new screen;

s22, calculating a new map range of the visible area of the screen and a coordinate set D of the visible area according to the actual coordinate C, the width W and the height H of the screen;

and S23, loading the map elements corresponding to the coordinates in the coordinate set D but not in the coordinate set B.

5. The method for updating the frame of the visible region of the geomap as claimed in claim 4, wherein: the step S3 includes the following steps:

s31, pairing the coordinates in the coordinate set B and the coordinate set D in pairs to obtain a coordinate pair (B)m,dn);

S32, finding bm=dnAnd b is judged according to data sent by the servermIf there is a player at the corresponding position, it is at the coordinate bmLoading corresponding map elements on the positions of the two-dimensional map, and if not, loading the coordinates bmThe map element at the location of (1) is reclaimed.

6. The method for updating the frame of the visible region of the geomap as claimed in claim 5, wherein: the step S4 specifically includes: and reading the coordinates in the coordinate set D one by one, judging whether a map element exists at the position of the coordinates, if so, refreshing the service of the map element at the position of the coordinates, and if not, not processing.

7. The method for updating the frame of the visible region of the geomap as claimed in any one of claims 1 to 6, wherein: the screen is a mobile phone screen, a tablet screen or a computer screen.

Technical Field

The invention relates to the technical field of computers, in particular to a method for updating a visible region of a geodetic map in a frame mode.

Background

In the geodesy playing method, frequent operations of a certain area by a large number of players often occur, in order to ensure real-time performance, the mobile phone end continuously receives new map data sent by the server, and meanwhile, after the player slides the map frequently, the mobile phone end continuously performs calculation and refreshing of the map because data and pictures corresponding to maps at different positions are different.

After the data are updated in real time, the original data need to be calculated to obtain the data required by the service, which is the first step; after the data is calculated, the map within the screen needs to be refreshed, which is the second step. Both steps put stress on the game engine, causing the game screen to be stuck.

Disclosure of Invention

In order to solve the problems, the invention provides a method for updating the frames of the visible area of the geodetic map.

The invention adopts the following technical scheme:

a method for updating a large map visual area by frames comprises the following steps:

s1, operating the first frame and recycling the map elements outside the screen range;

s2, operating a second frame, and loading the loaded elements in the screen range;

s3, operating a third frame, and recovering the recovered elements in the screen range;

and S4, operating the fourth frame, and refreshing the loaded elements in the screen range.

Further, the step S1 includes the following steps:

s11, calculating a map range of a screen visual area and a coordinate set B of the visual area;

and S12, traversing the elements loaded on the map, and judging whether the elements are in the coordinate set B, if so, retaining, and otherwise, recovering.

Further, the map range of the visible area of the screen and the coordinate set B of the visible area are calculated as follows:

s111, acquiring the width W and the height H of a screen;

s112, calculating the difference value between the coordinate of the lower left corner of the map and the coordinate of the lower left corner of the screen to obtain an actual coordinate A in the map corresponding to the coordinate of the lower left corner of the screen;

and S113, calculating a map range of a visible area of the screen and a coordinate set B of the visible area according to the actual coordinate A, the width W and the height H of the screen.

Further, the step S2 includes the following steps:

s21, recalculating the difference between the coordinates of the lower left corner of the map and the coordinates of the lower left corner of the screen to obtain the actual coordinates C in the map corresponding to the coordinates of the lower left corner of the new screen;

s22, calculating a new map range of the visible area of the screen and a coordinate set D of the visible area according to the actual coordinate C, the width W and the height H of the screen;

and S23, loading the map elements corresponding to the coordinates in the coordinate set D but not in the coordinate set B.

Further, the step S3 includes the following steps:

s31, pairing the coordinates in the coordinate set B and the coordinate set D in pairs to obtain a coordinate pair (B)m,dn);

S32, finding bm=dnAnd b is judged according to data sent by the servermIf there is a player at the corresponding position, it is at the coordinate bmLoading corresponding map elements on the positions of the two-dimensional map, and if not, loading the coordinates bmThe map element at the location of (1) is reclaimed.

Further, the step S4 is specifically: and reading the coordinates in the coordinate set D one by one, judging whether a map element exists at the position of the coordinates, if so, refreshing the service of the map element at the position of the coordinates, and if not, not processing.

Further, the screen is a mobile phone screen, a tablet screen or a computer screen.

After adopting the technical scheme, compared with the background technology, the invention has the following advantages:

according to the invention, the links of data calculation, map element resource removal, map element loading and map element refreshing are processed in different frames, so that the pressure of a game engine is effectively relieved, the stagnation of a game is avoided, and the game experience of a player is improved.

Drawings

FIG. 1 is a flow chart of a framing update method of the present invention;

FIG. 2 is a flowchart of step S1 in the embodiment;

FIG. 3 is a flowchart of step S2 in the embodiment;

FIG. 4 is a flowchart of step S3 in the embodiment;

fig. 5 is a flowchart of step S4 in the embodiment.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and 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.

Examples

As shown in fig. 1, the embodiment takes a mobile phone screen as an example for explanation, and a method for updating a visible area of a large map in frames gradually updates the visible area of the large map in frames, which specifically includes the following steps:

s1, operating the first frame and recycling the map elements outside the screen range;

as shown in fig. 2, step S1 includes the following steps:

s11, calculating a map range of a visible area of a mobile phone screen and a coordinate set B of the visible area;

and S12, traversing the elements loaded on the map, judging whether the elements are in the coordinate set B, if so, retaining, and otherwise, recovering.

The method for calculating the map range of the visible area of the mobile phone screen and the coordinate set B of the visible area comprises the following steps:

s111, obtaining the width W and the height H of a mobile phone screen;

s112, calculating a difference value between the coordinate of the lower left corner of the map and the coordinate of the lower left corner of the mobile phone screen to obtain an actual coordinate A in the map corresponding to the coordinate of the lower left corner of the mobile phone screen;

and S113, calculating a map range of a visible area of the mobile phone screen and a coordinate set B of the visible area according to the actual coordinate A, the width W and the height H of the screen.

S2, operating a second frame, and loading the loaded elements in the screen range;

as shown in fig. 3, step S2 includes the following steps:

s21, recalculating the difference between the coordinates of the lower left corner of the map and the coordinates of the lower left corner of the screen to obtain the actual coordinates C in the map corresponding to the coordinates of the lower left corner of the new screen; the value of coordinate C at this time is different from the value of coordinate a in the first frame because the player slides the map;

s22, calculating a new map range of a screen visual area and a coordinate set D of the visual area according to the actual coordinate C, the width W and the height H of the screen;

and S23, loading the map elements corresponding to the coordinates in the coordinate set D but not in the coordinate set B.

S3, operating a third frame, and recovering the recovered elements in the screen range;

as shown in fig. 4, step S3 includes the following steps:

s31, pairing the coordinates in the coordinate set B and the coordinate set D to obtain a coordinate pair (B)m,dn);

S32, finding bm=dnAnd b is judged according to data sent by the servermIf there is a player at the corresponding position, it is at the coordinate bmLoading corresponding map elements on the positions of the two-dimensional map, and if not, loading the coordinates bmThe map element at the location of (1) is reclaimed.

And S4, operating the fourth frame, and refreshing the loaded elements in the screen range.

As shown in fig. 5, step S4 specifically includes: and reading the coordinates in the coordinate set D one by one, judging whether a map element exists at the position of the coordinates, if so, refreshing the service of the map element at the position of the coordinates, and if not, not processing. For example: currently in the hit state, the map element will display the special effect of the fire.

The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:虚拟对象移动方法和装置、可读存储介质、电子设备

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类