Method and system for generating water sorting game levels and storage medium

Through the greed algorithm and the constraint-satisfied problem-satisfaction search algorithm, the water sorting type game levels are gradually built, which solves the problem of inefficient level generation in the existing technology, and realizes efficient and diverse level generation and accurate difficulty evaluation.

CN119565118APending Publication Date: 2025-03-07CHENGDU CHENGFENG QUYOU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411675148.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing water sorting type game levels are inefficient in generating levels, resulting in the low efficiency of generating levels of specific difficulty, and the randomly generated levels lack systematicity, which affects the playability of the game.

Method used

The greedy algorithm and the constraint-satisfied problem-satisfied search algorithm are used to gradually build levels, initialize the possibility of changes in each position, and update the possibility of changes in related positions after each step of construction, improving the efficiency and randomness of level generation.

Benefits of technology

It significantly improves the efficiency of level generation, enhances the diversity and variation of levels, and ensures the accuracy of difficulty assessment and the stability of game experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119565118A_ABST
    Figure CN119565118A_ABST
Patent Text Reader

Abstract

The invention provides a method for generating a water sorting game level. The method comprises the following steps: S1, generating a blank level; s2, pre-processing the occurrence probability of the object; s3, updating the probability of occurrence of the object; s4, selecting an object for filling; s5, traversing all positions for filling: if the filling is successful, returning level data; and if not, retry is carried out. The method introduces the presetting and updating mechanism of the change possibility, enhances the generation efficiency and randomness, and is obviously different from the traditional random generation method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of greedy algorithms, and in particular to a method, system and storage medium for generating levels of a water sorting game. Background Art

[0002] The way to play the water sorting game is to move and merge the water of different colors in multiple bottles by pouring them into each other, and finally put all the water of different colors into different bottles. The basic structure of this type of game includes multiple containers with upper carrying limits, some of which contain objects or liquids with obvious characteristics (objects and liquids are referred to as objects below). After the game starts, the player can only merge the objects in one container with the same characteristic objects in another container at a time, until all the same objects are successfully merged into independent containers, and the game ends.

[0003] Existing solutions usually use a combination of "purely random level generation" and "level difficulty evaluation" to generate standard levels of different difficulties. However, these solutions are inefficient in the generation and evaluation process, resulting in too low efficiency in generating levels of specific difficulty. In particular, the lack of systematicity in randomly generated levels may lead to unstable playability of the game. In addition, the existing evaluation mechanism fails to effectively take into account the player's operating strategies and habits, so that the difficulty assessment often deviates from the actual experience. In the process of solving these problems, the difficulties encountered include how to reasonably set the level difficulty parameters and how to improve the generation efficiency while retaining randomness. Summary of the invention

[0004] The present invention provides a method, system and storage medium for generating a water sorting game level, aiming to solve the problem of low efficiency in generating existing water sorting game levels.

[0005] This specification discloses a method for generating a water sorting game level, comprising:

[0006] S1. Generate a blank level, as follows:

[0007] Generate a blank level structure according to the parameter information of the level to be generated, and initialize all containers to be in an available state; the parameter information includes the level difficulty, the level size, the storage limit of objects in each container, and the number of object types; the blank level structure includes n containers, and the storage limit of objects in each container is m, that is, there are n*m ​​positions in total, and all positions constitute an n*m two-dimensional array;

[0008] S2. The probability of occurrence of preprocessed objects is as follows:

[0009] A list is set for each position. Each list initially stores all object type numbers, which are regarded as any object that may appear in each position at the beginning. Based on the three set level difficulties, rules are extracted from a number of preset rules and applied, so that the positions affected by the rules exclude some object type numbers. Thus, an initial probability model is established in the form of a list to reflect the possible types of objects that may appear in each position.

[0010] S3. Update the object occurrence probability, as follows:

[0011] According to the extraction rules, update and exclude the object numbers that should not appear in the affected position list; after the update, check that if there is a position where no object is placed and the candidate object number list is empty, the level generation fails;

[0012] S4. Select objects to fill, as follows:

[0013] Check in the lists of all positions, randomly select one from the lists with the shortest list length, that is, select from the list corresponding to the position with the least number of object types, and randomly select the object type number in the list from the list to place;

[0014] S5. Traverse all positions to fill them, as follows:

[0015] Execute S3, then repeat S4 and S3 until all positions have an object placed or no object can be placed; at this point, check whether the level is generated successfully:

[0016] If successful, the level data is returned; if failed, a retry is performed.

[0017] In this manual, the initial configuration of the level includes multiple preset templates for selection according to different game modes and difficulties; each preset template contains a different combination of rules.

[0018] In this manual, rules include but are not limited to:

[0019] Randomly fill the x-th row with objects, and the same object cannot appear more than a times in the x-th row;

[0020] From top to bottom, row x should not contain the same object types as those in row y.

[0021] The same object cannot appear more than b times in the same container;

[0022] In the same container, each object cannot appear more than c times consecutively.

[0023] In this manual, set the upper limit of the number of retries after a level generation failure.

[0024] This specification also discloses a water sorting game level generation system, which is used to implement any of the above-mentioned water sorting game level generation methods, and the water sorting game level generation system includes:

[0025] Generates a blank level module for:

[0026] Generate a blank level structure according to the parameter information of the level to be generated, and initialize all containers to be in an available state; the parameter information includes the level difficulty, the level size, the storage limit of objects in each container, and the number of object types; the blank level structure includes n containers, and the storage limit of objects in each container is m, that is, there are n*m ​​positions in total, and all positions constitute an n*m two-dimensional array;

[0027] Preprocessing object occurrence probability module, used for:

[0028] A list is set for each position. Each list initially stores all object type numbers, which are regarded as any object that may appear in each position at the beginning. Based on the three set level difficulties, rules are extracted from a number of preset rules and applied, so that the positions affected by the rules exclude some object type numbers. Thus, an initial probability model is established in the form of a list to reflect the possible types of objects that may appear in each position.

[0029] Updated object occurrence probability module for:

[0030] According to the extraction rules, update and exclude the object numbers that should not appear in the affected position list; after the update, check that if there is a position where no object is placed and the candidate object number list is empty, the level generation fails;

[0031] Select the object fill module to:

[0032] Check in the lists of all positions, randomly select one from the lists with the shortest list length, that is, select from the list corresponding to the position with the least number of object types, and randomly select the object type number in the list from the list to place;

[0033] Traverse all locations to fill modules for:

[0034] Update the object appearance probability, then repeat the process of selecting objects to fill and updating the object appearance probability until all positions have an object or no object can be placed; at this point, check whether the level is generated successfully:

[0035] If successful, the level data is returned; if failed, a retry is performed.

[0036] This specification also discloses a computer-readable storage medium, which stores computer instructions. When a computer reads the computer instructions, the computer executes any of the above-mentioned methods for generating water sorting game levels.

[0037] The embodiments of this specification can at least achieve the following beneficial effects:

[0038] The probability update mechanism of the present invention is executed at the beginning of level construction and during the gradual construction process; each time, the search is made in the direction where the possibility of the next choice becomes less, so as to enhance the efficiency of level generation; the probability update rules adopt multiple sets of replaceable templates to enhance flexibility and adaptability; the present invention introduces a preset and update mechanism for changing possibilities, which enhances the efficiency and randomness of generation, and is significantly different from the traditional random generation method. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0040] Figure 1 The figure is a flow chart of a method for generating a water sorting game level involved in the present invention. DETAILED DESCRIPTION

[0041] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the embodiments of the present invention. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.

[0042] The disclosure below provides many different embodiments or examples to implement different structures of the embodiments of the present invention. In order to simplify the disclosure of the embodiments of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the embodiments of the present invention. In addition, the embodiments of the present invention can repeat reference numbers and / or reference letters in different examples, and this repetition is for the purpose of simplification and clarity, which itself does not indicate the relationship between the various embodiments and / or settings discussed.

[0043] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0044] like Figure 1 As shown, this specification discloses a method for generating a water sorting game level, comprising:

[0045] S1. Generate a blank level, as follows:

[0046] Generate a blank level structure according to the parameter information of the level to be generated, and initialize all containers to be in an available state; the parameter information includes the level difficulty, the level size, the storage limit of objects in each container, and the number of object types; the blank level structure includes n containers, and the storage limit of objects in each container is m, that is, there are n*m ​​positions in total, and all positions constitute an n*m two-dimensional array;

[0047] S2. The probability of occurrence of preprocessed objects is as follows:

[0048] A list is set for each position. Each list initially stores all object type numbers, which are regarded as any object that may appear in each position at the beginning. Based on the three set level difficulties, rules are extracted from a number of preset rules and applied, so that the positions affected by the rules exclude some object type numbers. Thus, an initial probability model is established in the form of a list to reflect the possible types of objects that may appear in each position.

[0049] S3. Update the object occurrence probability, as follows:

[0050] According to the extraction rules, update and exclude the object numbers that should not appear in the affected position list; after the update, check that if there is a position where no object is placed and the candidate object number list is empty, the level generation fails;

[0051] S4. Select objects to fill, as follows:

[0052] Check in the lists of all positions, randomly select one from the lists with the shortest list length, that is, select from the list corresponding to the position with the least number of object types, and randomly select the object type number in the list from the list to place;

[0053] S5. Traverse all positions to fill them, as follows:

[0054] Execute S3, then repeat S4 and S3 until all positions have an object placed or no object can be placed; at this point, check whether the level is generated successfully:

[0055] If successful, the level data is returned; if failed, a retry is performed.

[0056] In this manual, the initial configuration of the level includes multiple preset templates for selection according to different game modes and difficulties; each preset template contains a different combination of rules.

[0057] In this manual, rules include but are not limited to:

[0058] Randomly fill the x-th row with objects, and the same object cannot appear more than a times in the x-th row;

[0059] From top to bottom, the xth row should not contain the same object type as the yth row (x≠y);

[0060] The same object cannot appear more than b times in the same container;

[0061] In the same container, each object cannot appear more than c times consecutively.

[0062] In this manual, set the upper limit of the number of retries after a level generation failure.

[0063] This specification also discloses a water sorting game level generation system, which is used to implement any of the above-mentioned water sorting game level generation methods, and the water sorting game level generation system includes:

[0064] Generates a blank level module for:

[0065] Generate a blank level structure according to the parameter information of the level to be generated, and initialize all containers to be in an available state; the parameter information includes the level difficulty, the level size, the storage limit of objects in each container, and the number of object types; the blank level structure includes n containers, and the storage limit of objects in each container is m, that is, there are n*m ​​positions in total, and all positions constitute an n*m two-dimensional array;

[0066] Preprocessing object occurrence probability module, used for:

[0067] A list is set for each position. Each list initially stores all object type numbers, which are regarded as any object that may appear in each position at the beginning. Based on three set level difficulties (such as easy, medium, and difficult), rules are extracted from a number of preset rules and applied so that the positions affected by the rules exclude some object type numbers. Thus, an initial probability model is established in the form of a list to reflect the possible object types that may appear in each position.

[0068] Updated object occurrence probability module for:

[0069] According to the extraction rules, update and exclude the object numbers that should not appear in the affected position list; after the update, check that if there is a position where no object is placed and the candidate object number list is empty, the level generation fails;

[0070] Select the object fill module to:

[0071] Check in the lists of all positions, randomly select one from the lists with the shortest list length, that is, select from the list corresponding to the position with the least number of object types, and randomly select the object type number in the list from the list to place;

[0072] Traverse all locations to fill modules for:

[0073] Update the object appearance probability, then repeat the process of selecting objects to fill and updating the object appearance probability until all positions have an object or no object can be placed; at this point, check whether the level is generated successfully:

[0074] If successful, the level data is returned; if failed, a retry is performed.

[0075] This specification also discloses a computer-readable storage medium, which stores computer instructions. When a computer reads the computer instructions, the computer executes any of the above-mentioned methods for generating water sorting game levels.

[0076] In order to clearly illustrate the technical solution of the present invention, the technical ideas of the present invention are as follows:

[0077] The present invention aims to solve the problem of low efficiency in level generation of existing water sorting type games and implement a greedy spatial constraint solving search algorithm, specifically including the following objectives:

[0078] 1. Improve the efficiency of level generation: While retaining randomness, optimize the level generation algorithm to quickly generate levels of specified difficulty.

[0079] 2. Flexible scalability: Provide an extensible framework to flexibly adjust the level difficulty according to the skill levels of different players.

[0080] 3. Accurate difficulty assessment: Improve the difficulty evaluation mechanism so that it can more accurately reflect the player's operating strategies and habits, thereby improving the gaming experience.

[0081] Among them, the greedy algorithm is an algorithm that takes the best or optimal (i.e. most favorable) choice in each step, hoping to lead to the best or optimal result. The basic idea of ​​the greedy algorithm can be summarized as "making a local optimal choice at each step, and finally getting the global optimal solution." The greedy algorithm does not guarantee that it can find the global optimal solution, but in many cases it can get a solution close to the optimal one, and it is simple to implement and efficient.

[0082] The constraint satisfaction problem search algorithm refers to solving the problem by defining variables, value ranges, and constraints. The main idea is to quickly eliminate the variable combinations that violate the constraints, thereby narrowing the search space. The algorithm takes advantage of the state structure and uses general strategies instead of problem-specific heuristics to solve complex problems.

[0083] The specific ideas are as follows:

[0084] 1. Build a complete level from scratch step by step:

[0085] This feature allows the level to be gradually constructed from a blank state to enhance randomness and variation. However, while it helps to increase the diversity of generation, it is not a necessary condition for implementing the present invention.

[0086] 2. Initialize the possibility of changing each position:

[0087] The principle of initializing the possibility of changes in each position is to limit the types of objects that may appear in each position. Initializing the preset can lock the key features of generating a level of specific difficulty, improve the efficiency and success rate of level generation, and control the difficulty of the level. Initializing the possibility of changes in each position and establishing multiple sets of replaceable presets is the core of realizing level generation, which is directly related to the efficiency of level generation, the success rate of level generation, and the control of level difficulty.

[0088] 3. Each step of construction is built from the position with the least possibility of change:

[0089] This feature is used to selectively optimize the construction process. The basis of this step is to search in the direction where the possibility of the next step selection becomes less, which can improve the rationality of generation and is a key part of realizing the present invention.

[0090] 4. Update the possibility of changes in related positions after each step of construction:

[0091] The update and record of the possibility of objects appearing in each position enables efficient elimination of situations that do not conform to the game rules in the future, improving the efficiency of level generation. The possibility of changes around placed objects is updated according to preset plans (multiple sets of replaceable ones), which is a key technical feature to ensure the logic and coherence of level generation and improve the efficiency of level generation.

[0092] The overall idea is as follows:

[0093] Initially, it is assumed that all types of objects may appear in each position. The more types of objects that may appear in a position, the more unstable this position is; conversely, the fewer types of objects that may appear in this position, the more stable this position is. Each time, the most stable unfilled position is selected, and an object is randomly filled according to the possibility, and then according to the constraint rules, the possibility of some types of objects appearing in other positions is eliminated. Each step searches in the direction of making the position stable, and finally all positions are placed with objects.

[0094] The average duration of the levels with the same parameters was evaluated. Compared with the randomly generated levels, the average duration of the simple levels using the new algorithm decreased by 42.54%, and the average duration of the difficult levels using the new algorithm increased by 65.03%. The variance of the average duration of the simple levels decreased by 21.39%, and the variance of the average duration of the difficult levels decreased by 52.58%.

[0095] The above-described embodiments are used to illustrate the present invention, not to limit the present invention, so changes in the exemplified values ​​or replacement of equivalent elements should still fall within the scope of the present invention.

[0096] From the above detailed description, it can be understood by those skilled in the art that the present invention can indeed achieve the aforementioned objectives and is in compliance with the provisions of the Patent Law.

[0097] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. It should be pointed out that any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

[0098] It should be noted that the above description of the relevant process is only for example and explanation, and does not limit the scope of application of this specification. For those skilled in the art, various modifications and changes can be made to the process under the guidance of this specification. However, these modifications and changes are still within the scope of this specification.

[0099] The basic concepts have been described above. Obviously, for those of ordinary skill in the art who have read this application, the above invention disclosure is only for example and does not constitute a limitation of this application. Although not explicitly stated here, those of ordinary skill in the art may make various modifications, improvements and amendments to this application. Such modifications, improvements and amendments are suggested in this application, so such modifications, improvements and amendments still belong to the spirit and scope of the exemplary embodiments of this application.

[0100] At the same time, the present application uses specific words to describe the embodiments of the present application. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of the present application. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, some features, structures or characteristics in one or more embodiments of the present application can be appropriately combined.

[0101] In addition, it will be appreciated by those skilled in the art that various aspects of the present application may be illustrated and described by a number of patentable categories or situations, including any new and useful combination of processes, machines, products or substances, or any new and useful improvements thereto. Therefore, various aspects of the present application may be implemented entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may all be referred to as "units", "modules" or "systems". In addition, various aspects of the present application may take the form of a computer program product embodied in one or more computer-readable media, wherein computer-readable program code is contained therein.

[0102] The computer program code required for the operation of each part of the application can be written in any one or more programming languages, including object-oriented programming languages ​​such as Java, Scale, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., such as C programming language, Visual Basic, Fortran2103, Perl, COBOL2102, PHP, ABAP, such as Python, Ruby and Groovy dynamic programming language or other programming languages. The program code can be run completely on the user's computer, or run on the user's computer as an independent software package, or partly run on the user's computer and partly run on the remote computer, or run completely on the remote computer or server. In the latter case, the remote computer can be connected to the user's computer by any network form, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (such as by the Internet), or in a cloud computing environment, or used as a service such as software as a service (SaaS).

[0103] In addition, unless explicitly stated in the claims, the order of the processing elements and sequences described in this application, the use of alphanumeric characters, or the use of other names are not intended to limit the order of the processes and methods of this application. Although the above disclosure discusses some invention embodiments that are currently considered useful through various examples, it should be understood that such details are only for illustrative purposes, and the attached claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that are consistent with the essence and scope of the embodiments of this application. For example, although the implementation of the various components described above can be embodied in a hardware device, it can also be implemented as a pure software solution, for example, installation on an existing server or mobile device.

[0104] Similarly, it should be noted that in order to simplify the description disclosed in this application and thus help understand one or more embodiments of the invention, in the above description of the embodiments of the application, multiple features are sometimes combined into one embodiment, figure or description thereof. However, this method of the application should not be interpreted as reflecting the intention that the claimed object requires more features than those explicitly stated in each claim. On the contrary, the subject of the invention should have fewer features than the above single embodiment.

Claims

1. A method for generating a water sorting game level, characterized in that: include: S1. Generate a blank level, as follows: Generate a blank level structure according to the parameter information of the level to be generated, and initialize all containers to be in an available state; the parameter information includes the level difficulty, the level size, the storage limit of objects in each container, and the number of object types; the blank level structure includes n containers, and the storage limit of objects in each container is m, that is, there are n*m ​​positions in total, and all positions constitute an n*m two-dimensional array; S2. The probability of occurrence of preprocessed objects is as follows: A list is set for each position. Each list initially stores all object type numbers, which are regarded as any object that may appear in each position at the beginning. Based on the set level difficulty, rules are extracted from a number of preset rules and applied so that the positions affected by the rules exclude some object type numbers. Thus, an initial probability model is established in the form of a list to reflect the types of objects that may appear in each position. S3. Update the object occurrence probability, as follows: According to the extraction rules, update and exclude the object numbers that should not appear in the affected position list; after the update, check that if there is a position where no object is placed and the candidate object number list is empty, the level generation fails; S4. Select objects to fill, as follows: Check in the lists of all positions, randomly select one from the lists with the shortest list length, that is, select from the list corresponding to the position with the least number of object types, and randomly select the object type number in the list from the list to place; S5. Traverse all positions to fill them, as follows: Execute S3, then repeat S4 and S3 until all positions have an object placed or no object can be placed; at this point, check whether the level is generated successfully: If successful, the level data is returned; if failed, a retry is performed.

2. The method for generating a water sorting game level according to claim 1, characterized in that: The initial configuration of the level includes multiple preset templates for selection according to different game modes and difficulties; each preset template contains a different combination of rules.

3. The method for generating a water sorting game level according to claim 1, characterized in that: The rules include: Randomly fill the x-th row with objects, and the same object cannot appear more than a times in the x-th row; From top to bottom, row x should not contain the same object types as those in row y. The same object cannot appear more than b times in the same container; In the same container, each object cannot appear more than c times consecutively.

4. The method for generating a water sorting game level according to claim 1, characterized in that: Sets the maximum number of retries after a level generation failure.

5. A system for generating water sorting game levels, characterized in that: A method for generating a water sorting game level according to any one of claims 1 to 4, wherein the system for generating a water sorting game level comprises: Generates a blank level module for: Generate a blank level structure according to the parameter information of the level to be generated, and initialize all containers to be in an available state; the parameter information includes the level difficulty, the level size, the storage limit of objects in each container, and the number of object types; the blank level structure includes n containers, and the storage limit of objects in each container is m, that is, there are n*m ​​positions in total, and all positions constitute an n*m two-dimensional array; Preprocessing object occurrence probability module, used for: A list is set for each position. Each list initially stores all object type numbers, which are regarded as any object that may appear in each position at the beginning. Based on the set level difficulty, rules are extracted from a number of preset rules and applied so that the positions affected by the rules exclude some object type numbers. Thus, an initial probability model is established in the form of a list to reflect the types of objects that may appear in each position. Updated object occurrence probability module for: According to the extraction rules, update and exclude the object numbers that should not appear in the affected position list; after the update, check that if there is a position where no object is placed and the candidate object number list is empty, the level generation fails; Select the object fill module to: Check in the lists of all positions, randomly select one from the lists with the shortest list length, that is, select from the list corresponding to the position with the least number of object types, and randomly select the object type number in the list from the list to place; Traverse all locations to fill modules for: Update the object appearance probability, then repeat the process of selecting objects to fill and updating the object appearance probability until all positions have an object or no object can be placed; at this point, check whether the level is generated successfully: If successful, the level data is returned; if failed, a retry is performed.

6. A computer-readable storage medium, characterized in that: The storage medium stores computer instructions. When a computer reads the computer instructions, the computer executes the method for generating a water sorting game level according to any one of claims 1 to 4.