Cloud game screen rendering method, device, electronic device and storage medium
By compressing and fusing image rendering instruction data in cloud games, the problem of high bandwidth of cloud games is solved, and bandwidth usage is reduced while ensuring image quality is not lost.
Patent Information
- Application Number
- CN202110174738.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-08
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2041-02-08
AI Technical Summary
It is difficult for existing cloud gaming technology to effectively reduce the bandwidth occupied while ensuring the game picture quality.
By obtaining the image rendering instruction data of the target game, determining the image instruction parameters of the preset parameter type, compressing its data sequence, and fusing the processed instruction parameters to generate the fused image rendering instruction to reduce the amount of data and reduce bandwidth.
On the premise of ensuring that the game picture quality is not lost, the bandwidth usage of cloud games will be significantly reduced and network transmission efficiency will be improved.
Smart Images

Figure CN114904274B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for rendering a picture of a cloud game. Background Art
[0002] Cloud gaming, also known as gaming on demand, is an online gaming technology based on cloud computing. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, the game is not played on the player's game terminal, but on a cloud server.
[0003] At present, cloud games include video streaming cloud games and command streaming cloud games. In video streaming cloud games, the cloud server renders the game scene into a video and audio stream and transmits it to the player's game terminal through the network. The player's game terminal does not need to have powerful graphics computing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input commands and send them to the cloud server; in command streaming cloud games, the cloud server transmits image rendering commands to the player's game terminal, and the player's game terminal uses its own graphics processor to render the picture. Compared with video streaming cloud games, the advantage is that there is no loss in game quality, but the bandwidth occupied by command streaming cloud games is much higher than that of video streaming cloud games. Summary of the invention
[0004] The present application provides a method, device, electronic device and storage medium for rendering a picture of a cloud game, which can reduce the bandwidth occupied by the cloud game while ensuring that the game image quality is not lost.
[0005] The present application provides a cloud game screen rendering method, including:
[0006] Acquire image rendering instruction data of a target game, wherein the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter;
[0007] According to the parameter type of the image instruction parameter, determining an image instruction parameter whose parameter type is a preset parameter type from at least one image instruction parameter as a target image instruction parameter;
[0008] According to the parameter value of the target image instruction parameter, compressing the data sequence of the target image instruction parameter into a data sequence of a predetermined format to obtain a processed instruction parameter;
[0009] Performing fusion processing on the processed instruction parameters to obtain fused image rendering instructions;
[0010] The fused image rendering instruction is sent to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction.
[0011] Accordingly, the present application also provides a screen rendering device for a cloud game, comprising:
[0012] An acquisition module, used for acquiring image rendering instruction data of a target game, wherein the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter;
[0013] a determination module, configured to determine, according to the parameter type of the image instruction parameter, an image instruction parameter of a preset parameter type from at least one image instruction parameter as a target image instruction parameter;
[0014] A compression module, used for compressing the data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter, to obtain a processed instruction parameter;
[0015] A fusion module, used for performing fusion processing on the processed instruction parameters to obtain a fused image rendering instruction;
[0016] The sending module is used to send the fused image rendering instruction to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction.
[0017] Optionally, in some embodiments of the present application, the compression module includes:
[0018] An acquisition unit, used for acquiring a parameter value of the target image instruction parameter;
[0019] A determination unit, used to determine a cache sequence allocated to the target image instruction parameter;
[0020] The compression unit is used to compress the data sequence of the target image instruction parameter into a data sequence in a predetermined format based on the parameter value of the target image instruction parameter and the allocated cache sequence to obtain a processed instruction parameter.
[0021] Optionally, in some embodiments of the present application, the compression unit includes:
[0022] A determination subunit, configured to determine the number of bytes required to cache the target image instruction parameter based on the parameter value of the target image instruction parameter, and obtain a target byte stream;
[0023] A deletion subunit, used to delete the values corresponding to the unoccupied bytes in the cache sequence allocated by the target image instruction parameter, to obtain a deleted data sequence;
[0024] The compression subunit is used to compress the data of the deleted data sequence into the target byte stream to generate a data sequence that complies with a predetermined format to obtain a processed instruction parameter.
[0025] Optionally, in some embodiments of the present application, the compression subunit is specifically used for:
[0026] Detecting the symbol type of the parameter value of the target image instruction parameter;
[0027] Filling the highest bit of the target byte stream with a value corresponding to the symbol type;
[0028] Based on the data of the deleted data sequence, generating a numerical sequence conforming to a predetermined format;
[0029] Based on the second highest bit of the filled target byte stream, the numerical sequence is sequentially added to the filled target byte stream to obtain the processed instruction parameter.
[0030] Optionally, in some embodiments of the present application, the fusion module includes:
[0031] A calling unit, used for calling the game canvas of the target game;
[0032] A modification unit, used for modifying the canvas data of the game canvas by processing the post-instruction parameter to obtain modified canvas data;
[0033] The generating unit is used to generate an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction.
[0034] Optionally, in some embodiments of the present application, the generating unit is specifically used for:
[0035] Save the modified canvas data to the cache space;
[0036] When an image drawing request is received, an image rendering instruction corresponding to the modified canvas data is generated to obtain a fused image rendering instruction.
[0037] Optionally, in some embodiments of the present application, a compression module is further included, and the compression module is specifically used to:
[0038] Determine the image instruction parameter whose parameter type is not the preset parameter type as the image instruction parameter to be compressed;
[0039] compressing the image instruction parameter to be compressed according to the parameter type of the image instruction parameter to be compressed;
[0040] The fusion module is specifically used to: fuse the compressed image rendering instruction and the processed image rendering instruction to obtain the fused image rendering instruction.
[0041] After acquiring the image rendering instruction data of the target game, the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. According to the parameter type of the image instruction parameter, an image instruction parameter with a parameter type of a preset parameter type is determined as a target image instruction parameter from at least one image instruction parameter. Then, according to the parameter value of the target image instruction parameter, the data sequence of the target image instruction parameter is compressed into a data sequence in a predetermined format to obtain a processed instruction parameter. Then, the processed instruction parameter is fused to obtain a fused image rendering instruction. Finally, the fused image rendering instruction is sent to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction. The screen rendering solution for cloud games provided by the present application compresses image instruction parameters of a preset parameter type into a data sequence in a predetermined format, and fuses multiple processed instruction parameters to achieve compression of image rendering instructions, thereby reducing the data volume of image rendering instruction data, thereby reducing the bandwidth occupied by cloud games while ensuring that the game image quality is not lost. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0043] Figure 1a This is a scene diagram of the screen rendering method of the cloud game provided by this application;
[0044] Figure 1b It is a flowchart of the screen rendering method of the cloud game provided by this application;
[0045] Figure 1c This is a diagram showing the distribution of bytes occupied by instruction parameters in the current instruction flow cloud game;
[0046] Figure 2a This is another flowchart of the screen rendering method of the cloud game provided by the present application;
[0047] Figure 2b It is a schematic diagram of the structure of the screen rendering system of the cloud game provided by this application;
[0048] Figure 2c It is a structural diagram of the graphics cache state machine of the cloud game provided by this application;
[0049] Figure 3aIt is a structural schematic diagram of a screen rendering device for a cloud game provided by the present application;
[0050] Figure 3b This is another structural schematic diagram of the screen rendering device of the cloud game provided by the present application;
[0051] Figure 4 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0053] The present application provides a method, device, electronic device and storage medium for rendering a picture of a cloud game.
[0054] Among them, the screen rendering device of the cloud game can be specifically integrated in the server, which can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.
[0055] For example, see Figure 1aThe present application provides a screen rendering system for a cloud game, which includes a cloud game server 10, a game terminal 20 and a user 30. The game terminal 20 can display a game list containing multiple cloud games. When the user 30 selects a target game in the game list, the cloud game server 10 can obtain image rendering instruction data of the target game, and the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. Then, the cloud game server 10 selects a target image instruction parameter whose instruction parameter type is a preset instruction parameter type from the at least one image instruction parameter. Then, the cloud game server 10 compresses the data sequence of the target image instruction parameter into a data sequence in a predetermined format to obtain a processed instruction parameter. Then, the cloud game server 10 performs fusion processing on the processed instruction parameters to obtain a fused image rendering instruction. Finally, the cloud game server 10 sends the fused image rendering instruction to the game terminal 20, so that the game terminal 20 displays the screen of the target game according to the fused image rendering instruction.
[0056] The screen rendering method of cloud games provided in the present application compresses image instruction parameters of preset parameter types into a data sequence of a predetermined format, and merges multiple processed instruction parameters to achieve compression of image rendering instructions, thereby reducing the data volume of image rendering instruction data, thereby reducing the bandwidth occupied by cloud games while ensuring that the game image quality is not lost.
[0057] It should be noted that the order of description of the following embodiments is not intended to limit the priority order of the embodiments.
[0058] A screen rendering method for a cloud game includes: obtaining image rendering instruction data of a target game, determining an image instruction parameter with a preset parameter type from at least one image instruction parameter as a target image instruction parameter according to the parameter type of the image instruction parameter, compressing a data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter to obtain a processed image rendering instruction, fusing the processed instruction parameters to obtain a fused image rendering instruction, and sending the fused image rendering instruction to a terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction.
[0059] See also Figure 1b , Figure 1b This is a flow chart of the screen rendering method of the cloud game provided by this application. The specific process of the screen rendering method of the cloud game can be as follows:
[0060] 101. Obtain image rendering instruction data of a target game.
[0061] The target game may be a multiplayer online tactical competitive game or a multiplayer shooting game, and the image rendering instruction data of the target game may be obtained through a wired network or a wireless network. In the present application, the game that requires screen rendering is determined as the target game.
[0062] Rendering is the last step of computer animation. In English, it is called Render. Because the words rendering and shading are two completely different concepts in 3D software, although their functions are very similar, they are different. Shading is a display scheme that generally appears in the main window of 3D software and plays the role of assisting in observing the model like the wireframe diagram of the 3D model. In the screen display scheme, the model or scene is often output as an image file, video signal or film, which must go through a rendering program. The image rendering instruction is a set of executable image rendering codes.
[0063] The image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. Different image instruction parameters correspond to different functions. For example, the image rendering instruction data includes an image rendering instruction glBufferData, and the image rendering instruction glBufferData is used to copy user-defined data to the currently bound buffer. It includes image instruction parameters "GL_STREAM_DRAW" and "GL_DYNAMIC_DRAW", wherein the "GL_STREAM_DRAW" image instruction parameter indicates that the data will change each time the image is drawn, and the "GL_DYNAMIC_DRAW" indicates that the data may change a lot each time the image is drawn.
[0064] Specifically, the player operates the terminal according to the game screen, and then the terminal can send the user's operation instructions to the server through wired or wireless communication. After receiving the operation instructions, the server generates image rendering instructions through the calculation of the central processing unit, wherein the image rendering instructions can be image rendering instructions of the Open Graphics Library (OpenGL) or the Web Graphics Library (WebGL). OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. This interface consists of nearly 350 different function calls, which are used to draw from simple graphic bits to complex three-dimensional scenes; WebGL is a 3D drawing protocol. This drawing technology standard allows JavaScript and OpenGL ES2.0 to be combined. By adding a JavaScript binding to OpenGL ES2.0, WebGL can provide hardware 3D accelerated rendering for HTML5 Canvas, so that Web developers can use the system graphics card to display 3D scenes and models more smoothly in the browser, and can also create complex navigation and data visualization. Obviously, the WebGL technical standard eliminates the trouble of developing dedicated rendering plug-ins for web pages. It can be used to create website pages with complex 3D structures, and can even be used to design 3D web games, etc.
[0065] 102. According to the parameter type of the image command parameter, determine an image command parameter having a parameter type of a preset parameter type from at least one image command parameter as a target image command parameter.
[0066] After the image rendering instruction data of the target game is obtained from 101, the image rendering instruction in the image rendering data data is obtained. Among them, the image rendering instruction includes at least one image instruction parameter. Take the image rendering instruction of OpenGL as an example for specific description. For example, the shader instruction glShaderSource of OpenGL means that the function compiles the shader object as the first parameter, which includes the following image instruction parameters, namely: "GLuint shader" and "GLchar**string", where "GLuint shader" is a long integer parameter type, and "GLchar**string is a string parameter type. For image instruction parameters of numerical types (such as long integer, short integer, integer and byte type), they can be compressed into image instruction parameters of a predetermined format, that is, optionally, in some embodiments, the step of "determining the current target image instruction parameter from at least one image instruction parameter according to the parameter type of the image instruction parameter" can specifically include:
[0067] (11) Detecting parameter types of image command parameters;
[0068] (12) An image instruction parameter whose parameter type is a preset parameter type is determined as a target image instruction parameter, and at least one target image instruction parameter is obtained.
[0069] For example, specifically, a certain image rendering instruction includes image rendering instruction parameter A, image rendering instruction parameter B, image rendering instruction parameter C, image rendering instruction parameter D and image rendering instruction parameter E, wherein image rendering instruction parameter A, image rendering instruction parameter B, image rendering instruction parameter C and image rendering instruction parameter D are all image rendering instruction parameters of preset parameter types, then image rendering instruction parameter A, image rendering instruction parameter B, image rendering instruction parameter C and image rendering instruction parameter D are determined as target image instruction parameters, and then, the current target image instruction parameter is determined among these four image rendering instruction parameters.
[0070] It should be noted that in the command stream cloud game, the image rendering instruction needs to be transmitted to the terminal, and the terminal parses the image rendering instruction to render the corresponding game screen. The present application provides a screen rendering solution based on cloud games, and the preset type of image instruction parameters are compressed by this solution. It can be understood that in order to facilitate the subsequent transmission of the image rendering instruction to the terminal, for image instruction parameters that are not of the preset parameter type (non-target image instruction parameters), such as string type image instruction parameters, the Zstandard compression algorithm can be used to compress this type of image instruction parameters. The Zstandard compression algorithm is a lossless compression algorithm, which is a lossless encoding of a semantic-free data stream compressed based on data statistical information; and for texture image type image instruction parameters, the Sharp p compression algorithm is used to compress this type of image instruction parameters, specifically including prediction space transformation, color space conversion, use of a palette, multiple pixels packed into one pixel, and transparent channel value replacement, that is, optionally, in some embodiments, it can also specifically include:
[0071] (21) determining the image instruction parameter whose parameter type is not the preset parameter type as the image instruction parameter to be compressed;
[0072] (22) Compressing the image instruction parameter to be compressed according to the parameter type of the image instruction parameter to be compressed.
[0073] In the game scene, there is a three-dimensional model, which is composed of a set of polygonal patches in three-dimensional space, and each set of patches includes multiple interconnected polygons. A polygon refers to a closed figure composed of three or more line segments connected end to end, among which the polygon in the three-dimensional model is a triangle. The three-dimensional model can present real objects or fictional objects, including but not limited to three-dimensional maps, three-dimensional equipment, three-dimensional characters and three-dimensional games.
[0074] In a three-dimensional model, the vertex of each polygon is the vertex of the three-dimensional model, and the vertex coordinates are three-dimensional coordinates, such as (x, y, z). Texture is a picture in two-dimensional space, which is actually a two-dimensional array, and its elements are some color values. A single color value is called a texture element or texture pixel. Each texture pixel has a unique address in the texture, that is, the texture coordinate. The texture coordinate is a two-dimensional coordinate and can be represented by (u, v). In a three-dimensional model, there are a certain number of vertex coordinates that are shared, that is, one vertex coordinate can correspond to multiple texture coordinates. Generally, at the inflection point of the three-dimensional model, multiple texture coordinates share one vertex coordinate. Therefore, in a three-dimensional model, the number of texture coordinates is greater than the number of vertex coordinates.
[0075] For image instruction parameters of texture picture type, data types of vertex coordinates and texture coordinates can be converted. Specifically, vertex coordinates are converted according to the coordinate value range of vertex coordinates, and texture coordinates are converted according to the coordinate value range of texture coordinates, so as to achieve compression of image instruction parameters of texture picture type.
[0076] 103. According to the parameter value of the target image instruction parameter, compress the data sequence of the target image instruction parameter into a data sequence of a predetermined format to obtain a processed instruction parameter.
[0077] In order to reduce the amount of data during data transmission, after determining the target image instruction parameters, the present application compresses the data sequence of the target image instruction parameters into a binary data sequence to achieve compression of the target image instruction parameters. The following is a specific explanation taking the OpenGL instruction as an example. In the OpenGL instruction, each parameter basically occupies more than 4 bytes of memory, such as the OpenGL drawing texture glTexImage2d instruction, the image instruction parameter Glenum, the image instruction parameter Glint and the image instruction parameter Glsizei all occupy more than 4 bytes of memory, but most of the values actually corresponding to the image instruction parameters are index numbers, such as the index number of the GPU cache, such as 0 for the first cache, 1 for the second cache, and a total of no more than 128 caches. For example, the image instruction parameter target, 0 means drawing two-dimensional graphics, 1 means drawing three-dimensional graphics, such as the parameter value of the shader instruction parameter is equal to 1, expressed in hexadecimal as 0x0000 0000 00000001, Byte is a unit of measurement used in computer information technology to measure storage capacity. In computer information technology, one byte stores an 8-bit unsigned number, and the stored value range is 0-255. Therefore, the image instruction parameter target and the shader parameter only need 1 byte for transmission, that is, optionally, in some embodiments, the step of "compressing the data sequence of the target image instruction parameter into a data sequence of a predetermined format to obtain the processed image rendering instruction" may specifically include:
[0078] (31) Obtaining parameter values of target image instruction parameters;
[0079] (32) determining the cache sequence assigned to the target image instruction parameter;
[0080] (33) Based on the parameter values of the target image instruction parameters and the allocated cache sequence, the data sequence of the target image instruction parameters is compressed into a data sequence in a predetermined format to obtain processed instruction parameters.
[0081] The compression method proposed in this embodiment dynamically determines the size of the occupied memory according to the value of the actual parameter of the interface. The smaller the parameter value, the smaller the memory occupied, which can greatly reduce the amount of data to be transmitted for each image rendering instruction.
[0082] Further, the number of bytes required for the target image instruction parameter may be determined, and then, in the cache sequence allocated to the target image instruction parameter, the values corresponding to the unoccupied bytes may be deleted to obtain the processed instruction parameter. That is, optionally, in some embodiments, the step of “compressing the data sequence of the target image instruction parameter into a data sequence in a predetermined format based on the parameter value of the target image instruction parameter and the allocated cache sequence to obtain the processed instruction parameter” may specifically include:
[0083] (41) determining the number of bytes required for caching the target image instruction parameter according to the parameter value, and obtaining the target bytes;
[0084] (42) deleting the values corresponding to the unoccupied bytes of the target image instruction parameter in the allocated cache sequence, and obtaining a deleted data sequence;
[0085] (43) Compress the data in the deleted data sequence into the target byte to generate a data sequence that complies with a predetermined format to obtain the processed instruction parameters.
[0086] Among them, in the present application, the target byte stream refers to the byte stream that needs to be packaged and cached. Let's take the image instruction parameter shader equal to 1 as an example. In OpenGL, the image instruction parameter shader occupies 4 bytes, that is, the cache sequence number allocated by the image instruction parameter shader is 4, which is represented by hexadecimal as 0x0000 0000 0000 0001. It can be understood that in the image instruction parameter shader, the data corresponding to three bytes are empty, that is, all are "0000". Then, the value corresponding to the unoccupied bytes of the target image instruction parameter in the allocated cache sequence can be deleted, and then the data of the deleted data sequence is compressed into the target byte to generate a data sequence that conforms to the predetermined format, that is, delete the first three bytes of data of 0000 0000 00000001 to obtain 0001. At this time, 0001 can represent the image instruction parameter shader, that is, the processed image rendering instruction is obtained.
[0087] It should be noted that for data with a sign (i.e., a positive sign or a symbol), when compressing the data, it is also necessary to represent the sign in the data sequence through a binary representation such as 0 or 1, so that the subsequent terminal can correctly display the game screen of the target game, that is, optionally, in some embodiments, the step of "compressing the data of the deleted data sequence into the target byte, generating a data sequence conforming to a predetermined format, and obtaining a processed image rendering instruction" may specifically include:
[0088] (51) Detecting the symbol type of the parameter value of the target image instruction parameter;
[0089] (52) Fill the highest bit of the target byte stream with the value corresponding to the symbol type;
[0090] (53) generating a numerical sequence conforming to a predetermined format according to the data of the deleted data sequence;
[0091] (54) Based on the second highest bit of the filled target byte stream, the numerical sequence is added to the filled target byte stream in sequence to obtain the processed image rendering instruction.
[0092] In this application, 7 bits in a byte are used to represent data. The highest bit indicates whether the next byte contains data 0. If so, it means that the byte is the last byte of the integer. 1 indicates that there are bytes following to represent the high bit of the data. For example, the first parameter shader value in glShaderSource is 3543. According to the OpenGL interface definition, GLuint4 bytes are used, but in fact 12 bits (|0000 0000|0000 0000|0000 1101|1101 0111|) are used to represent 3543.
[0093] In view of this situation, this embodiment provides a new compression solution, please refer to Figure 1c , remove all the 0s on the high bits of the bytes and do not transmit them (that is, remove the bytes without data). Assume that the value corresponding to the image instruction parameter is V, which occupies M bytes. Each byte has 8 bits (0 or 1) to represent data. The cache to be packaged and transmitted is the target byte stream B. Take the low 7 bits of V to B, and shift V right by 7 bits. If 7 bits can represent V, then the 8th bit is 0. If not, the highest bit of B is assigned 1, where the blanks that appear when the numbers are shifted are all filled with 0s. It should be noted that if the 8th bit of the first byte is 1, it means that there is subsequent high-order data. If it is 0, it indicates that there is no subsequent high-order data. As shown in the figure, the 8th bit of the second byte is 0, then the data occupies 2 bytes when saved.
[0094] It should be noted that if it is signed data, the highest bit represents positive and negative numbers, 1 represents a negative number, and 0 represents a positive number. It is necessary to shift the highest sign bit right to the lowest bit and convert it into unsigned data before using the above method for compression. For example, the value of the image instruction parameter is -127. It can be seen that the binary original code of 127 = 01111111, and its complement is 10000000. After taking the complement, adding 1 is 10000001, which is the binary representation of -127.
[0095] 104. Perform fusion processing on the processed instruction parameters to obtain fused image rendering instructions.
[0096] For example, specifically, in the present application, the processed instruction parameters and the non-target image instruction parameters that are not the preset parameter type are fused to obtain the fused image rendering instructions. For the processing of the non-target image instruction parameters, please refer to the previous embodiments, which will not be repeated here.
[0097] In order to further reduce the amount of data during data transmission and thus reduce the occupied bandwidth, this embodiment provides a new method for fusing unprocessed image rendering instructions and processed image rendering instructions. First, the image drawing process of the current command stream cloud game is described.
[0098] In actual use, the image rendering instruction parameter glBufferData writes 3D model data to the game canvas (memory space). The game canvas can be understood as a graphics container, and the running logic code can draw text, lines, rectangles, circles and other graphics on the canvas through the drawing interface. The canvas may include an on-screen canvas and an off-screen canvas. The on-screen canvas is already displayed on the screen of the terminal and is as wide and high as the screen. The off-screen canvas has not yet been displayed on the screen of the terminal. Game drawing resources are materials for drawing game drawing elements in the game screen. Game drawing resources include static game drawing resources and dynamic game drawing resources. Static game drawing resources are game drawing resources with general consistency. It can be understood that the game screen of a sub-application of a game type can be the same screen for each user. Dynamic game drawing resources are game drawing resources with differences. For example, the response screen after interaction with the user. After writing the 3D model data in the game canvas, the game canvas is transferred to the terminal; the image rendering instruction parameter lMapBufferRange / glBufferSubData, when modifying the model data, the modified data of the game canvas needs to be transferred to the terminal; the image rendering instruction parameter glVertexAttribPonter indicates the data cached by the game canvas in the 3D model attribute; the image rendering instruction parameter glDrawElement indicates the vertex data that the terminal needs to draw. From this process, it can be seen that when the game screen changes, data needs to be frequently transmitted between the server and the terminal, resulting in a large amount of bandwidth being occupied. Based on this, the present application can modify the canvas data of the game canvas based on multiple processed instruction parameters to obtain the modified canvas data to generate a fused image rendering instruction, that is, optionally, in some embodiments, the step of "fusion processing the processed instruction parameters to obtain the fused image rendering instruction" can specifically include:
[0099] (61) Call the game canvas of the target game;
[0100] (62) modifying canvas data of the game canvas based on a plurality of processed instruction parameters to obtain modified canvas data;
[0101] (63) Generate an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction.
[0102] Specifically, the image rendering instruction parameters do not need to be transmitted to the terminal. It is only necessary to modify the game data of the local game canvas. When an image drawing request is received, an image rendering instruction corresponding to the modified canvas data is generated to obtain a fused image rendering instruction.
[0103] 105. Send the fused image rendering instruction to the terminal, so that the terminal renders and displays the screen of the target game according to the fused image rendering instruction.
[0104] For example, specifically, the fused image rendering instructions can be sent to the terminal based on mobile communications such as the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), and Worldwide Interoperability for Microwave Access (WiMAX), or computer network communications based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP) protocols, so that the terminal displays the screen of the target game.
[0105] It should be noted that when the terminal receives the fused image rendering instruction, it needs to decode the fused image rendering instruction, that is, restore the fused image rendering instruction to the corresponding graphics library language type. Assuming that the type of the received byte B to be parsed is determined according to the OpenGL standard, for example, if the instruction glBindBuffer is received, then the parameter 1 type must be GLuint. Decoding is the inverse process of encoding. Assuming that the openGL type is saved with V, V takes the 7th bit of B. If the 8th bit of B is 1, it means that there is more data behind it. V is shifted left by 7 bits. If the 8th bit is 0, it means that V value taking ends.
[0106] After obtaining the image rendering instruction data of the target game, the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. According to the parameter type of the image instruction parameter, an image instruction parameter with a parameter type of a preset parameter type is determined as the target image instruction parameter from at least one image instruction parameter. Then, according to the parameter value of the target image instruction parameter, the data sequence of the target image instruction parameter is compressed into a data sequence in a predetermined format to obtain a processed instruction parameter. Then, the processed instruction parameter is fused to obtain a fused image rendering instruction. Finally, the fused image rendering instruction is sent to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction. The screen rendering solution for cloud games provided by the present application compresses the image instruction parameters of a preset parameter type into a data sequence in a predetermined format, and fuses multiple processed instruction parameters to achieve compression of the image rendering instruction, thereby reducing the data volume of the image rendering instruction data, thereby reducing the bandwidth occupied by the cloud game while ensuring that the game image quality is not lost.
[0107] The method described in the embodiment will be further described in detail below with examples.
[0108] In this embodiment, the image rendering device of the cloud game is specifically integrated into the server as an example for explanation.
[0109] See also Figure 2a , a screen rendering method for cloud games, the specific process can be as follows:
[0110] 201. The server obtains image rendering instruction data of a target game.
[0111] The target game may be a multiplayer online tactical competitive game or a multiplayer shooting game, and the image rendering instruction data of the target game may be obtained through a wired network or a wireless network. In the present application, the game that requires screen rendering is determined as the target game, and the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. Different image instruction parameters correspond to different functions. Specifically, the player operates and controls the terminal according to the game screen, and then the terminal can use wired or wireless communication to send the user's operation instructions to the server. After receiving the operation instruction, the server generates an image rendering instruction through calculation by the central processing unit.
[0112] 202. The server determines, according to the parameter type of the image instruction parameter, an image instruction parameter having a preset parameter type from at least one image instruction parameter as a target image instruction parameter.
[0113] After acquiring the image rendering data of the target game, the server will obtain the image rendering instruction in the image rendering data, wherein the image rendering instruction includes at least one image instruction parameter.
[0114] Take the OpenGL image rendering instruction as an example for specific description. For example, the OpenGL shader instruction glShaderSource includes the following image instruction parameters: "GLuint shader" and "GLchar**string", where "GLuint shader" is a long integer parameter type, and "GLchar**string is a string parameter type. For image instruction parameters of numerical types (such as long integer, short integer, integer, and byte), the server can compress them into image instruction parameters of a predetermined format.
[0115] 203. The server compresses the data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter to obtain a processed instruction parameter.
[0116] The server can dynamically determine the size of the memory to be occupied according to the value of the actual parameter of the interface. The smaller the parameter value, the smaller the memory occupied, which can greatly reduce the amount of data to be transmitted for each image rendering instruction. For example, specifically, the server can delete the numerical value corresponding to the unoccupied bytes of the target image instruction parameter in the allocated cache sequence, and then compress the data of the deleted data sequence into the target byte stream to generate a data sequence that conforms to a predetermined format. For example, the server deletes the numerical value corresponding to the unoccupied bytes of the image instruction parameter shader with an image instruction parameter value of 1 in the allocated cache sequence, that is, deletes the first three bytes of data of 0000 0000 0000 0001, and obtains 0001, thereby obtaining the processed image rendering instruction.
[0117] 204. The server performs fusion processing on the multiple processed instruction parameters to obtain a fused image rendering instruction.
[0118] For example, specifically, the server can call the game canvas of the target game, and then modify the canvas data of the game canvas based on multiple processed instruction parameters to obtain modified canvas data. When the server receives an image drawing request, it generates an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction.
[0119] 205. The server sends the fused image rendering instruction to the terminal, so that the terminal renders and displays the screen of the target game according to the fused image rendering instruction.
[0120] For example, specifically, the server can send the fused image rendering instructions to the terminal based on mobile communications such as the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), and Worldwide Interoperability for Microwave Access (WiMAX), or computer network communications based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP) protocols, so that the terminal displays the screen of the target game.
[0121] After the server of the present application obtains the image rendering instruction data of the target game, the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. The server determines the image instruction parameter with a parameter type of a preset parameter type from at least one image instruction parameter as the target image instruction parameter according to the parameter type of the image instruction parameter. Then, the server compresses the data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter to obtain the processed instruction parameter. Then, the server performs fusion processing on the processed instruction parameter to obtain the fused image rendering instruction. Finally, the server sends the fused image rendering instruction to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction. The screen rendering solution of the cloud game provided by the present application compresses the image instruction parameters of the preset parameter type into a data sequence of a predetermined format, and fuses multiple processed instruction parameters to achieve compression of the image rendering instruction, thereby reducing the data volume of the image rendering instruction data, thereby reducing the bandwidth occupied by the cloud game while ensuring that the game image quality is not lost.
[0122] In order to further understand the screen rendering solution of the cloud game of this application, the following will take updating the game screen as an example for specific description. Figure 2b The present application provides a screen rendering system for a command streaming cloud game, the system comprising a server and a terminal, wherein the server has an application program of a target game, an open graphics library, OpenGL instructions, an instruction interception module and a graphics cache state machine, the terminal comprises a display screen, an instruction receiving module and a graphics processor, the instruction interception module is used to intercept instructions and to compress the intercepted instructions, the instruction receiving module is used to receive instructions and to decompress the received instructions, thereby realizing displaying the game screen of the target game on the display screen of the terminal.
[0123] First, the server's instruction interception module intercepts OpenGL interface instructions and parameters. If the value of the instruction parameter is an unsigned numeric type, it is handed over to the unsigned integer compression module for processing; if it is signed data, the highest bit represents positive and negative numbers, 1 represents a negative number, and 0 represents a positive number. The highest sign bit needs to be shifted right to the lowest bit and converted into unsigned data for encoding; if the parameter is a string type, such as the string parameter in glShaderSource, it is compressed using the compression algorithm zstd; if it is a texture image type parameter, such as the pixel value in glTexImage2D, it is compressed using sharpP. Please refer to the previous embodiment for details, which will not be repeated here.
[0124] For further information, see Figure 2c, because the existing cloud game image rendering instructions are based on each draw (glDrawArray / glDrawElement) call as the basic unit, that is, the geometric data is prepared and rendered using the graphics processor. When drawing the game screen of the target game, it is necessary to call glMapBufferRage multiple times to write the vertex and color attribute data into the cache, and finally call glDrawElement so that the graphics processor can render the corresponding triangle surface.
[0125] In the present application, a graphics cache state machine is used to record the image rendering instructions for each drawing of geometric data. The graphics cache state machine is referred to as the state machine. It is a mathematical model that represents a finite number of states and behaviors such as transitions and actions between these states. Finally, it is merged into one instruction and sent to the terminal. After the terminal receives the merged instruction, it is restored to the nominal OpenGL instruction, which is then rendered and displayed by the terminal's graphics card.
[0126] The target game running on the server side calls the glCreateBuffer image rendering instruction to find the graphics cache state machine to create a piece of memory to save the data to be drawn. The returned value is a cache index number such as 1. The server does not have image processor hardware, so it relies on the graphics cache state machine to allocate memory. The terminal receives the glCreateBuffer image rendering instruction, and the terminal's image processor allocates a cache in the image processor at the terminal. The cache index number can be 2. Therefore, the terminal can add a resource mapping table to record the one-to-one correspondence between server and terminal resources (that is, the correspondence between the server cache index number and the terminal cache index number).
[0127] When the server obtains the target game calling image rendering instructions, such as lMapBufferRange, glFlushMappedBufferRange, glUnmapBuffer and / or glBufferSubData, the purpose of these image rendering instructions is to indicate that there are changes in geometric graphics, such as the vertex position, color value and / or texture coordinates of the game character. The server may not transmit these image rendering instructions to the terminal first, but save these data in the index 1 cache in the graphics cache state machine. The server's target game calls the glVertexAttribPointer image rendering instruction to use the cached data to draw geometric graphics. All graphics are composed of triangles. The server only needs to record the range of vertex attributes in the cache. At the same time, the server will save the hash value corresponding to the image rendering instruction, and mark the image rendering instruction that has been transmitted to the terminal, and will not transmit it later, thereby reducing the amount of data transmitted by the server. In addition, when the server receives an image drawing request, the server determines an image instruction parameter with a parameter type of a preset parameter type from at least one image instruction parameter as a target image instruction parameter according to the parameter type of the image instruction parameter. Then, the server compresses the data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter to obtain a processed instruction parameter. Then, the processed instruction parameter is fused to obtain a fused image rendering instruction. Specifically, the server generates a glDrawElementWithData image rendering instruction and sends the image rendering instruction to the terminal. When the terminal receives the glDrawElementWithData image rendering instruction, it is necessary to decompress the glDrawElementWithData image rendering instruction to obtain the image rendering operation parameters and data recorded in the glDrawElementWithData image rendering instruction to achieve game screen rendering of the target game.
[0128] In order to facilitate the better implementation of the screen rendering method of the cloud game of the present application, the present application also provides a screen rendering device (referred to as a display device) based on the above cloud game. The meaning of the nouns is the same as that in the screen rendering method of the above cloud game, and the specific implementation details can refer to the description in the method embodiment.
[0129] See also Figure 3a , Figure 3a This is a schematic diagram of the structure of the screen rendering device of the cloud game provided in the present application, wherein the distribution device may include an acquisition module 301, a determination module 302, a compression module 303, a fusion module 304 and a sending module 305, which may be specifically as follows:
[0130] The acquisition module 301 is used to acquire image rendering instruction data of a target game.
[0131] The target game may be a multiplayer online tactical competitive game or a multiplayer shooting game. The acquisition module 301 may acquire the image rendering instruction data of the target game through a wired network or a wireless network. In the present application, the game that requires screen rendering is determined as the target game. The image rendering instruction data includes at least one image rendering instruction. The image rendering instruction includes at least one image instruction parameter. Different image instruction parameters correspond to different functions.
[0132] The determination module 302 is used to determine the current target image instruction parameter from at least one image instruction parameter according to the parameter type of the image instruction parameter.
[0133] After acquiring the image rendering data of the target game, the determination module 302 will obtain the image rendering instruction in the image rendering data. The image rendering instruction includes at least one image instruction parameter. The OpenGL image rendering instruction is specifically described as an example. For example, the shader instruction glShaderSource of OpenGL includes the following image instruction parameters, namely: "GLuint shader" and "GLchar**string", wherein "GLuint shader" is a parameter type of a long integer, and "GLchar**string is a parameter type of a string. For image instruction parameters of numerical types (such as long integer, short integer, integer, and byte), the determination module 302 can compress them into image instruction parameters of a predetermined format.
[0134] The compression module 303 is used to compress the data sequence of the target image instruction parameters into a data sequence of a predetermined format according to the parameter values of the target image instruction parameters to obtain processed instruction parameters.
[0135] The compression module 303 can dynamically determine the size of the occupied memory according to the value of the actual interface parameter. The smaller the parameter value, the smaller the memory occupied, which can greatly reduce the amount of data to be transmitted for each image rendering instruction.
[0136] Optionally, in some embodiments, the compression module 303 may specifically include:
[0137] An acquisition unit, used for acquiring parameter values of target image instruction parameters;
[0138] A determination unit, used to determine a cache sequence allocated to a target image instruction parameter;
[0139] The compression unit is used to compress the data sequence of the target image instruction parameter into a data sequence of a predetermined format based on the parameter value of the target image instruction parameter and the allocated cache sequence to obtain the processed instruction parameter.
[0140] Optionally, in some embodiments, the compression unit may specifically include:
[0141] A determination subunit, configured to determine the number of bytes required to cache the target image instruction parameter based on the parameter value of the target image instruction parameter, and obtain a target byte stream;
[0142] A deletion subunit is used to delete the values corresponding to the unoccupied bytes in the cache sequence allocated by the target image instruction parameter to obtain a deleted data sequence;
[0143] The compression subunit is used to compress the data of the deleted data sequence into the target byte stream to generate a data sequence that complies with a predetermined format to obtain the processed instruction parameters.
[0144] Optionally, in some embodiments, the compression subunit can be specifically used to: detect the sign type of the parameter value of the target image instruction parameter; fill the highest bit of the target byte stream with a numerical value corresponding to the sign type; generate a numerical sequence that conforms to a predetermined format based on the data of the deleted data sequence; and add the numerical sequence to the filled target byte stream in sequence based on the second highest bit of the filled target byte stream to obtain the processed instruction parameter.
[0145] The fusion module 304 is used to perform fusion processing on the processed instruction parameters to obtain a fused image rendering instruction.
[0146] The fusion module 304 may modify the canvas data of the game canvas based on the multiple processed instruction parameters to obtain the modified canvas data to generate the fused image rendering instruction. That is, optionally, in some embodiments, the fusion module 304 may specifically include:
[0147] A calling unit, used to call the game canvas of the target game;
[0148] A modification unit, used for modifying the canvas data of the game canvas by processing the post-instruction parameter to obtain modified canvas data;
[0149] The generating unit is used to generate an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction.
[0150] Optionally, in some embodiments, the generation unit may be specifically configured to: save the modified canvas data into a cache space, and when an image drawing request is received, generate an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction.
[0151] Optionally, in some embodiments, see Figure 3b The display device may further include a compression module 306, which may be used to: determine an image instruction parameter whose parameter type is not a preset parameter type as an image instruction parameter to be compressed, and compress the image instruction parameter to be compressed according to the parameter type of the image instruction parameter to be compressed;
[0152] The fusion module 304 may be specifically used to: fuse the compressed image rendering instruction and the processed image rendering instruction to obtain a fused image rendering instruction.
[0153] The sending module 305 is used to send the fused image rendering instruction to the terminal, so that the terminal renders the screen of the target game according to the fused image rendering instruction.
[0154] For example, the sending module 305 can send the fused image rendering instruction to the terminal based on the mobile communication of the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), or the computer network communication based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP) protocols, so that the terminal displays the screen of the target game.
[0155] After the acquisition module 301 of the present application acquires the image rendering instruction data of the target game, the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. The determination module 302 determines the image instruction parameter with a parameter type of a preset parameter type from at least one image instruction parameter as the target image instruction parameter according to the parameter type of the image instruction parameter. Then, the compression module 303 compresses the data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter to obtain the processed instruction parameter. Then, the fusion module 304 performs fusion processing on the processed instruction parameter to obtain the fused image rendering instruction. Finally, the sending module 305 sends the fused image rendering instruction to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction. The screen rendering solution of the cloud game provided by the present application compresses the image instruction parameter of the preset parameter type into a data sequence of a predetermined format, and fuses multiple processed instruction parameters to realize compression of the image rendering instruction, thereby reducing the data volume of the image rendering instruction data, thereby reducing the bandwidth occupied by the cloud game under the premise of ensuring that the game image quality is not lost.
[0156] In addition, the present application also provides an electronic device, such as Figure 4 As shown, it shows a schematic diagram of the structure of the electronic device involved in this application, specifically:
[0157] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0158] The processor 401 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the electronic device and processes data, thereby performing overall detection of the electronic device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0159] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0160] The electronic device also includes a power supply 403 for supplying power to each component. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 403 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0161] The electronic device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0162] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:
[0163] Obtain image rendering instruction data of a target game, determine an image instruction parameter with a preset parameter type from at least one image instruction parameter as a target image instruction parameter according to a parameter type of the image instruction parameter, compress a data sequence of the target image instruction parameter into a data sequence of a predetermined format according to a parameter value of the target image instruction parameter, obtain a processed image rendering instruction, perform fusion processing on the processed instruction parameters to obtain a fused image rendering instruction, and send the fused image rendering instruction to a terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction.
[0164] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0165] After obtaining the image rendering instruction data of the target game, the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter. According to the parameter type of the image instruction parameter, an image instruction parameter with a parameter type of a preset parameter type is determined as the target image instruction parameter from at least one image instruction parameter. Then, according to the parameter value of the target image instruction parameter, the data sequence of the target image instruction parameter is compressed into a data sequence in a predetermined format to obtain a processed instruction parameter. Then, the processed instruction parameter is fused to obtain a fused image rendering instruction. Finally, the fused image rendering instruction is sent to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction. The screen rendering solution for cloud games provided by the present application compresses the image instruction parameters of a preset parameter type into a data sequence in a predetermined format, and fuses multiple processed instruction parameters to achieve compression of the image rendering instruction, thereby reducing the data volume of the image rendering instruction data, thereby reducing the bandwidth occupied by the cloud game while ensuring that the game image quality is not lost.
[0166] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0167] To this end, the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any of the cloud game screen rendering methods provided in the present application. For example, the instructions can execute the following steps:
[0168] Obtain image rendering instruction data of a target game, determine an image instruction parameter with a preset parameter type from at least one image instruction parameter as a target image instruction parameter according to a parameter type of the image instruction parameter, compress a data sequence of the target image instruction parameter into a data sequence of a predetermined format according to a parameter value of the target image instruction parameter, obtain a processed image rendering instruction, perform fusion processing on the processed instruction parameters to obtain a fused image rendering instruction, and send the fused image rendering instruction to a terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction.
[0169] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0170] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0171] Since the instructions stored in the storage medium can execute the steps in any cloud game screen rendering method provided in the present application, the beneficial effects that can be achieved by any cloud game screen rendering method provided in the present application can be achieved. Please see the previous embodiments for details and will not be repeated here.
[0172] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0173] The above is a detailed introduction to the screen rendering method, device, electronic device and storage medium of a cloud game provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A cloud game screen rendering method, characterized in that: include: Acquire image rendering instruction data of a target game, wherein the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter; According to the parameter type of the image instruction parameter, determining an image instruction parameter whose parameter type is a preset parameter type from at least one image instruction parameter as a target image instruction parameter; According to the parameter value of the target image instruction parameter, compressing the data sequence of the target image instruction parameter into a data sequence in a predetermined format to obtain the processed instruction parameter, including: acquiring the parameter value of the target image instruction parameter; determining the cache sequence allocated by the target image instruction parameter; determining the number of bytes required for caching the target image instruction parameter based on the parameter value of the target image instruction parameter to obtain a target byte stream; deleting the values corresponding to the unoccupied bytes in the cache sequence allocated by the target image instruction parameter to obtain a deleted data sequence; compressing the data of the deleted data sequence into the target byte stream to generate a data sequence conforming to the predetermined format to obtain the processed instruction parameter; Performing fusion processing on the processed instruction parameters to obtain fused image rendering instructions; The fused image rendering instruction is sent to the terminal so that the terminal renders the screen of the target game according to the fused image rendering instruction.
2. The method according to claim 1, characterized in that The step of compressing the data of the deleted data sequence into the target byte stream to generate a data sequence conforming to a predetermined format to obtain a processed instruction parameter includes: Detecting the symbol type of the parameter value of the target image instruction parameter; Filling the highest bit of the target byte stream with a value corresponding to the symbol type; Based on the data of the deleted data sequence, generating a numerical sequence conforming to a predetermined format; The numerical sequence is added to the filled target byte stream to obtain the processed instruction parameters.
3. The method according to claim 1 or 2, characterized in that: The step of fusing the processed instruction parameters to obtain fused instruction parameters includes: Calling the game canvas of the target game; Modify the canvas data of the game canvas based on the processed instruction parameters to obtain modified canvas data; An image rendering instruction corresponding to the modified canvas data is generated to obtain a fused image rendering instruction.
4. The method according to claim 3, characterized in that The step of generating an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction includes: Save the modified canvas data to the cache space; When an image drawing request is received, an image rendering instruction corresponding to the modified canvas data is generated to obtain a fused image rendering instruction.
5. The method according to claim 1 or 2, characterized in that: Also includes: Determine the image instruction parameter whose parameter type is not the preset parameter type as the image instruction parameter to be compressed; The image instruction parameter to be compressed is compressed according to the parameter type of the image instruction parameter to be compressed.
6. A screen rendering device for cloud gaming, characterized in that: include: An acquisition module, used for acquiring image rendering instruction data of a target game, wherein the image rendering instruction data includes at least one image rendering instruction, and the image rendering instruction includes at least one image instruction parameter; a determination module, configured to determine, according to the parameter type of the image instruction parameter, an image instruction parameter of a preset parameter type from at least one image instruction parameter as a target image instruction parameter; A compression module, used for compressing the data sequence of the target image instruction parameter into a data sequence of a predetermined format according to the parameter value of the target image instruction parameter, to obtain a processed instruction parameter; A fusion module, used for performing fusion processing on the processed instruction parameters to obtain a fused image rendering instruction; A sending module, used for sending a fused image rendering instruction to a terminal, so that the terminal renders the screen of the target game according to the fused image rendering instruction; Wherein, the compression module comprises: An acquisition unit, used for acquiring a parameter value of the target image instruction parameter; A determination unit, used to determine a cache sequence allocated to the target image instruction parameter; A compression unit, configured to compress the data sequence of the target image instruction parameter into a data sequence of a predetermined format based on the parameter value of the target image instruction parameter and the allocated cache sequence, so as to obtain a processed instruction parameter; The compression unit comprises: A determination subunit, configured to determine the number of bytes required to cache the target image instruction parameter based on the parameter value of the target image instruction parameter, and obtain a target byte stream; A deletion subunit, used to delete the values corresponding to the unoccupied bytes in the cache sequence allocated by the target image instruction parameter, to obtain a deleted data sequence; The compression subunit is used to compress the data of the deleted data sequence into the target byte stream to generate a data sequence that complies with a predetermined format to obtain a processed instruction parameter.
7. The device according to claim 6, characterized in that The compression subunit is specifically used for: Detecting the symbol type of the parameter value of the target image instruction parameter; Filling the highest bit of the target byte stream with a value corresponding to the symbol type; Based on the data of the deleted data sequence, generating a numerical sequence conforming to a predetermined format; Based on the second highest bit of the filled target byte stream, the numerical sequence is sequentially added to the filled target byte stream to obtain the processed instruction parameter.
8. The device according to claim 6 or 7, characterized in that The fusion module includes: A calling unit, used for calling the game canvas of the target game; A modification unit, used for modifying the canvas data of the game canvas by processing the post-instruction parameter to obtain modified canvas data; The generating unit is used to generate an image rendering instruction corresponding to the modified canvas data to obtain a fused image rendering instruction.
9. The device according to claim 8, characterized in that The generating unit is specifically used for: Save the modified canvas data to the cache space; When an image drawing request is received, an image rendering instruction corresponding to the modified canvas data is generated to obtain a fused image rendering instruction.
10. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the screen rendering method of the cloud game as described in any one of claims 1-5 are implemented.
11. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the steps of the screen rendering method of a cloud game as described in any one of claims 1-5 are implemented.
12. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of the cloud game screen rendering method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Bandwidth optimization method and system
CN103763307A
Online game system and method based on server real-time rendering
CN104796393A