Game game simulation method and device, equipment and medium
By generating simulation environment adapters and unifying interface specifications for different game types, the problem of differences in simulation environment software API design in the existing technology is solved, and the high flexibility and simplified development of intelligent game against simulation systems is realized.
Patent Information
- Application Number
- CN202411196157.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The existing intelligent game-adversarial simulation environment software has differences in API design, lacking universality and interoperability, which makes it difficult to directly integrate multiple different simulation environments, limiting the generalization ability and flexibility of the intelligent game-adversarial simulation system. Increases the complexity of user development work.
By obtaining preset general interaction paradigm data and unified interface collections, a simulation environment adapter is generated, interface specifications for different game types are unified, and game game interactions of different game types are realized, so that the game simulation system can integrate various simulation environments.
It improves the generalization ability and flexibility of the game simulation system, simplifies user development work, and allows different game environments to be managed and controlled in a unified manner.
Smart Images

Figure CN119129699A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of intelligent game confrontation technology, and in particular to a simulation method, device, equipment and medium for a game match. Background Art
[0002] At present, in the field of intelligent game confrontation, especially in the simulation research involving large-scale multi-agent systems, there are many types of game problems, such as single-agent, multi-agent, turn-based and non-turn-based, perfect information and imperfect information games, etc. These different game problems usually require different simulation environments for modeling and support. However, the existing simulation environment software has large differences in API design, lacks universality and interoperability, and requires different access solutions between different game modes. As a result, it is difficult to directly integrate multiple different simulation environments when developing large-scale intelligent game confrontation simulation systems, which limits the generalization ability and flexibility of intelligent game confrontation simulation systems and increases the complexity of user development work. Summary of the invention
[0003] The embodiment of the present invention provides a method for simulating a game game, which can generate a simulation environment adapter based on a unified interface set to unify the interface specifications of game environments of different game types, and realize game game interactions of different game types based on universal interaction paradigm data, so that the game simulation system can integrate various simulation environments, thereby effectively improving the generalization ability and flexibility of the game simulation system and simplifying the user's development work.
[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a method for simulating a game, comprising: obtaining preset general interaction paradigm data, wherein the general interaction paradigm data includes interaction control logic under simulation environments of multiple game types; obtaining a preset unified interface set, wherein the unified interface set includes interface functions for interacting with the simulation environments of the multiple game types; obtaining multiple business environments corresponding to the multiple game types to select a target game environment from the multiple business environments, and generating a simulation environment adapter corresponding to the target game environment based on matching of the unified interface set; creating a game environment instance corresponding to the target game environment through the simulation environment adapter, and creating at least one agent object corresponding to the game environment instance based on a preset agent model; and controlling at least one of the agent objects to perform game interaction through the game environment instance according to the general interaction paradigm data.
[0005] In some embodiments, controlling at least one of the intelligent agent objects to interact in a game through the game environment instance according to the general interaction paradigm data includes: obtaining game decision information of at least one of the intelligent agent objects according to the general interaction paradigm data; and executing the current simulation step of the game environment instance in the game according to the game decision information to control at least one of the intelligent agent objects to interact in the game.
[0006] In some embodiments, the game decision information includes action information, survival information, observation information and reward information, and the obtaining of the game decision information of at least one of the agent objects according to the general interaction paradigm data includes: initializing the game environment instance and at least one of the agent objects according to the general interaction paradigm data; obtaining the action information by querying the agent identification list of at least one of the agent objects that can perform actions in the current simulation step; obtaining the survival information by querying whether at least one of the agent objects corresponding to the agent identification list is in a terminated state; querying the observation information of at least one of the agent objects corresponding to the agent identification list; and querying the reward information of at least one of the agent objects corresponding to the agent identification list.
[0007] In some embodiments, executing the current simulation step of the game environment instance in the game game according to the game decision information includes: when it is detected that the target game type corresponding to the target game environment is a single-agent game or a turn-based multi-agent game, obtaining action information and reward information according to the game decision information, and executing the current simulation step of the game environment instance in the game game according to the action information and the reward information; when it is detected that the target game type is a non-turn-based multi-agent game, obtaining the action information, survival information and reward information according to the game decision information, and executing the current simulation step of the game environment instance in the game game according to the action information, the survival information and the reward information; when it is detected that the target game type is a perfect information game or an imperfect information game, obtaining the action information, observation information and reward information according to the game decision information, and executing the current simulation step of the game environment instance in the game game according to the action information, the observation information and the reward information.
[0008] In some embodiments, after executing the current simulation step of the game environment instance in the game according to the game decision information to control at least one of the intelligent agent objects to interact in the game, the method further includes: if the game environment instance does not reach a preset termination condition, repeatedly executing the step of obtaining the game decision information of at least one of the intelligent agent objects according to the general interaction paradigm data, and repeatedly executing the current simulation step of the game environment instance in the game according to the game decision information until the preset termination condition is reached.
[0009] In some embodiments, before obtaining the preset unified interface set, the method also includes: creating multiple interface functions that interact with the simulation environments of the multiple game types to obtain a unified interface set; wherein the unified interface set includes: a simulation environment initialization interface function, used to initialize the game environment instance; a static meta-information interface function, used to provide static meta-information of the game environment instance and at least one of the agent objects; a dynamic attribute interface function, used to perform dynamic attribute configuration for the game environment instance and at least one of the agent objects based on the static meta-information; an agent action acquisition interface function, used to obtain an agent identification list of at least one of the agent objects that can perform actions under the current simulation step; a simulation step interface function, used to execute the current simulation step of the game environment instance; an agent information query interface function, used to obtain action information, survival information, observation information and reward information of at least one of the agent objects; a global information acquisition interface function, used to obtain global status information of the game environment instance and at least one of the agent objects; and a close interface function, used to close the game environment instance.
[0010] In some embodiments, the generation of a simulation environment adapter corresponding to the target game environment based on the matching of the unified interface set includes: obtaining configuration information of the business environment corresponding to the target game environment; matching and implementing the simulation environment initialization interface function, the static meta-information interface function, the dynamic attribute interface function, the intelligent agent action acquisition interface function, the simulation step interface function, the global information acquisition interface function and the shutdown interface function corresponding to the target game environment according to the configuration information to generate a simulation environment adapter corresponding to the target game environment.
[0011] In some embodiments, creating a game environment instance corresponding to the target game environment through the simulation environment adapter, and creating at least one agent object corresponding to the game environment instance based on a preset agent model, includes: obtaining configuration information of the business environment through the simulation environment adapter to create a game environment instance corresponding to the target game environment according to the configuration information; selecting a target agent model from preset agent models based on the target game environment, and creating at least one agent object corresponding to the game environment instance according to the target agent model.
[0012] In some embodiments, after controlling at least one of the intelligent agent objects to interact in a game through the game environment instance in accordance with the general interaction paradigm data, the method further includes: configuring parameters of the game environment instance and at least one of the intelligent agent objects through the simulation environment adapter; obtaining operating information of the game environment instance and at least one of the intelligent agent objects after the parameter configuration through the simulation environment adapter, and performing game object analysis based on the operating information.
[0013] To achieve the above-mentioned purpose, the second aspect of an embodiment of the present invention provides a simulation device for a game game, the device comprising: a paradigm data acquisition module, used to acquire preset general interaction paradigm data, the general interaction paradigm data including interaction control logic in a simulation environment of multiple game types; an interface set acquisition module, used to acquire a preset unified interface set, the unified interface set including interface functions for interacting with the simulation environments of the multiple game types; an adapter generation module, used to acquire multiple business environments corresponding to the multiple game types, so as to select a target game environment from the multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the matching of the unified interface set; an environment instance creation module, used to create a game environment instance corresponding to the target game environment through the simulation environment adapter, and create at least one agent object corresponding to the game environment instance based on a preset agent model; a game game interaction module, used to control at least one of the agent objects to perform game game interaction through the game environment instance according to the general interaction paradigm data.
[0014] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present invention provides an electronic device, comprising: at least one processor; at least one memory for storing at least one program; and when at least one of the programs is executed by at least one of the processors, a simulation method for a game as described in any one of the first aspects is implemented.
[0015] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the simulation method of a game as described in any one of the fourth aspects.
[0016] The embodiments of the present invention provide a method, apparatus, device and storage medium for simulating a game game. The method can obtain preset universal interaction paradigm data, a preset unified interface set and multiple business environments corresponding to multiple game types to select a target game environment from multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the unified interface set matching, and then create a game environment instance corresponding to the target game environment through the simulation environment adapter, and control at least one intelligent agent object to interact with the game game through the game environment instance according to the universal interaction paradigm data to realize the simulation of the game game. It can be understood that the universal interaction paradigm data in the embodiments of the present invention defines a universal interaction process, which can be applicable to multiple different types of game problems, such as single-agent, multi-agent, turn-based and non-turn-based game problems. system, etc., to ensure that no matter what type of game environment can interact in the same mode; accordingly, the unified interface set defines standard interface functions for communicating with business environments of different game types, so that different simulation environments can be managed and controlled under the same framework. Therefore, after the system determines the target game environment from multiple external business environments that need to perform game simulation, the above-mentioned unified interface set can be used to create a simulation environment adapter for the selected target game environment, and the specific interface of the target game environment is converted into a unified standard interface through the simulation environment adapter, and the target game environment instance created by the adapter is used, and the agent object is created through the pre-set agent model, and then the agent object is controlled according to the preset general interaction paradigm to interact with the game through the game environment instance to realize game simulation. In summary, the embodiment of the present invention provides a simulation method for game games, which can enable different game environments to be uniformly managed and controlled, so that the game simulation system can integrate various simulation environments, thereby effectively improving the generalization ability and flexibility of the game simulation system, and simplifying the development work of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0018] Figure 2 A schematic diagram of a method for simulating a game of chess provided by an embodiment of the present invention;
[0019] Figure 3 Another method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0020] Figure 4 A schematic diagram of a process of performing game interaction based on a general interaction paradigm provided by an embodiment of the present invention;
[0021] Figure 5 Another method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0022] Figure 6 Another method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0023] Figure 7 Another method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0024] Figure 8 Another method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0025] Fig. 9 Another method flow chart of a method for simulating a game of chess provided by an embodiment of the present invention;
[0026] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0028] In some embodiments, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms first, second, etc. in the specification, claims and the above drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0029] In addition, unless otherwise clearly specified and limited, the term "connected" should be understood in a broad sense. For example, it can be a fixed connection or a movable connection, a detachable connection or a non-detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or the two can communicate with each other; it can be a direct connection or an indirect connection through an intermediate medium.
[0030] In the description of the embodiments of the present invention, the description with reference to the terms "one embodiment / implementation", "another embodiment / implementation" or "certain embodiments / implementations", "in the above embodiments / implementations", etc. means that the specific features, structures, materials or characteristics described in combination with the embodiments or examples are included in at least two embodiments or implementations disclosed in the present invention. In the disclosure of the present invention, the schematic representation of the above terms does not necessarily refer to the same embodiment or implementation. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that in the flowchart.
[0031] At present, in the field of intelligent game confrontation, especially in the simulation research involving large-scale multi-agent systems, there are many types of game problems, such as single-agent, multi-agent, turn-based and non-turn-based, perfect information and imperfect information games, etc. These different game problems usually require different simulation environments for modeling and support. However, the existing simulation environment software has large differences in API design, lacks universality and interoperability, and requires different access solutions between different game modes. As a result, it is difficult to directly integrate multiple different simulation environments when developing large-scale intelligent game confrontation simulation systems, which limits the generalization ability and flexibility of intelligent game confrontation simulation systems and increases the complexity of user development work.
[0032] In addition, the existing technical solutions only involve a single agent object in the interactive cycle process, and do not distinguish between different agent objects when obtaining observation information. Although existing solutions such as PettingZoo attempt to solve the multi-agent game problem through abstract adaptation, due to the different characteristics of turn-based and non-turn-based games (the former has only one agent action in each step, and the latter allows multiple agents to act simultaneously), it adopts two different access solutions, AEC and Parallel, which makes it impossible to be compatible with these two game types through a single adapter design. In addition, there are some limitations in the existing technology, such as the failure to provide an interface for obtaining global state information (i.e., the lack of a God's perspective function), the lack of support for the replay save function commonly used in environments such as StarCraft 2, and the inability to obtain static information such as the number of agents, whether visualization or replay save is supported, etc. before creating a simulation environment instance. These limitations require additional targeted adaptation when integrating the system, even when facing some common multi-agent game scenarios.
[0033] Therefore, in order to overcome the limitations of the prior art, an embodiment of the present invention provides a method for simulating a game, which can generate a simulation environment adapter based on a unified interface set to unify the interface specifications of game environments of different game types, and realize game interactions of different game types based on general interaction paradigm data, so that the game simulation system can integrate various simulation environments, thereby effectively improving the generalization ability and flexibility of the game simulation system and simplifying the user's development work.
[0034] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0035] refer to Figure 1 , Figure 1 A method flow chart of a method for simulating a game game provided by an embodiment of the present invention; a first aspect of an embodiment of the present invention provides a method for simulating a game game, including but not limited to the following steps:
[0036] Step S110, obtaining preset universal interaction paradigm data, where the universal interaction paradigm data includes interaction control logic in a simulation environment of multiple game types;
[0037] Step S120, obtaining a preset unified interface set, the unified interface set including interface functions for interacting with simulation environments of various game types;
[0038] Step S130, obtaining multiple business environments corresponding to multiple game types, selecting a target game environment from the multiple business environments, and generating a simulation environment adapter corresponding to the target game environment based on a unified interface set matching;
[0039] Step S140, creating a game environment instance corresponding to the target game environment through the simulation environment adapter, and creating at least one agent object corresponding to the game environment instance based on a preset agent model;
[0040] Step S150, controlling at least one intelligent agent object to perform game interaction through a game environment instance according to the general interaction paradigm data.
[0041] In some embodiments, the general interaction paradigm data is a preset data, which includes the interaction control logic in the simulation environment of various game types. These logics define the basic process and rules of interaction between the intelligent agent and the simulation environment, such as initialization, action execution, observation information acquisition, etc.; the unified interface set is a preset set, which includes interface functions for interacting with simulation environments of various game types. These interface functions define a set of standard interfaces, so that different simulation environments can interact with the intelligent agent through this set of interfaces; multiple game types: refers to different types of game problems such as single-agent game, multi-agent game, turn-based game, non-turn-based game, perfect information game, imperfect information game, etc.; multiple business environments refer to simulation environments that realize the above-mentioned different game types, such as Gymnasium, PettingZoo, MAGENT2, VizDoom, etc.; the target game environment refers to a specific game environment selected from multiple business environments for subsequent simulation.
[0042] It can be understood that the simulation environment adapter is an intermediary component, which is generated based on the matching of a unified interface set and is used to convert the specific interface of the target game environment into a unified standard interface. The game environment instance is an instantiated object of the target game environment and is used for actual simulation operation. The agent object refers to an entity that performs actions in the simulation environment, which can be a player-controlled character, an AI-controlled character, etc. The number of agent objects can be one or more, depending on the type of the target game environment. Game game interaction refers to the interaction process between the agent object and the game environment instance, including but not limited to the agent object executing actions, environmental feedback observation and rewards, etc., and in the subsequent process, the interaction between the agent object and the game environment instance can be guided according to the process and rules specified by the general interaction paradigm data.
[0043] It is conceivable that, through a series of preset data and interface sets, the embodiments of the present invention can enable different gaming environments to be uniformly managed and controlled, thereby effectively improving the generalization ability and flexibility of the gaming simulation system and simplifying the user's development work.
[0044] refer to Figure 2 , Figure 2A schematic diagram of a method for simulating a game of chess provided by an embodiment of the present invention; in some embodiments, the embodiment of the present invention can obtain preset universal interaction paradigm data, a preset unified interface set, and multiple business environments corresponding to multiple game types to select a target game environment from multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the unified interface set matching, and then create a game environment instance corresponding to the target game environment through the simulation environment adapter, and control at least one agent object to interact with the game of chess through the game environment instance according to the universal interaction paradigm data to realize the simulation of the game of chess; it can be understood that the universal interaction paradigm data in the embodiment of the present invention defines a universal interaction process, which can be applicable to multiple different types of game problems, such as single-agent, multi-agent, turn-based and Non-turn-based, etc., to ensure that no matter what type of game environment can interact in the same mode; accordingly, the unified interface set defines standard interface functions for communicating with business environments of different game types, so that different simulation environments can be managed and controlled under the same framework. Therefore, after the system determines the target game environment from multiple external business environments that need to perform game simulation, the above-mentioned unified interface set can be used to create a simulation environment adapter for the selected target game environment, and the specific interface of the target game environment is converted into a unified standard interface through the simulation environment adapter, and the target game environment instance created by the adapter is used, and the agent object is created through a pre-set agent model, and then the agent object is controlled according to the preset general interaction paradigm to interact with the game through the game environment instance to realize game simulation. In summary, the embodiment of the present invention provides a simulation method for game games, which can enable different game environments to be uniformly managed and controlled, so that the game simulation system can integrate various simulation environments, thereby effectively improving the generalization ability and flexibility of the game simulation system, and simplifying the development work of users.
[0045] In some embodiments, corresponding to Figure 2The embodiment of the present invention can obtain preset universal interaction paradigm data, which includes interaction control logic in simulation environments of various game types; obtain preset unified interface sets, which include interface functions for interacting with simulation environments of various game types; obtain multiple business environments corresponding to various game types, which may be Gymnasium, PettingZoo, MAGENT2, VizDoom, etc.; select a target game environment from multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the unified interface set matching; use the simulation environment adapter to create a game environment real game environment corresponding to the target game environment; For example, and based on the preset agent model, at least one agent object corresponding to the game environment instance is created; at least one agent object is controlled to interact in the game through the game environment instance according to the general interaction paradigm data; finally, other functions can be added to the system as needed, such as visualization function, so that users can understand the performance of the agent model more intuitively; in this way, the present invention provides a flexible game simulation system, which can adapt to a variety of different game environments and can easily create and manage agent models. At the same time, due to the use of a unified interface set and general interaction paradigm data, the scalability and compatibility of the system are significantly improved.
[0046] refer to Figure 3 , Figure 3 Another method flow chart of a method for simulating a game game provided by an embodiment of the present invention; in some embodiments, controlling at least one agent object to interact with the game game through a game environment instance according to the general interaction paradigm data includes but is not limited to the following steps:
[0047] Step S310, obtaining game decision information of at least one intelligent agent object according to the general interaction paradigm data;
[0048] Step S320, executing the current simulation step of the game environment instance in the game game according to the game decision information to control at least one intelligent agent object to interact in the game game.
[0049] In some embodiments, the agent object here refers to an entity that makes decisions and acts in the game environment, which can be one or more. The agent object can be a character controlled by a player, an AI agent that makes automatic decisions, etc. Game decision information is the information required for the agent object to make decisions during the game, usually including action information, survival information, observation information and reward information, among which action information: the action that the agent can currently choose; survival information: whether the agent is still active in the game (not eliminated or dead); observation information: the state information about the environment that the agent can currently obtain; reward information: the reward value obtained by the agent after the current decision.
[0050] In some embodiments, the current simulation step of the game environment instance in the game is executed according to the game decision information to control at least one intelligent agent object to interact in the game. The execution of the simulation step involves updating the state of the game environment according to the selection of the intelligent agent object, executing the action of the intelligent agent, and calculating the new environment state, reward and completion, etc., so that the intelligent agent object interacts with the game environment according to its decision information, which includes executing actions, receiving feedback (such as rewards and new observations), etc.
[0051] refer to Figure 4 , Figure 4 A flowchart of a game interaction process based on a general interaction paradigm is provided for one embodiment of the present invention; in some embodiments, the game decision information includes action information, survival information, observation information and reward information, and the game decision information of at least one intelligent agent object is obtained according to the general interaction paradigm data, including but not limited to the following steps: when the game environment instance does not reach a preset termination condition, repeatedly executing the game decision information of at least one intelligent agent object according to the general interaction paradigm data, and repeatedly executing the current simulation step of the game environment instance in the game according to the game decision information until the preset termination condition is reached.
[0052] Among them, Figure 4As shown, the game decision information includes action information, survival information, observation information and reward information. The game decision information of at least one agent object is obtained according to the general interaction paradigm data, including but not limited to the following steps: Initialize the game environment instance and at least one agent object: First, initialize the game environment instance and at least one agent object according to the general interaction paradigm data. This means setting the initial parameters of the game environment and creating agent objects; obtain action information: query the agent identification list of at least one agent object that can perform actions under the current simulation step to obtain action information. This may involve determining which agents can take actions at the current moment and what actions they can take; obtain survival information: query whether at least one agent object corresponding to the agent identification list is in a terminated state to obtain survival information. This helps to determine which agents are still active in the game and which have been eliminated; obtain observation information: query the observation information of at least one agent object corresponding to the agent identification list. This may be any information received by the agent about the game state, such as maps, resources, enemy positions, etc.; obtain reward information: query the reward information of at least one agent object corresponding to the agent identification list. This is usually the immediate feedback of the agent after performing an action, indicating how well they performed; Execute the current simulation step: Execute the current simulation step according to the agent's game decision information. This may include executing the agent's actions, updating the environment state, calculating rewards, etc.; Output state information: If the terminal state has not yet been entered, output the current state information to the agent for the next action decision. Otherwise, end the game; Loop iteration: Continue to execute the above steps until the game ends or other stop conditions are met.
[0053] refer to Figure 5 , Figure 5 Another method flow chart of a method for simulating a game game provided by an embodiment of the present invention; in some embodiments, the current simulation steps of the game environment instance in the game game are executed according to the game decision information, including but not limited to the following steps:
[0054] Step S510, when it is detected that the target game type corresponding to the target game environment is a single-agent game or a turn-based multi-agent game, action information and reward information are obtained according to the game decision information, and the current simulation step of the game environment instance in the game game is executed according to the action information and the reward information;
[0055] Step S520, when it is detected that the target game type is a non-turn-based multi-agent game, action information, survival information and reward information are obtained according to the game decision information, and the current simulation step of the game environment instance in the game is executed according to the action information, survival information and reward information;
[0056] Step S530, when it is detected that the target game type is a perfect information game or an imperfect information game, action information, observation information and reward information are obtained according to the game decision information, and the current simulation step of the game environment instance in the game is executed according to the action information, observation information and reward information.
[0057] In some embodiments, corresponding to steps S510 to S530, the general interaction paradigm data can solve the generalization requirements of various types of game confrontation problems in the following ways:
[0058] Call env.reset() function to initialize the environment;
[0059] Get the list of agent identifiers that can execute actions (action information): For single agent, non-turn-based multiplayer games, and turn-based multiplayer games, you can use the env.get_current_player_ids() function to get the list of agent identifiers that can currently execute actions, allowing this application to handle different types of game environments;
[0060] Query whether the agent is out (survival information): For multi-agent games such as StarCraft 2 micro-management, the embodiment of the present application can use the env.get_player_terminated(player_id) function to actively query whether a certain agent has been eliminated (died) in advance;
[0061] Get observation information, reward information and other information: The env.get_player_obs(player_id), env.get_player_reward(player_id) and env.get_player_info(player_id) functions are used to obtain the observation information, reward information and other related information of a specific agent, respectively, supporting perfect information and imperfect information games.
[0062] Execute simulation steps: Use env.step(actions) function to execute a step-length simulation. The structure of actions is standardized to make it a list containing num_agents. For agents that are eliminated early, they are set to None to achieve a more standardized interaction mode.
[0063] In summary, by allowing Env (game environment instance) and Agent (agent object) to interact cyclically, Env provides observation information Obs to Agent, and Agent makes action decisions based on it, which affects Env and then performs a step-length simulation calculation.
[0064] Specifically, examples of calling the above-mentioned related functions for simulation according to different game types are as follows:
[0065] Single-agent game: In a single-player game or simulation environment, the agent can interact with the environment through a common process. First, the environment is initialized using the env.reset() function, and then a loop is entered, where the agent uses env.step(action) to perform actions and receive feedback until the game ends;
[0066] Multi-agent games: In perfect information multiplayer games such as Go, each agent takes turns to act; the agent that should act can be determined through env.get_current_player_ids(), and the action is performed using env.step(action). All agents have access to the complete board state and can therefore obtain perfect information.
[0067] Imperfect information games: In games such as poker, the agent cannot access all players' hand information. However, the general process still applies. The agent can obtain its private information through env.get_player_obs(player_id) and make decisions based on this information.
[0068] Turn-based multiplayer games: In turn-based strategy games, each agent acts in its own turn; env.get_current_player_ids() can be used to determine which agent's turn it is, and then the agent performs the action;
[0069] Non-turn-based multiplayer games: In real-time strategy games, multiple agents can act at the same time; the general process can handle the actions of multiple agents at the same time through env.step(action), and each agent performs actions based on its own observations and strategies. At the same time, such as reaching a certain score, completing a specific task, or triggering a specific event, in these cases, env.get_player_terminated(player_id) can be used to check whether the agent has met the exit conditions.
[0070] refer to Figure 6 , Figure 6 Another method flow chart of a method for simulating a game game provided by an embodiment of the present invention; in some embodiments, after executing the current simulation step of the game environment instance in the game game according to the game decision information to control at least one intelligent agent object to interact in the game game, the method also includes but is not limited to the following steps:
[0071] Step S610, when the game environment instance does not reach the preset termination condition, repeatedly executing the acquisition of game decision information of at least one agent object according to the general interaction paradigm data, and repeatedly executing the current simulation step of the game environment instance in the game game according to the game decision information, until the preset termination condition is reached;
[0072] It can be understood that the termination condition is the game ending standard defined in the game environment, such as: the game reaches a predetermined maximum number of steps or rounds, and a certain agent reaches the victory condition, such as eating all the opponent's chess pieces in a board game and all agents have no legal actions to take, that is, they are stuck in a special condition set by the environment itself, such as in some environments, the environment automatically ends when it reaches a certain state, etc.; if the game environment instance does not reach the preset termination condition, then the game decision information of at least one agent object will be obtained multiple times according to the general interaction paradigm data, and the current simulation step of the game environment instance in the game will be executed according to these decision information, which will give the agent the opportunity to continuously adjust its strategy until the game ends.
[0073] refer to Figure 7 , Figure 7 Another method flow chart of a method for simulating a game of a game provided by an embodiment of the present invention; in some embodiments, before obtaining a preset unified interface set, the method further includes but is not limited to the following steps:
[0074] Step S710, creating multiple interface functions for interacting with simulation environments of multiple game types to obtain a unified interface set;
[0075] Among them, the unified interface set includes: a simulation environment initialization interface function, which is used to initialize the game environment instance; a static meta-information interface function, which is used to provide static meta-information of the game environment instance and at least one intelligent agent object; a dynamic attribute interface function, which is used to configure dynamic attributes for the game environment instance and at least one intelligent agent object based on the static meta-information; an intelligent agent action acquisition interface function, which is used to obtain an intelligent agent identification list of executable actions of at least one intelligent agent object under the current simulation step; a simulation step interface function, which is used to execute the current simulation step of the game environment instance; an intelligent agent information query interface function, which is used to obtain the action information, survival information, observation information and reward information of at least one intelligent agent object; a global information acquisition interface function, which is used to obtain the global status information of the game environment instance and at least one intelligent agent object; and a closing interface function, which is used to close the game environment instance.
[0076] Specifically, compared with various existing open source solutions, the interface design in the unified interface set has higher generalization, and the unified interface set may include:
[0077] act_space(player_id): Get the action space of a specific agent. This helps the agent determine its feasible action set in order to make decisions. player_id is the agent ID.
[0078] obs_space(player_id): Gets the observation space of a specific agent. This provides the spatial dimension in which the agent receives information, helping it understand the state of the environment.
[0079] reward_space(): Gets the size range of the reward. This helps the agent understand the range of possible benefits its actions can bring.
[0080] is_available(): Determines whether the simulation environment is available in the current environment. This helps avoid invalid environment access.
[0081] get_env_static_meta(): Get some static properties of the simulation environment (can be called before creating an instance). This provides basic information about the environment, such as rules, restrictions, etc.
[0082] get_env_runtime_meta(): Gets some runtime properties of the simulation environment (needs to be called after creating an instance). This provides real-time information about the state of the environment.
[0083] reset(seed=None,save_replay_path=None): resets the simulation instance to the initial state, and can set the random seed and the replay save path of this episode as needed (requires env support). This makes the experiment repeatable and controllable.
[0084] step(action): input the action to be performed by each Agent instance at the current time to the game engine, then calculate a timestamp forward, return whether the current game is over, and obtain reward, observation, done and other information through the get_xxx function. This is the core simulation step, which determines the behavior of the agent and the evolution of the environment.
[0085] get_current_player_ids(): Returns which agents should perform actions in the current round. The type is a list array, each element is an integer number, indicating the index of the participating agent. This helps manage the interaction of multiple agents.
[0086] get_player_default_action(player_id=0): Get the default action corresponding to the specified player_id, usually used when the corresponding agent calls the action decision function and times out. This provides an alternative plan when the agent cannot decide on an action.
[0087] get_player_legal_actions(player_id=0): Returns the set of actions that the agent represented by the specified player_id can take in the current state. This helps the agent understand its current feasible actions.
[0088] get_player_terminated(player_id=0): Returns whether the agent represented by the specified player_id has entered the terminal state in this round of the game. This helps the agent know when to exit the game.
[0089] get_player_obs(player_id=0): Returns the information that the agent represented by the specified player_id can observe. This is the key way for the agent to perceive the environment.
[0090] get_player_reward(player_id=0): Returns the reward information obtained by the agent represented by the specified player_id after this step. This is the main driving force for the agent to learn.
[0091] get_player_info(player_id=0): Returns other auxiliary information obtained by the agent represented by the specified player_id after this step. For details, please refer to the implementation of each sub-class game engine. This provides additional environmental feedback.
[0092] get_global_state(): Returns global state information. This function is only needed if the game engine supports it. It can be used for spectating, but should not be called from the agent client to prevent information leakage. This provides a global perspective, but should be used with caution.
[0093] render(mode = 'human'): Called after each step to render the game screen. This provides a visual interface for easy observation and debugging.
[0094] close(): Close the simulation environment and release the corresponding resources. This ensures the effective use of resources and the normal termination of the program.
[0095] The design of the above interface takes into account different game types and environmental characteristics, which can make the system more flexible and adaptable.
[0096] In some embodiments, a simulation environment adapter corresponding to the target game environment is generated based on a unified interface set matching, including: obtaining configuration information of a business environment corresponding to the target game environment; implementing a simulation environment initialization interface function, a static meta-information interface function, a dynamic attribute interface function, an intelligent agent action acquisition interface function, a simulation step interface function, a global information acquisition interface function and a shutdown interface function corresponding to the target game environment according to the configuration information matching to generate a simulation environment adapter corresponding to the target game environment.
[0097] Specifically, the following are specific examples for Gymnasium:
[0098] Simulation environment initialization interface function: initialize and create the gymnasium original env instance as the member variable self._env_instance;
[0099] Static meta information interface function get_env_static_meta(): returns the following information,
[0100] Software SDK name: sdk_name = "gymnasium";
[0101] Software SDK version: sdk_version = get_package_version(gymnasium.package);
[0102] List of all envs included: all_env_names = list(gymnasium.envs.registry.keys());
[0103] Minimum number of players: min_num_players = 1;
[0104] Maximum number of players: max_num_players = 1;
[0105] Whether to support visual rendering: if_supports_rendering = True;
[0106] Whether to support replay saving: if_supports_replay_saving = True (if necessary);
[0107] (Other static properties as needed).
[0108] Dynamic attribute interface function get_env_runtime_meta(): Returns the following information:
[0109] env name: set according to the initialization parameters, such as "LunarLander-v2";
[0110] Actual number of players: num_players = 1.
[0111] Agent action acquisition interface function get_current_player_ids(): forced to return 0 (because there is only one agent).
[0112] The simulation step interface functions include: reset function reset(seed, save_replay_path=None):
[0113] Call rets=self._env_instance.reset(seed=seed);
[0114] Parse obs, reward, terminated and other information from rets and cache them in member variables;
[0115] Save the latest obs. If the replay save function is set, you need to cache the rgb_array contained in obs.
[0116] Step function step(self,actions):
[0117] Get element 0 in actions and pass it to the step function of the original env rets = self._env_instance.step(action)
[0118] Parse obs, reward, terminated and other information from rets and cache them in member variables
[0119] If save replay is set, the rgb_array image information can be refreshed and written to the video file here.
[0120] Agent information query interface function: get_player_default_action(player_id): check that player_id must be 0, and then return self._act_space.sample(action information);
[0121] get_player_legal_actions(player_id): check that player_id must be 0, and then return self._act_space (action information); get_player_terminated(player_id): check that player_id must be 0, and then return self._last_terminated (survival information); get_player_obs(player_id): check that player_id must be 0, and then return self._last_obs (observation information); get_player_reward(player_id): check that player_id must be 0, and then return self._last_reward (reward information).
[0122] Global information acquisition interface function get_global_state(): Since only one agent is involved, self._last_obs is also returned.
[0123] Close interface function close(): call self._env_instance.close() to release related resources.
[0124] The following is an example of RLCard, which covers the unified adaptation of various turn-based multiplayer chess and card games with imperfect information. The specific RLCard implements the following interface functions:
[0125] The simulation environment initialization interface function is initialized according to the input common kwargs parameter dictionary, and creates the rlcard original env instance as the member variable self._env_instance.
[0126] The static meta information interface function get_env_static_meta() returns the following information:
[0127] Software SDK name: sdk_name = "rlcard":
[0128] Software SDK version: sdk_version = rlcard.__version__:
[0129] List of all included envs:
[0130] all_env_names=list(rlcard.envs.registration.registry.env_specs.keys());
[0131] Minimum number of players: min_num_players = 1. Some games only support a single player.
[0132] Maximum number of players: max_num_players = 10. Some games can support a variable number of players.
[0133] Whether to support visualization rendering: if_supports_rendering = False. Since RLCard itself does not have visualization capabilities, it is set to not support here;
[0134] Whether to support replay saving: if_supports_replay_saving=False;
[0135] (Other static properties as needed).
[0136] The dynamic attribute interface function get_env_runtime_meta() returns the following information:
[0137] Env name: set according to the initialization parameters, such as "limit-holdem";
[0138] Actual number of players: set according to the initialization parameters, for example, num_players = 2;
[0139] Reset function reset(seed, save_replay_path=None);
[0140] Call self._last_obs, self._player_id = self._env_instance.reset();
[0141] Where self._last_obs represents the current state, and self._player_id is the identity id of the player who can perform actions in the current round;
[0142] The current step action executes the player id function get_current_player_ids(), which returns [self._player_id]. Note that in a turn-based multiplayer game, only one player can execute an action at a time, but the player identity is related to the game rules and the actual execution status.
[0143] Simulation step interface function step(self,actions):
[0144] Get element 0 in actions (because there must be only one player's action command), and then pass it to the step function of the original env: self._last_obs, self._player_id = self._env_instance.step(action[0]);
[0145] Where self._last_obs represents the current state, and self._player_id is the identity id of the player who can perform actions in the current round;
[0146] Check whether the game is over self._last_terminated = self._env_instance.is_over().
[0147] Agent information query interface function is as follows:
[0148] get_player_default_action(player_id), verify that player_id is in the range of [0, self.num_players-1], then query the legal actions through the RLCard original API and sample them, self._env_instance.get_state(player_id)['legal_actions'].keys()[0];
[0149] get_player_legal_actions(player_id), verify that player_id is in the range of [0, self.num_players-1], return list(self._env_instance.get_state(player_id)['legal_actions'].keys());
[0150] get_player_terminated(player_id), check that player_id is in the range [0, self.num_players-1], and then return self._last_terminated;
[0151] get_player_obs(player_id), check that player_id is in the range of [0, self.num_players-1], and then return self._last_obs. Note that since the obs information returned by each step has matched the identity of the player who currently needs to query obs for action decision, no additional processing is required here;
[0152] get_player_reward(player_id), check that player_id is in the range of [0, self.num_players-1], then query payoffs from the original env, payoffs = self._env_instance.get_payoffs(), return float(payoffs[player_id]).
[0153] The global information acquisition interface function get_global_state() involves a variable number of multiple agents, [self._env_instance.get_state(i)['raw_obs']foriinrange(self._runtime_meta.num_players)], and it is necessary to obtain the corresponding information separately and then aggregate it.
[0154] Close the interface function close(). Since the original env implementation of RLCard has no corresponding API, it can be ignored directly.
[0155] The above steps further demonstrate that the embodiment of the present invention can use an adapter solution to uniformly abstract and integrate a multiplayer turn-based imperfect information game (chess and card) RLCard.
[0156] From the above, it can be understood that the processing details for different types of simulation environments are implemented in advance in the specific simulation environment adapter. If a new business environment wants to be connected, it only needs to implement the specific simulation environment adapter according to the unified API, and then all types of simulation environments are uniformly accessed in the upper-level business system, and general support is provided for functions such as replay saving, env static and runtime property acquisition.
[0157] refer to Figure 8 , Figure 8 Another method flow chart of a method for simulating a game game provided by an embodiment of the present invention; in some embodiments, creating a game environment instance corresponding to a target game environment through a simulation environment adapter, and creating at least one agent object corresponding to the game environment instance based on a preset agent model, including but not limited to the following steps:
[0158] Step S810, obtaining configuration information of the business environment through the simulation environment adapter, so as to create a gaming environment instance corresponding to the target gaming environment according to the configuration information;
[0159] Step S820: Select a target agent model from preset agent models based on the target game environment, and create at least one agent object corresponding to the game environment instance according to the target agent model.
[0160] It can be understood that the configuration information of the business environment is obtained through the simulation environment adapter, which can help create a game environment instance that conforms to the characteristics of the target game environment. Then, according to the target game environment, a suitable agent model can be selected from the preset agent models, and at least one agent object corresponding to the game environment instance can be created according to the selected target agent model.
[0161] refer to Fig. 9 , Fig. 9 Another method flow chart of a method for simulating a game game provided by an embodiment of the present invention; in some embodiments, after controlling at least one agent object to interact with the game game through a game environment instance according to the general interaction paradigm data, the method further includes but is not limited to the following steps:
[0162] Step S910, configuring parameters of the game environment instance and at least one intelligent agent object through a simulation environment adapter;
[0163] Step S920, obtaining the game environment instance after parameter configuration and the operation information of at least one intelligent agent object through the simulation environment adapter, and performing game object analysis according to the operation information.
[0164] In some embodiments, after controlling at least one agent object to interact with the game through the game environment instance according to the general interaction paradigm data, the following operations may be performed: configuring parameters of the game environment instance and the at least one agent object through the simulation environment adapter to optimize their behavior and performance; further, obtaining the operation information of the game environment instance and the at least one agent object after the parameter configuration through the simulation environment adapter, and performing game object analysis based on the information, wherein reference Figure 2Other functions in the game can be used as part of step S920, that is, after the analysis of the game object, and these functions include: General configuration parameters: general parameters used in the game process, such as learning rate, exploration rate, network architecture, etc. These parameters can be adjusted according to the game results and operation information to optimize the learning effect of the agent; Replay preservation: During the game process, the operation and results of each step can be recorded to form the so-called "replay". These replays can be used to further analyze the behavior of the agent, and can also be used for subsequent training and testing; Visual rendering: In order to facilitate the observation and understanding of the game process, visualization tools can be used to render the game environment and the behavior of the agent, which can help researchers intuitively understand how the agent responds to environmental changes and how they learn and adapt; Human-computer interaction: In addition to the game between agents, human-computer interaction functions can also be designed so that human players can directly participate and play against the agent. This can not only test the ability of the agent, but also collect more human behavior data to facilitate the improvement of the algorithm.
[0165] In some embodiments, a simulation method for game games proposed in the present invention has been fully implemented and functionally verified in a large-scale game confrontation simulation system. Through the simulation method of the present invention, a variety of simulation environments including gymnasium, gym, pettingzoo, magent2, vizdoom, rlcard, openspiel, pysc2, smac, metadrive, and finrl can be uniformly accessed. These environments cover a variety of problem types such as single agent, multi-agent, perfect information game, imperfect information game, turn-based, non-turn-based, as well as real-time strategy, first-person shooting, physical simulation, chess, robots, military simulation, financial quantification, and other application fields. Users can freely select and test the intelligent agent models they developed on the platform, and the platform also realizes visualization functions to help users analyze model performance. Therefore, the present invention significantly improves the compatibility of the simulation environment and the research and development efficiency of the intelligent agent model.
[0166] The second aspect of an embodiment of the present invention provides a simulation device for a game game, the device comprising: a paradigm data acquisition module, used to acquire preset universal interaction paradigm data, the universal interaction paradigm data including interaction control logic in a simulation environment of multiple game types; an interface set acquisition module, used to acquire a preset unified interface set, the unified interface set including interface functions for interacting with simulation environments of multiple game types; an adapter generation module, used to acquire multiple business environments corresponding to multiple game types, so as to select a target game environment from multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the unified interface set matching; an environment instance creation module, used to create a game environment instance corresponding to the target game environment through the simulation environment adapter, and create at least one agent object corresponding to the game environment instance based on a preset agent model; a game game interaction module, used to control at least one agent object to perform game game interaction through the game environment instance according to the universal interaction paradigm data; wherein the device is used to implement a simulation method for a game game as described in any one of the first aspects, so it will not be repeated here.
[0167] Some embodiments of the present invention provide an electronic device, Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, referring to Fig.10 The electronic device 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, the method for simulating a game of a game described in any one of the above embodiments is implemented. For example, the method described above is executed. Figure 2 Steps S210 to S230 of the method, Figure 3 Steps S310 to S330 of the method, Figure 5 Steps S510 to S550 of the method, Figure 7 Method steps S710 to S750.
[0168] The electronic device 1000 of the embodiment of the present invention includes one or more processors 1010 and a memory 1020. Fig.10 In the figure, a processor 1010 and a memory 1020 are taken as an example.
[0169] The processor 1010 and the memory 1020 may be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.
[0170] The memory 1020, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 1020 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1020 may optionally include a memory 1020 remotely disposed relative to the processor 1010, and these remote memories may be connected to the electronic device 1000 via a network. At the same time, examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0171] In some embodiments, when the processor executes the computer program, it executes the simulation method of the game of any one of the above embodiments at preset intervals.
[0172] Those skilled in the art will understand that Fig.10 The device structure shown in the figure does not constitute a limitation on the electronic device 1000, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0173] exist Fig.10 In the electronic device 1000 shown, the processor 1010 can be used to call the simulation method of the game game stored in the memory 1020, so as to implement the simulation method of the game game.
[0174] Based on the hardware structure of the above-mentioned electronic device 1000, various embodiments of the game game simulation device of the present invention are proposed. At the same time, the non-transient software program and instructions required to implement the game game simulation method of the above-mentioned embodiment are stored in the memory. When executed by the processor, the game game simulation method of the above-mentioned embodiment is executed.
[0175] The embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute the above-mentioned game simulation method, which can enable the above-mentioned one or more processors to execute the game simulation method of any one of the above-mentioned embodiments, for example, to execute the above-mentioned Figure 1 Steps S110 to S150 of the method, Figure 3 Steps S310 to S320 of the method, Figure 5 Steps S510 to S530 of the method, Figure 6 In method step S610, Figure 7 In method step S710, Figure 8 Steps S810 to S820 of the method, Fig. 9 Method steps S910 to S920.
[0176] The embodiment of the present invention further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the simulation method of the game game of any one of the above embodiments, for example, executing the above-described Figure 1 Steps S110 to S150 of the method, Figure 3 Steps S310 to S320 of the method, Figure 5 Steps S510 to S530 of the method, Figure 6 In method step S610, Figure 7 In method step S710, Figure 8 Steps S810 to S820 of the method, Fig. 9 Method steps S910 to S920.
[0177] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network nodes. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0178] It will be appreciated by those skilled in the art that all or some of the steps and devices in the method disclosed above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application specific integrated circuit. The software may be distributed on a computer-readable medium, which may include a computer-readable storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer-readable storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD to ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, magnetic tape, disk storage or other magnetic storage device, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0179] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A method for simulating a game, characterized in that: include: Acquire preset universal interaction paradigm data, wherein the universal interaction paradigm data includes interaction control logic in a simulation environment of multiple game types; Acquire a preset unified interface set, wherein the unified interface set includes interface functions for interacting with the simulation environments of the multiple game types; Acquire multiple business environments corresponding to the multiple game types, select a target game environment from the multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the unified interface set matching; Creating a game environment instance corresponding to the target game environment through the simulation environment adapter, and creating at least one agent object corresponding to the game environment instance based on a preset agent model; At least one of the intelligent agent objects is controlled according to the general interaction paradigm data to perform game interaction through the game environment instance.
2. The method for simulating a game of game according to claim 1, characterized in that: The step of controlling at least one of the agent objects to perform game interaction through the game environment instance according to the general interaction paradigm data comprises: Acquire game decision information of at least one of the intelligent agent objects according to the general interaction paradigm data; The current simulation step of the game environment instance in the game game is executed according to the game decision information to control at least one of the intelligent agent objects to interact in the game game.
3. The method for simulating a game of game according to claim 2, characterized in that: The game decision information includes action information, survival information, observation information and reward information. The step of obtaining the game decision information of at least one of the agent objects according to the general interaction paradigm data includes: Initialize the game environment instance and at least one of the agent objects according to the general interaction paradigm data; The action information is obtained by querying a list of agent identifiers of at least one of the agent objects that can perform actions in the current simulation step; Obtaining the survival information by querying whether at least one of the agent objects corresponding to the agent identification list is in a terminated state; Querying the observation information of at least one of the agent objects corresponding to the agent identification list; Query the reward information of at least one of the agent objects corresponding to the agent identification list.
4. The method for simulating a game of game according to claim 2, characterized in that: The step of executing the current simulation step of the game environment instance in the game game according to the game decision information includes: When it is detected that the target game type corresponding to the target game environment is a single-agent game or a turn-based multi-agent game, action information and reward information are obtained according to the game decision information, and a current simulation step of the game environment instance in the game game is executed according to the action information and the reward information; When it is detected that the target game type is a non-turn-based multi-agent game, the action information, the survival information and the reward information are obtained according to the game decision information, and the current simulation step of the game environment instance in the game game is executed according to the action information, the survival information and the reward information; When it is detected that the target game type is a perfect information game or an imperfect information game, the action information, observation information and reward information are obtained according to the game decision information, and the current simulation step of the game environment instance in the game game is executed according to the action information, the observation information and the reward information.
5. The method for simulating a game of game according to claim 2, characterized in that: After executing the current simulation step of the game environment instance in the game game according to the game decision information to control at least one of the intelligent agent objects to interact in the game game, the method further includes: When the game environment instance does not reach the preset termination condition, the step of obtaining the game decision information of at least one of the intelligent agent objects according to the general interaction paradigm data is repeated, and the step of executing the current simulation step of the game environment instance in the game according to the game decision information is repeated until the preset termination condition is reached.
6. The method for simulating a game of game according to claim 1, characterized in that: Before obtaining the preset unified interface set, the method further includes: Creating multiple interface functions that interact with the simulation environments of the multiple game types to obtain a unified interface set; The unified interface set includes: The simulation environment initialization interface function is used to initialize the game environment instance; A static meta-information interface function, used to provide static meta-information of the game environment instance and at least one of the agent objects; A dynamic attribute interface function, used for configuring dynamic attributes for the game environment instance and at least one of the agent objects based on the static meta-information; An agent action acquisition interface function is used to obtain an agent identifier list of at least one of the agent objects that can perform actions in the current simulation step; A simulation step interface function, used to execute the current simulation step of the game environment instance; Agent information query interface function, used to obtain action information, survival information, observation information and reward information of at least one of the agent objects; A global information acquisition interface function, used to obtain the global state information of the game environment instance and at least one of the agent objects; The closing interface function is used to close the gaming environment instance.
7. The method for simulating a game of game according to claim 6, characterized in that: The generating a simulation environment adapter corresponding to the target gaming environment based on the matching of the unified interface set includes: Acquire configuration information of the business environment corresponding to the target gaming environment; According to the configuration information, the simulation environment initialization interface function, the static meta-information interface function, the dynamic attribute interface function, the intelligent agent action acquisition interface function, the simulation step interface function, the global information acquisition interface function and the closing interface function corresponding to the target game environment are matched and implemented to generate a simulation environment adapter corresponding to the target game environment.
8. The method for simulating a game of game according to claim 7, characterized in that: The step of creating a game environment instance corresponding to the target game environment through the simulation environment adapter, and creating at least one agent object corresponding to the game environment instance based on a preset agent model includes: Acquiring configuration information of the business environment through the simulation environment adapter to create a gaming environment instance corresponding to the target gaming environment according to the configuration information; A target agent model is selected from preset agent models based on the target game environment, and at least one agent object corresponding to the game environment instance is created according to the target agent model.
9. The method for simulating a game of game according to claim 1, characterized in that: After controlling at least one of the intelligent agent objects to interact in a game through the game environment instance according to the general interaction paradigm data, the method further includes: Performing parameter configuration on the game environment instance and at least one of the agent objects through the simulation environment adapter; The operation information of the game environment instance and at least one of the intelligent agent objects after the parameter configuration is obtained through the simulation environment adapter, and the game object analysis is performed according to the operation information.
10. A game simulation device, characterized in that: The device comprises: A paradigm data acquisition module, used to acquire preset universal interaction paradigm data, wherein the universal interaction paradigm data includes interaction control logic in a simulation environment of multiple game types; An interface set acquisition module, used to acquire a preset unified interface set, wherein the unified interface set includes interface functions for interacting with the simulation environments of the multiple game types; An adapter generation module, used to obtain multiple business environments corresponding to the multiple game types, select a target game environment from the multiple business environments, and generate a simulation environment adapter corresponding to the target game environment based on the unified interface set matching; An environment instance creation module, used to create a game environment instance corresponding to the target game environment through the simulation environment adapter, and create at least one agent object corresponding to the game environment instance based on a preset agent model; A game interaction module is used to control at least one of the intelligent agent objects to perform game interaction through the game environment instance according to the general interaction paradigm data.
11. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, a method for simulating a gaming game as described in any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the game simulation method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Game platform modeling and simulation method and system
CN116702585A
