A game picture maintenance method and system
Patent Information
- Application Number
- CN202510401837.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2026-10-16
AI Technical Summary
然而,这种人工操作方式存在诸多技术问题
[0006] The beneficial effects of this invention are as follows: It acquires a source image and a target template image library for the game, determines the feature information of the source images, acquires a set of game script files, and filters a subset of scripts related to the source images from the script file set based on the feature information. Based on the script subset, it selects a pre-filtered target template image from the target template image library, and determines a target image matching the source image from the pre-filtered target template images based on pixel values. It replaces the source image with the target image and updates the script subset based on the replaced source image. This achieves automated game image maintenance without manual operation. Furthermore, by selecting a pre-filtered target template image from the script subset and determining a target image matching the source image from the pre-filtered target template images based on pixel values, it accurately updates the game images, thereby improving the efficiency and accuracy of image maintenance.
Smart Images

Figure CN122925668A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game testing technology, and in particular to a method and system for maintaining game images. Background Technology
[0002] In the field of game testing, current technology primarily relies on manual maintenance of images related to the game's User Interface (UI). When game client resources are updated, the method involves testers manually capturing template images from the game one by one, renaming these images, and saving them to their respective folders. However, this manual approach has several technical problems. On the one hand, due to slight differences in screenshotting habits and methods among different testers, even for the same template images, some template matching may fail during image matching tests, requiring secondary maintenance. On the other hand, when many module images need maintenance, manual operation is prone to omissions, and these omissions also need to be maintained again. This not only wastes a lot of manpower and time but also seriously affects the efficiency and accuracy of game testing, failing to meet the high-efficiency and accurate image maintenance requirements of rapid game iteration development. Summary of the Invention
[0003] The technical problem to be solved by this invention is to provide a method and system for maintaining game images, which can improve the efficiency and accuracy of image maintenance.
[0004] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A method for maintaining game images, including the following steps: Obtain the source images and target template image library of the game, and determine the feature information of the source images; Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information; Based on the script subset, select pre-filtered target template images from the target template image library, and determine the target image that matches the source image from the pre-filtered target template images based on pixel values; The source image is replaced with the target image to obtain the replaced source image, and the script subset is updated based on the replaced source image.
[0005] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: A game image maintenance system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: Obtain the source images and target template image library of the game, and determine the feature information of the source images; Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information; Based on the script subset, select pre-filtered target template images from the target template image library, and determine the target image that matches the source image from the pre-filtered target template images based on pixel values; The source image is replaced with the target image to obtain the replaced source image, and the script subset is updated based on the replaced source image.
[0006] The beneficial effects of this invention are as follows: It acquires a source image and a target template image library for the game, determines the feature information of the source images, acquires a set of game script files, and filters a subset of scripts related to the source images from the script file set based on the feature information. Based on the script subset, it selects a pre-filtered target template image from the target template image library, and determines a target image matching the source image from the pre-filtered target template images based on pixel values. It replaces the source image with the target image and updates the script subset based on the replaced source image. This achieves automated game image maintenance without manual operation. Furthermore, by selecting a pre-filtered target template image from the script subset and determining a target image matching the source image from the pre-filtered target template images based on pixel values, it accurately updates the game images, thereby improving the efficiency and accuracy of image maintenance. Attached Figure Description
[0007] Figure 1 This is a flowchart illustrating the steps of a game image maintenance method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a game image maintenance system according to an embodiment of the present invention. Detailed Implementation
[0008] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0009] Please refer to Figure 1 A method for maintaining game images, including the following steps: Obtain the source images and target template image library of the game, and determine the feature information of the source images; Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information; Based on the script subset, select pre-filtered target template images from the target template image library, and determine the target image that matches the source image from the pre-filtered target template images based on pixel values; The source image is replaced with the target image to obtain the replaced source image, and the script subset is updated based on the replaced source image.
[0010] As can be seen from the above description, the beneficial effects of the present invention are as follows: It acquires a source image and a target template image library for the game, determines the feature information of the source images, acquires a set of script files for the game, and filters out a subset of scripts related to the source images from the script file set based on the feature information. Based on the script subset, it selects a pre-filtered target template image from the target template image library, and determines a target image matching the source image from the pre-filtered target template images based on pixel values. It replaces the source image with the target image and updates the script subset based on the replaced source image. This achieves automated game image maintenance without manual operation. By selecting a pre-filtered target template image from the script subset and determining a target image matching the source image from the pre-filtered target template images based on pixel values, it accurately achieves game image updates, thereby improving the efficiency and accuracy of image maintenance.
[0011] Furthermore, determining the feature information of the source image includes: Obtain the pixel value of the RGB channel of each pixel in the pixel matrix of the source image; Determine the total number of pixels in the pixel matrix of the source image; The average pixel value of each color channel is calculated based on the pixel value of each pixel's RGB channel and the total number of all pixels. A source image histogram is generated based on the pixel values of the RGB channels of each pixel. The feature information of the source image is obtained based on the average pixel value of each color channel and the histogram of the source image.
[0012] As described above, the feature information of the source image is obtained by calculating the average pixel value of each color channel and the source image histogram. This facilitates the subsequent use of the source image's feature information to filter out matching target images, ensuring the reliability of image maintenance.
[0013] Further, the step of filtering the script subset related to the source image from the script file set based on the feature information includes: The string processing technique is used to parse each line of instruction in each script file in the script file set to obtain the image information of each script file. The image information includes the image name and color histogram. Determine whether the image name is associated with the source image. If so, calculate the similarity between the color histogram and the source image histogram to obtain the similarity. Determine whether the similarity exceeds a first preset threshold. If it does, add the script file to the script subset related to the source image.
[0014] As described above, by analyzing the script file, a subset of scripts related to the source image can be quickly and effectively filtered out, which can reduce the amount of calculation required for subsequent precise image filtering and improve the overall processing efficiency.
[0015] Further, determining the target image matching the source image from the initially filtered target template images based on pixel values includes: Iterate through the target template images after the initial screening; For each target template image encountered during traversal, the pixel difference value between every two pixels is calculated based on the pixel values of the RGB channels of the pixels in the pixel matrix of the target template image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image. Determine the number of pixel difference values that are less than or equal to a preset pixel tolerance value among all the pixel difference values; The matching degree between the target template image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the preset pixel tolerance value; If the matching degree reaches a second preset threshold, the target template image is determined as the target image that matches the source image; otherwise, the target template image is added to the set of failed images.
[0016] As described above, by calculating the pixel difference between every two pixels in the target template image and the source image, the matching degree between the target template image and the source image can be determined. Filtering the target image based on the matching degree can effectively ensure the accuracy of the target image.
[0017] Further, the step of replacing the source image with the target image to obtain the replaced source image, and updating the script subset based on the replaced source image, includes: Collect detailed information about the source image, including the precise coordinate range in the game interface and the script reference information corresponding to the source image; An image cropping algorithm is used to extract the area to be replaced from the pixel matrix of the target image based on the precise coordinate range in the game interface; The source image is replaced with the area to be replaced to obtain the replaced source image; Modify the script content corresponding to the script reference information in the script subset according to the reference path and resource identifier of the replaced source image.
[0018] As described above, the image cropping algorithm extracts the replacement area from the pixel matrix of the target image based on the precise coordinate range in the game interface. The replacement area is then used to replace the source image. Finally, the script reference information is modified according to the reference path and resource identifier of the replaced source image. This ensures that the game can continue to run normally after the image is updated, and that the interface display is accurate. It guarantees the consistency between game functions and image resources and avoids game abnormalities caused by incorrect references.
[0019] Please refer to Figure 2 A game image maintenance system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: Obtain the source images and target template image library of the game, and determine the feature information of the source images; Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information; Based on the script subset, select pre-filtered target template images from the target template image library, and determine the target image that matches the source image from the pre-filtered target template images based on pixel values; The source image is replaced with the target image to obtain the replaced source image, and the script subset is updated based on the replaced source image.
[0020] As can be seen from the above description, the beneficial effects of the present invention are as follows: It acquires a source image and a target template image library for the game, determines the feature information of the source images, acquires a set of script files for the game, and filters out a subset of scripts related to the source images from the script file set based on the feature information. Based on the script subset, it selects a pre-filtered target template image from the target template image library, and determines a target image matching the source image from the pre-filtered target template images based on pixel values. It replaces the source image with the target image and updates the script subset based on the replaced source image. This achieves automated game image maintenance without manual operation. By selecting a pre-filtered target template image from the script subset and determining a target image matching the source image from the pre-filtered target template images based on pixel values, it accurately achieves game image updates, thereby improving the efficiency and accuracy of image maintenance.
[0021] Furthermore, determining the feature information of the source image includes: Obtain the pixel value of the RGB channel of each pixel in the pixel matrix of the source image; Determine the total number of pixels in the pixel matrix of the source image; The average pixel value of each color channel is calculated based on the pixel value of each pixel's RGB channel and the total number of all pixels. A source image histogram is generated based on the pixel values of the RGB channels of each pixel. The feature information of the source image is obtained based on the average pixel value of each color channel and the histogram of the source image.
[0022] As described above, the feature information of the source image is obtained by calculating the average pixel value of each color channel and the source image histogram. This facilitates the subsequent use of the source image's feature information to filter out matching target images, ensuring the reliability of image maintenance.
[0023] Further, the step of filtering the script subset related to the source image from the script file set based on the feature information includes: The string processing technique is used to parse each line of instruction in each script file in the script file set to obtain the image information of each script file. The image information includes the image name and color histogram. Determine whether the image name is associated with the source image. If so, calculate the similarity between the color histogram and the source image histogram to obtain the similarity. Determine whether the similarity exceeds a first preset threshold. If it does, add the script file to the script subset related to the source image.
[0024] As described above, by analyzing the script file, a subset of scripts related to the source image can be quickly and effectively filtered out, which can reduce the amount of calculation required for subsequent precise image filtering and improve the overall processing efficiency.
[0025] Further, determining the target image matching the source image from the initially filtered target template images based on pixel values includes: Iterate through the target template images after the initial screening; For each target template image encountered during traversal, the pixel difference value between every two pixels is calculated based on the pixel values of the RGB channels of the pixels in the pixel matrix of the target template image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image. Determine the number of pixel difference values that are less than or equal to a preset pixel tolerance value among all the pixel difference values; The matching degree between the target template image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the preset pixel tolerance value; If the matching degree reaches a second preset threshold, the target template image is determined as the target image that matches the source image; otherwise, the target template image is added to the set of failed images.
[0026] As described above, by calculating the pixel difference between every two pixels in the target template image and the source image, the matching degree between the target template image and the source image can be determined. Filtering the target image based on the matching degree can effectively ensure the accuracy of the target image.
[0027] Further, the step of replacing the source image with the target image to obtain the replaced source image, and updating the script subset based on the replaced source image, includes: Collect detailed information about the source image, including the precise coordinate range in the game interface and the script reference information corresponding to the source image; An image cropping algorithm is used to extract the area to be replaced from the pixel matrix of the target image based on the precise coordinate range in the game interface; The source image is replaced with the area to be replaced to obtain the replaced source image; Modify the script content corresponding to the script reference information in the script subset according to the reference path and resource identifier of the replaced source image.
[0028] As described above, the image cropping algorithm extracts the replacement area from the pixel matrix of the target image based on the precise coordinate range in the game interface. The replacement area is then used to replace the source image. Finally, the script reference information is modified according to the reference path and resource identifier of the replaced source image. This ensures that the game can continue to run normally after the image is updated, and that the interface display is accurate. It guarantees the consistency between game functions and image resources and avoids game abnormalities caused by incorrect references.
[0029] The game image maintenance method and system described above are applicable to game image maintenance scenarios, and are further illustrated below through specific embodiments: Please refer to Figure 1 Embodiment 1 of the present invention is as follows: A method for maintaining game images, including the following steps: S1. Obtain the source images and target template image library of the game, and determine the feature information of the source images, specifically including S11-S16: S11. Obtain the source images and target template image library for the game.
[0030] Specifically, using file reading interfaces (such as the fopen and fread functions in C or file operation functions in other programming languages), the source image files in the game client are located according to the specified file path. Based on the file format (such as common image formats like PNG and JPEG), the corresponding image decoding library (such as OpenCV or PIL) is called to parse the file content, converting it into a pixel matrix that the program can directly process. This process involves parsing the file header information to determine the image format and decoding the compressed image data into a pixel matrix according to the format specifications. Finally, the source image is loaded into memory for subsequent processing. The target template image library is read in batches from a predefined storage path. For each file in the library, the above file reading and decoding process is repeated, converting all target template images into pixel matrix form and storing them in a data structure in memory, such as a list or array, for easy traversal and comparison of these images later.
[0031] The source images are original images from the game client, representing the image resources used by the game in its current running state. The target template image library stores a standard set of images used to update game image resources. These images are not from the old resource environment but have been carefully crafted and reviewed to meet the latest game design and functional requirements. Suitable images are selected from the target template image library to replace the source images, thereby updating and optimizing the game image resources.
[0032] S12. Obtain the RGB channel pixel value of each pixel in the pixel matrix of the source image.
[0033] S13. Determine the total number of pixels in the pixel matrix of the source image.
[0034] S14. Calculate the average pixel value of each color channel based on the pixel value of the RGB channel of each pixel and the total number of all pixels.
[0035] Specifically, the pixel values of each pixel's RGB channels are summed separately for each color channel, and then divided by the total number of pixels to obtain the average pixel value for each color channel. The average pixel value reflects the overall brightness and color tendency of the image. For example, if the average pixel value of the red channel is high, the image may be reddish overall.
[0036] S15. Generate a source image histogram based on the pixel values of the RGB channels of each pixel.
[0037] Specifically, the range of pixel values in the RGB channels is divided into several intervals (e.g., each channel is divided into intervals of 0-32, 33-64, ..., 224-255, etc.). The interval to which each pixel belongs is determined based on its RGB channel pixel value, and the count for that interval is incremented accordingly to obtain the source image histogram. This source image histogram visually displays the frequency distribution of different color values in the image, helping to identify the image's color features, such as whether the image is mainly composed of certain specific colors or whether the color distribution is uniform.
[0038] S16. Obtain the feature information of the source image based on the average pixel value of each color channel and the source image histogram.
[0039] S2. Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information, specifically including S21-S23: S21. Obtain the set of script files for the game.
[0040] Specifically, the storage location of the game's script files is determined, and the contents of all script files are retrieved using appropriate file reading or database query operations to obtain a set of script files. If the scripts are stored as text files, the text content of each script file is read line by line and stored in memory for subsequent parsing and processing.
[0041] S22. Use string processing technology to parse each line of instructions in each script file in the script file set to obtain the image information of each script file. The image information includes the image name, color histogram, coordinate position of the image in the game interface, and operation type.
[0042] Specifically, string processing techniques (such as word segmentation and regular expression matching) are used to parse each line of instructions in each script file in the script file collection to obtain image information related to image operations. The image name can be in the form of a filename, resource identifier, etc. The coordinate position of the image in the game interface is in pixels and can include the coordinates of the top left corner, width, height, etc. The operation type is such as show, hide, replace, etc. This information can be organized into a data structure that is easy to process later, such as a structure or object containing multiple fields. Each field stores information such as image name, coordinates, operation type, etc., and these structures or objects are added to a list to form a script information list, where each element represents an image operation instruction in a script.
[0043] S23. Determine whether the image name is related to the source image. If so, calculate the similarity between the color histogram and the source image histogram to obtain the similarity. Determine whether the similarity exceeds a first preset threshold. If it does, add the script file to the script subset related to the source image.
[0044] For example, the system compares whether the image name is related to the source image. This could include whether the name contains keywords related to the source image (such as names based on game function modules) or whether it follows specific naming rules. If related, the system calculates similarity between the source image's histogram and the color histogram in the script using metrics such as Bach's distance and chi-square distance to measure the difference between the two histograms. A smaller distance indicates higher similarity. The system then checks if the similarity exceeds a first preset threshold. If it does, the script file is added to the subset of scripts related to the source image.
[0045] S3. Select target template images from the target template image library after preliminary filtering according to the script subset, and determine the target image that matches the source image from the target template images after preliminary filtering based on pixel values, specifically including S31-S32: S31. Select target template images from the target template image library after preliminary filtering according to the script subset.
[0046] S32. Traverse the target template images after the initial screening.
[0047] In one alternative implementation, it further includes: The matching status of the target template images after the initial screening is set to unmatched.
[0048] S321. For the target template image that has been traversed, calculate the pixel difference value between every two pixels based on the pixel values of the RGB channels of the pixels in the pixel matrix of the target template image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image.
[0049] Specifically, for the target template images encountered during the traversal, a preset distance metric formula (such as the Euclidean distance formula) is used. (where R1, G1, and B1 are the RGB values of the source image pixels, and R2, G2, and B2 are the RGB values of the target template image pixels.) The pixel difference value is calculated based on the RGB channel pixel values of the pixels in the pixel matrix of the target template image at the same position and the RGB channel pixel values of the pixels in the pixel matrix of the source image. This value represents the distance between the two pixels in the color space. The smaller the distance, the closer the colors are.
[0050] S322. Determine the number of pixel difference values that are less than or equal to a preset pixel tolerance value among all the pixel difference values.
[0051] S323. The matching degree between the target template image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the preset pixel tolerance value.
[0052] Specifically, the total number of all pixel difference values is equal to the total number of pixels. The number of pixel difference values that are less than or equal to the preset pixel tolerance value is divided by the total number of all pixel difference values to obtain the matching degree between the target template image and the source image.
[0053] S324. Determine whether the matching degree reaches the second preset threshold. If yes, determine the target template image as the target image that matches the source image. If no, add the target template image to the set of failed images.
[0054] For example, if both the source image and the target template image are 100×100 pixels in size, with a total of 10,000 pixels, and during the comparison process 9,000 pixels have a difference value less than or equal to a preset pixel tolerance value, then the matching degree is 9,000 / 10,000 = 0.9. When the matching degree reaches a second preset threshold (such as 0.85 or other suitable values), the target template image is determined to be the target image that matches the source image; otherwise, the target template image is added to the set of images that failed the comparison.
[0055] In one alternative implementation, it further includes: Set the matching status flag of the target template image to "match successful".
[0056] In one alternative implementation, it further includes: A third preset threshold is determined, wherein the third preset threshold is less than the preset pixel tolerance value.
[0057] Iterate through the set of images that failed to pass.
[0058] For each failed image encountered during the traversal, the pixel difference value between every two pixels is calculated based on the pixel values of the RGB channels of the pixels in the pixel matrix of the failed image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image.
[0059] Determine the number of pixel difference values that are less than or equal to the third preset threshold among all the pixel difference values.
[0060] The matching degree between the failed image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the third preset threshold.
[0061] Determine whether the matching degree reaches the second preset threshold. If so, determine the failed image as the target image that matches the source image.
[0062] In one alternative implementation, it further includes: Different weights are assigned to different regions of each failed image based on the importance of different regions in the set of failed images.
[0063] Based on the weights, the pixel difference value between every two pixels is calculated according to the pixel values of the RGB channels of the pixels in the pixel matrix of the failed image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image.
[0064] Determine the number of pixel difference values that are less than or equal to the preset pixel tolerance value among all the pixel difference values.
[0065] The matching degree between the failed image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the preset pixel tolerance value.
[0066] Determine whether the matching degree reaches the second preset threshold. If so, determine the failed image as the target image that matches the source image.
[0067] For example, pixels in the central or key functional areas of an image can be given higher weights, and the corresponding weights can be multiplied when calculating pixel differences. This makes the matching of pixels in these areas have a greater impact on the overall matching results, thus more accurately measuring the similarity of images.
[0068] S4. Replace the source image with the target image to obtain the replaced source image, and update the script subset based on the replaced source image, specifically including S41-S44: S41. Collect detailed information about the source image, including the image's full name, its memory storage address, its precise coordinate range in the game interface, and the script reference information corresponding to the source image.
[0069] S42. Using an image cropping algorithm, extract the region to be replaced from the pixel matrix of the target image based on the precise coordinate range within the game interface. Ensure that the size and position of the extracted region perfectly match the source image to guarantee a natural and smooth integration of the replaced image without misalignment, distortion, or blurring. During the extraction process, fully consider the pixel format, color depth, and other attributes of the source image to ensure the completeness and accuracy of the extracted region data.
[0070] S43. Replace the source image with the area to be replaced to obtain the replaced source image.
[0071] Specifically, the area to be replaced is copied to the corresponding position in the source image, accurately written according to the source image's pixel format and coordinate system, overwriting the original pixel values. During the copying operation, various image attributes, such as color, brightness, and transparency, are meticulously handled to ensure that the replaced source image visually harmonizes with surrounding elements and displays correctly in the game UI. For example, for images with transparent backgrounds, it must be ensured that the transparent areas retain their transparency after replacement, allowing for normal overlay with other elements. Simultaneously, the layout rules and display requirements of the game interface are strictly followed to guarantee that the replaced image does not affect the normal layout and functional interaction of other elements.
[0072] S44. Modify the script content corresponding to the script reference information in the script subset according to the reference path and resource identifier of the replaced source image.
[0073] Specifically, the script content corresponding to the script reference information in the script subset may involve accurately identifying specific function calls, variable assignment statements, or other complex code structures directly related to image references within the script. This involves determining the specific lines or snippets of code that need modification to ensure the accuracy and relevance of the update operation. The script content must accurately update the reference paths or image identifiers pointing to the original source image with the information of the replaced source image. When modifying reference paths, the script language syntax must be strictly followed to ensure the modified script can pass syntax checks and be correctly parsed and executed. For example, if the script references an image using a file path, the old source image path must be completely replaced with the new one; if the image is referenced using a resource identifier, the corresponding identifier must be updated to match the new image. After modification, the updated script file must be saved to ensure that the script can accurately load and use the new image resources during subsequent execution, thereby guaranteeing a high degree of consistency between game functionality and image resources and avoiding game anomalies caused by incorrect references.
[0074] In one alternative implementation, it further includes: A comprehensive inspection of the game's user interface was conducted after the image maintenance was completed, resulting in a maintenance report.
[0075] Specifically, the first step is to activate the pre-integrated game automation testing framework. During activation, based on the game's characteristics and the specific scope of this image maintenance, the various parameters of the testing framework are precisely configured. For example, based on the relationship between game functional modules and images, specific functional modules or scenarios involving image updates are selected as the execution scope of test cases; based on common user operation patterns within the game, parameters simulating user operations are set, such as click frequency, swipe distance, and input text content; based on the layout and display rules of game interface elements, the expected result verification standards are clarified, including the display position of image elements in the interface, color accuracy, relative layout relationship with other elements, and the correctness of related function responses, ensuring that the testing framework can highly simulate the user's real-world operation scenarios in the game and perform a comprehensive and precise check of the game state after image replacement.
[0076] The testing framework comprehensively simulates various user actions in the game according to the configured parameters. For example, it simulates players clicking buttons in the game, swiping the screen to browse different interfaces, entering text information in input boxes, and triggering various in-game events (such as task completion and item use), ensuring coverage of all scenarios in the game that may involve image display and interaction. During the simulation process, the system thoroughly checks whether all game functions can operate normally. For example, after clicking an image button, it rigorously verifies whether the corresponding functional logic is accurately triggered, such as correctly opening a new interface, executing a specific task flow, or updating relevant game data. For image-related game elements, it meticulously checks whether they can correctly respond to player operations, such as whether image switching is smooth, whether animation playback is normal, and whether interaction with other elements meets design expectations. Simultaneously, it closely monitors the display status of the game interface, verifying one by one whether images are correctly loaded and clearly displayed, whether their display positions are accurate, whether the colors are consistent with expectations, whether the layout with other interface elements is reasonable and aesthetically pleasing, and whether there are any abnormal phenomena such as image flickering, distortion, obstruction, or misalignment. This comprehensive approach ensures that the game UI after image replacement strictly meets the expected requirements in terms of visual effects and functional interaction, without any abnormalities.
[0077] We comprehensively collect detailed result data generated during automated testing, covering the execution result of each test case (clearly marked as pass or fail), execution time, complete operation steps, and any abnormal information captured during the test (such as error messages, relevant entries in system logs, etc.). For test cases that fail, we conduct in-depth analysis of the reasons for failure, investigating from multiple possible dimensions, such as checking whether the file path after image replacement is correct, and whether incorrect paths prevent images from loading correctly; confirming whether the image size and format are compatible with game requirements, avoiding display effects due to unsupported formats or size mismatches; carefully reviewing the interaction logic between images and other game elements for errors, ensuring the consistency and correctness of the operation process. Through comprehensive analysis of the result data, we accurately calculate the pass rate and failure rate of test cases and generate detailed test reports, providing developers with highly valuable feedback information so that they can quickly locate and fix new problems caused by image maintenance operations, effectively ensuring the overall quality and stability of the game and improving the player's gaming experience.
[0078] Regardless of whether automated testing and verification are implemented, a detailed maintenance report will be generated. The report is rich in content and diverse. First, it clearly states the total number of images maintained, clearly distinguishing and separately counting the number of successfully replaced images and the number that failed to be processed, allowing users to quickly understand the scale and completion status of the maintenance work. It provides comparison information of images before and after replacement, visually displaying the details of image changes. For example, it can generate image thumbnail comparison images to visually present differences in content, layout, color, etc.; or it can list the specific changes in key image attributes (such as size, resolution, color mode, file format, etc.) before and after replacement, helping users clearly understand the actual content of the image updates. It records script updates in detail, clearly indicating which specific parts of the script were modified, showing the precise lines or code snippets before and after the modifications, and explaining the reasons for the modifications (such as adapting to changes in resource references after image replacement, optimizing image loading logic, etc.), allowing developers to clearly track the script's evolution and ensuring that the script and image resources always maintain close consistency. Accurately track the processing time of the entire batch image maintenance process, breaking it down into the time consumed in each major stage (such as image loading, filtering and matching, replacement and updating, and result verification), providing precise data support for subsequent performance optimization. Finally, clearly identify any unresolved issues, such as anomalies encountered during processing (e.g., file read errors, image decoding failures, insufficient memory allocation), warning messages issued (e.g., some images were processed despite their matching accuracy being close to the threshold), and problems discovered in automated testing (if testing was conducted). Describe the nature of the problems, their specific manifestations, and their potential impact on the game in detail. This helps users comprehensively evaluate the quality and effectiveness of the maintenance work, providing important reference for further improvement and optimization of the maintenance process.
[0079] The generated maintenance reports are saved in various common file formats (such as HTML, PDF, or text files), allowing users to choose the appropriate method to view, share, and archive the report content according to their needs. A convenient preview function is also provided in the visual interface, enabling users to quickly browse the core content of the report without leaving the program environment, improving user convenience. The report storage path can be set according to the user's specifications; if not specified, the program's default storage path is used, ensuring that users can easily find and effectively manage the report files. By providing detailed and comprehensive maintenance reports, users can gain a comprehensive understanding of the actual effect of this batch image maintenance, promptly identify potential problems and take decisive measures, and accumulate valuable experience for subsequent maintenance work, providing important reference materials to help continuously improve and refine the image maintenance process, and continuously improve the quality and stability of the game.
[0080] In this way, it is ensured that the image replacement process does not cause new problems, while generating a detailed maintenance report to provide users with comprehensive maintenance results information, assisting users in evaluating the quality of the maintenance work, providing data support and decision-making basis for subsequent maintenance, and ensuring the stable operation of the game.
[0081] In one alternative implementation, it further includes: Using a progress bar component in the graphical user interface (GUI), the program's progress in each stage of image filtering, matching, and replacement is presented in an intuitive and dynamic way. The progress bar is updated periodically according to the ratio of processed images to the total number of images. For example, after processing a certain number of images (such as 50 images or 5% of the total number of images), the progress bar's fill ratio is updated accordingly, allowing users to clearly understand the program's running speed and remaining workload. This enables users to allocate time and resources effectively and avoids the illusion of program lag or crashes due to prolonged periods without feedback.
[0082] The visual interface clearly displays detailed image filtering and matching results using lists, tables, or graphical elements (such as image thumbnail display areas). For successfully matched images, key information such as filename, script file path, and match degree is listed, allowing users to quickly review and analyze the matching situation to determine which images can proceed to the subsequent replacement stage. For unmatched images, the filename and reason for non-match (such as pixel difference exceeding the tolerance range or failure to meet the set match degree requirement) are also displayed, helping users quickly locate potentially problematic images to further determine whether parameter adjustments or other countermeasures are needed. For example, in the list display, each row clearly presents relevant information for an image, including filename, script path, and precise match degree value. For unmatched images, additional information such as the approximate percentage of pixel difference exceeding the tolerance value or other auxiliary information to help analyze the cause is provided, allowing users to grasp the overall matching status at a glance.
[0083] The visual interface features carefully designed interactive components for adjusting key parameters such as preset thresholds and pixel tolerance values, including sliders and text boxes for inputting values. An efficient event listening mechanism (such as an ActionListener interface implementation in Java or event listeners in JavaScript) captures user actions on these components in real time. When a user changes the pixel matching degree by dragging the slider, or enters a new pixel tolerance value in the text box and triggers a corresponding event (such as a mouse release event or an Enter key press event), these actions are immediately detected and captured.
[0084] Upon receiving a user's parameter adjustment event, the system quickly retrieves the new parameter value and updates the corresponding internal variable values in real time. Then, based on the new parameter settings, it immediately recalculates the subsequent filtering and matching logic. For example, if the user increases the pixel matching requirement, the matching threshold will be raised accordingly during subsequent image comparisons, reducing the number of images that might be judged as successfully matched, while simultaneously improving matching accuracy. Conversely, if the user decreases the pixel tolerance value, a stricter standard will be used when calculating pixel differences, potentially causing some previously matched images to become unmatched, but more effectively eliminating images with significant differences. Simultaneously, the system promptly presents a preview or prompt on the visual interface to inform the user of the impact of parameter adjustments on the current processing results. For instance, when the user adjusts the pixel tolerance value, the interface can immediately display the expected reduction in the number of successfully matched images, but with improved matching accuracy, or show the change in the number of successfully matched images among currently processed images after reassessment based on the new tolerance value. This allows users to flexibly weigh and adjust parameters according to their actual needs, achieving real-time interaction and dynamic optimization with the program.
[0085] In one alternative implementation, it further includes: Based on the actual system hardware resources, especially the number of CPU cores, a scientific and reasonable strategy is adopted to divide the set of images to be processed into multiple balanced subtasks. A common and effective approach is to distribute the images evenly according to their number. For example, if the system has four CPU cores, the total number of images is divided into four equal parts, with each part assigned as an independent subtask to a single thread. Another approach is to intelligently group the images based on their type, the game module they belong to, or other relevant factors. This ensures that the tasks processed by each thread are relatively balanced in terms of computational complexity and data volume, preventing some threads from completing their tasks prematurely while others are overloaded, thus achieving full utilization of system resources. For example, images of the same type (such as background images, button images, etc.) or belonging to the same game module can be grouped into the same subtask, facilitating targeted processing by threads.
[0086] A corresponding number of threads are created based on the number of subtasks, with each thread independently executing a specific image subtask. During thread creation, each thread is carefully allocated independent memory space to store local variables, intermediate results (such as pixel matrices of partial images, matching result statistics, etc.), and thread execution context information required during processing. Then, all threads are safely started, enabling them to process their respective image data in parallel. Each thread operates independently and without interference when performing image filtering, matching, and replacement operations. However, when accessing shared resources (such as global image pixel data, script information, etc.), a highly efficient thread synchronization mechanism is used to coordinate and ensure data consistency and correctness.
[0087] To ensure safety and consistency when multiple threads access shared resources, mature and efficient thread synchronization mechanisms are employed, such as locking mechanisms (including mutexes and read-write locks) and semaphores. When multiple threads simultaneously need to access and modify shared image pixel data or script information, acquiring the appropriate lock ensures that only one thread can operate at a time, while other threads must wait for the lock to be released, effectively avoiding data races and inconsistencies. For example, when updating a global variable showing the number of successfully matched images, a mutex is used to ensure that only one thread can perform a write operation at a time, preventing data errors caused by multiple threads writing simultaneously. Simultaneously, semaphores are used appropriately to control the concurrent access of multiple threads to limited resources (such as simultaneous database connections), avoiding excessive resource consumption or deadlocks.
[0088] During execution, each thread stores its intermediate results in a specific data structure, carefully designed to facilitate subsequent merging operations. For example, a thread-safe queue or list can be used to store partially matched image information, updated script fragments, and other intermediate results. Once all threads have completed their tasks, the main thread efficiently collects and merges the intermediate results from each thread. For successfully matched images, the images found by each thread are merged into a global list, ensuring no duplicates and a logical order. For updated script fragments, they are precisely integrated according to the script's logical order to form the final, complete updated script. Through multi-threading optimization, the program fully leverages the advantages of multi-core processors, significantly improving the efficiency of batch image maintenance. Especially when processing massive amounts of images, it can drastically shorten processing time, effectively enhancing the overall performance of the program and providing users with faster and more efficient services.
[0089] Please refer to Figure 2 Embodiment two of the present invention is as follows: A game image maintenance system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the game image maintenance method in Embodiment 1.
[0090] In summary, this invention provides a game image maintenance method and system. It acquires a source image and target template image library for the game, determines the feature information of the source images, acquires a set of script files for the game, and filters a subset of scripts related to the source images from the script file set based on the feature information. Based on the script subset, it selects a pre-filtered target template image from the target template image library, and determines a target image matching the source image from the pre-filtered target template images based on pixel values. It replaces the source image with the target image and updates the script subset based on the replaced source image. This achieves automated game image maintenance without manual operation. After filtering target template images, and based on pixel values, a target image matching the source image is determined from the initially filtered target template images, accurately realizing game image updates and improving the efficiency and accuracy of image maintenance. In addition, an image cropping algorithm is used to extract the area to be replaced from the pixel matrix of the target image according to the precise coordinate range in the game interface. The area to be replaced is used to replace the source image. Then, the script reference information is modified according to the reference path and resource identifier of the replaced source image to ensure that the game can continue to run normally after the image update and the interface display is accurate. This ensures the consistency between game functions and image resources and avoids game abnormalities caused by incorrect references.
[0091] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for maintaining game images, characterized in that, Including the following steps: Obtain the source images and target template image library of the game, and determine the feature information of the source images; Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information; Based on the script subset, select pre-filtered target template images from the target template image library, and determine the target image that matches the source image from the pre-filtered target template images based on pixel values; The source image is replaced with the target image to obtain the replaced source image, and the script subset is updated based on the replaced source image.
2. The game image maintenance method according to claim 1, characterized in that, The determination of the feature information of the source image includes: Obtain the pixel value of the RGB channel of each pixel in the pixel matrix of the source image; Determine the total number of pixels in the pixel matrix of the source image; The average pixel value of each color channel is calculated based on the pixel value of each pixel's RGB channel and the total number of all pixels. A source image histogram is generated based on the pixel values of the RGB channels of each pixel. The feature information of the source image is obtained based on the average pixel value of each color channel and the source image histogram.
3. The game image maintenance method according to claim 2, characterized in that, The step of filtering the script subset related to the source image from the script file set based on the feature information includes: The string processing technique is used to parse each line of instruction in each script file in the script file set to obtain the image information of each script file. The image information includes the image name and color histogram. Determine whether the image name is associated with the source image. If so, calculate the similarity between the color histogram and the source image histogram to obtain the similarity. Determine whether the similarity exceeds a first preset threshold. If it does, add the script file to the script subset related to the source image.
4. The game image maintenance method according to claim 1, characterized in that, The step of determining the target image that matches the source image from the initially filtered target template images based on pixel values includes: Iterate through the target template images after the initial screening; For each target template image encountered during traversal, the pixel difference value between every two pixels is calculated based on the pixel values of the RGB channels of the pixels in the pixel matrix of the target template image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image. Determine the number of pixel difference values that are less than or equal to a preset pixel tolerance value among all the pixel difference values; The matching degree between the target template image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the preset pixel tolerance value; If the matching degree reaches a second preset threshold, the target template image is determined as the target image that matches the source image; otherwise, the target template image is added to the set of failed images.
5. A method for maintaining game images according to claim 1, characterized in that, The step of replacing the source image with the target image to obtain the replaced source image, and updating the script subset based on the replaced source image, includes: Collect detailed information about the source image, including the precise coordinate range in the game interface and the script reference information corresponding to the source image; An image cropping algorithm is used to extract the area to be replaced from the pixel matrix of the target image based on the precise coordinate range in the game interface; The source image is replaced with the area to be replaced to obtain the replaced source image; Modify the script content corresponding to the script reference information in the script subset according to the reference path and resource identifier of the replaced source image.
6. A game image maintenance system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it performs the following steps: Obtain the source images and target template image library of the game, and determine the feature information of the source images; Obtain the set of script files for the game, and filter out a subset of scripts related to the source image from the set of script files based on the feature information; Based on the script subset, select pre-filtered target template images from the target template image library, and determine the target image that matches the source image from the pre-filtered target template images based on pixel values; The source image is replaced with the target image to obtain the replaced source image, and the script subset is updated based on the replaced source image.
7. A game image maintenance system according to claim 6, characterized in that, The determination of the feature information of the source image includes: Obtain the pixel value of the RGB channel of each pixel in the pixel matrix of the source image; Determine the total number of pixels in the pixel matrix of the source image; The average pixel value of each color channel is calculated based on the pixel value of each pixel's RGB channel and the total number of all pixels. A source image histogram is generated based on the pixel values of the RGB channels of each pixel. The feature information of the source image is obtained based on the average pixel value of each color channel and the source image histogram.
8. A game image maintenance system according to claim 7, characterized in that, The step of filtering the script subset related to the source image from the script file set based on the feature information includes: The string processing technique is used to parse each line of instruction in each script file in the script file set to obtain the image information of each script file. The image information includes the image name and color histogram. Determine whether the image name is associated with the source image. If so, calculate the similarity between the color histogram and the source image histogram to obtain the similarity. Determine whether the similarity exceeds a first preset threshold. If it does, add the script file to the script subset related to the source image.
9. A game image maintenance system according to claim 6, characterized in that, The step of determining the target image that matches the source image from the initially filtered target template images based on pixel values includes: Iterate through the target template images after the initial screening; For each target template image encountered during traversal, the pixel difference value between every two pixels is calculated based on the pixel values of the RGB channels of the pixels in the pixel matrix of the target template image and the pixel values of the RGB channels of the pixels in the pixel matrix of the source image. Determine the number of pixel difference values that are less than or equal to a preset pixel tolerance value among all the pixel difference values; The matching degree between the target template image and the source image is obtained based on the total number of all the pixel difference values and the number of pixel difference values that are less than or equal to the preset pixel tolerance value; If the matching degree reaches a second preset threshold, the target template image is determined as the target image that matches the source image; otherwise, the target template image is added to the set of failed images.
10. A game image maintenance system according to claim 6, characterized in that, The step of replacing the source image with the target image to obtain the replaced source image, and updating the script subset based on the replaced source image, includes: Collect detailed information about the source image, including the precise coordinate range in the game interface and the script reference information corresponding to the source image; An image cropping algorithm is used to extract the area to be replaced from the pixel matrix of the target image based on the precise coordinate range in the game interface; The source image is replaced with the area to be replaced to obtain the replaced source image; Modify the script content corresponding to the script reference information in the script subset according to the reference path and resource identifier of the replaced source image.