Game engine-oriented AI Agent tool calling method and virtual device

By using an AI Agent tool invocation method based on multi-dimensional tag indexing and type mapping rules, the challenges of understanding and integrating LLM in game engine API calls are solved, enabling secure and accurate invocation of game engine APIs and high system scalability, thereby improving the level of automation in game development.

CN122086646APending Publication Date: 2026-05-26QUANLING (SHENZHEN) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
QUANLING (SHENZHEN) NETWORK CO LTD
Filing Date
2026-02-05
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, Large Language Models (LLMs) suffer from non-standard tool definitions and a lack of semantic abstraction when calling game engine APIs. This makes it difficult to understand the purpose, parameter types, and value ranges of the APIs. Furthermore, they cannot be integrated with standard tool calling protocols such as MCP, resulting in insufficient universality and interoperability, and failing to meet the automation needs of game development.

Method used

This paper provides a method for calling AI Agent tools for game engines. By parsing natural language instructions through multi-dimensional tag indexing and type mapping rules, constructing operation delegates, and executing API calls in the main thread synchronous task queue, combined with hot update mechanism and standardized protocol adaptation, it achieves efficient and secure calling of tool libraries.

Benefits of technology

It enables LLM to accurately understand and securely call game engine APIs, lowering the barrier to understanding and calling, improving system stability and scalability, enhancing interoperability and error handling capabilities, and supporting the complexity and version iteration of game development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122086646A_ABST
    Figure CN122086646A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence and game development, in particular to a game engine-oriented AI Agent tool calling method and virtual equipment, and the method comprises the following steps: receiving a natural language tool calling request sent by an AI Agent through a standard protocol; and tool matching and parameter analysis are carried out based on a pre-established tool definition system adopting natural language semantic description and multi-dimensional tags. The general request parameters are automatically converted into strong data types specific to the game engine, and all converted instructions are ensured to be safely executed in a main thread of the game engine through a task queue scheduling mechanism of the main thread. In addition, the method also supports the quick retrieval of the tool through the reverse index and the hot update of the tool based on file monitoring. According to the method, the problem that a large language model is difficult to directly understand and call a complex game engine API is effectively solved, and the technical threshold and the operation risk of participation of AI in game development are remarkably reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and game development technology, and in particular to a method for invoking the AIAgent tool for game engines and a virtual device. Background Technology

[0002] Currently, there are significant limitations to applying the tool invocation capabilities of Large Language Models (LLMs) to the field of game development. First, the general tool invocation mechanisms of LLMs (such as Function Calling) suffer from problems such as non-standard tool definitions and a lack of semantic abstraction. Furthermore, their definitions and execution logic are often mixed, which is not conducive to maintenance and expansion.

[0003] Secondly, when directly interacting with commercial game engines like Unity, their native APIs are characterized by their vast number, deep hierarchy, complex parameters, and strong type dependencies, and strictly require invocation within the main thread. This makes it difficult for LLMs to accurately understand the API's purpose, grasp the parameter types and value ranges, and master the invocation order and dependencies.

[0004] Although there are some AI and game engine integration solutions on the market, they generally suffer from incomplete tool coverage, lack of a unified organizational structure, poor scalability, imperfect error handling, and failure to integrate with industry standard tool calling protocols such as MCP, resulting in insufficient universality and interoperability.

[0005] In addition, game development itself involves special requirements such as multi-type asset management, diverse engine operations, strict operation sequence dependencies, and frequent real-time status queries, which further increases the difficulty of AI-driven automated development.

[0006] Therefore, existing technologies lack a dedicated AI Agent tool invocation framework that can systematically solve the above problems, possess standardized, scalable, and easy-to-understand characteristics, and can be integrated with standardized protocols. Summary of the Invention

[0007] In view of this, the purpose of this invention is to propose an AI Agent tool invocation method and virtual device for game engines, so as to solve the problem that in the prior art, large language models are difficult to invoke directly, securely and reliably due to the complexity of game engine APIs, lack of semantic encapsulation and strong type differences, which cannot meet the needs of game development automation.

[0008] To achieve the above objectives, this invention provides a method for invoking AI Agent tools for game engines, comprising the following steps: Step S1: Receive a tool invocation request containing natural language instructions from the AI ​​Agent; Step S2: Parse the tool call request and match the target tool and required parameters from the tool library according to the multi-dimensional tag index pre-configured for the tool. The multi-dimensional tags include at least the function, the operation object, and the engine module to which it belongs. Step S3: Based on the pre-established type mapping rules, the matched parameters are converted from general data structures to specific data types in the target game engine, and an operation delegate carrying the specific data type parameters is constructed. Step S4: Submit the operation delegate to the task queue synchronized with the game engine's main thread to trigger the game engine to execute the corresponding native API call; Step S5: Obtain the call result of the native API, format it as a natural language response, and return it to the AI ​​Agent.

[0009] Preferably, in step S3, converting the matched parameters from a general data structure to a specific data type in the target game engine includes: The target data type corresponding to the parameter is determined according to the type mapping rule; Based on the target data type, select the corresponding converter from a set of preset custom converters; Using the selected converter, the input general data format is converted into at least one of the game engine's vector, quaternion, or color structure.

[0010] Preferably, in step S4, submitting the operation delegate to the task queue synchronized with the game engine's main thread includes: The data type parameter is bound to the underlying API method corresponding to the target tool to generate a function delegate that can be executed directly in the main thread of the game engine; The generated function delegate is added to a concurrent queue maintained by the main thread of the game engine; The game engine retrieves and executes the function delegate from the concurrent queue during each frame update cycle.

[0011] Preferably, the construction of the multi-dimensional tag index includes the following steps: Read the definitions of all tools in the tool library and extract the tags for each tool in terms of function, target object, and engine module to which it belongs; Based on the extracted tags, construct an inverted index from tags to tool identifiers; In response to the addition of new tools, keywords are automatically extracted as supplementary tags by analyzing the natural language description of the tools, and the inverted index is updated.

[0012] Preferably, the method further includes hot updating of the tool definition, including: The monitoring tool defines the file change events; Without interrupting service, reload the updated tool definitions into memory and rebuild the relevant indexes.

[0013] Preferably, the method further includes, in the step of matching the target tool from the tool library, performing semantic verification on the matching result, the semantic verification including: Verify whether the name of the target tool conforms to the semantic naming convention of verb-noun; Compare the semantic consistency between the instruction parameter name and the underlying API parameter name.

[0014] Preferably, the method further includes, in the step of matching the required parameters of the tool, performing a security check on the parameters, the security check including: Filter parameters for code injection attack signature characters; Perform a validation of the file path parameter to ensure it is valid for the project sandbox directory.

[0015] This invention also provides an AI Agent tool invocation system for game engines, comprising: The AI ​​Agent layer is used to receive and understand natural language instructions, generate tool invocation requests, and parse the responses returned by the system. A tool invocation protocol adaptation layer, connected to the AI ​​Agent layer, is used to communicate with the AI ​​Agent layer based on a standardized tool invocation protocol and to forward the requests and responses; The tool configuration layer, connected to the protocol adaptation layer, is used to define the semantic interface of the tool through a structured configuration file. The interface includes the tool's natural language description, parameter specifications, and return format. The tool execution layer, connected to the tool configuration layer, is used to carry the implementation logic of the tool. Specifically, it includes: mapping request parameters to the native data types of the game engine, scheduling and executing the corresponding game engine API or external service calls, and encapsulating the execution results into a standardized response. The game engine's underlying layer connects to the tool execution layer, providing the native APIs and responding to their calls to complete specific game development operations.

[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described above.

[0017] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method.

[0018] The beneficial effects of this invention are: 1. This invention encapsulates game engine functions in a natural language style through a tool configuration layer, providing clear tool descriptions, parameter examples, and return value explanations. This enables LLM to understand tool functions and usage methods as accurately as it understands human instructions, greatly improving the mapping relationship between natural language instructions and API calls, and significantly reducing the threshold for AI to understand and call them. 2. The intelligent type mapping and serialization engine built into the execution layer of this invention automatically and accurately converts between LLM general data types and game engine strongly typed systems (such as Vector3 and Quaternion) through a custom converter and reflection mechanism. Combined with a safe call mechanism based on the main thread scheduler, it ensures that all engine API calls meet thread safety requirements, fundamentally improving the success rate of calls and system stability, and achieving safe and accurate engine operation; 3. This invention establishes a tool tag system covering multiple dimensions such as function, object, and difficulty, as well as an in-memory inverted index, which supports millisecond-level accurate retrieval and combined query of massive tools, enabling the AI ​​Agent to quickly locate the most suitable tool and effectively cope with the complexity of game development; 4. This invention adopts a two-layer architecture that decouples tool definition (Schema) and execution logic (Execution), allowing the addition or modification of tools to be achieved only by adjusting configurations or independent plugins. Combined with a zero-downtime hot update mechanism based on file monitoring and dynamic loading, it achieves seamless updates and high availability of the framework at runtime, easily adapting to game engine version iterations and changes in project requirements, giving the framework excellent scalability and maintainability. 5. This invention enhances the interoperability and versatility of the framework with different AI agents by integrating with the MCP standard protocol through a protocol adaptation layer. Simultaneously, the standardized error handling mechanism can convert underlying technical anomalies into natural language descriptions that AI can understand, assisting it in autonomous correction, improving the human-machine collaboration experience, and enhancing standardization and error handling capabilities. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only for this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of the AI ​​Agent tool invocation method for game engines according to an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.

[0022] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0023] Example 1: like Figure 1 As shown, this embodiment provides a method for invoking an AI Agent tool for game engines, specifically including the following steps: Step S1: Receive a tool invocation request containing natural language instructions from the AI ​​Agent. The AI ​​Agent (such as GPT-4) generates a structured invocation request following the Model Context Protocol (MCP). This method receives the request through a protocol adaptation layer, performs connection management and heartbeat detection, and parses out the target tool name and parameters initially extracted from the natural language instructions.

[0024] The second step, step S2, involves parsing the tool call request and, based on the multi-dimensional tag index pre-configured for the tool, matching the target tool and required parameters from the tool library. The multi-dimensional tags at least include function, target object, and associated engine module. Specifically, a tool classification system covering the entire game development process is used to organize the tools, including: Unity operation classes: covering the management of scenes, objects, components, transformations, and scripts; Asset generation category: covers the generation of 3D models, textures, scenes, animations, and audio; Information query category: covers queries of scene information, object attributes, and project status; Code manipulation class: covers script generation, modification, and analysis; Project management: covering build and release, version control.

[0025] Each tool, when defined, is assigned multi-dimensional tags in addition to belonging to the above categories, such as function, target audience, difficulty, and frequency (for example, the tool "create_physics_cube" might have tags like "create," "physics," "cube," and "high frequency"). This method uses a real-time maintained inverted index of tags for matching, supporting complex combined queries and achieving accurate retrieval. For newly added and unlabeled tools, the system introduces the TF-IDF algorithm to automatically analyze their natural language descriptions, extract high-frequency keywords as candidate tags, and dynamically update the index.

[0026] Step S3: Based on pre-established type mapping rules, the matched parameters are converted from general data structures to specific data types in the target game engine, and an operation delegate carrying parameters of that specific data type is constructed. This method processes the parameters according to the matched tool definition: Intelligent Type Mapping: First, based on the intermediate representation layer (IR) type identifier declared in the parameters (e.g., {"_type": "Vector3"}), the target is determined to be Unity's Vector3 type according to preset mapping rules. Then, a custom converter (such as Vector3Converter) pre-built for this type is dynamically found and invoked via reflection to automatically deserialize general data (such as an array [0, 1, 0]) into engine-specific objects (such as Vector3.up). This mechanism also handles complex structures such as Quaternion and Color.

[0027] Before the conversion, the parameter semantic alignment validator analyzes the semantic similarity between the parameter names in the instruction and the underlying API parameter names to prevent incorrect mappings (such as misassociating position with scale). At the same time, a deep security defense system is activated to perform sandbox validation on the input, filter special characters to prevent code injection, and forcibly restrict file path parameters to the project sandbox directory (such as Application.dataPath).

[0028] The successfully converted, strongly typed parameter is then bound to the corresponding engine API method found through reflection indexing, constructing an operation delegate that can be executed directly in the main thread. To improve performance, the system uses delegate caching technology to convert the MethodInfo obtained from the first reflection into a strongly typed delegate and cache it, eliminating the reflection overhead of subsequent calls.

[0029] Step S4: Submit the operation delegate to a task queue synchronized with the game engine's main thread to trigger the game engine to execute the corresponding native API call. To meet the strict requirement that game engine APIs must be called from the main thread, the method submits the operation delegate obtained in the previous step to a dedicated main thread task queue (MainThreadDispatcher). This queue is a ConcurrentQueue, responsible for caching Action delegates from asynchronous MCP requests. In its Update loop of each frame, the game engine automatically retrieves delegates from this queue and executes them sequentially, thereby safely and synchronously calling the native API to complete all operations from creating objects and modifying properties to generating assets.

[0030] Step S5: Obtain the call result of the native API, format it as a natural language response, and return it to the AI ​​Agent.

[0031] Specifically, this includes: during hot updates, monitoring the configuration and plugin directories via a file system watcher (FileSystemWatcher), triggering a zero-downtime hot reload upon detection of changes: changes to configuration files reload metadata; changes to .dll plugins dynamically load the new assembly via Assembly.Load and rebind reflection mappings. This process employs a double-buffering mechanism to ensure automatic rollback to the old version if the new version fails to load. Any exceptions during execution are caught and converted into AI-understandable natural language descriptions via an error handling mechanism (e.g., converting NullReferenceException to "Operation failed: Could not find the specified game object"). Finally, all results are standardized into text format and returned to the AIAgent through the protocol layer.

[0032] Example 2: This embodiment provides an AI Agent tool invocation system for game engines, including: AI Agent Layer: As an intelligent front end, driven by a large language model, it is responsible for generating tool call requests that conform to the MCP protocol. This layer exists independently of the whole and communicates with the lower layer through standardized protocols, ensuring the openness of the system and compatibility with various AI models.

[0033] Tool Invocation Protocol Adaptation Layer: As an MCP server, it enables state integration with AI. It handles all network communication, registers and discovers tools, and allows the AI ​​Agent to query the full list of capabilities provided by the framework.

[0034] Tool Configuration Layer (Schema Layer): Responsible for defining the semantic information of tools, geared towards AI Agent design. Each tool is semantically defined using JSON / YAML files, with definitions strictly adhering to specifications, including tool metadata definitions, parameter definitions, and return value definitions. The tool metadata includes: Tool names should use semantic naming, such as create_game_object instead of CreateGO; Tool description: Use natural language to describe the tool's functions, usage scenarios, and precautions; Tool categorization, marking the category to which the tool belongs (Unity operation class, asset generation class, etc.); Tool version, supporting tool version management and compatibility declarations; The parameter definitions include: Parameter names, semantic parameter names; Parameter types include string, number, boolean, enumeration, object, array, etc. Parameter constraints: required / optional fields, value range, format requirements, and default values; Parameter description, explaining the meaning and usage of the parameters in natural language; Parameter examples provide typical parameter value examples.

[0035] The return value is defined as a return format that explicitly specifies whether the success or failure occurs.

[0036] The Execution Layer, which runs the managed plugin within the game engine process, is responsible for actually calling the game engine API or asset generation interface to complete specific tasks. It includes a smart type mapping and serialization engine, a game engine API call encapsulation and dynamic dispatch module, and an asset generation interface integration module. The smart type mapping and serialization engine includes: Intermediate Presentation Layer (IR): This layer defines a standard JSON Schema internally, acting as a neutral bridge between generic data types and the game engine's strong typing. For example, Unity's Vector3 type is uniformly represented as {"_type":"Vector3", "data": [x, y, z]}.

[0037] Type Conversion Middleware: This module contains a series of custom converters pre-built for game engine-specific structures such as Vector3, Quaternion, Color, GameObject references, etc. Each converter knows how to convert IR data to and from engine objects.

[0038] Automatic deserialization process: When a call request is received, the parameter parser will dynamically find the corresponding custom converter based on the _type identifier in the parameter using the C# reflection mechanism, and automatically call its method to instantiate the JSON data into an engine object that can be directly manipulated (for example, mapping [0, 1, 0] to Vector3.up).

[0039] The game engine API call encapsulation and dynamic dispatch module includes: The reflection-based instruction dispatcher: During the framework initialization phase, this module uses System.Reflection to scan all loaded assemblies, automatically discovers and indexes all C# static methods marked with the custom attribute [SeeleTool(“ToolName”)], and builds an efficient tool name -> (assembly, class, MethodInfo) hash index table in memory.

[0040] Dynamic Invocation and Delegate Caching: When a request needs to be executed, the dispatcher retrieves the corresponding MethodInfo from the index table based on the tool name. To eliminate the performance overhead of reflection invocation, the system uses the Delegate.CreateDelegate method to convert the MethodInfo into a strongly typed delegate and caches it on the first invocation. Subsequent invocations directly execute the cached delegate, achieving performance close to that of native invocation.

[0041] MainThreadDispatcher: To address thread safety issues arising from the requirement that Unity and other engine APIs must be called from the main thread, this module includes a built-in thread-safe main thread task queue (typically implemented as a ConcurrentQueue). <action>All asynchronous requests from the MCP layer have their core logic encapsulated as an Action delegate and injected into this queue before execution. During each frame of the Update loop in the main thread, the engine retrieves these delegates from this queue and executes them sequentially, thus ensuring the safety of all engine operations.

[0042] The asset generation interface integration module encapsulates the communication logic with external services (such as cloud APIs) for non-engine built-in functions (such as generating 3D models, textures, and audio through AI). It is responsible for sending requests, waiting for results, and the subsequent processing flow of automatically importing the generated asset files into the engine project and converting them into a usable format.

[0043] This system also includes a tool organization and tag indexing module: This module is responsible for maintaining the complete tool classification system defined in the disclosure document in memory, which is used to implement the tool tagging system and its dynamic maintenance. During system startup or hot updates, it parses the tags of all tools and constructs a tag->List. <toolid>The in-memory inverted index enables tag-based combinatorial queries to be completed in O(1) time complexity.

[0044] For the new tools, this module can call the adaptive tag generation algorithm, use algorithms such as TF-IDF to analyze the text, and automatically extract high-frequency keywords as candidate tag suggestions.

[0045] Lifecycle and Hot Update Management Module: This system implements a hot-reload strategy based on file monitoring and reflection cache refresh, aiming for zero-downtime hot reload. It utilizes FileSystemWatcher to monitor the configuration file directory of the tool's configuration layer and the plugin DLL directory of the tool's execution layer in real time. When a configuration file change is detected, the file is automatically re-parsed, and the tool definitions and inverted indexes in memory are updated. When a change is detected in a .dll file implementing the tool logic, dynamic assembly loading is triggered. The system uses Assembly.Load to load the new version of the DLL into a new context, then rescans and binds reflection mappings, establishing a new index and delegate cache.

[0046] The entire update process employs a double-buffering mechanism. The new module is loaded and initialized in the background, and traffic is switched only after successful confirmation. If the new version fails to load or initialize, the system can automatically roll back to the stable, older version index, ensuring high service availability.

[0047] As one implementation method, this system also includes a semantic consistency verification and security defense module: before a tool is registered or invoked, it will forcibly verify whether the tool name conforms to the preset verb-object structure specification and will check it based on a verb whitelist (such as Create, Modify, Delete, Get, etc.). At the same time, it will analyze the semantic similarity between the tool parameter name and the underlying API parameter name to prevent semantic conflicts such as incorrectly mapping the position to the scale parameter, and will issue a warning when a problem is detected.

[0048] Before invoking reflection, the input string is rigorously cleaned, filtering out special characters that may trigger code injection. For all file path parameters, they are forced to be parsed and restricted to the engine project's secure sandbox directory (such as Unity's Application.dataPath) to prevent unauthorized file access.

[0049] Ultimately, commercial or self-developed game engines such as Unity and Unreal provide the basic capabilities required for game development through their public and extensive collection of native APIs, such as scene graph management, physics simulation, rendering pipeline control, and resource systems.

[0050] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0051] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0052] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0053] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0054] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a terminal device, the terminal device can implement the steps in the various method embodiments described above.

[0055] The embodiments described above are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.< / toolid> < / action>

Claims

1. A method for invoking AI Agent tools for game engines, characterized in that, Includes the following steps: Step S1: Receive a tool invocation request containing natural language instructions from the AI ​​Agent; Step S2: Parse the tool call request and match the target tool and required parameters from the tool library according to the multi-dimensional tag index pre-configured for the tool. The multi-dimensional tags include at least the function, the operation object, and the engine module to which it belongs. Step S3: Based on the pre-established type mapping rules, the matched parameters are converted from general data structures to specific data types in the target game engine, and an operation delegate carrying the specific data type parameters is constructed. Step S4: Submit the operation delegate to the task queue synchronized with the game engine's main thread to trigger the game engine to execute the corresponding native API call; Step S5: Obtain the call result of the native API, format it as a natural language response, and return it to the AIAgent.

2. The method for invoking AI Agent tools for game engines according to claim 1, characterized in that, In step S3, converting the matched parameters from a general data structure to a specific data type in the target game engine includes: The target data type corresponding to the parameter is determined according to the type mapping rule; Based on the target data type, select the corresponding converter from a set of preset custom converters; Using the selected converter, the input general data format is converted into at least one of the game engine's vector, quaternion, or color structure.

3. The method for invoking AI Agent tools for game engines according to claim 1, characterized in that, In step S4, submitting the operation delegate to the task queue synchronized with the game engine's main thread includes: The data type parameter is bound to the underlying API method corresponding to the target tool to generate a function delegate that can be executed directly in the main thread of the game engine; The generated function delegate is added to a concurrent queue maintained by the main thread of the game engine; The game engine retrieves and executes the function delegate from the concurrent queue during each frame update cycle.

4. The method for invoking AI Agent tools for game engines according to claim 1, characterized in that, The construction of the multi-dimensional tag index includes the following steps: Read the definitions of all tools in the tool library and extract the tags for each tool in terms of function, target object, and engine module to which it belongs; Based on the extracted tags, construct an inverted index from tags to tool identifiers; In response to the addition of new tools, keywords are automatically extracted as supplementary tags by analyzing the natural language description of the tools, and the inverted index is updated.

5. The method for invoking AI Agent tools for game engines according to claim 1, characterized in that, The method also includes hot updating of tool definitions, including: The monitoring tool defines the file change events; Without interrupting service, reload the updated tool definitions into memory and rebuild the relevant indexes.

6. The method for invoking AI Agent tools for game engines according to claim 1, characterized in that, The method further includes, in the step of matching the target tool from the tool library, performing semantic verification on the matching result, the semantic verification including: Verify whether the name of the target tool conforms to the semantic naming convention of verb-noun; Compare the semantic consistency between the instruction parameter name and the underlying API parameter name.

7. The method for invoking AI Agent tools for game engines according to claim 1, characterized in that, The method further includes, in the step of matching the required parameters of the tool, performing a security check on the parameters, the security check including: Filter parameters for code injection attack signature characters; Perform a validation of the file path parameter to ensure it is valid for the project sandbox directory.

8. A tool invocation system for AI agents in game engines, characterized in that, include: The AI ​​Agent layer is used to receive and understand natural language instructions, generate tool invocation requests, and parse the responses returned by the system. A tool invocation protocol adaptation layer, connected to the AI ​​Agent layer, is used to communicate with the AI ​​Agent layer based on a standardized tool invocation protocol and to forward the requests and responses; The tool configuration layer, connected to the protocol adaptation layer, is used to define the semantic interface of the tool through a structured configuration file. The interface includes the tool's natural language description, parameter specifications, and return format. The tool execution layer, connected to the tool configuration layer, is used to carry the implementation logic of the tool. Specifically, it includes: mapping request parameters to the native data types of the game engine, scheduling and executing the corresponding game engine API or external service calls, and encapsulating the execution results into a standardized response. The game engine's underlying layer connects to the tool execution layer, providing the native APIs and responding to their calls to complete specific game development operations.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.