Skill realization method and system

文档序号:576957 发布日期:2021-05-25 浏览:36次 中文

阅读说明:本技术 一种技能实现的方法和系统 (Skill realization method and system ) 是由 周涛 于 2021-01-29 设计创作,主要内容包括:本申请涉及一种技能实现的方法和系统,其中,该技能实现方法包括:获取游戏对象的资源信息,基于资源信息对游戏对象创建分发器,其中,资源信息包括:第一技能、第二技能和触发事件;通过分发器在触发事件中注册第一技能的回调函数,在具备触发条件的情况下,将触发事件分发出去;在第二技能的接收端接收到触发事件的情况下,虚拟角色执行第二技能对应的指令;分发器调用回调函数并根据回调函数确定第一技能的触发效果。通过本申请,解决了相关技术中游戏实现过程过于复杂的问题,实现了将技能相关代码与触发事件代码解耦,简化了技能实现的过程。(The application relates to a skill implementation method and a system, wherein the skill implementation method comprises the following steps: acquiring resource information of a game object, and creating a distributor for the game object based on the resource information, wherein the resource information comprises: a first skill, a second skill, and a triggering event; registering a callback function of a first skill in a trigger event through a distributor, and distributing the trigger event under the condition of having a trigger condition; under the condition that a receiving end of the second skill receives a trigger event, the virtual character executes an instruction corresponding to the second skill; and the distributor calls a callback function and determines the trigger effect of the first skill according to the callback function. Through the method and the device, the problem that the game implementation process is too complex in the related technology is solved, the decoupling of the skill related codes and the trigger event codes is realized, and the skill implementation process is simplified.)

1. A method of skill realization, the method comprising:

acquiring resource information of a game object, and creating a distributor for the game object based on the resource information, wherein the resource information comprises: a first skill, a second skill, and a triggering event;

registering the callback function of the first skill in the trigger event through the distributor, and distributing the trigger event under the condition of having a trigger condition;

under the condition that the receiving end of the second skill receives the trigger event, the virtual character executes an instruction corresponding to the second skill;

and the distributor calls the callback function and determines the trigger effect of the first skill according to the callback function.

2. The method of claim 1, wherein after creating a dispatcher for the resource information and before registering, by the dispatcher, the callback function of the first skill in the trigger event, the method further comprises:

judging whether the first skill and the trigger event have associated information or not;

the dispatcher registers the callback function of the first skill in the trigger event if the associated information exists;

in the absence of the association information, the dispatcher does not register the callback function of the first skill in the trigger event.

3. The method of claim 2, wherein after instructing the virtual character to perform the instruction corresponding to the second skill, the method further comprises:

the distributor searches callback functions of the first skill;

and under the condition that the callback function of the first skill is not found, the client does not send an instruction for executing the first skill to the virtual role.

4. The method of claim 1, wherein the dispatcher invoking the callback function and determining the triggering effect of the first skill from the callback function comprises:

under the condition that the callback function comprises trigger information of the first skill, instructing the virtual role to execute an instruction corresponding to the first skill;

in a case where the callback function does not include trigger information of the first skill, the first skill is not triggered.

5. The method of claim 1, wherein after creating the distributor for the resource information, the method further comprises:

after the distributor registers the calling object in the trigger event, the distributor distributes the trigger event under the condition of having a trigger condition;

and after the receiving end of the second skill receives the trigger event and releases the trigger event, the distributor calls the calling object.

6. The method of claim 5, wherein after determining the triggering effect of the first skill according to the callback function, the method further comprises:

and receiving a configuration requirement through a configuration interface, and instructing the distributor to cancel the registration of the callback function and the call object of the trigger event according to the configuration requirement.

7. A skill achievement system, the system comprising: the method comprises the steps of obtaining a creating module, a distributing module and a receiving module;

the acquisition and creation module is used for acquiring resource information of a game object and creating a distributor for the game object based on the resource information, wherein the resource information comprises: a first skill, a second skill, and a triggering event;

the distribution module is configured to register, by the distributor, the callback function of the first skill in the trigger event, and distribute the trigger event when a trigger condition is met, or,

the dispatcher is used for calling the callback function and determining the trigger effect of the first skill according to the callback function;

the receiving module is used for indicating the virtual character to execute the instruction corresponding to the second skill when the receiving end of the second skill receives the trigger event.

8. The system of claim 7, wherein the acquisition creation module is further configured to determine whether there is associated information between the first skill and the trigger event after the creation of the dispatcher for the resource information and before the registration of the callback function of the first skill in the trigger event by the dispatcher; the dispatcher registers the callback function of the first skill in the trigger event if the associated information exists; in the absence of the association information, the dispatcher does not register the callback function of the first skill in the trigger event.

9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements a skill-implementing method as claimed in any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a skill achieving method as claimed in any one of claims 1 to 6.

Technical Field

The application relates to the technical field of game development and design, in particular to a skill realization method and system.

Background

The skill is a common game mechanism in role playing games and multiplayer online tactical sports games, and different games are configured with different skill implementation methods based on the game mechanism of the game.

In the related art, the mechanism for skill implementation is generally simpler, and a hard-coded method is generally adopted to implement skill implementation triggering, but in the process, the code triggering the skill event and the code related to the skill are closely coupled, so that the two are more in relation, the calling is not convenient, and in addition, the process for skill implementation is too complex.

At present, no effective solution is provided for the problem that the process of realizing skills in the related art is too complex.

Disclosure of Invention

The embodiment of the application provides a skill implementation method, a skill implementation device, a skill implementation system, a computer device and a computer readable storage medium, so as to at least solve the problem that the skill implementation process in the related art is too complex.

In a first aspect, an embodiment of the present application provides a skill implementation method, where the method includes:

acquiring resource information of a game object, and creating a distributor for the game object based on the resource information, wherein the resource information comprises: a first skill, a second skill, and a triggering event;

registering the callback function of the first skill in the trigger event through the distributor, and distributing the trigger event under the condition of having a trigger condition;

under the condition that the receiving end of the second skill receives the trigger event, the virtual character executes an instruction corresponding to the second skill;

and the distributor calls the callback function and determines the trigger effect of the first skill according to the callback function.

In some embodiments, after creating a dispatcher for the resource information and before registering, by the dispatcher, the callback function of the first skill in the triggering event, the method further comprises:

judging whether the first skill and the trigger event have associated information or not;

the dispatcher registers the callback function of the first skill in the trigger event if the associated information exists;

in the absence of the association information, the dispatcher does not register the callback function of the first skill in the trigger event.

In some embodiments, after the instructing the virtual character to execute the instruction corresponding to the second skill, the method further includes:

the distributor searches callback functions of the first skill;

and under the condition that the callback function of the first skill is not found, the client does not send an instruction for executing the first skill to the virtual role.

In some of these embodiments, the dispatcher invoking the callback function and determining the trigger effect of the first skill from the callback function comprises:

under the condition that the callback function comprises trigger information of the first skill, instructing the virtual role to execute an instruction corresponding to the first skill;

in a case where the callback function does not include trigger information of the first skill, the first skill is not triggered.

In some embodiments, after creating the distributor for the resource information, the method further comprises:

after the distributor registers the calling object in the trigger event, the distributor distributes the trigger event under the condition of having a trigger condition;

and after the receiving end of the second skill receives the trigger event and releases the trigger event, the distributor calls the calling object.

In some embodiments, after determining the triggering effect of the first skill according to the callback function, the method further comprises:

and receiving a configuration requirement through a configuration interface, and instructing the distributor to cancel the registration of the callback function and the call object of the trigger event according to the configuration requirement.

In a second aspect, an embodiment of the present application provides a skill implementation system, where the system includes: the method comprises the steps of obtaining a creating module, a distributing module and a receiving module;

the acquisition and creation module is used for acquiring resource information of a game object and creating a distributor for the game object based on the resource information, wherein the resource information comprises: a first skill, a second skill, and a triggering event;

the distribution module is configured to register, by the distributor, the callback function of the first skill in the trigger event, and distribute the trigger event when a trigger condition is met, or,

the dispatcher is used for calling the callback function and determining the trigger effect of the first skill according to the callback function;

the receiving module is used for indicating the virtual character to execute the instruction corresponding to the second skill when the receiving end of the second skill receives the trigger event.

In some embodiments, the acquisition creating module is further configured to determine whether there is associated information between the first skill and the trigger event after the creating of the dispatcher for the resource information and before the registering of the callback function of the first skill in the trigger event by the dispatcher; the dispatcher registers the callback function of the first skill in the trigger event if the associated information exists; in the absence of the association information, the dispatcher does not register the callback function of the first skill in the trigger event.

In a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, implements a skill implementation method as described in the first aspect.

In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements a skill achieving method as described in the first aspect above.

Compared with the related technology, the skill implementation method provided by the embodiment of the application decouples the skill related codes and the trigger event codes through event distribution; the method specifically comprises the following steps: after registering a callback function of the first skill in a trigger event through a distributor, distributing the trigger event; under the condition that a receiving end of the second skill receives a trigger event, indicating the virtual character to execute an instruction corresponding to the second skill; meanwhile, the distributor calls a callback function and determines the trigger effect of the first skill according to the callback function. The problems that the skill implementation process in the related technology is too complex and not easy to call are solved, the skill related codes and the trigger event codes are decoupled, and the skill implementation process is simplified.

Drawings

The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:

FIG. 1 is a schematic diagram of an application environment of a skill implementation method according to an embodiment of the present application;

FIG. 2 is a flow diagram of a skill achievement method according to an embodiment of the present application;

FIG. 3 is a block diagram of a skill implementation system according to an embodiment of the present application;

fig. 4 is an internal structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.

It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.

Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.

Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.

The skill implementation method provided by the present application may be applied to an application environment shown in fig. 1, where fig. 1 is a schematic application environment diagram of the skill implementation method according to an embodiment of the present application, as shown in fig. 1, a terminal 10 communicates with a server 11 through a network, the terminal 10 uploads data generated by a game client to the server 11, and meanwhile, the server 11 obtains data from other terminals 10; in addition, the terminal 10 has installed thereon an application for skill realization running the present embodiment. The user can interact with information, such as release of skills, release of Olympic and physical character movements, etc., of the virtual game character in the application through external devices on the terminal 10, such as a touch screen, physical keys, a keyboard and a mouse. By the aid of the technical implementation method, the technical code part and the trigger event code part in the technical implementation process can be decoupled, and therefore the technical implementation process is simplified. Further, the terminal 10 may be a smart phone, a tablet computer, a desktop computer, a notebook computer, and a smart wearable device. The server 11 may be an independent server or a server cluster composed of a plurality of servers.

The present application provides a skill implementation method, and fig. 2 is a flowchart of a skill implementation method according to an embodiment of the present application, and as shown in fig. 2, the flowchart includes the following steps:

step S201, obtaining resource information of the game object, and creating a distributor for the game object based on the resource information, wherein the resource information comprises: a first skill, a second skill, and a triggering event; the first skill and the second skill can be obtained by directly reading a local memory or by a network. The first skill and the second skill are a series of game events executed by the game system, and the game events can instruct the game character to trigger a specific effect in the game scene under the condition that a certain precondition is met, and the effect can be one or more combination of effects of displacement, control, gain and the like of the game character. Further, a trigger event may be one of the preconditions; it can be understood that, during the running process of the game program, when a receiving end of a certain skill receives a corresponding trigger event, the skill is triggered or released, and a specific effect is triggered. Further, when the specific effect is triggered, the skill is released;

step S202, after registering the callback function of the first skill in the trigger event through the distributor, distributing the trigger event; in this embodiment, the distributor is defined according to actual requirements, and the specific implementation steps thereof have no core influence on this embodiment, so that the details are not repeated; it should be noted that, before executing the step, it needs to be determined whether the first skill and the trigger event have associated information; further, under the condition that the associated information exists, the distributor registers a callback function of the first skill in a trigger event; under the condition that the associated information does not exist, the distributor does not register the callback function of the first skill in the trigger event;

step S203, under the condition that the receiving end of the second skill receives the trigger event, the virtual character is indicated to execute the instruction corresponding to the second skill; optionally, the first skill and the second skill both comprise separate code portions, wherein the receiving end is configured to receive information such as a triggering event; further, after receiving a trigger event that a second skill is released, the virtual character is instructed to execute an instruction included in the second skill, for example, the skill of the second skill is described as performing displacement of a preset distance in a virtual map or increasing the moving speed of the virtual character itself and performing a common attack of a reinforcement version, and correspondingly, the virtual character presents a corresponding action state in a game scene;

step S204, the distributor calls a callback function and determines the trigger effect of the first skill according to the callback function; it should be noted that, in step S201, a callback function for determining whether to register the first skill for the trigger event by searching the association information is described, and here, whether to trigger the first skill is determined by calling the callback function and according to the callback function. It can be appreciated that in the case where the callback function can be found, the first skill is triggered; when the callback function is not found, that is, the callback function of the first skill is not registered for the trigger event in step S201, the first skill is not triggered.

Through the above steps S201 to S204, compared with the method for implementing skills in the related art by means of hard coding, in this embodiment, the dispatcher registers a callback function in the trigger event of the first skill, in a game, under the condition that the trigger condition is met, the trigger event is dispatched by the dispatcher, the second skill is released after receiving the trigger event, and finally, the callback function determines the trigger effect of the first skill. The problem that skill codes and trigger event codes are mutually coupled in the related technology, so that the skill implementation process is too complex is solved. For example, in the related art, the triggering event of the first skill needs to trigger another skill, that is, a second skill, held by the player character, in this case, the first skill must first acquire the object of the player character, and then trigger the second skill through the player character, so that there is a coupling between the first skill, the second skill and the triggering event, which results in a complex skill implementation process. In this embodiment, the trigger event and the specific skill are decoupled by the distributor, and in the skill triggering process, the specific skill does not need to be known, and the trigger event is distributed by the distributor, and whether the trigger event is specifically triggered is determined according to the callback function registered to the first skill.

In one embodiment, after the distributor is created for the resource information, before the callback function of the first skill is registered in the trigger event through the distributor, whether the first skill and the trigger event have associated information is judged; under the condition that the associated information exists, the distributor registers a callback function of the first skill in a trigger event; in the absence of the associated information, the dispatcher does not register the callback function of the first skill in the trigger event.

In an embodiment, after the virtual character is instructed to execute the instruction corresponding to the second skill, whether the first skill is triggered may be determined according to whether the callback function of the first skill can be found. The dispatcher searches a callback function of the first skill; and under the condition that the callback function of the first skill is not found, the distributor does not send the information for triggering the first skill to the client.

In one embodiment, whether to trigger the first skill may also be determined according to the specific content of the callback function. The method for determining the triggering effect of the first skill by the distributor through calling the callback function comprises the following steps: under the condition that the callback function comprises trigger information of the first skill, the client instructs the virtual role to execute an instruction corresponding to the first skill; in the case where the trigger information of the first skill is not included in the callback function, the first skill is not triggered.

In one embodiment, after the distributor is created for the resource information, the distributor can also register a call object in the trigger event and distribute the trigger event; and after the receiving end of the second skill receives the trigger event and releases the trigger event, the distributor calls the calling object. Optionally, the client receives the configuration requirement through the configuration interface, and instructs the distributor to cancel registration of the callback function and the call object of the trigger event according to the configuration requirement.

It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.

The embodiment also provides a skill implementation system, which is used for implementing the above embodiments and preferred embodiments, and the description of the system is omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.

Fig. 3 is a block diagram of a skill implementation system according to an embodiment of the present application, and as shown in fig. 3, the system includes an acquisition creation module 31, a distribution module 32, and a reception module 33;

the obtaining and creating module 31 is configured to obtain resource information of the game object, and create a distributor for the game object based on the resource information, where the resource information includes: a first skill, a second skill, and a triggering event;

the distribution module 32 is configured to register, through the distributor, the callback function of the first skill in the trigger event, and distribute the trigger event if the trigger condition is met, or,

the system comprises a dispatcher, a callback function and a trigger effect determining module, wherein the dispatcher is used for calling the callback function and determining the trigger effect of the first skill according to the callback function;

the receiving module 33 is configured to instruct the virtual character to execute an instruction corresponding to the second skill when the receiving end of the second skill receives the trigger event.

In one embodiment, the obtaining and creating module 31 is further configured to determine whether there is associated information between the first skill and the trigger event after creating the distributor for the resource information and before registering the callback function of the first skill in the trigger event through the distributor; under the condition that the associated information exists, the distributor registers a callback function of the first skill in a trigger event; in the absence of the associated information, the dispatcher does not register the callback function of the first skill in the trigger event.

In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a skill achieving method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.

In one embodiment, fig. 4 is a schematic diagram of an internal structure of an electronic device according to an embodiment of the present application, and as shown in fig. 4, there is provided an electronic device, which may be a server, and its internal structure diagram may be as shown in fig. 4. The electronic device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the electronic device is used for storing data. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a skill achieving method.

Those skilled in the art will appreciate that the configuration shown in fig. 4 is a block diagram of only a portion of the configuration associated with the present application, and does not constitute a limitation on the electronic device to which the present application is applied, and a particular electronic device may include more or less components than those shown in the drawings, or combine certain components, or have a different arrangement of components.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

It should be understood by those skilled in the art that various features of the above embodiments can be combined arbitrarily, and for the sake of brevity, all possible combinations of the features in the above embodiments are not described, but should be considered as within the scope of the present disclosure as long as there is no contradiction between the combinations of the features.

The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:降低手机游戏首包的方法、装置及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类