Game prototype interface image generation method and system
By receiving the requirements documents for natural language description and using the game engine interface documents and prompt word templates, preliminary development code is automatically generated, which solves the problem of complex operation of prototype tools in the existing technology and the inability to directly understand the requirements for natural language description, and achieves the effect of improving the efficiency of game prototype interface development.
Patent Information
- Application Number
- CN202411991904.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2044-12-31
AI Technical Summary
When creating game prototype interfaces, existing prototype tools require users to spend a lot of time learning operation methods and functional characteristics, and cannot directly understand the requirements documents described in natural language, resulting in inefficient development.
By receiving requirements documents described in natural language, using game engine interface documents and prompt word templates, initial development code is automatically generated, and game prototype interface images are rendered based on these codes.
It reduces the learning cost and time cost of prototype interface production, reduces manual intervention and understanding bias, improves the accuracy of requirements understanding and the convenience of integration, and thus improves the overall development efficiency.
Smart Images

Figure CN119917096A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and system for generating a game prototype interface image. Background Art
[0002] The existing prototype interface production methods mainly rely on various prototype tools. Although these prototype tools are powerful, users need to spend a lot of time to learn and master their operation methods and functional characteristics. This not only increases the learning burden of users, but may also lead to reduced efficiency when making prototype interfaces due to unfamiliarity with the tools.
[0003] Moreover, traditional prototyping tools usually only provide basic interface design functions and cannot directly understand requirement documents described in natural language. This requires users to manually convert descriptions in requirement documents into operations in prototyping tools, making the generation of game prototype interface images inefficient. Summary of the invention
[0004] In view of the problems in the prior art, the present application provides a method for generating a game prototype interface image that can improve the efficiency of developing game prototype interface images.
[0005] A method for generating a game prototype interface image comprises the following steps:
[0006] Receive a requirement document, wherein the requirement document includes a plurality of requirement texts describing the interface image of the game prototype development in natural language;
[0007] According to the requirement document, pre-stored game engine interface documents for recording various interface texts are screened and integrated to obtain a requirement interface document;
[0008] Acquire a pre-built prompt word template, wherein the prompt word template includes a specific prompt word for indicating to perform a text replacement operation and a replacement mark for replacing the required text and the interface text;
[0009] According to the requirement text, extracting corresponding interface text from the requirement interface document;
[0010] After identifying the specific prompt word in the prompt word template, the requirement text and the interface text are replaced with the replacement mark to generate a prompt word;
[0011] According to the prompt words, based on a preset code generation model, a preliminary development code is generated;
[0012] According to the preliminary development code, a game prototype interface image is rendered.
[0013] The present application also provides a game prototype interface image generation method system, including:
[0014] A requirement document receiving module: used to receive a requirement document, wherein the requirement document includes a plurality of requirement texts describing the interface image of the game prototype development in natural language;
[0015] The demand interface document acquisition module is used to screen and integrate the pre-stored game engine interface documents for recording various interface texts according to the demand document to obtain the demand interface document;
[0016] Prompt word module replacement module: used to obtain a pre-built prompt word template, wherein the prompt word template includes a specific prompt word for indicating the execution of a text replacement operation and a replacement mark for replacing the required text and the interface text;
[0017] Interface text acquisition module: used to extract corresponding interface text from the requirement interface document according to the requirement text;
[0018] Prompt word acquisition module: used for identifying the specific prompt word in the prompt word template, and replacing the replacement mark with the requirement text and the interface text to generate the prompt word;
[0019] A preliminary development code acquisition module is used to generate preliminary development codes according to the prompt words and based on a preset code generation model;
[0020] Game prototype interface image acquisition module: used to render the game prototype interface image according to the preliminary development code.
[0021] Compared with the prior art, this solution receives the requirements document described in natural language, and uses the game engine interface document and prompt word template to automatically generate preliminary development code. Then, the game prototype interface image is rendered according to these codes, which reduces the learning cost and time cost of prototype interface production. Through natural language processing technology, the automatic parsing and understanding of the requirements document is realized, which reduces manual intervention and understanding deviation. The game engine interface document and prompt word template are integrated to realize the automatic generation from requirements to code, improve the accuracy of requirements understanding and the convenience of integration, thereby improving the overall development efficiency.
[0022] In order to provide a clearer understanding of the present application, the specific implementation of the present application will be described below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flowchart of a method for generating a game prototype interface image for this application;
[0024] Figure 2 A flowchart of a method for adjusting demand text in a method for generating a game prototype interface image in this application;
[0025] Figure 3 A flow chart of a method for calculating relative position in a method for generating a game prototype interface image in this application;
[0026] Figure 4 This is a flow chart of a method for calculating a proportion in a method for generating a game prototype interface image in this application;
[0027] Figure 5 A flowchart of a method for obtaining executable code in a method for generating a game prototype interface image in this application;
[0028] Figure 6 A flowchart of a method for obtaining fault-tolerant execution code in a method for generating a game prototype interface image in this application;
[0029] Figure 7 This is a schematic diagram of a game prototype interface image generation system for the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0031] It should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of the application. It should be understood that the operations of the flowcharts may be implemented out of order, and steps without logical contextual relationships may be reversed in order or implemented simultaneously. In addition, those skilled in the art may add one or more other operations to the flowcharts, or may remove one or more operations from the flowcharts, under the guidance of the content of this application.
[0032] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0033] Example 1
[0034] See also Figure 1 , Figure 1This is a flow chart of a method for generating a game prototype interface image in this application. This application provides a method for generating a game prototype interface image, which specifically includes the following steps:
[0035] S1: receiving a requirement document, wherein the requirement document includes a plurality of requirement texts describing the interface image of the game prototype development in natural language;
[0036] S2: According to the requirement document, pre-stored game engine interface documents for recording various interface texts are screened and integrated to obtain a requirement interface document;
[0037] S3: obtaining a pre-built prompt word template, wherein the prompt word template includes a specific prompt word for indicating to perform a text replacement operation and a replacement mark for replacing the required text and the interface text;
[0038] S4: extracting corresponding interface text from the requirement interface document according to the requirement text;
[0039] S5: After identifying the specific prompt word in the prompt word template, the requirement text and the interface text are replaced with the replacement mark to generate a prompt word;
[0040] S6: Generate preliminary development code according to the prompt word and based on a preset code generation model;
[0041] S7: Rendering a game prototype interface image according to the preliminary development code.
[0042] Compared with the existing technology, this solution receives the requirement document described in natural language, and uses the game engine interface document and prompt word template to automatically generate preliminary development code, which reduces the learning cost and time cost of prototype interface production, so that developers can quickly produce game prototype interface images that meet the requirements without in-depth understanding of complex prototype tools or game engines. Through natural language processing technology, automatic parsing and understanding of requirement documents are achieved, reducing manual intervention and understanding deviations, integrating game engine interface documents and prompt word templates, and realizing automatic generation from requirements to code, improving the accuracy of requirement understanding and the convenience of integration, thereby improving overall development efficiency.
[0043] The game prototype interface image generation method of the present invention can be executed by the following computer system, which includes a development database server, a data import server, a data acquisition server and a game prototype interface image generation server.
[0044] The development database server is used to store the requirement document, the game engine interface document, the prompt word template, the requirement interface document and the preliminary development code document to construct the development database. The data import server receives the requirement document into the development database. The data import server can import the game engine interface document from the game engine official website into the development database, and import the preset prompt word template into the development database.
[0045] The data acquisition server is used to obtain the requirement document, prompt word template and game engine interface document from the development database, and send them to the game prototype interface image generation server.
[0046] The game prototype interface image generation server executes the game prototype interface image generation method of the present invention, and according to the requirement text in the requirement document, the game engine interface document for recording multiple interface texts is screened and integrated to obtain the requirement interface document; according to the requirement text, the corresponding interface text is extracted from the requirement interface document, for example, the requirement text specifically requires a button control, and an event needs to be triggered after the user clicks the button; at this time, the interface text related to the button control is found in the requirement interface document, and the interface method matching the function described in the requirement text is identified. After identifying the specific prompt word in the prompt word template, the requirement text and the interface text replace the replacement mark to generate a prompt word; according to the prompt word, based on the preset code generation model, the preliminary development code is generated and stored in the development database. According to the preliminary development code, the game prototype interface image is rendered by the game development tool and engine.
[0047] In this embodiment, for step S1, in response to the receiving instruction of the data acquisition server, the data import server receives the user's demand document, for example, through human-computer dialogue, receiving the natural voice text input by the user to generate the demand document. Of course, the data import server can also receive the demand document through an application programming interface (Application Programming Interface, API).
[0048] The requirement document includes several requirement texts describing the development of the game prototype interface image in natural language. The requirement texts include the description of the prototype control layout, implementation functions and interaction methods of the game prototype interface image, wherein each prototype control is correspondingly provided with a prototype control identifier.
[0049] Exemplarily, for the description of the prototype control layout, a top navigation bar, a game information display area and a bottom control bar are provided. The top navigation bar is located at the top of the interface, and includes five buttons, namely, "Start Game", "Continue Game", "Settings", "Store" and "Exit". The buttons are evenly spaced, and the buttons are designed in a rounded rectangle with a dark blue background color and white text color. The background color changes to light blue when hovering. The game information display area is located below the navigation bar, and includes text, using clear fonts and colors to distinguish different information. The bottom control bar is set at the bottom of the interface, and includes a virtual joystick (for movement), an attack button, a jump button and a special skill button.
[0050] For the functional description, click the "Start Game" button to load and display the main interface of the game and initialize the game data; click the "Continue Game" button to load the game progress saved by the player last time; click the "Settings" button to allow the player to adjust game sound effects, picture quality and other options; click the "Store" button to display purchasable props, equipment and skills, and players can use gold coins to purchase them; click the "Exit" button to save the current game progress and exit the game.
[0051] For the description of the interaction method, click interaction: players can interact by clicking buttons on the interface, such as selecting characters, purchasing props, etc. Virtual joystick control: players can control the movement direction of the game character through the virtual joystick to achieve precise operation. Button combination operation: players can use a combination of different attack buttons, jump buttons and special skill buttons to achieve special skills or attacks.
[0052] Of course, in other embodiments, according to actual development requirements, the requirement text also includes annotation content, etc.
[0053] For step S2, in response to the screening and integration instruction of the data acquisition server, the data acquisition server obtains the requirement document and the game engine interface document from the development database, and sends them to the game prototype interface image generation server.
[0054] The game prototype interface image generation server matches the demand text in the demand document with the controls, implementation functions and interaction methods mentioned in the demand text, and excludes interface texts that are irrelevant to the current game prototype interface image design, thereby completing the screening of each of the game engine interface documents. The game engine interface documents after screening are integrated to obtain the demand interface document, and are stored in the development database. The interface text refers to the API interface text in the game engine interface document.
[0055] For steps S3-S5, in response to the replacement instruction of the data acquisition server, the data acquisition server obtains the requirement document, the requirement interface document and the prompt word template from the development database, and sends them to the game prototype interface image generation server.
[0056] The prompt word template is a predefined text structure, which contains specific placeholders or tags, which will be replaced by actual content in subsequent steps, and are used to guide the generation of prompt words with clear indicative meanings according to the requirement document and the requirement interface document. The prompt word template includes a specific prompt word for indicating the execution of a text replacement operation and a replacement tag for replacing the requirement text and the interface text.
[0057] The game prototype interface image generation server searches for an interface that matches the function described in the requirement text from the requirement interface document according to the requirement text in the requirement document, extracts the corresponding interface text, and the interface text may include the complete definition of the interface, parameter description and usage examples, etc.; after identifying the specific prompt word in the prompt word template, the requirement text and interface text replace the replacement mark, generate prompt words and store them in the development database. The prompt word is the final text generated according to the prompt word template, which combines the requirement text in the requirement document and the interface text in the interface document, and is formed by replacing the placeholders or tags in the template, and is used to provide clear instructions to the developer or code generation model to implement specific functions or interfaces according to the requirements.
[0058] In one embodiment, the replacement mark includes a requirement text replacement mark and an interface text replacement mark. After identifying the specific prompt word in the prompt word template, the requirement text and the interface text are replaced with the requirement text replacement mark and the interface text replacement mark respectively. Exemplarily, the specific prompt word is "Based on the content of the requirement text, filter out the interface text required to implement the requirement content from the requirement interface document. The following is the interface text content and requirement content", and the interface text replacement mark is "<api_tag> ", the requirement text replaces the mark with " <input> ”.
[0059] Of course, in other embodiments, the prompt word template also includes a comment text replacement mark, and after identifying the comment text replacement mark, the comment content in the requirement document replaces the comment text replacement mark. According to actual development requirements, the content of the specific prompt word, the requirement text replacement mark and the interface text replacement mark can also be adaptively modified.
[0060] For step S6 and step S7, the preset code generation model is a large language model, and the GPT model is preferably selected. The preliminary development code generation instruction generated by the game prototype interface image generation server is received, the data acquisition server obtains the prompt word from the development database and sends it to the game prototype interface image generation server, the game prototype interface image generation server inputs the prompt word into the code generation model, obtains the preliminary development code, and stores it in the development database. And according to the preliminary development code, the game prototype interface image is rendered by the game development tool and engine.
[0061] For step S7, after rendering the game prototype interface image according to the preliminary development code, the following steps are included: S8: According to the game prototype interface image, the demand text is adjusted based on the demand-driven game prototype interface image iterative optimization mechanism to obtain the final development code.
[0062] For step S8, in this embodiment, the demand-driven iterative optimization mechanism for the game prototype interface image is specifically as follows: the developer evaluates the game prototype interface image to obtain an evaluation result. The evaluation result includes whether the control layout, color, and font in the game prototype interface image meet the needs of the developer. According to the evaluation result, the demand text is adjusted, and according to the adjusted demand text, steps S1-S7 are repeated, and the user evaluates the generated game prototype interface image again, and continues to adjust the demand text according to the evaluation result until the game prototype interface image meets the needs of the developer. At this time, the preliminary development code is the final development code.
[0063] For example, if the position of a specific button control in the game prototype interface image is higher, and the developer's requirement is that the button control is lower, the developer can modify the requirement text: "Lower the position of the button control", and then re-evaluate the game prototype interface image generated according to the modified requirement text. If it is found that the button control is already at a lower position, the game prototype interface image meets the developer's requirements, and the process of adjusting the requirement text is stopped, and the preliminary development code at this time is determined to be the final development code. Otherwise, continue to modify the requirement text to adjust the position of the button control.
[0064] In other embodiments, for step S8, see Figure 2 , Figure 2 This is a flow chart of a method for adjusting the requirement text in a method for generating a game prototype interface image in this application. According to the game prototype interface image, the requirement text is adjusted based on a requirement-driven iterative optimization mechanism for the game prototype interface image to obtain the final development code, and the following steps are also included:
[0065] S81: Acquire a pre-stored game prototype benchmark interface image, wherein each benchmark control identifier in the game prototype benchmark interface image has any prototype control identifier that matches it;
[0066] S82: Based on a preset control recognition model, image recognition is performed on the game prototype benchmark interface image and the game prototype interface image to obtain a benchmark control prediction box, a benchmark control type probability, a benchmark control identifier, and a game prototype benchmark interface border frame in the game prototype benchmark interface image, as well as a prototype control prediction box, a prototype control type probability, a prototype control identifier, and a game prototype interface border frame in the game prototype interface image;
[0067] S83: Calculate the relative position of each of the reference controls relative to the game prototype reference interface and the relative position of each of the prototype controls relative to the game prototype interface according to the coordinates of each pixel point of the reference control prediction frame, the game prototype reference interface border frame, the prototype control prediction frame and the game prototype interface border frame;
[0068] S84: Calculate the proportion of each benchmark control relative to the game prototype benchmark interface and the proportion of each prototype control relative to the game prototype interface according to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame and the game prototype interface border frame;
[0069] S85: According to the relative position and proportion of the benchmark control relative to the game prototype benchmark interface, and the relative position and proportion of the prototype control relative to the game prototype interface, select a benchmark control and a prototype control whose benchmark control identifier is the same as the prototype control identifier, and calculate the relative position error of the prototype control relative to the benchmark control, and the proportion error of the prototype control relative to the benchmark control;
[0070] S86: Selecting the control type with the highest probability of the benchmark control type as the benchmark control type and the control type with the highest probability of the prototype control type as the prototype control type respectively;
[0071] S87: If the relative position error is greater than the preset relative position error threshold, and / or the proportion error is greater than the preset proportion error threshold and / or the benchmark control type and the prototype control type are different, based on the preset control adjustment model, repeatedly adjust the requirement document until the relative position error is less than the preset relative position error threshold, and / or the proportion error is less than the preset proportion error threshold and / or the benchmark control type and the prototype control type are the same.
[0072] For step S81, during the game development process, the UI design team first designs the game prototype benchmark interface image according to the requirement document, and the game prototype benchmark interface image displays the layout of each benchmark control such as the top navigation bar, the game information display area and the bottom control bar, etc., wherein each benchmark control is provided with a specific benchmark control identifier.
[0073] The setting of each prototype control identifier in the requirement text in the requirement document should be consistent with the setting standard of each benchmark control identifier in the game prototype benchmark interface image. Specifically, each benchmark control identifier in the game prototype benchmark interface image has any prototype control identifier that matches it. The game prototype benchmark interface image can be stored in the development database, and of course can also be used as an input parameter for comparison with the game prototype interface image.
[0074] For step S82, in this embodiment, a deep learning method such as a convolutional neural network (CNN) is preferably used as the control recognition model, and the control recognition model is trained based on a large amount of annotated data. The annotated data can be marked by marking the control in the game prototype interface image and the entire game prototype interface image to mark the position coordinates, type labels and identification labels of the control, and mark the position coordinates of the game prototype interface image. It enables it to learn and extract features in the game prototype interface image, thereby realizing accurate recognition and positioning of the position, control identification and type of the control, and accurate recognition and positioning of the position of the game prototype interface image.
[0075] It is worth noting that the control recognition model is not only applicable to the game prototype interface images used in training, but can also be extended to other related images such as game prototype benchmark interface images.
[0076] When the control recognition model performs image recognition on the game prototype reference interface image and the game prototype interface image, for each identified prototype control and reference control, the control recognition model generates a corresponding prediction box, control identifier and control type probability, and the center coordinates and size of the corresponding prototype control and / or reference control can be further extracted according to the coordinates of each pixel point of the corresponding prediction box. And for the corresponding prediction box, the control type with the highest control type probability is selected as the control type of the prediction box, and the control type includes buttons, text boxes, drop-down lists, icons, etc.
[0077] At the same time, the control recognition model will also generate a reference bounding box for the entire game prototype reference interface image and a prototype bounding box for the entire game prototype interface image, and further extract the center coordinates and size of the game prototype reference interface image and the game prototype interface image based on the coordinates of each pixel point of the reference bounding box and the prototype bounding box.
[0078] Among them, the prototype control refers to the control set in the game prototype benchmark interface, and the benchmark control refers to the control set in the game prototype benchmark interface.
[0079] For step S83, please also refer to Figure 3 , Figure 3 This is a flow chart of a method for calculating relative position in a method for generating a game prototype interface image in the present application. The relative position of the reference control relative to the game prototype reference interface and the relative position of the prototype control relative to the game prototype interface are calculated according to the coordinates of each pixel point of the reference control prediction frame, the game prototype reference interface border frame, the prototype control prediction frame, and the game prototype interface border frame, respectively, including:
[0080] S831: Calculate the center coordinates of the benchmark control, the center coordinates of the game prototype benchmark interface, the center coordinates of the prototype control, and the center coordinates of the game prototype benchmark interface according to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame, and the game prototype interface border frame;
[0081] S832: Calculate the relative position of the benchmark control with respect to the game prototype benchmark interface and the relative position of the prototype control with respect to the game prototype interface according to the center coordinates of the benchmark control and the center coordinates of the game prototype benchmark interface, as well as the center coordinates of the prototype control and the center coordinates of the game prototype benchmark interface.
[0082] For step S831, in this embodiment, when the reference control prediction frame, the game prototype reference interface border frame, the prototype control prediction frame, and the game prototype interface border frame are all rectangular frames, the center coordinates can be obtained by obtaining the upper left corner coordinates and the lower right corner coordinates of the rectangular frame, and calculating the average horizontal coordinates and the average vertical coordinates of the upper left corner coordinates and the lower right corner coordinates, respectively. When the reference control prediction frame and the prototype control prediction frame are circular or elliptical, the center of the circle is the center coordinate of the reference control prediction frame and the prototype control prediction frame.
[0083] Of course, the center coordinates can also be obtained by calculating the centroid of the benchmark control prediction box, the game prototype benchmark interface border box, the prototype control prediction box and the game prototype interface border box through the coordinates of each pixel point of the benchmark control prediction box, the game prototype benchmark interface border box, the prototype control prediction box and the game prototype interface border box.
[0084] For step S832, the relative position of the reference control relative to the game prototype reference interface and the relative position of the prototype control relative to the game prototype interface can be expressed by vector representation or coordinate difference representation. The horizontal coordinate difference and the vertical coordinate difference between the center coordinates of the reference control and the center coordinates of the game prototype reference interface are calculated to obtain the relative position of the reference control relative to the game prototype reference interface; the horizontal coordinate difference and the vertical coordinate difference between the center coordinates of the prototype control and the center coordinates of the game prototype interface are calculated to obtain the relative position of the prototype control relative to the game prototype interface.
[0085] For step S84, please also refer to Figure 4 , Figure 4 This is a flow chart of a method for calculating a proportion in a method for generating a game prototype interface image in the present application. The method of calculating the proportion of the benchmark control relative to the game prototype benchmark interface and the proportion of the prototype control relative to the game prototype interface respectively according to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame, and the game prototype interface border frame includes:
[0086] S841: Calculate the area of the benchmark control, the area of the game prototype benchmark interface, the area of the prototype control and the area of the game prototype benchmark interface according to the coordinates of each pixel point of the benchmark control prediction box, the game prototype benchmark interface border box, the prototype control prediction box and the game prototype interface border box;
[0087] S842: Calculate the ratio of the benchmark control area to the game prototype benchmark interface area, and calculate the proportion of the prototype control area to the game prototype benchmark interface area, to obtain the proportion of the benchmark control relative to the game prototype benchmark interface and the proportion of the prototype control relative to the game prototype interface.
[0088] For step S841, in this embodiment, when the benchmark control prediction box, the game prototype benchmark interface border box, the prototype control prediction box and the game prototype interface border box are rectangles, the area of the rectangle can be obtained by calculating the horizontal coordinate difference and vertical coordinate interpolation of the upper left corner coordinate and the lower right corner coordinate of the rectangle, and multiplying the horizontal coordinate difference and the vertical coordinate interpolation.
[0089] When the reference control prediction box, the game prototype reference interface edge box, the prototype control prediction box, and the game prototype interface edge box are irregular shapes, the polygon approximation technology can be used to determine the boundary pixel points of the irregular shape, and the irregular shape can be approximated to a polygon using a polygon approximation algorithm (such as a convex hull algorithm, a minimum circumscribed polygon algorithm, etc.), and the area of the polygon can be calculated. The polygon area can be calculated using a variety of methods, such as a vector cross product method, a triangle segmentation method, etc.
[0090] For step S85, in this embodiment, the horizontal coordinate error can be obtained by calculating the difference between the horizontal coordinate of the relative position of the prototype control and the horizontal coordinate of the relative position of the reference control; the vertical coordinate error can be obtained by calculating the difference between the vertical coordinate of the relative position of the prototype control and the vertical coordinate of the relative position of the reference control. According to actual needs, the horizontal coordinate error and the vertical coordinate error can also be combined by calculating the square root of the sum of the squares of the vertical coordinate error and the horizontal coordinate error (i.e., the Euclidean distance) to form a comprehensive relative position error to obtain the relative position error.
[0091] The proportion error is obtained by calculating the absolute difference or relative difference between the proportion of the benchmark control relative to the game prototype benchmark interface and the proportion of the prototype control relative to the game prototype interface.
[0092] For step S87, in this embodiment, the relative position error threshold can be set to a proportional value related to the size of the game prototype reference interface or the game prototype interface. Exemplarily, when the width and height of the game prototype reference interface or the game prototype interface are both 1000 pixels, the relative position error threshold can be set to 5% of the size of the game prototype reference interface or the game prototype interface, that is, 50 pixels.
[0093] The proportion error threshold is the ratio of the difference between the actual proportion of the control and the expected proportion. For example, if the proportion of the benchmark control or prototype control is between 0.1 and 0.5, the reasonable proportion error threshold should be set to within 10% of the proportion. Taking the benchmark control or prototype control with a proportion of 0.2 as an example, its proportion error threshold should be strictly limited to within 0.02 (i.e. 10% of 0.2). According to actual development needs, the proportion error threshold can be adaptively reduced as the proportion increases.
[0094] When any prototype control and the benchmark control corresponding to the prototype control identifier that is the same as the benchmark control identifier simultaneously satisfy the conditions that the relative position error is less than a preset relative position error threshold, the proportion error is less than a preset proportion error threshold, and the benchmark control type and the prototype control type are the same, it is considered that the game prototype interface image meets the development requirements.
[0095] The preset control adjustment model gives priority to the GPT model. If the relative position error is greater than the preset relative position error threshold, the control adjustment model generates a relative position adjustment text for adjusting the requirement text according to the value and direction of the relative position error, indicating that the position of the corresponding prototype control needs to be adjusted, as well as the direction and distance of the adjustment. Exemplarily, it can be generated: "Please move the 'login button' to the right by a number of pixels and down by a number of pixels" to ensure that the relative position of the "login button" in the game prototype interface is consistent with the relative position of the "login button" in the game prototype baseline interface image, which is specifically reflected in that the relative position error is less than the relative position error threshold.
[0096] If the proportion error is greater than the preset proportion error threshold, the control adjustment model generates proportion adjustment text for adjusting the requirement text according to the value of the proportion error, indicating that the size of the corresponding prototype control needs to be adjusted. Exemplarily, it can be generated: "Please increase the width of the 'login button' by a certain number of pixels, and keep the height unchanged" to ensure that the proportion of the "login button" in the game prototype interface is consistent with the proportion of the "login button" in the game prototype baseline interface image, which is specifically reflected in the proportion error being less than the proportion error threshold.
[0097] If the benchmark control type and the prototype control type are not the same, the control adjustment model generates a control type adjustment text for adjusting the requirement text, indicating that the control type of the corresponding prototype control needs to be adjusted. Exemplarily, it can be generated: "Please change the 'text input box' to 'password input box'" to ensure that the benchmark control type and prototype control type corresponding to the prototype control and the benchmark control are the same. Of course, the control adjustment model uses other artificial intelligence models suitable for understanding and generating natural language text.
[0098] In one embodiment, the preliminary development code includes executable code, non-executable code and an executable code segmentation mark for segmenting the executable code and the non-executable code, wherein the executable code refers to a code fragment that can be directly executed by a computer or an interpreter to complete a specific task, and generally includes instructions in a programming language (such as Python, Java, C++, etc.), such as function definitions, variable declarations, control structures (such as loops and conditional statements), etc. When the executable code is compiled or interpreted and run, specific operations or calculations will be performed. The non-executable code generally refers to text or markup language content that is not directly used for computer execution, including comments, document strings, Markdown text (for document writing), HTML tags (for description of text and structure in web page development), etc., which are used for code interpretation, usage instructions or formatted text information. The non-executable code is important for humans to read and understand the code, but it will not be directly executed by the computer. The executable code segmentation mark is a Markdown code block mark, specifically "```".
[0099] Developers can add a description of code generation requirements in the requirement text. For example, the code generation requirements can be: the generated preliminary development code includes executable code and non-executable code, and an executable code segmentation mark is set before and after the executable code to achieve segmentation of the executable code and the non-executable code. The code segmentation mark is "```". Of course, according to actual development needs, the executable code segmentation mark can also use other code block marks.
[0100] See also Figure 5 , Figure 5 This is a flowchart of a method for obtaining executable code in a method for generating a game prototype interface image in this application. According to the prompt word, based on a preset code generation model, after generating a preliminary development code, the following steps are included:
[0101] S91: identifying the execution code segmentation mark according to the preliminary development code, and determining the start and end boundaries of the execution code according to the position of the execution code segmentation mark;
[0102] S92: Based on the start and end boundaries of the execution code, extract the execution code from the preliminary development code by string cutting as the executable code.
[0103] For step S92, please also refer to Figure 6 , Figure 6 This is a flow chart of a method for obtaining a fault-tolerant execution code in a method for generating a game prototype interface image in the present application. After obtaining the executable code, the executable code is packaged to obtain the fault-tolerant execution code, which specifically includes the following steps:
[0104] S921: According to the executable code, based on a preset code segmentation standard, sequentially segment the executable code into a plurality of executable code blocks having independent logic and capable of being executed separately;
[0105] S922: inserting preset fault-tolerant codes before and after each executable code block to obtain an enhanced code block;
[0106] S923: splicing the enhanced code blocks in sequence to obtain the fault-tolerant execution code.
[0107] For step S921, the code segmentation standard at least includes taking any function structure, any class structure, any complete conditional judgment statement and any complete loop statement as an executable code block. The function structure refers to an entity that encapsulates a series of instructions that can execute a specific task or calculation and may return an execution result, including a function declaration and a function body. The function declaration is used to specify the function name, parameter list and return type, and the function body is the code that executes a specific task or calculation.
[0108] The class structure is used to define the properties and behaviors of an object, and includes a class declaration and a class body. The class declaration is used to specify the name of the class structure and the inherited parent class, and the class body includes property definitions and method definitions.
[0109] The complete conditional judgment statement is used to execute different code paths according to the judgment condition, and includes one or more conditional expressions and one or more conditional execution code blocks, and the conditional execution code blocks are executed when the condition is true or false.
[0110] The complete loop statement is used to repeatedly execute a section of code until a certain condition is met. It includes loop initialization, loop condition and loop body. The loop initialization refers to setting the initial condition and / or initial variable before the loop starts. For example, in a for loop, initialization is completed in the loop declaration. For example, int i=0 in for(int i=0; i<10; i++) is loop initialization. In a while loop, loop initialization is usually completed in a separate statement before the loop statement, because the while loop itself does not contain loop initialization. The loop condition is a Boolean expression used to determine whether to continue executing the loop body. The loop body refers to a code block that is repeatedly executed.
[0111] In other embodiments, the code segmentation annotation may be adaptively adjusted according to actual development requirements. For example, if a code block involves a database transaction, the entire database transaction processing code may be treated as an independent code block.
[0112] For steps S922-S923, the fault-tolerant code preferentially uses the try-catch block to catch exceptions, and records error information or takes other recovery measures in the except block. Specifically, the try block is inserted into the front end of the executable code block, so that the executable code block is placed in the try block, and the catch block is inserted into the back end of the executable code block, and any possible exceptions are handled in the catch block. Exemplarily, in Java, for a for loop statement, after inserting the fault-tolerant code, it is as follows:
[0113] try{
[0114] / / This is the start of the for loop
[0115] for(int i=0;i<10;i++){
[0116] / / Code inside the loop
[0117] System.out.println(i);
[0118] / / Here you can put some code that may throw an exception
[0119] }
[0120] }catch(SomeSpecificException e){
[0121] / / If SomeSpecificException is thrown in the for loop, the code here is executed
[0122] System.out.println("An error occurred:"+e.getMessage());
[0123] }.
[0124] The executable code blocks obtained by cutting according to the above code segmentation standards all have independent logic and the ability to be executed independently. After inserting the fault-tolerant code to obtain the enhanced code blocks, they are spliced to form the final fault-tolerant execution code. By inserting the fault-tolerant code to capture exceptions, the program can be prevented from crashing directly when encountering errors, which helps to improve the robustness, readability and maintainability of the code.
[0125] Example 2
[0126] See also Figure 7 , Figure 7 This is a schematic diagram of a game prototype interface image generation system of the present application. The present application also provides a game prototype interface image generation system, including:
[0127] Requirement document receiving module 1: used to receive a requirement document, wherein the requirement document includes a plurality of requirement texts describing the interface image of the game prototype development in natural language;
[0128] Demand interface document acquisition module 2: used to screen and integrate pre-stored game engine interface documents for recording various interface texts according to the demand document to obtain the demand interface document;
[0129] Prompt word module replacement module 3: used to obtain a pre-built prompt word template, wherein the prompt word template includes a specific prompt word for indicating the execution of a text replacement operation and a replacement mark for replacing the required text and the interface text;
[0130] Interface text acquisition module 4: used to extract corresponding interface text from the demand interface document according to the demand text;
[0131] Prompt word acquisition module 5: used for identifying the specific prompt word in the prompt word template, and replacing the replacement mark with the requirement text and the interface text to generate a prompt word;
[0132] A preliminary development code acquisition module 6 is used to generate preliminary development codes according to the prompt words and based on a preset code generation model;
[0133] The game prototype interface image acquisition module 7 is used to render the game prototype interface image according to the preliminary development code.
[0134] It should be noted that the data obtained by the game prototype interface image generation method system provided by the present application when implementing a game prototype interface image generation method is stored one-to-one in the storage of the system. When relevant calculations are required, the data required for the calculation can be directly obtained from the storage.
[0135] It should also be noted that the game prototype interface image generation method system provided in the above embodiment only uses the division of the above functional modules as an example when implementing a game prototype interface image generation method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the game prototype interface image generation method system provided in the above embodiment and the game prototype interface image generation method of embodiment 1 belong to the same concept. The implementation process is detailed in the method embodiment, which will not be repeated here.
[0136] Based on the same inventive concept, the present application also provides an electronic device, which may be a terminal device such as a server, a desktop computing device or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the method for generating a game prototype interface image; and the memory is used to store a computer program executable by the processor.
[0137] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be a computer executable instruction, and the computer executable instruction can execute the method for generating a game prototype interface image. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassette, tape disk storage or other magnetic storage device or any other non-transmission medium, which can be used to store information that can be accessed by a computing device.
[0138] The present application is not limited to the above-mentioned implementation modes. If various changes or modifications to the present application do not depart from the spirit and scope of the present application, and if these changes and modifications fall within the claims and equivalent technical scope of the present application, the present application is also intended to include these changes and modifications.
Claims
1. A method for generating a game prototype interface image, characterized in that: The following steps are involved: Receive a requirement document, wherein the requirement document includes a plurality of requirement texts describing the interface image of the game prototype development in natural language; According to the requirement document, pre-stored game engine interface documents for recording various interface texts are screened and integrated to obtain a requirement interface document; Acquire a pre-built prompt word template, wherein the prompt word template includes a specific prompt word for indicating to perform a text replacement operation and a replacement mark for replacing the required text and the interface text; According to the requirement text, extracting corresponding interface text from the requirement interface document; After identifying the specific prompt word in the prompt word template, the requirement text and the interface text are replaced with the replacement mark to generate a prompt word; According to the prompt words, based on a preset code generation model, a preliminary development code is generated; According to the preliminary development code, a game prototype interface image is rendered.
2. A method for generating a game prototype interface image according to claim 1, characterized in that: After rendering a game prototype interface image according to the preliminary development code, the following steps are included: according to the game prototype interface image, the requirement text is adjusted based on a requirement-driven game prototype interface image iterative optimization mechanism to obtain a final development code.
3. A method for generating a game prototype interface image according to claim 2, characterized in that: The requirement text at least includes a prototype control layout of a game prototype interface image, wherein each prototype control is correspondingly provided with a prototype control identifier; According to the game prototype interface image, the requirement text is adjusted based on a requirement-driven game prototype interface image iterative optimization mechanism to obtain a final development code, including the following steps: Acquire a pre-stored game prototype benchmark interface image, wherein each benchmark control identifier in the game prototype benchmark interface image has any of the prototype control identifiers that match it; Based on a preset control recognition model, image recognition is performed on the game prototype benchmark interface image and the game prototype interface image to obtain a benchmark control prediction box, a benchmark control type probability, a benchmark control identifier, and a game prototype benchmark interface border frame in the game prototype benchmark interface image, as well as a prototype control prediction box, a prototype control type probability, a prototype control identifier, and a game prototype interface border frame in the game prototype interface image; According to the coordinates of each pixel point of the reference control prediction frame, the game prototype reference interface border frame, the prototype control prediction frame and the game prototype interface border frame, respectively calculate the relative position of each reference control relative to the game prototype reference interface and the relative position of each prototype control relative to the game prototype interface; According to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame and the game prototype interface border frame, respectively calculate the proportion of each benchmark control relative to the game prototype benchmark interface and the proportion of each prototype control relative to the game prototype interface; According to the relative position and proportion of the benchmark control relative to the game prototype benchmark interface, and the relative position and proportion of the prototype control relative to the game prototype interface, select a benchmark control and a prototype control whose benchmark control identifier is the same as the prototype control identifier, and calculate the relative position error of the prototype control relative to the benchmark control, and the proportion error of the prototype control relative to the benchmark control; Respectively selecting the control type with the highest probability of the benchmark control type as the benchmark control type, and the control type with the highest probability of the prototype control type as the prototype control type; If the relative position error is greater than a preset relative position error threshold, and / or the proportion error is greater than a preset proportion error threshold, and / or the benchmark control type and the prototype control type are different, based on a preset control adjustment model, repeatedly adjust the requirement document until the relative position error is less than the preset relative position error threshold, and / or the proportion error is less than the preset proportion error threshold, and / or the benchmark control type and the prototype control type are the same.
4. A method for generating a game prototype interface image according to claim 3, characterized in that: The method of calculating the relative position of the reference control relative to the game prototype reference interface and the relative position of the prototype control relative to the game prototype interface according to the coordinates of each pixel point of the reference control prediction frame, the game prototype reference interface border frame, the prototype control prediction frame and the game prototype interface border frame comprises: According to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame and the game prototype interface border frame, respectively calculate the benchmark control center coordinates, the game prototype benchmark interface center coordinates, the prototype control center coordinates and the game prototype benchmark interface center coordinates; According to the center coordinates of the benchmark control and the center coordinates of the game prototype benchmark interface, as well as the center coordinates of the prototype control and the center coordinates of the game prototype benchmark interface, the relative position of the benchmark control with respect to the game prototype benchmark interface and the relative position of the prototype control with respect to the game prototype interface are calculated respectively.
5. A method for generating a game prototype interface image according to claim 3, characterized in that: The calculating the proportion of the benchmark control relative to the game prototype benchmark interface and the proportion of the prototype control relative to the game prototype interface respectively according to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame and the game prototype interface border frame includes: According to the coordinates of each pixel point of the benchmark control prediction frame, the game prototype benchmark interface border frame, the prototype control prediction frame and the game prototype interface border frame, respectively calculate the benchmark control area, the game prototype benchmark interface area, the prototype control area and the game prototype benchmark interface area; The ratio of the benchmark control area to the game prototype benchmark interface area and the ratio of the prototype control area to the game prototype benchmark interface area are calculated respectively to obtain the proportion of the benchmark control relative to the game prototype benchmark interface and the proportion of the prototype control relative to the game prototype interface.
6. A method for generating a game prototype interface image according to claim 1, characterized in that: The replacement mark includes a requirement text replacement mark and an interface text replacement mark. After identifying the specific prompt word in the prompt word template, the requirement text and interface text are replaced by the requirement text replacement mark and the interface text replacement mark respectively.
7. A method for generating a game prototype interface image according to claim 1, characterized in that: The preliminary development code includes an execution code, a non-execution code, and an execution code segmentation mark for segmenting the execution code and the non-execution code; According to the prompt words, based on the preset code generation model, after the preliminary development code is generated, the following steps are included: According to the preliminary development code, identifying the execution code segmentation mark, and determining the start and end boundaries of the execution code according to the position of the execution code segmentation mark; Based on the start and end boundaries of the execution code, the execution code is extracted from the preliminary development code by string cutting as the executable code.
8. A method for generating a game prototype interface image according to claim 7, characterized in that: After obtaining the executable code, encapsulating the executable code to obtain a fault-tolerant executable code specifically includes the following steps: According to the executable code, based on a preset code segmentation standard, the executable code is sequentially segmented into a plurality of executable code blocks having independent logic and capable of being executed separately, wherein the code segmentation standard at least includes taking any function structure, any class structure, any complete conditional judgment statement and any complete loop statement as an executable code block; After inserting preset fault-tolerant codes before and after each executable code block, an enhanced code block is obtained; The enhanced code blocks are sequentially spliced to obtain the fault-tolerant execution code.
9. A game prototype interface image generation system, characterized in that: include: A requirement document receiving module: used to receive a requirement document, wherein the requirement document includes a plurality of requirement texts describing the interface image of the game prototype development in natural language; The demand interface document acquisition module is used to screen and integrate the pre-stored game engine interface documents for recording various interface texts according to the demand document to obtain the demand interface document; Prompt word module replacement module: used to obtain a pre-built prompt word template, wherein the prompt word template includes a specific prompt word for indicating the execution of a text replacement operation and a replacement mark for replacing the required text and the interface text; Interface text acquisition module: used to extract corresponding interface text from the requirement interface document according to the requirement text; Prompt word acquisition module: used for identifying the specific prompt word in the prompt word template, and replacing the replacement mark with the requirement text and the interface text to generate the prompt word; A preliminary development code acquisition module is used to generate preliminary development codes according to the prompt words and based on a preset code generation model; Game prototype interface image acquisition module: used to render the game prototype interface image according to the preliminary development code.
10. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method for generating a game prototype interface image as described in any one of claims 1 to 8 when executing the computer program.
Citation Information
Patent Citations
Document generation method and device based on product prototype interface
CN111859886A
Interactive page generation method and device, equipment and storage medium thereof
CN117234505A
Data processing method and device, storage medium and electronic equipment
CN118567772A
Method and device for automatically generating front-end code by image
CN119179484A
Converting Text-Based Requirements to A Live Prototype
US20210271815A1