Game optimization system based on cocos engine
By designing a game optimization system based on the cocos engine in Snake Games, optimizing control script reading and processing, and improving the drawing system, the problem of game frame rate drop and excessive GPU pressure is solved, and efficient game performance and good user experience are achieved.
Patent Information
- Application Number
- CN202010777505.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-05
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2040-08-05
Abstract
Description
Technical Field
[0001] The invention belongs to the field of game technology, and in particular relates to a game optimization system based on a cocos engine. Background Art
[0002] Snake is a casual game. Players need to obtain the original red snake. Two identical snakes will evolve into a stronger and higher-level snake when they collide. Use the snake you own to enter the game and press the lower left corner key to control the movement of the snake. Eating the small gold dots on the road will make the snake's body longer. Be careful not to touch other snakes' bodies and walls with your snake head, otherwise the game will be over. If the heads of other snakes touch your body, the other snakes will become small gold coins of the same length as their bodies, and you can eat all these gold coins. Using stronger and higher-level snakes will have greater lethality. In the early stage of development, the moving snake in the game was implemented using nodes in the cocos engine. When the length of the snake was within 500 nodes, the frame rate in our game was relatively stable, at 50-60fps. When the length of the snake exceeded 500 nodes, the frame rate was below 45fps. The low frame rate caused the game to feel stuck and dizzy. When the length of the snake exceeded 1000 nodes, the frame rate dropped significantly to below 20fps. The reading time was long, and the efficiency of processing commands in the execution control script was low. The mismatched positioning lines were judged line by line, which control command prompt did not match, reducing the efficiency of finding deviations. The error detection code of the data block address data needs to be recalculated, which increases the time for generating error detection codes. The test equipment is seriously heated, and the game experience is extremely poor. Moreover, each node will draw a map separately for each frame. When there are few nodes, the impact of separate drawing is almost unnoticeable. However, when the number of nodes increases, the number of renderings doubles, and there are a lot of repeated drawing. The GPU pressure on the small game platform is too high, causing stuck. Summary of the invention
[0003] The purpose of the present invention is to provide a game optimization system based on the cocos engine to overcome the above shortcomings, including the following parts:
[0004] Cocos engine optimization processing module, used to receive the instructions input by the programmer and request processing, distinguish the types of control scripts in the received instructions, the control script has multiple control command prompts, the control command prompt is used to process the address of the data block to which it belongs, and this is achieved by reading the first line of control command prompt in the control script, and then returning the processing result;
[0005] The programmer input interface is connected to the Cocos engine optimization processing module and is used for programmers to input data. It also reads the programmer input data, creates instructions, and sends the instructions to the Cocos engine optimization processing module.
[0006] The Cocos engine optimization processing module includes an editor. Programmers use the editor to build snake game scenes, edit UI, edit snake animations, and import illustration resources and skin sorting. The illustration resources are used to meet the preferences of collecting players. At the same time, interesting buffs will be unlocked every time the illustrations are collected to a certain stage.
[0007] The programmer inputs instructions and requests processing. After the differentiation action is completed, the control command prompt is read to generate an edit execution result set. After reading a control command prompt, it is determined whether the read control command prompt does not match. If it does not match, the deviation information of the deviation control command prompt line will be popped up. When the type differentiation result is the control script type preset by the control script, the preset script type is used to read the control command prompt contained in the received control script. Otherwise, the control script type reading rule string is reset, and the reset control script type reading rule string is used to read the control command prompt contained in the received control script.
[0008] Before the programmer inputs instructions and requests processing, assist in decision-making on related functions, proactively contact users to communicate about product experience issues, in order to deepen the understanding of the current product ecosystem, and use the self-built ABtest platform to conduct ABtest tests on online users to improve the accuracy of decision-making, and use the thinkdata platform for data tracking.
[0009] Read the first line in the control script, and distinguish the result sets into resultA and resultB. ResultA is the preset control script type of the control script, and resultB is other script types. If it is resultA, the preset script type is used for reading. If it is resultB, the reset script type is used for reading. When both types cannot be read, the type deviation information is output; the starting point of the data block address and the length of the processed data block address are determined according to the range of the processed data block address; the control command prompt is read line by line, and after reading a control command prompt, the current reading process is output; when the control command prompt is a certain value, the data value of the processed data block address is a certain value, otherwise a function srand parameter is generated according to the line number in the control script, and then a data block address is generated according to the function srand parameter. A random number of the address; when the control command prompt is a write control command prompt, when editing and executing the control command prompt, the data block address data category of the command is received in advance, so an error detection code is generated in advance, and the binary type script after editing and execution is read. After extracting the data block address data and the error detection code, the corresponding relationship between the data block address and the error detection code is updated in real time. After editing and executing the binary information unit corresponding to the control command prompt, the number of database partition rows is set; it is determined whether the number of control command prompt rows contained in the generated binary information unit is greater than the number of database partition rows. If so, the binary information unit is partitioned into databases, and a database partition script is generated, and then the database partition script information is output; regardless of whether the binary script is partitioned into databases, it is further determined whether the control script is edited and executed. If the editing and execution is completed, it ends, otherwise the control script continues to be read.
[0010] After the optimization is completed and a low-fidelity prototype of the game is drawn, the gameplay is quickly implemented based on the prototype, and a demo with basic gameplay that can be run on a mobile phone is developed. The feel and experience of the game are continuously adjusted and optimized, and then the design materials are perfected to enrich the visual experience of the game. After comprehensive testing, it is submitted to the app market for review and launch.
[0011] The present invention has the following effects: through this optimization, the frame rate can still be maintained at 55-60fps when the length of the snake is 5000 nodes, the game performance is greatly improved, automatic error correction can be performed, the reading time is reduced, the efficiency of processing commands in the execution control script is improved, and the unmatched positioning lines can be quickly found without judging which control command prompt does not match line by line, thereby improving the efficiency of finding deviations, and by extracting data block address data and error detection codes, the corresponding relationship between the data block address and the error detection code is updated in real time, without recalculating the error detection code of the written data block address data, thereby reducing the time for generating error detection codes, optimizing the rendering performance of the game interface, greatly reducing the pressure on the GPU, and locally processing a large number of numerical calculations, reducing the user's dependence on the network, optimizing the network experience, and improving efficiency. DETAILED DESCRIPTION
[0012] The present invention will be further described below with reference to specific embodiments:
[0013] A game optimization system based on the cocos engine, including the following parts:
[0014] Cocos engine optimization processing module, used to receive the instructions input by the programmer and request processing, distinguish the types of control scripts in the received instructions, the control script has multiple control command prompts, the control command prompt is used to process the address of the data block to which it belongs, and this is achieved by reading the first line of control command prompt in the control script, and then returning the processing result;
[0015] The programmer input interface is connected to the Cocos engine optimization processing module and is used for programmers to input data. It also reads the programmer input data, creates instructions, and sends the instructions to the Cocos engine optimization processing module.
[0016] The Cocos engine optimization processing module includes an editor. Programmers use the editor to build snake game scenes, edit UI, edit snake animations, and import illustration resources and skin sorting. The illustration resources are used to meet the preferences of collecting players. At the same time, interesting buffs will be unlocked every time the illustrations are collected to a certain stage.
[0017] The programmer inputs instructions and requests processing. After the differentiation action is completed, the control command prompt is read to generate an edit execution result set. After reading a control command prompt, it is determined whether the read control command prompt does not match. If it does not match, the deviation information of the deviation control command prompt line will be popped up. When the type differentiation result is the control script type preset by the control script, the preset script type is used to read the control command prompt contained in the received control script. Otherwise, the control script type reading rule string is reset, and the reset control script type reading rule string is used to read the control command prompt contained in the received control script.
[0018] Before the programmer inputs instructions and requests processing, assist in decision-making on related functions, proactively contact users to communicate about product experience issues, in order to deepen the understanding of the current product ecosystem, and use the self-built ABtest platform to conduct ABtest tests on online users to improve the accuracy of decision-making, and use the thinkdata platform for data tracking.
[0019] Read the first line in the control script, and distinguish the result sets into resultA and resultB. ResultA is the preset control script type of the control script, and resultB is other script types. If it is resultA, the preset script type is used for reading. If it is resultB, the reset script type is used for reading. When both types cannot be read, the type deviation information is output; the starting point of the data block address and the length of the processed data block address are determined according to the range of the processed data block address; the control command prompt is read line by line, and after reading a control command prompt, the current reading process is output; when the control command prompt is a certain value, the data value of the processed data block address is a certain value, otherwise a function srand parameter is generated according to the line number in the control script, and then a data block address is generated according to the function srand parameter. A random number of the address; when the control command prompt is a write control command prompt, when editing and executing the control command prompt, the data block address data category of the command is received in advance, so an error detection code is generated in advance, and the binary type script after editing and execution is read. After extracting the data block address data and the error detection code, the corresponding relationship between the data block address and the error detection code is updated in real time. After editing and executing the binary information unit corresponding to the control command prompt, the number of database partition rows is set; it is determined whether the number of control command prompt rows contained in the generated binary information unit is greater than the number of database partition rows. If so, the binary information unit is partitioned into databases, and a database partition script is generated, and then the database partition script information is output; regardless of whether the binary script is partitioned into databases, it is further determined whether the control script is edited and executed. If the editing and execution is completed, it ends, otherwise the control script continues to be read.
[0020] After the optimization is completed and a low-fidelity prototype of the game is drawn, the gameplay is quickly implemented based on the prototype, and a demo with basic gameplay that can be run on a mobile phone is developed. The feel and experience of the game are continuously adjusted and optimized, and then the design materials are perfected to enrich the visual experience of the game. After comprehensive testing, it is submitted to the app market for review and launch.
[0021] V1.0 is launched. The core content of the first version is two modules: merging and placing and IO battle. The merging and placing gameplay sets a reasonable numerical growth route to establish clear stage goals for players (upgrade to get better-looking snakes), and the things to do to achieve the goal are also very clear (constantly merge snakes). Constantly give users positive feedback to keep them from stopping. The IO battle gameplay simulates real players as much as possible by constantly adjusting the capabilities of the AI in the game. Give AI different capabilities at different stages. Keep users in a tense and exciting game atmosphere. A new ranking module is added, and a prop house is added to the store module. The ranking gives users a new pursuit line to improve users' long-term retention. The store adds a prop house for use at the appropriate stage. Reduce the cost of users buying new snakes. Make the user's upgrade curve smoother. The task module is optimized, replacing linear repetitive tasks with interesting random tasks and achievement tasks. Let users have a sense of purpose when entering the game every day, and achievement tasks increase users' sense of accomplishment. The acceleration module is optimized and the treasure hunting module is optimized. These two modules are attempts to monetize advertising. The acceleration module will make you get more money the next time you watch a video. You will get a high reward if you watch a certain number of videos in the treasure hunt. Let users like watching videos. Cultivate users' habit of watching advertising videos. Added illustration module and skin sorting optimization. Synthetic users have some collection achievement attributes. We designed the illustration gameplay to meet the preferences of collecting users. At the same time, interesting buffs will be unlocked every time the illustrations are collected to a certain stage. Greatly increase the playability of the game. Cocos engine upgrade. Because the old version of the cocos engine is not friendly to low-end machines, low-end machines will experience lag, frame loss, heat and other phenomena when playing games. We upgraded the cocos engine. Optimize performance. Make low-end models iPhone6 and 6P no longer lag, and get a better experience. Added arena gameplay. After the ranking version module was launched, there was not much positive change in the long-term retention of users. We added another pursuit line for players. Arena gameplay. The arena is essentially a shorter and faster settlement instant ranking. It is a supplement to the old ranking. Users who don't have much time can also show their personality in the small leaderboard. We switched to the native drawing method of WebGL, manually calculated the position and color of each node map of the snake in each frame, and drew it all at once in the same frame. This led to the development of the snake drawing system in the game, which greatly reduced the pressure on the GPU. After the snake drawing system in the game was developed, the drawing system was expanded for a large number of scattered nodes such as debris / food / gold coins in the game, enriching the game content and gameplay without affecting the game performance, further improving the game experience.Cocos engine uses box2d as its internal physics system, which is powerful and complete. The game content of Snake Wars will use part of the physics system's technology, but Cocos cannot separate the most streamlined functions required for the game, so it develops its own physics collision system to simulate the physical scenarios needed for the game, and implements the basic movement and collision detection required by the game through quantification formulas, forming a game-specific physics collision system.
Claims
1. A game optimization system based on the cocos engine, characterized in that: Includes the following sections: The cocos engine optimization processing module is used to receive the instructions input by the programmer and request processing, distinguish the types of control scripts in the received instructions, and the control script has multiple control command prompts. The control command prompt is used to process the address of the data block to which it belongs. This is achieved by reading the first line of control command prompt in the control script, and then returning the processing result; The programmer input interface is connected to the cocos engine optimization processing module, and is used for the programmer to input data, read the programmer input data, create instructions, and send the instructions to the cocos engine optimization processing module; the cocos engine optimization processing module includes an editor, and the programmer uses the editor to build the snake game scene, edit the UI, edit the snake animation, and import the illustration resources and skin sorting. The illustration resources are used to meet the preferences of collecting players. At the same time, interesting buffs will be unlocked every time the illustrations are collected to a certain stage; the programmer inputs the instructions and requests processing, and after the distinction action is completed, the control command prompt is read to generate an edit execution result set. After reading a control command prompt, it is determined whether the read control command prompt does not match. If it does not match, the deviation control command prompt line deviation information is popped up. When the type distinction result is the control script type preset by the control script, the preset script type is used to read the control command prompt contained in the received control script. Otherwise, the control script type reading rule string is reset, and the control command prompt contained in the received control script is read using the reset control script type reading rule string; after the programmer inputs the instructions and requests Before processing, assist in decision-making for related functions, actively contact users to communicate about product experience issues, in order to deepen the understanding of the current product ecosystem, and use the self-built ABtest platform to conduct ABtest tests on online users to improve the accuracy of decision-making, and use the thinkdata platform for data tracking; read the first line in the control script, distinguish the result set into resultA and resultB, resultA is the preset control script type of the control script, and resultB is other script types. If it is resultA, the preset script type is used for reading, and if it is resultB, the reset script type is used for reading. When both types cannot be read, the type deviation information is output; determine the starting point of the data block address and the length of the data block address according to the range of the data block address; the control command prompt is read line by line, and when a control command prompt is read, the current reading process is output; when the control command prompt is a certain value, the data value of the data block address is a certain value, otherwise a function srand parameter is generated according to the line number in the control script, and then a random number of the data block address is generated according to the function srand parameter;When the control command prompt is a write control command prompt, when editing and executing the control command prompt, the data block address data category of the command is received in advance, so the error detection code is generated in advance, and the binary type script after editing and execution is read. After extracting the data block address data and the error detection code, the corresponding relationship between the data block address and the error detection code is updated in real time. After editing and executing the binary information unit corresponding to the control command prompt, the number of database partition rows is set; it is judged whether the number of control command prompt rows contained in the generated binary information unit is greater than the number of database partition rows. If it is greater, the binary information unit is partitioned, and a database partition script is generated, and then the database partition script information is output; regardless of whether the binary script is partitioned, it is further judged whether the control script is edited and executed. If the editing and execution is completed, it ends, otherwise the control script continues to be read. ; 2. The game optimization system based on the cocos engine according to claim 1, characterized in that: After the optimization is completed and a low-fidelity prototype of the game is drawn, the gameplay is quickly implemented based on the prototype, and a demo with basic gameplay that can be run on a mobile phone is developed. The feel and experience of the game are continuously adjusted and optimized, and then the design materials are improved to enrich the visual experience of the game. After comprehensive testing, it is submitted to the app market for review and launch.
Citation Information
Patent Citations
Control method based on unreal engine and related device
CN109753276A