CN100421119C - Method for drawing map in game - Google Patents

Method for drawing map in game Download PDF

Info

Publication number
CN100421119C
CN100421119C CN 200610089679 CN200610089679A CN100421119C CN 100421119 C CN100421119 C CN 100421119C CN 200610089679 CN200610089679 CN 200610089679 CN 200610089679 A CN200610089679 A CN 200610089679A CN 100421119 C CN100421119 C CN 100421119C
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
game
map
Prior art date
Application number
CN 200610089679
Other languages
Chinese (zh)
Other versions
CN1885296A (en )
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
Grant date

Links

Abstract

本发明属于图像显示技术,提供了一种游戏中的地图绘制方法,该方法具体为:判断当前游戏中的地图是否是第一次绘制,如果是,获取地表图素块,顺序绘制,否则,保存上一游戏循环的地图图像数据,在下一游戏循环时,计算下一游戏循环与上一游戏循环中地图的纵横向象素差,并将保存的上一游戏循环的地图图像数据取出,根据象素差进行绘制,然后以地表图素块为单位绘制所保存图像数据中未显示的部分。 The present invention belongs to an image display technique, a mapping method in a game, the method specifically comprises: determining whether the current game is the first time to draw the map, and if so, obtain surface picture element blocks, the order of drawing, otherwise, save on a game loop map image data, the game at the next cycle, the next calculation cycle of the game with a game loop on vertical and horizontal pixel difference map, the map image data extracted and saved on a game loop, in accordance with drawn pixel difference, then the surface is part of a picture element block (not shown) in the image data stored plotted. 利用本发明,避免了重新以地表图素块为单位绘制上下游戏循环地图相同的部分,减少了绘制地图时的逻辑运算,节省了时间,缩短了绘制游戏地图的循环周期,实现在不牺牲画面质量的情况下,保证游戏的流畅性、美观性和可玩性。 With the present invention, to avoid the re-order surface picture element block is plotted on the same portion of the vertical game loop map, reducing the logic operation when drawing a map, saving time and shortening the cycle time rendering of the game map, realized without sacrificing the screen the case of quality assurance fluency, aesthetics and gameplay.

Description

一种游戏中的地图绘制方法技术领域本发明涉及图像显示技术领域,尤其是一种游戏中的地图绘制方法。 TECHNICAL FIELD mapping a game in the technical field of the present invention relates to an image display, in particular a method for mapping the game. 背景技术随着游戏的不断升级,人们对游戏画面的要求也越来越高。 BACKGROUND With the game escalating, people on the game screen is also increasing. 游戏过程是一个按时间为周期的循环,称为游戏循环,每个游戏循环中,进行一次游戏逻辑运算及游戏画面的纟会制。 A game process cycle time is called game cycles, each cycle of the game, once the game logic operation will be made of Si and a game screen. 游戏画面一^:由"l争态画面和动态画面构成。,争态画面指游戏的背景地图, 一个游戏通常有一张世界地图,以象素为单位设定坐标。 为了节省存储资源以及地图部分的重复利用,将世界地图划分为大小相同的正方形,称为地表图素块,世界地图还可以根据游戏逻辑需要进一步划分为关卡地图,例如:玩家闯关成功,则进入到另一关,加载新的关卡地图,或者世界地图按游戏逻辑划分为华南地区、华北地区等,玩家每到一个地区,则加载新的地区地图,若包含关卡地图,则以关卡地图为单位,对每个关卡地图进行分块划分。具体做法:以世界地图或关卡地图的原点(一般以世界地图或关卡地图的左上顶点为地图原点)为起始点顺序进行划分,并为每个地表图素块设置一个唯一编号。在每一个游戏循环中,对地图进行绘制时,获l^又当前玩家所在位置 ^ A game screen: consists of "l contention state picture and dynamic picture, the picture refers to the dispute state background map of the game, a game usually has a map of the world, in pixels coordinates are set to save storage resources and map section. reuse, the map of the world divided into equally sized squares, called picture element block surface, a world map may also need to be further divided into logic level map according to the game, for example: a player into being, the process proceeds to the other off, loading new the level map, world map game or logically divided into South China, North China and other players each to a region, then load a new map of the area, if the map contains points, places level map as a unit, for each level maps specifically block division: in the world map or map the origin level (typically in a world map or map levels map for the origin of upper left vertex) as the starting point sequence is divided, and a unique number is provided for each picture element block surface. in each game cycle, when plotted on a map, but also won ^ l position where the current player 世界坐标,再依据屏幕的大小,计算出当前屏幕中地图的起始点的世界坐标(即左上角顶点的世界坐标),依据当前屏幕中地图起始点的世界坐标以及屏幕大小,获取当前屏幕中所有的地表图素块,并一一进行绘制,从而完成背景地图的绘制,每个游戏循环中,都用同样的方法绘制背景地图。其中,世界地图,指游戏中的地图;世界坐标,指世界地图中每个象素点的坐标,起始点是世界地图的左上角;当前地图,指以玩家当前的位置以及屏幕大小所决定的地图范围,为了获取比较好的感观效果,除了地图边界与屏幕边界重合的情况, 一般会将玩家始终置于屏幕的中心。动态画面,指游戏中所有的玩家及游戏中设置的角色,其状态会随游戏逻辑实时变化。动态画面由一系列连续的图片构成,每张图片称为一个帧,帧数越多,表现出来的动作越平滑 World coordinates, and then depending on the size of the screen, calculate the coordinates of the current screen world map starting point (ie, the world's top-left corner coordinates of the vertices), based on the current screen map coordinate the starting point of the world and the size of the screen to get the current screen all the surface picture element blocks, and 11 are drawn, thereby completing the background map drawing, each game cycle, the background map are drawn in the same manner in which the world map, the map refers to the game; world coordinates, means the World map coordinates of each pixel point, the starting point is the top left corner of the world map; the current map, the map refers to the range of the player's current location and screen size of the decision, in order to obtain better sensory effects, in addition to the border with map the case of the screen boundaries coincide, generally players will always be at the center of the screen. dynamic images, refer to the role of all game players and game settings, its status changes in real time with the game logic. dynamic picture of a series of consecutive pictures configuration, each picture is called a frame, more frames, the smoother operation manifested 每个游戏循环中,绘制完静态画面后,再依据逻辑运算的结果对动态画面进行绘制,绘制时只绘制动态画面的一帧。以上可以看出,每个游戏循环中都需要计算并获取当前屏幕中所有的地表图素块,即使上一个游戏循环与下一个游戏循环中的地图完全相同或仅仅有几个地表图素块不同,每个游戏循环中大量的计算,对于运行游戏的硬件要求高。在手机网络游戏中,由于手机的处理速度低,内存小,在实现画面复杂的游戏时,用上述方法绘制地图需要花较长的时间,会导致在一个游戏循环内, 无法完成所有的逻辑运算以及游戏画面的显示,就进入下一次游戏循环,使得游戏画面看起来有跳格,动画迟延的现象。发明内容本发明要解决的技术问题是提供一种游戏中的地图绘制方法,能够减少游戏地图的绘制时间,保证游戏的流畅性、美观性和可玩性 Each game cycle, the finished drawing a still picture, and then based on the result of the logic operation draw dynamic picture, a dynamic picture draw only when the drawing. As can be seen above, each game cycle are necessary to calculate and obtain the current All the screen surface of FIG pixel block, even though a game loop to the next game cycle map identical surface or only a few blocks of different picture elements, each game a large number of calculation cycle, the hardware requirements for running the game high in the mobile phone network games, mobile phones due to low processing speed, memory is small, when implementing complex picture of the game, using the above method to map takes a long time, the game will result in a cycle, unable to complete all the logical operations and display the game screen, the game will enter the next cycle, making the game appear to have Tab screen, animation delay phenomenon. the present invention to solve the technical problem is to provide a method for mapping game, can reduce the drawing time of the game map, to ensure the fluency of the game, aesthetics and playability 为解决上述技术问题,本发明的目的是通过以下技术方案实现的: (1)保存上一游戏循环的地图图像数据;(2 )获取下一游戏循环与上一游戏循环玩家所在位置的纵横向世界坐标, 根据所述纵横向世界坐标获得下一游戏循环与上一游戏循环中地图的纵橫向象素差;(3 )将保存的上一游戏循环的地图图像数据取出,根据象素差进行绘制。 To solve the above problems, an object of the present invention is achieved by the following technical solutions: (1) a stored map image data on the game loop; (2) the game loop get the next cycle with the position of the player a game where the vertical and horizontal world coordinates, according to an aspect of the game loop get the next pixel difference to the world coordinates to the map on a game loop aspect; (3) the image map data stored on a game loop extraction, according to pixel difference draw. (4)根据象素差,绘制所保存图像数据中未显示的部分。 (4) The pixel difference, not shown in the partial image data stored in the drawing. 其中,所述步骤(1)之前进一步包括: (0 )第一次绘制游戏循环地图时,顺序绘制地表图素块。 Wherein, prior to said step (1) further comprises: (0) for the first time the game loop map drawing, the drawing surface of FIG pixel block sequence. 其中,所述步骤(0)之前进一步包括:1) 将世界地图划分成地表图素块;2) 从世界地图的起始点开始为每个地表图素块设置一个唯一编号。 Wherein said step (0) before further comprises: 1) the surface map of the world divided into picture element block; 2) starts to set up a unique number for each pixel block in FIG surface from a starting point in the world map. 其中,所述步骤1)进一步包括:11)将世界地图划分为关卡地图;12)以关卡地图左上角顶点为起始点划分成地表图素块。 Wherein said step a) further comprises: 11) is divided into a world map levels map; 12) to checkpoint the map as a starting point the top left vertex of surface divided into pixel blocks of FIG. 其中,所述步骤(0)包括:(01) 获取玩家所在位置的世界坐标;(02) 根据获取的世界坐标计算该游戏循环地图顶点的世界坐标;(03) 根据计算出的顶点坐标的坐标获取相应的地表图素块;(04) 以左上角的顶点为起始点顺序绘制地表图素块。 Wherein said step (0) comprising: (01) obtaining the coordinate position of the player is the world; (02) coordinates of the world map game loop vertex world coordinate is calculated according to the acquired; (03) based on the calculated coordinates of the vertex coordinates surface obtain the corresponding picture element blocks; (04) the top left vertex order as the start point pixel block drawing surface of FIG. 其中,所述步骤(2)中根据所述纵横向世界坐标获得下一游戏循环与上一游戏循环中地图的纵横向象素差包括:根据上一游戏循环玩家横向世界坐标与下一游戏循环玩家横向世界坐标的差值得出下一游戏循环与上一游戏循环中地图的橫向象素差;才艮据上一游戏循环玩家纵向世界坐标与下一游戏循环玩家纵向世界坐标的差值得出下一游戏循环与上一游戏循环中地图的纵向象素差。 Wherein said step (2) is obtained according to a next aspect of the game loop to the world coordinates and the game loop in a vertical and horizontal pixel difference map comprising: a game cycle in accordance with the players and the next game world coordinates lateral cycle players lateral world coordinate difference pixel difference derived lateral cyclic next game on the map with a game loop; Gen only data on a game player longitudinal vertical circulation world coordinates and world coordinates of the difference between the next cycle of the game players come under a game on a game loop circulation and longitudinally pixel difference map. 其中,所述步骤(3)进一步包括:计算该地图在屏幕中的绘制点的世界坐标,并在屏幕中显示上下游戏循环地图图像数据相同的部分。 Wherein said step (3) further comprising: calculating world coordinates of the mapping point in the screen, and shows the same vertical section game loop map image data on the screen. 其中,所述步骤(4)包括:(41) 获取图像数据中未显示部分的地表图素块;(42) 获取每个地表图素块的起始点坐标;(43 )根据每个地表图素块对应的起始点坐标分别绘制游戏循环地图。 Wherein said step (4) comprises: (41) acquires image data of the pixel block portion of FIG surface is not shown; (42) acquires the coordinates of the starting point of each picture element block surface; (43) The surface of each picture element corresponding to the block start point map coordinates are plotted game loop. 其中,所述步骤(4)进一步包括:(41) 删除緩冲区中保存的上一游戏循环中的地图图像数据;(42) 将下一游戏循环中所显示的地图图像数据保存到内存中。 Wherein said step (4) further comprises: (41) remove the map image data stored in the buffer on a game cycle; (42) to save the map image data displayed in the next game cycle into memory . 其中,对所述的游戏循环地图进行周期绘制。 Wherein said game periodic cycle map drawing. 以上技术方案可以看出,在上一游戏循环中绘制完地图时,保存了该地图图像数据,下一游戏循环时,从内存中获取所保存的上一游戏循环中的地图图像数据,根据上下游戏循环中地图象素差,直接对上一游戏循环地图进行绘制, 然后再以地表图素块为单位绘制所保存图像中没有绘制的部分,这样就避免了重新以地表图素块为单位绘制上下游戏循环地图相同的部分。 As can be seen above technical solutions, when drawing a map finished, the map image data stored in a game loop, when the next game cycle, acquiring the map image data stored on a game loop from memory, according to the uplink game loop map pixel difference, directly on a drawn map game loop, and then to block picture element surface part of the image is not drawn plotted saved, thus avoiding re-pixel block in the surface is plotted in FIG. the same part of the game up and down cycle map. 因此,减少了绘制地图时的逻辑运算,节省了时间,缩短了绘制游戏地图的循环周期,实现在不牺牲画面质量的情况下,保证游戏的流畅性、美观性和可玩性。 Thus, reducing the time of mapping logical operation, saving time and shortening the cycle time of the game map drawing, achieved without sacrificing image quality, to ensure the smooth game, aesthetics and playability. 附图说明图1为本发明实施例的流程图; 图2为本发明的世界地图; 图3为本发明上一游戏循环所显示的地图; 图4为本发明当前游戏循环所显示的地图; 图5为本发明上一游戏循环与当前游戏循环比较所得到的地图。 1 shows a flowchart of an embodiment of the present invention; FIG. 2 is a map of the world the invention; FIG. 3 on a map displayed on the game loop to the present invention; FIG. 4 of the present invention, the game loop current map displayed; FIG 5 the circulation and this game a game cycle map obtained comparing present invention. 具体实施方式本发明为一种游戏中的地图绘制方法,为使本发明的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本发明进一步进行详细说明。 DETAILED DESCRIPTION The present invention is a method of mapping the game, for the purposes of the present invention, technical solutions and advantages clearer, the accompanying drawings simultaneously embodiment, the present invention is described in further detail below with reference. 首先,对本发明所提供的方法进行总体描述:本发明所提供的方法包括步骤:步骤(1 ):第一次绘制背景地图时,依据玩家位置的世界坐标、屏幕大小计算出当前地图起始点的世界坐标,获取当前屏幕中相应的地表图素块,顺序绘制;步骤(2):将上一游戏循环的当前地图作为图像数据保存在内存中;步骤(3):获取玩家在下一循环中的世界坐标,计算出与上一游戏循环中世界坐标的纵横向的象素差;步骤(4):下一游戏循环时,将保存的上一游戏循环的地图图像数据取出, 根据象素差,计算出该地图在屏幕中的绘制点的世界坐标,进行绘制;步骤(5):根据象素差,获取所保存的图像中没有显示的地表图素块,进行绘制。 First, the method of the present invention provides a general description: The present invention provides a method comprising the steps of: Step (1): The first time the map drawing the background, based on the world coordinate position of the player, the screen size of the start point to calculate the current map world coordinates, to obtain the corresponding surface in FIG pixel block currently displayed in the order of drawing; step (2): the last game loop current map image data stored in memory; step (3): Get the player in the next cycle world coordinate is calculated on a pixel and the game loop to the world coordinates of the vertical and horizontal difference; step (4): when the next cycle of the game, the map image data stored on a game loop extraction, according to pixel difference, calculated world coordinates of the mapping point in the screen, draw; step (5): the difference between the pixel acquires surface picture element block stored in the image is not displayed, plotted. 计算过程:假设世界地图为500 x 500,划分为20*20的地表图素块,则该世界地图有25*25个地表图素块,按橫向排列为地表图素块设置编号,分别为1, 2, 3.....625,编号1的地表图素块的四个顶点坐标为(0, 0), (20, 0), (0, 20), (20, 20);编号2的地表图素块的四个顶点坐标为(20, 0), (40, 0), (0, 20), (40, 40);依此类推,编号为625的地表图素块的四个顶点坐标为(480, 480 ), ( 480, 500 ), (500, 480 ), ( 500, 500)假设屏幕大小为100 x 100象素,屏幕的四个顶点的屏幕坐标是:(0,0), (100,0), (O,IOO), ( 100,100)假设当前玩家的世界坐标为(60, 80 ),玩家位置位于屏幕中心。 Calculation: assume world map for 500 x 500, divided into a surface picture element block of 20 * 20, the world map has a 25 * 25 Surface picture element block provided numbered arranged transversely to the surface picture element block, respectively 1 , 2, 3 ..... 625, four vertex coordinates of picture element blocks numbered surface 1 is (0, 0), (20, 0), (0, 20), (20, 20); number 2 surface vertex coordinates of the four picture element block is (20, 0), (40, 0), (0, 20), (40, 40); and so on, the surface number is four pixel block 625 of FIG. vertex coordinates (480, 480), (480, 500), (500, 480), (500, 500) assuming the screen size of 100 x 100 pixels, the coordinates of four vertices of the screen is a screen: (0,0 ), (100,0), (O, IOO), (100,100) assumes that the current players in the world coordinates (60, 80), player position is located in the center of the screen. 第一次绘制该地图时,通过以下计算,进行绘制:当前i也图的四个顶点坐才示为:(x0,y0) , (xl,y0), (x0,yl), (xl,yl), 根据公式:(x0+xl)/2=60, x0+xl = 100, (y0+yl)/2=80, y0+yl=100,可以计算出当前地图4个顶点的世界坐标分别为(10,30 ),( 110, 30), ( 10, 130), (110, 130),其中(10,30)为屏幕(0,0)点的世界坐标,也是当前地图起始点的世界坐标。 The first time the map drawn by the following calculation, to draw: a current i also take four vertices of FIG was shown as: (x0, y0), (xl, y0), (x0, yl), (xl, yl ), according to the formula: (x0 + xl) / 2 = 60, x0 + xl = 100, (y0 + yl) / 2 = 80, y0 + yl = 100, can calculate the current world coordinates map the four vertices are (10, 30), (110, 30), (10, 130), (110, 130), of which (10, 30) for the screen (0,0) world coordinates of points, but also the current map coordinates of the starting point of the world . 根据该起始点坐标(IO, 30),可获知该点坐标位于第一列,第二4亍的地表图素块中。 According to the start point coordinates (IO, 30), which is known coordinate point in the first column, the second surface of the right foot 4 pixel block in FIG. 由于屏幕大小为100 x 100,可获知当前地图四个顶点的坐标为:(10, 30 ), ( 110, 30 ), ( 10, 130 ), ( 110, 130),应绘制的地表图素块为第l列至第6列,第2行至第7行获取该图素块,进行绘制时,将第1列,第2 行的地表图素块的(10, 30)点绘制在屏幕的(0,0)点上。 Because the screen size is 100 x 100, may know the current map coordinates of four apexes of: (10, 30), (110, 30), (10, 130), (110, 130), the surface to be rendered pixel blocks of FIG. is the l th column to column 6, line 7 to obtain the picture element blocks, draw line 2 to the column 1, row 2 of surface picture element blocks (10, 30) points plotted on the screen (0,0) point. 即绘制的地表图素块共为36个,绘制的地图实际大小为120 x 120,玩家通过屏幕看到的地图大小是100*100。 That is plotted in FIG surface a total of 36 pixel blocks, the map drawn to actual size 120 x 120, the player through the screen to see the map size is 100 * 100. 将显示的100 x 100地图的图像数据保存在内存中,该地图以P表示,其对应的四个顶点坐标,即当前地图坐标是:(10, 30), (110, 30),(10, 130), ( 110, 130)。 100 x 100 maps the image data stored in memory to be displayed in the map represents P, which corresponds to the four vertex coordinates, i.e., the current map coordinates: (10, 30), (110, 30), (10, 130), (110, 130). 下一游戏循环时,若玩家位置横向移动了+15个象素,即玩家坐标为(75,80),由于象素差小于地表图素块的大小,因此,当前地图对应的地表图素块仍是第1列至第6列,第2行至第7行的地表图素块,保存的图像P中覆盖了当前地图中点(25,30 )和点(110, 130)构成的面积,此面积即为上一游戏循环与下一游戏循环地图的相同部分,上下游戏循环地图不同部分为第6列中6个地表图素块偏移+ 15个象素后的部分,再绘制这部分地图时是以地表图素块为单位进行绘制的,因此需要重新绘制第6列中的6个地表图素块,绘制时, 取出内存中保存的上一游戏循环中的地图的图像数据P,进行绘制,将该图像的(25,30)点绘制在屏幕的(0,0)点上,绘制完该图像后,重新绘制第6列中的6个地表图素块,每个地表图素块的绘制起始点,分别为图像P上的世界坐标为(100, 30 ), ( 100, When the next cycle of the game, if a player position +15 pixels moved laterally, i.e., coordinates of the player (75, 80), since the difference is smaller than the pixel size of the surface of the picture element blocks, and therefore, the map corresponding to the current picture element block surface still column to the sixth column, the surface picture element block line 2 to line 7, the image P stored in the map covering the area of ​​the current point (25, 30) and points (110, 130) configured, this is the same as the area of ​​a portion of the game loop to the next cycle of the game map, the vertical part of the game loop maps for the sixth column of the offset portion of the rear surface 15 pixels 6 + picture element blocks, then this part of the drawing when the surface map is plotted picture element block as a unit, and therefore need to be redrawn in column 6 of the picture element block surface 6, when drawn, taken saved in the memory on a game loop P map image data, draw, the (25, 30) of the image drawn on the point (0,0) of the screen, the image rendering after redraw column 6 6 surface picture element blocks, each picture element surface drawing the starting point of the block, respectively, the image P world coordinates (100, 30), (100, 50 ), ( 100, 70 ), ( 100, 90), (100, 110), (100, 130)的6个点。 50), (100, 70), (100, 90), (100, 110), (100, 130) of the 6 points. 绘制完成后,将当前地图保存到内存中,该地图以P1表示, 其对应的四个顶点坐标是:(25, 30 ), ( 125, 30), (25, 130), (125, 130)。 After the drawing is complete, save the current memory map, the map represented by P1, which corresponds to the coordinates of four vertices are: (25, 30), (125, 30), (25, 130), (125, 130) . 下面参照附图进行详细说明:参见图1,实现本发明的具体流程如下:步骤101:判断当前游戏循环中的世界地图或关卡地图是否是第一次绘制,若是,则进行步骤102,否则,进行步骤104;步骤102:依据玩家位置的世界坐标、屏幕大小计算出当前地图四个顶点的世界坐标,获取相应的地表图素块,并顺序进行绘制;步骤103:将当前地图作为图像数据保存在緩冲区中;步骤104:从緩冲区中取出保存的上一游戏循环中的地图图像数据,根据象素差,计算出该地图在屏幕中的绘制点的世界坐标,进行绘制;步骤105:获取玩家当前位置的世界坐标,计算与上一游戏循环中玩家位置的象素差;步骤106:根据象素差,获取所保存的图像中没有显示的地图部分所对应的地表图素块,顺序进行绘制;步骤107:删除緩沖区中所保存的上一游戏循环中的地图图像数据,将下一游戏循环 Described in detail below with reference to the accompanying drawings: Referring to Figure 1, the specific implementation of the invention process is as follows: Step 101: determining whether the current game world map, or cycle map levels if the first draw is, if yes, proceeds to step 102, otherwise, step 104; step 102: based on the world coordinate position of the player, the screen size to calculate the current map coordinates of the four vertices of the world, to obtain the corresponding surface of the picture element blocks, and sequentially drawn; step 103: the image data is stored as the current map in the buffer; step 104: remove the preservative from the buffer map image data on a game loop, according to the pixel difference calculated world coordinates of the mapping point in the screen, draw; step 105: Get the current position of the player's world coordinates, calculates pixels on a game player position loop difference; step 106: the difference between the pixel acquires picture element block surface portion of the map stored in the image is not displayed in the corresponding sequentially drawn; step 107: remove the map image data stored in the buffer in the previous cycle of the game, the next game cycle 所显示的地图图像数据保存到内存中。 Save the map displayed image data into memory. 其中,进行本流程之前还需如下步骤,具体包括:(a) :将世界地图划分成地表图素块;(b) :为每个地表图素块设置一个唯一编号;其中,步骤(a)中,若世界地图进一步划分为关卡地图,则以关卡地图为单位,对每个关卡地图进行划分。 Wherein, prior to the present step of the process needs, comprises: (a): The world map is divided into blocks of picture elements surface; (b): a unique number is provided for each picture element block surface; wherein the step (a) , if the map of the world map further divided into levels, places the unit level map, the map is divided for each level. 下面结合本发明的游戏循环界面,进一步进行详细说明:参见图2,将世界地图划分成大小相等,形状为正方形的地表图素块,然后以世界地图的左上角作为起始点对每个地表图素块设置一个编号,在本发明中将世界地图分为大小相等,形状为正方形的20个地表图素块,从左上角开始用1至20的数字对这20个地表图素块顺序编号。 Below in connection with the game loop interface of the present invention is further described in detail: Referring to Figure 2, the world map is divided into equal size, the surface shape of a square block of picture elements, then the upper left corner of the world map as a starting point for each surface in FIG. setting a pixel block number, in the present invention, the world map into equal size, the shape of a square picture element block surface 20, from the upper left corner with the numbers 1 to 20 on this surface in FIG. 20 pixel block sequence number. 在第一次绘制背景地图时,依据当前玩家的坐标位置,计算出当前地图起始点在世界地图中的世界坐标,根据世界坐标,可顺序绘制该世界坐标开始的地表图素块。 In the first drawing the background map, based on the coordinates of the current position of the player, and to calculate the current map coordinates of the starting point in the world map of the world, according to world coordinates, to draw the surface of the picture element block of the world coordinate of the start sequence. 参见图3,为本发明的上一游戏循环所显示的地图,上一游戏循环所显示的地图用A区表示,包括编号分别为1、 2、 3、 5、 6、 7、 9、 10、 11的地表图素块,其中,标号为6的地表图素块表示当前玩家所在的位置。 Referring to Figure 3, a map of the game loop shown in the present invention, a map of the game loop shown represent the area A, including numbered 1, 2, 3, 5, 6, 7, 9, 10, surface 11 of FIG pixel block, wherein the reference surface is a pixel block of FIG. 6 represents the position of the current player is on. 标号为1、 2、 3、 5、 6、 7、 9、 10、 11的地表图素块所在的地图,即标号为6的地表图素块为中心,手机屏幕所能显示的地图作为当前地图;将A区表示的地图保存到緩冲区。 Reference numeral 1, 2, 3, 5, 6, 7, 9, picture element block map surface 10, 11 is located, i.e., reference picture elements for the surface of the center block 6, the phone screen can display the current map as map ; a map will be saved to the buffer zone represented. 将A区保存到緩冲区的目的是为了在下一游戏循环时避免在每个游戏循环中绘制背景时,减少背景中的地表图素块的重复绘制,由于玩家游戏过程中, 不论是行走,跑动,还是静止状态,其所在的上一游戏循环所显示的地图与当前游戏循环所显示的地图的差别不会太大,例如如杲玩家处于静止状态,则地图不发生变化,若要重新绘制所有地表图素块,则会占用有限资源;若玩家处于行走或跑动状态,玩家所在的位置, 一般情况下只是在原有位置基础上,移动有限的象素,地图的变化,只是几个象素位置的变化,大部分的地表图素块, 在下一游戏循环时仍需重新绘制。 A buffer area to save the purpose is to avoid the background is drawn in each game cycle, reduce surface drawing in FIG background pixel block is repeated at the next cycle of the game, since the player during the game, whether it is walking, running, or an inactive state, the difference map of map they are in a game loop on the game show with the current cycle display is not too large, such as Gao players at a standstill, the map does not change, to re FIG surface draw all pixel blocks, will occupy the limited resources; if the player is walking or running state, the position where the player, generally only in the original position based on the movement limited pixel map changes, only a few change pixel position, most of the surface of the picture element blocks, still redrawn when the next game cycle. 参见图4,为下一游戏循环所显示的地图,下一游戏循环所显示的地图用B区表示,包括标号为2、 3、 4、 6、 7、 8、 10、 11、 12的地表图素块,其中, 标号为7的地表图素块表示当前玩家所在的位置。 Referring to FIG 4, a game map for the next display cycle, the next cycle game map display region is represented by B, including designated 2, 3, 4, 6, 7, 8, 10, surface 11, 12 of pixel blocks, wherein the reference surface is a pixel block of FIG. 7 indicates a position where the current player. 当前游戏循环所显示的地图的绘制包括以下步骤:步骤(l):依据当前玩家所在的位置,计算出与上一游戏循环中玩家位置的象素差;步骤(2):从緩冲区中取出上一游戏循环所表示的地图,根据象素差,计算出该地图在屏幕中的绘制坐标,进行绘制;步骤(3):根据像素差,绘制图像中没有显示的地图部分所对应的地表图素块,即标号分别为4、 8、 12的地表图素块;至此,完成了当前游戏循环所显示的地图的绘制,最后显示在屏幕中的当前地图用B区表示,包括标号分别为2、 3、 4、 6、 7、 8、 10、 11、 12的地表图素块,在此之后还应包括:步骤(4):将B区表示的地图保存到緩冲区中。 Current game loop drawing the displayed map comprising the following steps: Step (L): depending on the location where the current player is calculated in the previous cycle, the game player positions the pixel difference; Step (2): from the buffer remove the map represented by a game cycle, according to pixel difference, calculates the coordinates of the map drawn in the screen, draw; step (3): the pixel difference, mapping partial image not corresponding to the display surface FIG pixel block, i.e., reference numeral respectively 4, 8, the surface picture element block 12; this completes the current game cycle displayed map drawing, and finally display the current map by B region in the screen representation, including reference numerals, respectively 2, 3, 4, 6, 7, 8, 10, the surface picture element block 11, 12, after which also comprises: step (4): save a map showing area B into the buffer. 在绘制当前地图时,利用了上一游戏循环所保存的地图图像数据,即A 区,根据上一游戏循环玩家所在的位置即标号为6的地表图素块,与当前游戏循环玩家所在的位置即标号为7的地表图素块,可看出当前游戏循环玩家所在的位置只是在上一游戏循环玩家所在位置的基础上,移动有限的象素,因此, 地图的变化,只是几个象素位置的变化,在绘制当前游戏循环地图的过程中, 就避免了重复绘制标号分别为2、 3、 6、 7、 10、 11的地表图素块,只需绘制变化的部分,即标号分别为4、 8、 12的地表图素块。 When drawing the current map using the map image data on a game loop stored, i.e. A region, according to a position on a game loop player is on, i.e., designated surface in FIG pixel block 6, the position of the current game loop player located i.e. the surface designated pixel block in FIG. 7, it can be seen the position of a current game player is only in the cycle based on a position where the player on the game loop, limited movement of pixels, thus, the map changes, only a few pixels change in position, during the draw cycle map in the current game, to avoid repetition section drawing reference numerals are 2, 3, 6, picture element surface block 7, 10, 11, simply changing the drawing, reference numerals respectively i.e. 4, 8, pixel block 12 in FIG surface. 参见图5,为本发明上一游戏循环与下一游戏循环比较所得的地图。 Referring to Figure 5, the game loop with a resultant comparison cycle map for the next game of the present invention. 其中,I区表示上一游戏循环与下一游戏循环不同的部分,II区表示上一游戏循环与下一游戏循环相同的部分,在绘制地图时,先将A区保存在緩冲区中,在绘制B区时将A区从緩冲区中取出,根据玩家位置在上下游戏循环中的横纵向象素差,计算出A区在屏幕中的绘制坐标,进行A区的绘制,然后再绘制B区中A区所没有显示的部分,即标号分别为4、 8、 12地表图素块, 这时在手机内存中有I区、1I区和标号分别为4、 8、 12地表图素块,但是由于手机的屏幕有限,玩家所能看到的地图为II区和标号分别为4、 8、 12地表图素块。 Wherein, the I field indicates the next cycle of the game on a different part of the game loop, II region indicates a game loop on the next cycle of the same part of the game, when drawing a map, the first area A stored in the buffer, the removed region a region B is drawn from the buffer, the pixel difference in longitudinal vertical cross-cycle game based on the player position, calculates the coordinates of the drawing area a in the screen, draw zone a, and then draw a area B portion of the region, not shown, respectively, i.e., reference numeral 4, 8, 12 surface picture element block, then I have in the phone memory region, respectively. 1I region and reference numeral 4, 8, 12 picture element block surface but, due to the phone's screen, the player can see a reference map for zone II and 4, respectively, 8, surface 12 pixel block in FIG. 绘制一个游戏地图时,将绘制好的当前游戏循环所显示的地图保存到緩冲区,是为了下一游戏循环绘制游戏地图时,减少游戏地图中相同部分地图重新以地表图素块为单位进行绘制,本实施例中,上下游戏循环中游戏地图相同的部分为II区,在绘制时,只需以地表图素块为单位绘制上一游戏循环中没有显示的部分地图,即标号分别为4、 8、 12的地表图素块。 When drawing a game map, the map drawing a good save the current game loop shown to the buffer, in order to draw the game map when the game loop to the next, reducing the same part of the game map to re-map the surface picture element units of blocks drawing, in this embodiment, the vertical game map game loop region II moiety is the same, when the drawing, only the surface to block picture element is plotted on a portion of the map is not displayed in the game loop, i.e., reference numeral 4 respectively , the surface 8, the 12 pixel block. 以上对本发明所提供的一种游戏中的地图绘制方法进行了详细介绍,本文只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 More than a game of mapping method provided by the invention are described in detail in this article is only used to help understand the method and core ideas of the present invention; at the same time, those of ordinary skill in the art, according to the ideas of the present invention, may make modifications to the specific embodiments and application scope of the specification shall not be construed as limiting the present invention.

Claims (10)

  1. 1. 一种游戏中的地图绘制方法,其特征在于,包括步骤: (1)保存上一游戏循环的地图图像数据; (2)获取下一游戏循环与上一游戏循环玩家所在位置的纵横向世界坐标,根据所述纵横向世界坐标获得下一游戏循环与上一游戏循环中地图的纵横向象素差; (3)将保存的上一游戏循环的地图图像数据取出,根据象素差进行绘制; (4)根据象素差,绘制所保存图像数据中未显示的部分。 A method for mapping of a game, characterized by comprising the steps of: (1) a stored map image data on the game loop; (2) the game loop get the next cycle of the position where the player the game on a vertical and horizontal world coordinates, according to an aspect of the game loop get the next pixel difference to the world coordinates to the map on a game loop aspect; (3) the image map data stored on a game loop extraction, according to pixel difference rendering; (4) the portion of the image data is not displayed according to the stored pixel difference, drawing.
  2. 2、 根据权利要求1所述的游戏中的地图绘制方法,其特征在于,所述步骤(1)之前进一步包括:(0) 第一次绘制游戏循环地图时,顺序绘制地表图素块。 2. The game method of mapping according to claim 1, wherein further comprising, prior to said step (1): (0) for the first time the game loop map drawing, the drawing surface of FIG pixel block sequence.
  3. 3、 根据权利要求2所述的游戏中的地图绘制方法,其特征在于,所述步骤(0)之前进一步包括:1) 将世界地图划分成地表图素块;2) 从世界地图的起始点开始为每个地表图素块设置一个唯一编号。 3, the map drawing method in a game according to claim 2, wherein said step (0) before further comprises: 1) the surface map of the world divided into picture element block; 2) starting from the world map start a unique number is provided for each picture element block surface.
  4. 4、 根据权利要求3所述的游戏中的地图绘制方法,其特征在于,所述步骤l)进一步包括:11) 将世界地图划分为关卡地图;12) 以关卡地图左上角顶点为起始点划分成地表图素块。 4. The game method of mapping according to claim 3, wherein said step l) further comprises: 11) is divided into a world map levels map; 12) to checkpoint the map as a starting point the top left vertex division FIG surface into pixel blocks.
  5. 5、 根据权利要求2所述的游戏中的地图绘制方法,其特征在于,所述步骤(0)包括:(01) 获取玩家所在位置的世界坐标;(02) 根据获取的世界坐标计算该游戏循环地图顶点的世界坐标; (03 )根据计算出的顶点的世界坐标获取相应的地表图素块;(04)以左上角的顶点为起始点顺序绘制地表图素块。 5. The game method of mapping according to claim 2, wherein said step (0) comprising: (01) obtaining the coordinate position of the player is the world; (02) is calculated according to the game world coordinate acquired vertex coordinate world map of the cycles; (03) acquires the corresponding surface of the picture element block according to the calculated world coordinates of the vertices; (04) the top left vertex order as the start point pixel block drawing surface of FIG.
  6. 6、 根据权利要求1所述的游戏中的地图绘制方法,其特征在于,所述步骤(2)中根据所述纵橫向世界坐标获得下一游戏循环与上一游戏循环中地图的纵横向象素差包括:根据上一游戏循环玩家横向世界坐标与下一游戏循环玩家横向世界坐标的差值得出下一游戏循环与上一游戏循环中地图的横向象素差;才艮才居上一游戏循环^元家纵向世界坐标与下一游戏循环J元家纵向世界坐标的差值得出下一游戏循环与上一游戏循环中地图的纵向象素差。 6. The game method of mapping according to claim 1, wherein said step (2) in accordance with an aspect of the game loop get the next aspect of the game loop in a world map coordinates to the image factors include poor: come to the next game cycle transverse pixel difference map on a game loop and a game based on the difference between the lateral transverse circulation players in world coordinates of the world coordinate cycle to the next game player; it was living on a Gen game ^ membered cyclic longitudinal home game world coordinates to the next home membered cyclic J world coordinate difference longitudinal vertical pixel difference obtained in the previous cycle of the next game in the game loop map.
  7. 7、 根据权利要求1所述的游戏中的地图绘制方法,其特征在于,所述步骤(3)进一步包括:计算该地图在屏幕中的绘制点的世界坐标,并在屏幕中显示上下游戏循环地图图像数据相同的部分。 7, the map drawing method in a game according to claim 1, wherein said step (3) further comprising: calculating world coordinates of the mapping point in the screen, and displays the screen up and down game loop map image data of the same section.
  8. 8、 根据权利要求1所述的游戏中的地图绘制方法,其特征在于,所述步骤(4)包括:(41) 获取图像数据中未显示部分的地表图素块;(42) 获取每个地表图素块的起始点坐标;(43 )根据每个地表图素块对应的起始点坐标分别绘制游戏循环地图。 8. The game method of mapping according to claim 1, wherein said step (4) comprises: (41) acquires image data of the pixel block portion of FIG surface is not shown; (42) takes each starting point picture element block surface; (43) are plotted according to each game cycle map corresponding to the pixel block in FIG surface starting point.
  9. 9、 根据权利要求1所述的游戏中的地图绘制方法,其特征在于,所述步骤(4)进一步包括:(41 )删除緩沖区中保存的上一游戏循环中的地图图像数据;(42 )将下一游戏循环中所显示的地图图像数据保存到内存中。 9, the map drawing method in a game according to claim 1, wherein said step (4) further comprises: (41) remove the map image data stored in the buffer on a game cycle; (42 ) save the map image data of the next game loop displayed in memory.
  10. 10、 根据权利要求1所述的游戏中的地图绘制方法,其特征在于,对所述的游戏循环地图进行周期绘制。 10, the map drawing method in a game according to claim 1, wherein the game loop drawing the map cycle.
CN 200610089679 2006-07-11 2006-07-11 Method for drawing map in game CN100421119C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200610089679 CN100421119C (en) 2006-07-11 2006-07-11 Method for drawing map in game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200610089679 CN100421119C (en) 2006-07-11 2006-07-11 Method for drawing map in game

Publications (2)

Publication Number Publication Date
CN1885296A true CN1885296A (en) 2006-12-27
CN100421119C true CN100421119C (en) 2008-09-24

Family

ID=37583446

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200610089679 CN100421119C (en) 2006-07-11 2006-07-11 Method for drawing map in game

Country Status (1)

Country Link
CN (1) CN100421119C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100517349C (en) 2007-06-28 2009-07-22 中兴通讯股份有限公司 Game picture saving system and method
CN103198112A (en) * 2013-03-28 2013-07-10 广东威创视讯科技股份有限公司 Incremental update method and device in distributed display
CN103729558A (en) * 2013-12-26 2014-04-16 北京像素软件科技股份有限公司 Scene change method
CN104571994A (en) * 2014-12-31 2015-04-29 苏州乐米信息科技有限公司 Loop playback method for background map in mobile game
CN105381611A (en) * 2015-11-19 2016-03-09 网易(杭州)网络有限公司 Method and device for layered three-dimensional display of 2D game scene

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1088573A2 (en) 1999-09-30 2001-04-04 KCE Tokyo Inc. Method and a video game system of generating a field map
US6347995B1 (en) 1999-09-30 2002-02-19 Konami Corporation Method, computer-readable storage medium and video game device for automatically generating a maze map with at least one correct path
CA2347290A1 (en) 2001-05-09 2002-11-09 Free Radical Design Limited Methods and apparatus for constructing virtual environments
CN1584907A (en) 2003-08-20 2005-02-23 英业达股份有限公司 Artificial game system and method for combining geographic information
CN1624704A (en) 2004-12-02 2005-06-08 高永安 Construction method of virtual world imitating analogue real world in network game software

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1088573A2 (en) 1999-09-30 2001-04-04 KCE Tokyo Inc. Method and a video game system of generating a field map
US6347995B1 (en) 1999-09-30 2002-02-19 Konami Corporation Method, computer-readable storage medium and video game device for automatically generating a maze map with at least one correct path
CA2347290A1 (en) 2001-05-09 2002-11-09 Free Radical Design Limited Methods and apparatus for constructing virtual environments
CN1584907A (en) 2003-08-20 2005-02-23 英业达股份有限公司 Artificial game system and method for combining geographic information
CN1624704A (en) 2004-12-02 2005-06-08 高永安 Construction method of virtual world imitating analogue real world in network game software

Also Published As

Publication number Publication date Type
CN1885296A (en) 2006-12-27 application

Similar Documents

Publication Publication Date Title
US20020122036A1 (en) Image generation method and device used therefor
US20050227761A1 (en) Portable game machine and computer-readable recording medium
US7123266B2 (en) Method and apparatus for a video graphics circuit having parallel pixel processing
US6339430B1 (en) Video game machine and method for changing texture of models
US20080030513A1 (en) Graphics processing unit with extended vertex cache
US7104891B2 (en) Game machine and game program for displaying a first object casting a shadow formed by light from a light source on a second object on a virtual game space
JP2009237680A (en) Program, information storage medium, and image generation system
US7102639B2 (en) Image processing apparatus, image processing method, information processing apparatus, information processing system, semiconductor device and computer program
US6856321B2 (en) Texture rendering method, entertainment apparatus and storage medium
CN102307312A (en) Method for performing hole filling on destination image generated by depth-image-based rendering (DIBR) technology
JPH10113471A (en) Video game machine and medium with video game program recorded
US20020101428A1 (en) Graphic engine and method for reducing idle time by validity test
CN1949269A (en) Cartoon realizing method and cartoon drawing system thereof
US20050248580A1 (en) Image processing system for increasing the number of rendered polygons
US20050046625A1 (en) Image creation program and method of creating image
JP2003085578A (en) Game information, information storage medium and game device
CN101388157A (en) Electronic map display packing, apparatus and equipment
US20020101435A1 (en) Apparatus and method for rendering antialiased image
JP2009064356A (en) Program, information storage medium, and image generation system
US6911985B1 (en) Method and apparatus for reducing frame buffer size in graphics systems
CN101388967A (en) Gap filling method for view synthesis
JP2007026111A (en) Program, information storage medium, and image creation system
US20030025710A1 (en) Rendering processing method
CN101968888A (en) Vector graph filling method for mobile terminal
CN1670766A (en) Image zooming method

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted