Method and device for generating non-player characters, storage medium, and electronic device

Through the combination method of universal non-player character templates and component libraries, non-player characters with personalized functions are generated, which solves the problems of low development efficiency and high maintenance cost in the existing technology, and achieves flexible configuration and efficient development.

CN112245924BActive Publication Date: 2024-10-08BEIJING BEINGFUNGAMES TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011183808.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-29
Publication Date
2024-10-08
Estimated Expiration
2040-10-29

AI Technical Summary

Technical Problem

When developing non-player characters with existing technology, there are problems such as heavy repetitive design and development workload, high maintenance costs, and poor flexibility. Especially during cross-department cooperation and work handover, communication costs and bug risks may increase.

Method used

Using a combination method of universal non-player character templates and preset component libraries, by configuring universal non-player character templates and mounting corresponding target business components, non-player characters with personalized functions can be generated, reducing the amount of repeated code editing, and realizing multi-functional Flexible configuration and expansion.

Benefits of technology

It reduces the cost of non-player character configuration, improves development efficiency and development cycle, increases the flexibility of functional configuration, and reduces the workload of repeated development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112245924B_ABST
    Figure CN112245924B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for generating a non-player character, a storage medium, and an electronic device, wherein the method comprises: configuring a universal non-player character template, wherein the universal non-player character template contains the basic logic of all non-player character types, and the universal non-player character template encapsulates the logic codes of multiple universal services; searching for a plurality of target business components matching the business demand information in a preset component library, wherein the preset component library includes a plurality of business components, each business component corresponds to a type of non-player character, and each business component encapsulates the logic code of a corresponding business; mounting the target business component to the universal non-player character template to generate the target non-player character. Through the present invention, the technical problem of low efficiency in developing game non-player characters in the related art is solved, the development efficiency of non-player characters is improved, and the development cycle of non-player characters is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for generating a non-player character, a storage medium, and an electronic device. Background Art

[0002] In related art, non-player characters (NPCs) are a type of character in games and a type of game element. They refer to all interactive objects or objects with their own logic, such as monsters, quest NPCs, and treasure chests. Different NPCs are designed based on the functional requirements of game strategies, such as monsters, minerals, treasure chests, traps, quest NPCs, and pets. The data structures of these NPCs vary significantly.

[0003] In the prior art, developing non-player characters (NPCs) with specific functions typically involves editing code, resulting in significant development costs. While these characters are designed to meet diverse needs, monsters, minerals, and quest NPCs often share a significant amount of overlapping logic, such as display, refresh and destruction, and basic interactions. This logic requires extensive repetitive design, development, and testing, resulting in significant additional development costs, especially for large-scale projects. Maintenance costs also increase. Because the data structures of NPCs with different functions differ, cross-departmental collaboration and work handovers incur significant communication costs. If hidden configuration rules exist, this can increase the risk of bugs and lead to significant additional maintenance costs. Furthermore, NPCs developed using prior art lack flexibility and scalability. During game development, multiple functional combinations are often required, such as a treasure chest monster that can run, a mechanism that allows for quest handovers, or even a monster that can gather resources. These require joint development by multiple business units, resulting in limited flexibility and the inability to expand upon existing templates.

[0004] Currently, no effective solution has been found for the above-mentioned problems existing in the related technologies. Summary of the Invention

[0005] Embodiments of the present invention provide a method and device for generating a non-player character, a storage medium, and an electronic device.

[0006] According to one embodiment of the present invention, a method for generating a non-player character is provided, comprising: configuring a universal non-player character template, wherein the universal non-player character template includes basic logic for all non-player character types and encapsulates logic code for multiple universal services; searching a preset component library for a plurality of target service components that match service requirement information, wherein the preset component library includes a plurality of service components, each service component corresponding to a type of non-player character, and each service component encapsulates logic code for a corresponding service; and attaching the target service components to the universal non-player character template to generate the target non-player character.

[0007] Optionally, configuring a universal non-player character template includes: configuring a model resource code of the universal non-player character template, configuring an interface display code of the universal non-player character template, configuring a combat behavior code of the universal non-player character template, and configuring an attack and defense attribute code of the universal non-player character template, wherein the model resource code is used to represent the visual size information of the target non-player character in the game scene, the interface display code is used to represent the display content and display path of the target non-player character in the game scene, the combat behavior code is used to represent the camp information and skill gain information of the target non-player character in the game scene, and the attack and defense attribute code is used to represent the combat capability of the target non-player character in the game scene; and the model resource code, the interface display code, the combat behavior code, and the attack and defense attribute code are combined into the universal non-player character template.

[0008] Optionally, searching for several target business components that match the business requirement information in the preset component library includes: determining the non-player character type that matches the business requirement information; searching for at least one of the following target business components that matches the non-player character type in the preset component library: collection component, belonging component, building component, pet capture component, picking component, treasure chest component, artificial intelligence AI component, vehicle component, trigger component, switch component, blocking component, relic component, livestock component, puzzle component, interaction component, and non-player character service component.

[0009] Optionally, mounting the target business component to the universal non-player character template to generate a target non-player character includes: locating a specified directory file under the root directory in the script file of the universal non-player character template; and mounting the universal non-player character template and the target business component using the specified directory file as a mount point to generate the target non-player character.

[0010] Optionally, if the target non-player character is an ore non-player character, the target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring acquisition parameters of the acquisition component, wherein the acquisition parameters are used to characterize the amount of virtual resources obtained by collecting the ore non-player character in the game scene; and mounting the acquisition component to the universal non-player character template to generate the ore non-player character.

[0011] Optionally, if the target non-player character is an animal non-player character, the target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring acquisition parameters of the acquisition component, and configuring action parameters of the AI ​​component, wherein the acquisition parameters are used to represent the amount of virtual resources acquired by acquiring the animal non-player character in the game scene, and the action parameters are used to represent the playback animation of the animal non-player character in the game scene;

[0012] The acquisition component and the AI ​​component are mounted to the universal non-player character template to generate an animal non-player character.

[0013] Optionally, if the target non-player character is a livestock non-player character, the target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring the collection parameters of the collection component, configuring the action parameters of the AI ​​component, and configuring the livestock parameters of the livestock component, wherein the collection parameters are used to characterize the amount of virtual resources obtained by collecting the livestock non-player character in the game scene, the action parameters are used to characterize the playback animation of the livestock non-player character in the game scene, and the livestock parameters are used to characterize the breeding area of ​​the livestock non-player character in the game scene; the collection component, the AI ​​component and the livestock component are mounted to the universal non-player character template to generate the livestock non-player character.

[0014] Optionally, after mounting the target business component to the universal non-player character template to generate a target non-player character, the method further includes: after triggering the target non-player character in the game scene, determining whether the health value of the target non-player character is lower than a first preset value, and / or determining whether the distance between the player-controlled character and the target non-player character is less than a second preset value; if the health value of the target non-player character is lower than the first preset value, and / or the distance between the player-controlled character and the target non-player character is less than the second preset value, generating ancillary resources for the target non-player character, and allocating the ancillary resources to the game account of the player-controlled character.

[0015] Optionally, after mounting the target business component to the universal non-player character template to generate a target non-player character, the method further includes: after triggering the target non-player character in the game scene, detecting the switch state of the switch component of the target non-player character, wherein the switch component is used to control the start and stop state of the controlled component, and the controlled component includes at least one of the following: an acquisition component, a non-player character service component, and a blocking component, and the target business component includes the switch component and the controlled component; if the switch state of the switch component is on, running the logic code of the controlled component; if the switch state of the switch component is off, prohibiting the running of the logic code of the controlled component.

[0016] According to another embodiment of the present invention, a device for generating a non-player character is provided, comprising: a configuration module for configuring a universal non-player character template, wherein the universal non-player character template includes basic logic for all non-player character types and encapsulates logic codes for multiple universal services; a search module for searching a preset component library for a plurality of target business components that match business requirement information, wherein the preset component library includes a plurality of business components, each business component corresponding to a type of non-player character, and each business component encapsulates logic code for a corresponding service; and a mounting module for mounting the target business component to the universal non-player character template to generate the target non-player character.

[0017] Optionally, the configuration module includes: a configuration unit, configured to configure the model resource code of the universal non-player character template, configure the interface display code of the universal non-player character template, configure the combat behavior code of the universal non-player character template, and configure the attack and defense attribute code of the universal non-player character template, wherein the model resource code is used to represent the visual size information of the target non-player character in the game scene, the interface display code is used to represent the display content and display path of the target non-player character in the game scene, the combat behavior code is used to represent the camp information and skill gain information of the target non-player character in the game scene, and the attack and defense attribute code is used to represent the combat ability of the target non-player character in the game scene; and a combination unit, used to combine the model resource code, the interface display code, the combat behavior code, and the attack and defense attribute code into the universal non-player character template.

[0018] Optionally, the search module includes: a determination unit for determining a non-player character type that matches the business demand information; a search unit for searching a preset component library for at least one of the following target business components that matches the non-player character type: acquisition component, attribution component, building component, pet capture component, pickup component, treasure chest component, artificial intelligence AI component, vehicle component, trigger component, switch component, blocking component, relic component, livestock component, puzzle component, interaction component, and non-player character service component.

[0019] Optionally, the mounting module includes: a positioning unit, used to locate a specified directory file under the root directory in the script file of the universal non-player character template; and a mounting unit, used to mount the universal non-player character template and the target business component using the specified directory file as a mounting point to generate a target non-player character.

[0020] Optionally, if the target non-player character is an ore non-player character, the mounting module includes: a first configuration unit, used to configure the collection parameters of the collection component, wherein the collection parameters are used to represent the amount of virtual resources obtained by collecting the ore non-player character in the game scene; a first mounting unit, used to mount the collection component to the universal non-player character template to generate an ore non-player character.

[0021] Optionally, if the target non-player character is an animal non-player character, the mounting module includes: a second configuration unit, used to configure the acquisition parameters of the acquisition component, and configure the action parameters of the AI ​​component, wherein the acquisition parameters are used to characterize the amount of virtual resources obtained by collecting the animal non-player character in the game scene, and the action parameters are used to characterize the playback animation of the animal non-player character in the game scene; a second mounting unit, used to mount the acquisition component and the AI ​​component to the universal non-player character template to generate an animal non-player character.

[0022] Optionally, if the target non-player character is a livestock non-player character, the mounting module includes: a third configuration unit, configured to configure the acquisition parameters of the acquisition component, configure the action parameters of the AI ​​component, and configure the livestock parameters of the livestock component, wherein the acquisition parameters are used to characterize the amount of virtual resources obtained by collecting the livestock non-player character in the game scene, the action parameters are used to characterize the playback animation of the livestock non-player character in the game scene, and the livestock parameters are used to characterize the breeding area of ​​the livestock non-player character in the game scene; a third mounting unit, configured to mount the acquisition component, the AI ​​component and the livestock component to the universal non-player character template to generate a livestock non-player character.

[0023] Optionally, the device further includes: a judgment module for, after the mounting module mounts the target business component to the universal non-player character template to generate a target non-player character, and after triggering the target non-player character in the game scene, judging whether the health value of the target non-player character is lower than a first preset value, and / or judging whether the distance between the player-controlled character and the target non-player character is less than a second preset value; an allocation module for, if the health value of the target non-player character is lower than the first preset value, and / or the distance between the player-controlled character and the target non-player character is less than the second preset value, generating ancillary resources for the target non-player character and allocating the ancillary resources to the game account of the player-controlled character.

[0024] Optionally, the device further includes: a detection module, configured to, after the mounting module mounts the target business component to the universal non-player character template to generate a target non-player character, and after the target non-player character is triggered in a game scene, detect the switch state of the switch component of the target non-player character, wherein the switch component is used to control the start and stop states of the controlled component, and the controlled component includes at least one of the following: an acquisition component, a non-player character service component, and a blocking component, and the target business component includes the switch component and the controlled component; a control module, configured to run the logic code of the controlled component if the switch state of the switch component is on; and prohibit the running of the logic code of the controlled component if the switch state of the switch component is off.

[0025] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.

[0026] According to another embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

[0027] The present invention configures a universal non-player character template, then searches for several target business components that match business requirement information in a preset component library, and mounts the target business components to the universal non-player character template to generate a target non-player character. By mounting the universal non-player character template and the target business components, a non-player character with personalized functions can be generated based on the basic logic of the universal non-player character, reducing the amount of code editing for repeated functions and enabling flexible configuration and expansion of multiple functions. This solves the technical problem of low efficiency in developing game non-player characters in related technologies, increases the flexibility of non-player character function configuration, reduces the configuration cost of non-player characters, improves the development efficiency of non-player characters, and shortens the development cycle of non-player characters. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0029] Figure 1 This is a block diagram of hardware structure for generating a non-player character according to an embodiment of the present invention;

[0030] Figure 2 is a flow chart of a method for generating a non-player character according to an embodiment of the present invention;

[0031] Figure 3 is a diagram of the data organization of non-player characters according to an embodiment of the present invention;

[0032] Figure 4 is a schematic diagram of a non-player character collecting minerals according to an embodiment of the present invention;

[0033] Figure 5 is a structural block diagram of a device for generating a non-player character according to an embodiment of the present invention;

[0034] Figure 6 It is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this application. It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0037] Example 1

[0038] The method embodiment provided in the first embodiment of the present application can be executed in a server, a computer or similar electronic device. Taking running on a computer as an example, Figure 1 This is a hardware structure diagram of a non-player character generation embodiment of the present invention. Figure 1 As shown, the computer 10 may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data. Optionally, the above computer may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. For example, the computer 10 may also include Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0039] Memory 104 can be used to store computer programs, such as application software programs and modules, such as the computer program corresponding to a method for generating a non-player character in an embodiment of the present invention. Processor 102 executes the computer program stored in memory 104 to execute various functional applications and data processing, thereby implementing the aforementioned method. Memory 104 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some embodiments, memory 104 may further include memory remotely located from processor 102, which can be connected to computer 10 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. In this embodiment, processor 104 is configured to respond to human-computer interaction instructions and game strategies, controlling the target virtual character to perform designated operations to complete game tasks. Memory 104 is configured to store electronic game program scripts, configuration information, and virtual character attribute information.

[0040] Transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of computer 10. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0041] Optionally, the input and output device 108 further includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface;

[0042] In this embodiment, a method for generating a non-player character is provided. Figure 2 is a flow chart of a method for generating a non-player character according to an embodiment of the present invention, such as Figure 2 As shown, the process includes the following steps:

[0043] Step S202: configuring a universal non-player character template, wherein the universal non-player character template contains basic logic for all non-player character types and encapsulates logic codes for multiple universal services;

[0044] The universal non-player character template of this embodiment is a component common to all non-player character types, encapsulating the logic code of the basic logic required for all types of non-player characters, such as the non-player character's form, size, attack and defense attributes and other fields.

[0045] Step S204: searching a preset component library for several target business components that match the business requirement information, wherein the preset component library includes multiple business components, each business component corresponds to a type of non-player character, and each business component encapsulates a logic code corresponding to a business;

[0046] The service components of this embodiment correspond to personalized services for non-player characters. Different types of non-player characters have different personalized services, and their target service components and logic code data structures are also different. Some complex non-player characters may belong to multiple types of non-player characters at the same time. After finding the target service component, the component parameters of the target service component can be configured according to the service requirement information, such as the amount of collection resources corresponding to the collection component and the playback animation of the AI ​​component. Separately encapsulated service components can be maintained independently, which can minimize the number of bugs and increase the stability of the game.

[0047] Step S206 , attaching the target business component to the universal non-player character template to generate a target non-player character;

[0048] Because the target business component and the universal non-player character template are pre-configured and encapsulated code, or only require simple parameter configuration, a variety of non-player characters can be generated by mounting the target business component and the universal non-player character template without coding complex and tedious code. Target non-player characters are a type of game element in the game scene.

[0049] Through the above steps, a universal non-player character template is configured, and then several target business components that match the business requirement information are searched in the preset component library. The target business components are mounted to the universal non-player character template to generate a target non-player character. By mounting the universal non-player character template and the target business components, a non-player character with personalized functions can be generated based on the basic logic of the universal non-player character, reducing the amount of code editing for repeated functions and achieving flexible configuration and expansion of multiple functions. This solves the technical problem of low efficiency in developing game non-player characters in related technologies, increases the flexibility of non-player character function configuration, reduces the configuration cost of non-player characters, improves the development efficiency of non-player characters, and shortens the development cycle of non-player characters.

[0050] In this embodiment, all game elements in the game scene that can be interacted with by the player characters or have autonomous behaviors are collectively referred to as non-player characters. Figure 3This is a diagram of the data organization of non-player characters in an embodiment of the present invention. Non-player characters can be divided into two major parts according to their functions: universal templates (corresponding to universal non-player character templates) and non-player character components (business components). The universal template is responsible for processing the basic logic required by non-player characters, such as the configuration of model resources, interface display content, general combat logic, and basic attributes. Then, according to different business needs, different non-player character components are mounted on each non-player character universal template to form non-player characters with various different functions, such as monsters, minerals, treasure chests, and quest non-player characters.

[0051] In one implementation of this embodiment, configuring a universal non-player character template includes: configuring a model resource code for the universal non-player character template, configuring an interface display code for the universal non-player character template, configuring a combat behavior code for the universal non-player character template, and configuring an attack and defense attribute code for the universal non-player character template. The model resource code is used to represent the visual size information of the target non-player character in the game scene, the interface display code is used to represent the display content and display path of the target non-player character in the game scene, the combat behavior code is used to represent the faction information and skill gain information of the target non-player character in the game scene, and the attack and defense attribute code is used to represent the combat capability of the target non-player character in the game scene. The model resource code, interface display code, combat behavior code, and attack and defense attribute code are combined into a universal non-player character template. During the configuration process, by configuring the content or parameter values ​​of each code field in the universal non-player character template, the attribute values ​​of each universal attribute in the universal non-player character template, such as the specific size, form, and attack capability of the non-player character, can be configured.

[0052] In this embodiment, the model resource code, interface display code, combat behavior code, and attack and defense attribute code are the basic units of the universal non-player character template. Each basic unit is composed of several fields to form a complete logic code, as shown in Table 1. In one example, the fields of the universal non-player character template include:

[0053] Table 1

[0054]

[0055] The fields in the general template implement all the basic logic for non-player characters in the game scene, as well as corresponding common functions that every non-player character possesses, such as character refresh and destruction, display of model resources and the non-player character interface, and calculation of combat statistics. The general non-player character template supports the configuration of multiple different business components to combine various non-player character functions and generate non-player characters with specific functions.

[0056] In one implementation of this embodiment, searching for several target business components matching the business requirement information in the preset component library includes:

[0057] S11, determining a non-player role type that matches the business requirement information;

[0058] The non-player character type in this embodiment is the role type of the non-player character in the game, such as whether the non-player character can move, whether it can interact, the activity area of ​​the non-player character, etc.

[0059] S12, searching the preset component library for at least one of the following target business components that matches the non-player character type: acquisition component, attribution component, building component, pet capture component, pickup component, treasure chest component, artificial intelligence AI component, vehicle component, trigger component, switch component, blocking component, relic component, livestock component, puzzle component, interaction component, non-player character service component.

[0060] Each different non-player character component has a different data structure according to its different functions. It is associated with the non-player character universal template through the component type and component ID (configuration parameters of the business component). Multiple different business components can be configured on each universal non-player character template.

[0061] In one example, there are 16 business components in the preset component library, as shown in Table 2:

[0062] Table 2

[0063]

[0064] In some implementations, for non-player character (NPC) business components that cover a wide range of areas but have similar logic, such as NPC service components, they can be split into multiple independent service configuration items based on their corresponding specific functions. These specific functions are assigned to the NPC service components using a "service type + service parameter ID" format. Different services have different data structures. NPC services include: accepting quests, submitting quests, conversations (including surveys), chat bubbles, intra-game teleportation, one-way teleportation, tangents, and the game mall.

[0065] This embodiment can also open up the target non-player character synthesis permission to players through user interaction instructions, thereby increasing players' sense of participation in the game. Preferably, the server searches for player accounts whose player-controlled character attributes meet specific requirements, and then unlocks the non-player character synthesis permission for the player account. Players who meet specific requirements, such as the player-controlled character level being greater than or equal to a first threshold, or the player-controlled character's skills reaching a second threshold, can have the non-player character synthesis permission. Through interactive instructions, users select a general non-player character template and several target business components to generate a target non-player character in the game scene, and then the user's self-synthesized non-player character appears in a specific copy or a specific level. The player's non-player character synthesis page includes a list of non-player character components available to the player, as well as a selection button and a synthesis button for selecting and synthesizing the desired target non-player character components. For example, the non-player character component list includes eight non-player character components. The user selects or sets the desired number of component functions, for example, five, using the selection button. The user triggers the synthesis button through an interactive instruction. The synthesis button, based on the set number of component functions, five, cycles through the eight non-player character components to be selected and selects five required non-player character components (target business components) according to a polling strategy, each of which serves as a business function for the final synthesized target non-player character. The polling strategy is related to the user's account level or skill value, the skill positioning of the player-controlled character, and the character form of the player-controlled character. In one example, a polling signal is issued at a polling rate related to the player's level or skill value, and each non-player character component is selected, resulting in the final selected target business component. Alternatively, five polling signals are issued at a polling rate related to the player's level or skill value, and the required target business components are selected at a time. In other examples, based on the skill positioning of the player-controlled character (e.g., attack, defense, support, etc.), several business components that best match the skill positioning are selected from the non-player character component list. Based on the character form of the player-controlled character (e.g., soft and cute girl, lone ranger, etc.), several business components that best match the character form are selected from the non-player character component list. However, the polling strategy of this embodiment is not limited to the above strategies. This embodiment also incorporates a certain degree of randomness in the determination of target business components during the non-player character synthesis process, increasing the playability and freshness of the game.

[0066] In one implementation of this embodiment, mounting a target business component to a universal non-player character template to generate a target non-player character includes: locating a specified directory file in a root directory of a script file of the universal non-player character template; and mounting the universal non-player character template and the target business component using the specified directory file as a mount point to generate the target non-player character.

[0067] Optionally, the target business component can be mounted through a container, and a container creation instruction input by a user is received, the container creation instruction carrying the identification information of the universal non-player character template and the image corresponding to the target business component; according to the identification information of the universal non-player character template, a container creation instruction is sent to the universal non-player character template, the container creation instruction carrying the image corresponding to the target business component and the container folder mount parameters, the container folder mount parameters including the container's identity code (i.e. the identifier of the target non-player character generated last), so that the universal non-player character template creates a Docker container according to the image corresponding to the target business component, and creates a folder corresponding to the container root directory at the mount point according to the container folder mount parameters, and creates a universal non-player character on the universal non-player character template. The root directory of the universal non-player character template and the corresponding target address are used to mount the folder corresponding to the container root directory to the target address corresponding to the root directory of the universal non-player character template, wherein the corresponding target address includes the identity identification code of the Docker container; a container startup instruction is sent to the universal non-player character template to enable the Docker container of the universal non-player character template to write the target business component into the folder corresponding to the container root directory, wherein there is a folder in the target address corresponding to the root directory of the universal non-player character template, and there is a target business component in the folder; according to the container identity identification code in the target address corresponding to the root directory of the universal non-player character template, the folder corresponding to the container root directory of the Docker container is read from the target address to execute the logic code corresponding to the target business component.

[0068] In one application scenario, an ore that can collect mineral resources is created in a game and is set as a non-player character in the game scene. The target non-player character is the ore non-player character. The target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring the collection parameters of the collection component, wherein the collection parameters are used to represent the amount of virtual resources obtained by the ore non-player character when collecting ore in the game scene; mounting the collection component to the universal non-player character template to generate the ore non-player character.

[0069] When configuring a non-player character that can collect minerals, such as a copper mine, you will first configure the collection component to collect 3 to 4 pieces of copper ore (this can be customized in the collection parameters), and then configure the collection component to the universal template configured with the copper mine model. Figure 4 This is a schematic diagram of a non-player character collecting minerals according to an embodiment of the present invention. By collecting copper ore, the player obtains 4 or 2 virtual resources.

[0070] In one application scenario, an animal that can move and collect resources is created in a game and set as a non-player character in the game scene. The target non-player character is the animal non-player character. The target business component is mounted to a universal non-player character template to generate the target non-player character, including: configuring the collection parameters of the collection component and configuring the action parameters of the AI ​​component, wherein the collection parameters are used to represent the amount of virtual resources obtained by collecting the animal non-player character in the game scene, and the action parameters are used to represent the playback animation of the animal non-player character in the game scene; the collection component and the AI ​​component are mounted to the universal non-player character template to generate the animal non-player character.

[0071] If the animal is a woolly sheep, a woolly sheep non-player character that can obtain wool, considering that sheep have their own behaviors, the woolly sheep will be configured with an AI component to enable it to move, be in a daze, and other actions. Then, the non-player character will be configured with a collection component that can obtain 3 to 4 wools (which can be customized in the collection parameters), thus realizing a "mineral" with autonomous behavior, which is displayed as an animal non-player character in the game scene.

[0072] In one application scenario, a poultry animal that can move and collect resources is created in a game and set as a non-player character in the game scene. The target non-player character is a livestock non-player character. The target business component is mounted to a universal non-player character template to generate the target non-player character, including: configuring the collection parameters of the collection component, configuring the action parameters of the AI ​​component, and configuring the livestock parameters of the livestock component. The collection parameters are used to characterize the amount of virtual resources obtained by collecting the livestock non-player character in the game scene, the action parameters are used to characterize the playback animation of the livestock non-player character in the game scene, and the livestock parameters are used to characterize the breeding area of ​​the livestock non-player character in the game scene; the collection component, the AI ​​component, and the livestock component are mounted to the universal non-player character template to generate the livestock non-player character.

[0073] If the animal is a woolly sheep, a woolly sheep non-player character that can obtain wool, considering that sheep have their own behaviors, the woolly sheep will be equipped with an AI component to enable it to move, be in a daze, and so on. Then, the non-player character will be equipped with a gathering component that can obtain 3 to 4 wools (which can be customized in the gathering parameters). On the basis of the above non-player character, if the livestock component is added to the woolly sheep non-player character, it will become a woolly sheep that can be raised in the home (which can be customized in the livestock parameters).

[0074] In an application scenario of this embodiment, after the target business component is mounted to the universal non-player character template to generate the target non-player character, the method further includes: after the target non-player character is triggered in the game scene, determining whether the health value of the target non-player character is lower than a first preset value, and / or determining whether the distance between a player-controlled character (PPC) and the target non-player character is lower than a second preset value; if the health value of the target non-player character is lower than the first preset value, and / or the distance between the player-controlled character and the target non-player character is lower than the second preset value, generating attached resources for the target non-player character, and allocating the attached resources to the game account of the player-controlled character.

[0075] In an application scenario of this embodiment, after the target business component is mounted to the universal non-player character template to generate the target non-player character, the process further includes: after the target non-player character is triggered in the game scene, detecting the switch state of the switch component of the target non-player character, wherein the switch component is used to control the start and stop states of the controlled components, and the controlled components include at least one of the following: an acquisition component, a non-player character service component, and a blocking component, and the target business component includes a switch component and a controlled component; if the switch state of the switch component is on, running the logic code of the controlled component; if the switch state of the switch component is off, prohibiting the running of the logic code of the controlled component.

[0076] This embodiment uses business components to control the start and stop status of other business components, and directly prohibits the operation of some business components in the shutdown state. For non-player characters with large size and complex logic, the number of calls to the main logic can be reduced, the host resources consumed by running non-player characters can be reduced, and the smoothness of game operation can be improved.

[0077] By adopting the solution of this embodiment, the basic logic of all interactive objects appearing in the game can be unified, duplication of development can be avoided and maintenance costs can be reduced, the flexibility of non-player character function configuration can be increased, and richer non-player character behaviors can be achieved at a lower cost, thereby improving the development efficiency of non-player characters.

[0078] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0079] Example 2

[0080] This embodiment also provides a device for generating a non-player character, which is used to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0081] Figure 5 is a structural block diagram of a device for generating a non-player character according to an embodiment of the present invention, such as Figure 5 As shown, the device includes: a configuration module 50, a search module 52, and a mounting module 54, wherein:

[0082] A configuration module 50 is configured to configure a universal non-player character template, wherein the universal non-player character template contains basic logic for all non-player character types and encapsulates logic codes for multiple universal services;

[0083] A search module 52 is configured to search a preset component library for a plurality of target business components that match the business requirement information, wherein the preset component library includes a plurality of business components, each business component corresponding to a type of non-player character, and each business component encapsulates a logic code corresponding to a business;

[0084] The mounting module 54 is configured to mount the target business component to the universal non-player character template to generate a target non-player character.

[0085] Optionally, the configuration module includes: a configuration unit, configured to configure the model resource code of the universal non-player character template, configure the interface display code of the universal non-player character template, configure the combat behavior code of the universal non-player character template, and configure the attack and defense attribute code of the universal non-player character template, wherein the model resource code is used to represent the visual size information of the target non-player character in the game scene, the interface display code is used to represent the display content and display path of the target non-player character in the game scene, the combat behavior code is used to represent the camp information and skill gain information of the target non-player character in the game scene, and the attack and defense attribute code is used to represent the combat ability of the target non-player character in the game scene; and a combination unit, used to combine the model resource code, the interface display code, the combat behavior code, and the attack and defense attribute code into the universal non-player character template.

[0086] Optionally, the search module includes: a determination unit for determining a non-player character type that matches the business demand information; a search unit for searching a preset component library for at least one of the following target business components that matches the non-player character type: acquisition component, attribution component, building component, pet capture component, pickup component, treasure chest component, artificial intelligence AI component, vehicle component, trigger component, switch component, blocking component, relic component, livestock component, puzzle component, interaction component, and non-player character service component.

[0087] Optionally, the mounting module includes: a positioning unit, used to locate a specified directory file under the root directory in the script file of the universal non-player character template; and a mounting unit, used to mount the universal non-player character template and the target business component using the specified directory file as a mounting point to generate a target non-player character.

[0088] Optionally, if the target non-player character is an ore non-player character, the mounting module includes: a first configuration unit, used to configure the collection parameters of the collection component, wherein the collection parameters are used to represent the amount of virtual resources obtained by collecting the ore non-player character in the game scene; a first mounting unit, used to mount the collection component to the universal non-player character template to generate an ore non-player character.

[0089] Optionally, if the target non-player character is an animal non-player character, the mounting module includes: a second configuration unit, used to configure the acquisition parameters of the acquisition component, and configure the action parameters of the AI ​​component, wherein the acquisition parameters are used to characterize the amount of virtual resources obtained by collecting the animal non-player character in the game scene, and the action parameters are used to characterize the playback animation of the animal non-player character in the game scene; a second mounting unit, used to mount the acquisition component and the AI ​​component to the universal non-player character template to generate an animal non-player character.

[0090] Optionally, if the target non-player character is a livestock non-player character, the mounting module includes: a third configuration unit, configured to configure the acquisition parameters of the acquisition component, configure the action parameters of the AI ​​component, and configure the livestock parameters of the livestock component, wherein the acquisition parameters are used to characterize the amount of virtual resources obtained by collecting the livestock non-player character in the game scene, the action parameters are used to characterize the playback animation of the livestock non-player character in the game scene, and the livestock parameters are used to characterize the breeding area of ​​the livestock non-player character in the game scene; a third mounting unit, configured to mount the acquisition component, the AI ​​component and the livestock component to the universal non-player character template to generate a livestock non-player character.

[0091] Optionally, the device further includes: a judgment module for, after the mounting module mounts the target business component to the universal non-player character template to generate a target non-player character, and after triggering the target non-player character in the game scene, judging whether the health value of the target non-player character is lower than a first preset value, and / or judging whether the distance between the player-controlled character and the target non-player character is less than a second preset value; an allocation module for, if the health value of the target non-player character is lower than the first preset value, and / or the distance between the player-controlled character and the target non-player character is less than the second preset value, generating ancillary resources for the target non-player character and allocating the ancillary resources to the game account of the player-controlled character.

[0092] Optionally, the device further includes: a detection module, configured to, after the mounting module mounts the target business component to the universal non-player character template to generate a target non-player character, and after the target non-player character is triggered in a game scene, detect the switch state of the switch component of the target non-player character, wherein the switch component is used to control the start and stop states of the controlled component, and the controlled component includes at least one of the following: an acquisition component, a non-player character service component, and a blocking component, and the target business component includes the switch component and the controlled component; a control module, configured to run the logic code of the controlled component if the switch state of the switch component is on; and prohibit the running of the logic code of the controlled component if the switch state of the switch component is off.

[0093] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0094] Example 3

[0095] The embodiment of the present application also provides an electronic device, Figure 6 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 6 As shown, it includes a processor 61, a communication interface 62, a memory 63 and a communication bus 64, wherein the processor 61, the communication interface 62, and the memory 63 communicate with each other through the communication bus 64, and the memory 63 is used to store computer programs;

[0096] The processor 61 is configured to implement the following steps when executing the program stored in the memory 63: configuring a universal non-player character template, wherein the universal non-player character template includes basic logic for all non-player character types and encapsulates logic code for multiple universal services; searching a preset component library for a plurality of target business components that match the business requirement information, wherein the preset component library includes a plurality of business components, each business component corresponding to a type of non-player character, and each business component encapsulates logic code for a corresponding service; and mounting the target business component to the universal non-player character template to generate a target non-player character.

[0097] Optionally, configuring a universal non-player character template includes: configuring a model resource code of the universal non-player character template, configuring an interface display code of the universal non-player character template, configuring a combat behavior code of the universal non-player character template, and configuring an attack and defense attribute code of the universal non-player character template, wherein the model resource code is used to represent the visual size information of the target non-player character in the game scene, the interface display code is used to represent the display content and display path of the target non-player character in the game scene, the combat behavior code is used to represent the camp information and skill gain information of the target non-player character in the game scene, and the attack and defense attribute code is used to represent the combat capability of the target non-player character in the game scene; and the model resource code, the interface display code, the combat behavior code, and the attack and defense attribute code are combined into the universal non-player character template.

[0098] Optionally, searching for several target business components that match the business requirement information in the preset component library includes: determining the non-player character type that matches the business requirement information; searching for at least one of the following target business components that matches the non-player character type in the preset component library: collection component, belonging component, building component, pet capture component, picking component, treasure chest component, artificial intelligence AI component, vehicle component, trigger component, switch component, blocking component, relic component, livestock component, puzzle component, interaction component, and non-player character service component.

[0099] Optionally, mounting the target business component to the universal non-player character template to generate a target non-player character includes: locating a specified directory file under the root directory in the script file of the universal non-player character template; and mounting the universal non-player character template and the target business component using the specified directory file as a mount point to generate the target non-player character.

[0100] Optionally, if the target non-player character is an ore non-player character, the target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring acquisition parameters of the acquisition component, wherein the acquisition parameters are used to characterize the amount of virtual resources obtained by collecting the ore non-player character in the game scene; and mounting the acquisition component to the universal non-player character template to generate the ore non-player character.

[0101] Optionally, if the target non-player character is an animal non-player character, the target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring acquisition parameters of the acquisition component, and configuring action parameters of the AI ​​component, wherein the acquisition parameters are used to represent the amount of virtual resources acquired by acquiring the animal non-player character in the game scene, and the action parameters are used to represent the playback animation of the animal non-player character in the game scene;

[0102] The acquisition component and the AI ​​component are mounted to the universal non-player character template to generate an animal non-player character.

[0103] Optionally, if the target non-player character is a livestock non-player character, the target business component is mounted to the universal non-player character template to generate the target non-player character, including: configuring the collection parameters of the collection component, configuring the action parameters of the AI ​​component, and configuring the livestock parameters of the livestock component, wherein the collection parameters are used to characterize the amount of virtual resources obtained by collecting the livestock non-player character in the game scene, the action parameters are used to characterize the playback animation of the livestock non-player character in the game scene, and the livestock parameters are used to characterize the breeding area of ​​the livestock non-player character in the game scene; the collection component, the AI ​​component and the livestock component are mounted to the universal non-player character template to generate the livestock non-player character.

[0104] Optionally, after mounting the target business component to the universal non-player character template to generate a target non-player character, the method further includes: after triggering the target non-player character in the game scene, determining whether the health value of the target non-player character is lower than a first preset value, and / or determining whether the distance between the player-controlled character and the target non-player character is less than a second preset value; if the health value of the target non-player character is lower than the first preset value, and / or the distance between the player-controlled character and the target non-player character is less than the second preset value, generating ancillary resources for the target non-player character, and allocating the ancillary resources to the game account of the player-controlled character.

[0105] Optionally, after mounting the target business component to the universal non-player character template to generate a target non-player character, the method further includes: after triggering the target non-player character in the game scene, detecting the switch state of the switch component of the target non-player character, wherein the switch component is used to control the start and stop state of the controlled component, and the controlled component includes at least one of the following: an acquisition component, a non-player character service component, and a blocking component, and the target business component includes the switch component and the controlled component; if the switch state of the switch component is on, running the logic code of the controlled component; if the switch state of the switch component is off, prohibiting the running of the logic code of the controlled component.

[0106] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0107] The communication interface is used for communication between the above terminal and other devices.

[0108] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0109] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0110] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the risk level data processing method described in any of the above embodiments.

[0111] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the risk level data processing method described in any one of the above embodiments.

[0112] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0113] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0114] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0115] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0116] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0117] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0118] If the integrated unit is implemented in the form of 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, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0119] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating a non-player character, characterized in that: include: Configuring a universal non-player character template, wherein the universal non-player character template contains basic logic of all non-player character types, and the universal non-player character template encapsulates logic codes of multiple universal services; Searching for a plurality of target business components matching the business requirement information in a preset component library, wherein the preset component library includes a plurality of business components, each business component corresponds to a type of non-player character, and each business component encapsulates a logic code corresponding to a business; Mounting the target business component to the universal non-player character template to generate a target non-player character; Mounting the target business component to the universal non-player character template to generate a target non-player character includes: locating a designated directory file under a root directory in a script file of the universal non-player character template; and mounting the universal non-player character template and the target business component using the designated directory file as a mount point to generate a target non-player character.

2. The method according to claim 1, characterized in that Configuring the generic NPC template includes: configuring a model resource code of the universal non-player character template, configuring an interface display code of the universal non-player character template, configuring a combat behavior code of the universal non-player character template, and configuring an attack and defense attribute code of the universal non-player character template, wherein the model resource code is used to characterize the visual size information of the target non-player character in the game scene, the interface display code is used to characterize the display content and display path of the target non-player character in the game scene, the combat behavior code is used to characterize the camp information and skill gain information of the target non-player character in the game scene, and the attack and defense attribute code is used to characterize the combat capability of the target non-player character in the game scene; The model resource code, the interface display code, the combat behavior code, and the attack and defense attribute code are combined into the universal non-player character template.

3. The method according to claim 1, characterized in that The target business components that match the business requirement information are searched in the preset component library, including: Determining a non-player role type that matches the business requirement information; Search the preset component library for at least one of the following target business components that matches the non-player character type: acquisition component, belonging component, building component, pet capture component, pickup component, treasure chest component, artificial intelligence AI component, vehicle component, trigger component, switch component, blocking component, relic component, livestock component, puzzle component, interaction component, non-player character service component.

4. The method according to claim 1, characterized in that: If the target non-player character is an ore non-player character, mounting the target business component to the universal non-player character template to generate the target non-player character includes: Configuring acquisition parameters of the acquisition component, wherein the acquisition parameters are used to represent the amount of virtual resources acquired by the non-player character by collecting the ore in the game scene; The gathering component is mounted to the universal non-player character template to generate an ore non-player character.

5. The method according to claim 1, characterized in that If the target non-player character is an animal non-player character, mounting the target business component to the universal non-player character template to generate the target non-player character includes: Configuring acquisition parameters of the acquisition component and configuring action parameters of the AI ​​component, wherein the acquisition parameters are used to characterize the amount of virtual resources acquired by acquiring the animal non-player character in the game scene, and the action parameters are used to characterize the playback animation of the animal non-player character in the game scene; The acquisition component and the AI ​​component are mounted to the universal non-player character template to generate an animal non-player character.

6. The method according to claim 1, characterized in that If the target non-player character is a livestock non-player character, mounting the target business component to the universal non-player character template to generate the target non-player character includes: Configure the collection parameters of the collection component, configure the action parameters of the AI ​​component, and configure the livestock parameters of the livestock component, wherein the collection parameters are used to characterize the amount of virtual resources acquired by collecting the livestock non-player characters in the game scene, the action parameters are used to characterize the playback animation of the livestock non-player characters in the game scene, and the livestock parameters are used to characterize the breeding area of ​​the livestock non-player characters in the game scene; The collection component, the AI ​​component and the livestock component are mounted to the universal non-player character template to generate a livestock non-player character.

7. The method according to claim 1, characterized in that After mounting the target business component to the universal non-player character template to generate a target non-player character, the method further includes: After the target non-player character is triggered in the game scene, determining whether the health value of the target non-player character is lower than a first preset value, and / or determining whether the distance between the player-controlled character and the target non-player character is less than a second preset value; If the health value of the target non-player character is lower than a first preset value, and / or the distance between the player-controlled character and the target non-player character is less than a second preset value, ancillary resources of the target non-player character are generated and the ancillary resources are allocated to the game account of the player-controlled character.

8. The method according to claim 1, characterized in that: After mounting the target business component to the universal non-player character template to generate a target non-player character, the method further includes: After the target non-player character is triggered in the game scene, the switch state of the switch component of the target non-player character is detected, wherein the switch component is used to control the start and stop state of the controlled component, the controlled component includes at least one of the following: a collection component, a non-player character service component, and a blocking component, and the target service component includes the switch component and the controlled component; If the switch state of the switch component is an on state, the logic code of the controlled component is run; if the switch state of the switch component is an off state, the running of the logic code of the controlled component is prohibited.

9. A device for generating a non-player character, characterized in that: include: A configuration module, configured to configure a universal non-player character template, wherein the universal non-player character template contains basic logic of all non-player character types, and the universal non-player character template encapsulates logic codes of multiple universal services; A search module, used to search for a plurality of target business components matching the business requirement information in a preset component library, wherein the preset component library includes a plurality of business components, each business component corresponds to a type of non-player character, and each business component encapsulates a logic code corresponding to a business; A mounting module, used for mounting the target business component to the universal non-player character template to generate a target non-player character; The mounting module includes: a positioning unit, used to locate a designated directory file under a root directory in the script file of the universal non-player character template; and a mounting unit, used to mount the universal non-player character template and the target business component with the designated directory file as a mounting point to generate a target non-player character.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 8 when executed.

11. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 8.