CN111858092A - Method, device and system for communication between scripts - Google Patents

Method, device and system for communication between scripts Download PDF

Info

Publication number
CN111858092A
CN111858092A CN202010644087.1A CN202010644087A CN111858092A CN 111858092 A CN111858092 A CN 111858092A CN 202010644087 A CN202010644087 A CN 202010644087A CN 111858092 A CN111858092 A CN 111858092A
Authority
CN
China
Prior art keywords
node
script
module
nodes
bound
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010644087.1A
Other languages
Chinese (zh)
Inventor
李金彪
霍鸽
张龙江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Lexuebang Network Technology Co Ltd
Original Assignee
Beijing Lexuebang Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Lexuebang Network Technology Co Ltd filed Critical Beijing Lexuebang Network Technology Co Ltd
Priority to CN202010644087.1A priority Critical patent/CN111858092A/en
Publication of CN111858092A publication Critical patent/CN111858092A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/543User-generated data transfer, e.g. clipboards, dynamic data exchange [DDE], object linking and embedding [OLE]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application provides a method, a device and a system for communication among scripts, which are applied to data transmission or method calling among scripts bound by multiple nodes in game development, and the method comprises the following steps: acquiring state change information of a first node, wherein the state change information is used for representing that a script between the first node and at least one target node of the first node has a communication requirement; notifying the at least one target node of the state change information to cause a script bound with the at least one target node to be executed or to transmit data to the script bound with the at least one target node. According to some embodiments of the application, the communication method of the script between different nodes or modules on different nodes is improved by acquiring the change states of different nodes and informing the target node of the state change situation so that the target node executes the script and the like.

Description

Method, device and system for communication between scripts
Technical Field
The application relates to the field of game development, in particular to a method, a device and a system for communication among scripts.
Background
Cocos2d-x is a powerful open source game engine issued under the MIT license. And allowing developers to develop games by using three languages of C + +, Javascript and Lua. A variety of common platforms are supported, e.g., iOS, Android, Windows, macOS, Linux, or the like.
In the CocosCreator, where the script is also part of the resource, the developer can add and select JavaScript or TypeScript by clicking the "Create" button in the resource editor to create a copy of the component script. At this point a new script is obtained in the resource editor. The script is added into the scene node, actually, a component is added to the scene node, and as long as the newly created script is selected and added to the scene node, the script is bound with the node at the moment.
In the development based on the Cocos2d-x engine, scripts bound on nodes cannot be directly acquired, and data and calling method logic stored in the scripts cannot be directly acquired. Therefore, when there is a communication requirement between scripts or components of different nodes, two or more nodes to be communicated and script names bound on the two or more nodes need to be acquired first, and then the communication between the scripts is realized through direct access between the two or more nodes or modules on the two or more nodes needing to be communicated.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, and a system for inter-script communication, which may implement that a first node or a first module (alternatively referred to as a first script, a first component, etc.) located on the first node sends a communication request to a state change recording module (hereinafter referred to as an aggregation module) shared by multiple nodes or modules on multiple nodes, and the state change recording module notifies a target node or a second module (alternatively referred to as a second script, a second component, etc.) located on the target node of a completion request, so that link data volume of script communication between multiple modules or nodes may be reduced.
In a first aspect, an embodiment of the present application provides a method for inter-script communication, which is applied to data transfer or method call between scripts bound by multiple nodes in game development, where the method includes: acquiring state change information of a first node, wherein the state change information is used for representing that a script between the first node and at least one target node of the first node has a communication requirement; notifying the at least one target node of the state change information to cause a script bound with the at least one target node to be executed or to transmit data to the script bound with the at least one target node.
According to some embodiments of the application, the communication method of the script between different nodes or modules on different nodes is improved by acquiring the change states of different nodes and informing the target node of the state change situation so that the target node executes the script and the like.
In some embodiments, before the obtaining the state change information of the first node, the method further includes: obtaining the registration information of each of the plurality of nodes, wherein the registration information includes: attribute information of each of the plurality of nodes, the attribute information being used to characterize a state of each of the plurality of nodes, and at least one target node of each of the plurality of nodes.
Some embodiments of the application maintain the attribute information of all nodes by obtaining the registration information of all nodes, and update the registered attribute information when the state of the nodes changes, so that the state information of each node at each moment can be conveniently obtained, and the nodes in all the nodes can know the operation to be executed on the script by directly reading the state change information of other related nodes.
In some embodiments, the at least one target node obtains attribute information of the node related to itself by listening.
According to the target node of some embodiments of the application, whether the attribute information related to the node changes is monitored and obtained, and when the attribute information changes, the related script of the target node executes corresponding operation or transmits data to the related script, so that a script communication method between nodes is improved. Specifically, each script file bound by the target node acquires state change information of scripts related to other nodes through monitoring.
In some embodiments, the script comprises a code file written in the Javascript language, wherein the code file is used to control game logic, store game data, or interface interactions.
Some embodiments of the application may employ script files written in the Javascript language, which may enable the script files to be executed across platforms.
In a second aspect, an embodiment of the present application provides a method for communication between scripts, which is applied to a node binding scripts in game development, and the method includes: confirming that the attribute information of the node changes; and providing state change information corresponding to the change so as to enable the script bound by the target node of the node to be executed or transmit data to the script.
In some embodiments, the method of the second aspect further comprises: and acquiring state change information of each node taking the node as a target node through monitoring so as to enable the script bound with the node to be executed or transmit data to the script bound with the node.
In a third aspect, an embodiment of the present application provides an apparatus for inter-script communication, which is applied to data transfer and method call of a script between multiple nodes in game development, where the apparatus includes: the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is configured to acquire state change information of a first node, and the state change information is used for representing that a script between the first node and at least one target node of the first node has a communication requirement; a providing module configured to notify the at least one target node of the state change information, so that a script bound with the at least one target node is executed or data is transmitted to the script bound with the at least one target node.
In a fourth aspect, an embodiment of the present application provides an apparatus for communication of scripts, where the apparatus is applied to a node of a binding script in game development, and the apparatus includes: the confirming module is configured to confirm that the attribute information of the node is changed; a sending module configured to provide state change information corresponding to the change, so that a script bound by a target node of the local node is executed or data is transmitted to the script.
In some embodiments, the apparatus of the fourth aspect further comprises: and the monitoring module is configured to acquire state change information of each node taking the local node as a target node through monitoring so as to enable the script bound with the local node to be executed or transmit data to the script bound with the local node.
In a fifth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, where the computer program can implement the method of the first aspect or the second aspect when executed by a processor.
In a sixth aspect, an embodiment of the present application provides an information processing apparatus, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the method of the first aspect or the second aspect.
In a seventh aspect, an embodiment of the present application provides a system for communication between scripts, where the system is applied to a game development engine, and the system includes: a plurality of nodes binding a script, wherein the script causes the nodes to have a predetermined function or property; the aggregation module is configured to directly communicate with each of a plurality of nodes to acquire attribute information of each node, and send state change information to a target node of each of the plurality of nodes, wherein the state change information is obtained by updating the attribute information.
In some embodiments, the script is packaged as a target script including a state obtaining function and a monitoring function, wherein the state obtaining function is implemented by a state obtaining submodule configured to obtain state change information of each node from the aggregation module, and the monitoring function is implemented by calling a monitoring method to monitor when states of other nodes taking the current node as a target node in the aggregation module change.
In some embodiments, the script is further packaged as the target script having a management function, wherein the management function is used for updating and managing the status acquisition submodule.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a schematic diagram of an exemplary game scenario;
FIG. 2 is a schematic diagram of a system for inter-script communication according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for inter-script communication according to an embodiment of the present application;
FIG. 4 is a block diagram of a first apparatus for inter-script communication according to an embodiment of the present disclosure;
FIG. 5 is a block diagram illustrating a second apparatus for inter-script communication according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an information processing apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Each individual script file in the Cocos engine may constitute a module, or multiple scripts located on a node in a game scenario may constitute a module (i.e., a module is a component or a part of a component bound to a node). It is understood that each module may have a separate scope, and components (i.e., multiple script files) may be defined in the module, and then bound to nodes in the game scene to implement the game function.
The following exemplifies a communication manner between scripts of the related art. When a first module located on a first node needs to communicate with a script of a second module located on a target node, a target module on the target node needs to be acquired first, and after the target module is acquired, if the target module exists and a needed method is available on the target module, the final access of the first module on the first node to the script on the target node can be realized. The script communication method of the related technology is described by taking communication between scripts corresponding to the module A and the module B as an example, and specifically comprises the following steps: 1) the module A acquires the whole module B in a reference mode or a mode of directly calling a Cocos engine Application Program Interface (API) and the like; 2) a method for obtaining a module B from a module A; 3) executing the method in the module B; 4) and finishing the communication.
It can be seen that the barriers to communication between related art cocos scripts are the following: 1) there is node dependency. If the interaction of the attributes between the scripts is required, a node where a component (module or script) is located needs to be obtained, then a variable this is accessed in a component (module or script) method, and the API of the function getComponent is used to obtain the real script. 2) The script acquisition success rate is not high. If the required component is not found on the node, the function getComponent will return null, and if you try to access null's value, TypeError will be thrown at runtime. 3) The communication technology between scripts of the related art has certain disadvantages in convenience and flexibility. In normal game logic, it is often not sufficient to have access to the nodes' own components, and scripts often require interaction between multiple nodes. For example, automatically aiming a player's cannon at a door requires constantly obtaining the latest position of the player, where the player and cannon belong to two nodes and the position of the player belongs to the information carried by the script file of the player's node.
That is, frequent communication between scripts is a precondition for normal operation of game logic, so the research on the convenience method of script communication is of great significance to game development and maintenance. The communication mode of the script bound between different nodes in the related art has a problem of high cost in the aspects of one-to-one, one-to-many, many-to-many and the like. For example, in the related art, the target module (or the target node) is acquired first, and after the target module (or the target node) is acquired, if the target module (or the target node) exists and a method is needed on the target module (or the target node), the final access may be implemented; in the related technology, one-to-many communication needs to acquire different target modules (or target nodes) for multiple times and judge the reliability of the target modules (or target nodes) for multiple times to finish the final effect; in the related art, not only different target modules (or target nodes) need to be acquired for multiple times and the reliability of the target modules (or target nodes) needs to be judged for multiple times during many-to-many communication, but also the communication complexity is much higher than that of one-to-many communication.
Some embodiments of the present application relate to a method for facilitating communication between scripts during the development of a Cocos2d-x game. Scripts (scripts) are code files of executable files written in a format using a particular descriptive language (e.g., a language such as Javascript) that can control game logic, store game data, interface interactions, etc. The communication mode between different scripts refers to a mode of data transmission and method calling between the scripts in the game development process.
Referring to FIG. 1, FIG. 1 is a game scenario in which elements, i.e., nodes, in the scenario may have components embedded therein. The game scene of fig. 1 includes two nodes, namely, a bottle gourd child 100 and a bird 200, and each node of the two nodes is respectively bound with a group of components, so that the node bound with the components has a certain function or property. The components are the main components of the Cocos Creator, and several aspects of rendering (scene display content), logic, user input feedback, timers and the like are all completed by the components. According to the general architecture of the Cocos Creator, the components and nodes cooperate (i.e., bind) to complete the content required for the game. Objects in a scene are driven by writing a script component and assigning it to a scene node. The embodiment of the application is used for solving how scripts bound by two nodes communicate with each other.
As shown in FIG. 2, some embodiments of the present application provide a scripting communication system to enhance the way scripts communicate between nodes. FIG. 2 is a system for inter-script communication in a game development engine, comprising: the script communication system of the embodiment of the present application may also be said to include a plurality of nodes for binding scripts and the aggregation module 300 in some embodiments.
The plurality of nodes corresponding to the plurality of modules of fig. 2 are bound with a component consisting of a plurality of scripts because the scripts can make the nodes bound with the scripts have predetermined functions or properties (for example, if a person wearing body armor and holding a gun is displayed in a game scene, the person corresponds to the node, the body armor and the gun correspond to the component on the node of the person, the body armor component provides the function of not being shot by the gun to the person, and the gun component provides the function of shooting enemies to the person.
The aggregation module 300 of fig. 2 is configured to directly communicate with each of a plurality of modules (e.g., the first module 301, the second module 302, the third module 303, and the fourth module 304 of fig. 2) to obtain attribute information of a node corresponding to each of the modules, and send state change information to a target module of each of the plurality of modules (e.g., the first module 301, the second module 302, the third module 303, and the fourth module 304 of fig. 2), where the state change information is characterized by updating the attribute information.
It should be noted that the target module of each module is determined according to whether script communication needs to be executed between nodes corresponding to the modules. For example, when the attribute or the state information of the node corresponding to the first module 301 in fig. 2 changes, it indicates that the first module 301 needs to communicate with a script in the third module 303 bound to another node, and at this time, the third module is a target module of the first module, and a target node of the node bound to the first module 301 is a node bound to the third module 303.
It is understood that the modules in fig. 2 may also be understood as nodes. In order to improve the communication effect between scripts bound on different nodes, the embodiments of the present application need to analyze in advance which attribute information or state change of a node may cause communication with a script on another node after the scripts are bound with each node, and update and store the attribute information or state information in the aggregation module 300 in real time.
In addition, assuming that when the state of the first module 301 changes, the method corresponding to the first script of the third module 303 needs to be executed, the embodiment of the present application further needs to repackage the first script of the third module in advance, so that the first script adds a function of monitoring the state change information of the first module stored on the aggregation module 300. In particular, in some embodiments, each script on the third module 303 is packaged as a target script that includes a state acquisition function and a listening function, wherein, the status acquiring function is realized by registering a status acquiring sub-module shared by all modules or nodes (such as the first module 301, the second module 302, the third module 303, and the fourth module 304 of fig. 2) and directly acquiring various status change information in the aggregation module 300 through the sub-module, the snooping function is obtained by invoking a snooping method to snoop when the state of the first module 301 (since the target module of the first module 301 is assumed to be the third module 303 in this embodiment) changes in the aggregation module 300, that is, the snooping function is implemented by invoking the snooping method to snoop when the state of the other nodes taking this node as the target node changes in the aggregation module. In some embodiments, each script on the third module 303 is further packaged as the target script having a management function, wherein the management function is used for updating and managing the status acquisition submodule.
It should be noted that, in the embodiment of the present application, only the third module is taken as an example to illustrate a script encapsulation manner for facilitating communication between scripts on a node, and it is understood that each of the four modules in fig. 2 may adopt the above encapsulation manner to achieve the technical purpose that the modules perform inter-script communication via the aggregation module 300.
The script communication method executed on the convergence module 300 is exemplified below with reference to fig. 3.
As shown in fig. 3, an embodiment of the present application provides a method for inter-script communication, which is applied to data transfer or method call between scripts bound by multiple nodes in game development, and the method includes: s101, state change information of a first node is obtained, wherein the state change information is used for representing that communication requirements exist in a script between the first node and at least one target node of the first node; s102, informing the at least one target node of the state change information so as to enable the script bound with the at least one target node to be executed or transmit data to the script bound with the at least one target node. It should be noted that the first node in the embodiment of the present application is a node bound by any one of the four modules shown in fig. 2. At least one target node of the first node in the embodiment of the application is a node which can cause the script bound on the first node to be executed or can cause the script to transmit data to the script due to the state change of the first node. According to some embodiments of the application, the change states of different nodes are acquired, and the state change condition is notified to the target node so that the target node executes the script and the like, so that the communication methods of the script or the module of different nodes are improved.
In some embodiments, the method for script communication performed by the convergence module 300 before S101 further includes: obtaining the registration information of each of the plurality of nodes, wherein the registration information includes: attribute information of each of the plurality of nodes, the attribute information being used to characterize a state of each of the plurality of nodes, and at least one target node of each of the plurality of nodes. Some embodiments of the application maintain the attribute information of all nodes by obtaining the registration information of all nodes, and update the registered attribute information when the state of the nodes changes, so that the state information of each node at each moment can be conveniently obtained.
In some embodiments, the at least one target node obtains attribute information of the node related to itself by listening. According to some embodiments of the application, the target node monitors whether the attribute information related to the node changes or not, and when the attribute information changes, the related script of the target node executes corresponding operation or transmits data to the related script, so that the communication method of the script between the nodes is improved. Specifically, each script file bound by the target node acquires state change information of scripts related to other nodes through monitoring.
The script communication method performed on the node is briefly set forth below.
Some embodiments of the present application provide a method for communication between scripts, which is applied to a node for binding scripts in game development, and the method includes: confirming that the attribute information of the node changes; and providing state change information corresponding to the change so as to enable the script bound by the target node of the node to be executed or transmit data to the script.
In some embodiments, the script communication method executed on the node further comprises: and acquiring state change information of each node taking the node as a target node through monitoring so as to enable the script bound with the node to be executed or transmit data to the script bound with the node.
The script communication system of fig. 2 is set forth below in connection with a specific example.
In conjunction with fig. 2, it will be understood that some embodiments of the present application implement interactive communication via a convergence module with scripts bound to multiple nodes or multiple modules on multiple nodes.
The aggregation module 300 may be a module for storing global variables, important data. For example, these global variables or significance data may include the number of points a game player receives during game play. The reason why the scores belong to the important data is that the scores are used by a plurality of applications including a game main scene, a game settlement and a leader board, so that the game scores can be stored in the aggregation module 300.
The communication method of the aggregation module 300 and each module bound to a node may include the following two steps:
1) the convergence module 300 acts as a medium for communication back and forth and for communication indirectly between scripts of different modules or different nodes.
For example, when the method in the second module 302 is to be accessed in the first module 301, only a certain state of the node in the aggregation module 300 where the first module is located needs to be modified by using the embodiment of the present application. Then, the second module 302 may directly obtain the modified state and also monitor the state, and call and execute a corresponding method of the script. As shown in particular in fig. 2.
The convergence module 300 is used as a medium to realize communication among the modules, so that the round-trip communication efficiency among the modules can be greatly improved, and the direct complex interaction among multiple modules can be conveniently realized.
2) On the basis that the aggregation module 300 serves as a communication medium among a plurality of modules or a plurality of nodes, the original modules (or scripts in the modules) bound with the nodes are encapsulated to obtain encapsulated modules with the functions of fig. 2. For example, the original module is changed into a packaged script module by giving attribute information and a monitoring method to the original module in a mixed mode. The packaged script modules can directly communicate with each other by using the aggregation module as a medium, and also can communicate with each other in an original mode (i.e. the communication mode of the module a and the module B). The encapsulated modules are used to maintain the data stored in the convergence module 300, provide an interface for the outside, and are responsible for data synchronization.
The encapsulation process is set forth below as a process for encapsulating a first original module (i.e., a module bound to any one of the nodes).
1) In the process of encapsulating the first original module, a state obtaining sub-module shared by all modules is registered first, and various states of a plurality of nodes stored in the aggregation module 300 can be directly obtained in all encapsulated modules through the state obtaining sub-module.
2) Registering a universal updating method in the process of encapsulating the first original module, wherein the universal updating method is used for updating and managing the shared aggregation module 300, and the unified method ensures that the aggregation module 300 is more controllable and safer;
3) introducing a snooping object (i.e., state information of other nodes and nodes that may cause the script in the first primitive to be executed), the encapsulated first primitive needs to snoop some property in the aggregation module 300. By providing a monitoring object, if the state information of the relative nodes in the convergence module is updated, the encapsulated first module can automatically call a corresponding monitoring method to acquire the changed state information;
4) the state acquisition sub-module, the updating method, the monitoring object and the monitoring method are added to the first original module in a mixed mode, the first original module is changed into a packaged module which can be communicated with the convergence module 300, and then communication among all scripts can be achieved through the convergence module.
The communication between the scripts is realized by the media convergence module 300, and compared with the related art, the following advantages are provided in the communication efficiency: 1) the one-to-one-way communication flow becomes more streamlined. The related art script communication has three processes: firstly, acquiring a target module, acquiring a target method or attribute after successful acquisition, and finally executing the method or using the attribute; the embodiment of the present application may include two steps for realizing communication between scripts on multiple modules or multiple nodes through the media aggregation module. The two steps are described by taking the communication among scripts in the E module and the F module as an example: the E module sends a communication request to the convergence module 300, and the convergence module 300 notifies the F module of a completion request, wherein the E module sends the communication request by modifying the attribute information of the node where the E module is located, and the convergence module 300 notifies the F module on the target node of the node where the E module is located of a state change condition, so that the script in the F module is executed. 2) One-to-one round trip and many-to-many communications are more efficient. The media convergence module of the embodiment of the application realizes the advantages of communication, and mainly focuses on direct mutual communication of a plurality of modules. If the related technology is adopted to realize communication through the acquisition module, 5-4-3-2-1 communication routes are needed for realizing the direct communication among the five modules; if the media convergence module of the embodiment of the application realizes communication, only 5 communication routes are needed; the efficiency is improved by several times; meanwhile, in terms of game state management, some embodiments of the present application also have the following advantages compared to the related art; firstly, the states before and after communication are changed into centralized management, and as an observer, the observer can clearly know whether a target module needs to be acquired currently or not and clearly know whether the target module is acquired currently or not; adding more convenience to debugging. Secondly, communication between scripts is achieved through the aggregation module 300, and all states of the nodes are stored through the aggregation module, so that the states of the nodes at all times can be clearly obtained, and the aggregation module is uniformly managed through an updating method packaged on each script, so that the aggregation module is very safe and reliable.
That is to say, the scripts bound to different nodes in the embodiment of the present application may directly share the state information of all nodes stored in the aggregation module, and the update method included in the script may be used to modify the state of each node, so as to facilitate uniform state management of all nodes. Some embodiments of the present application also facilitate communication of scripts through intermediary convergence modules by directly packaging the original scripts into encapsulated scripts with monitoring and reporting state information. The packaged modules can directly share the convergence module without affecting the functions of the original script.
Referring to fig. 4, fig. 4 shows an apparatus for inter-script communication provided by an embodiment of the present application, it should be understood that the apparatus corresponds to the above-mentioned method embodiment of fig. 3, and is capable of performing various steps related to the above-mentioned method embodiment, and specific functions of the apparatus may be referred to the above description, and a detailed description is appropriately omitted here to avoid repetition. The device comprises at least one software functional module which can be stored in a memory in the form of software or firmware or solidified in an operating system of the device, the device for communication among scripts is applied to data transfer and method calling among a plurality of node-bound scripts in game development, and the device comprises: an obtaining module 101, configured to obtain state change information of a first node, where the state change information is used to characterize that a script between the first node and at least one target node of the first node has a communication requirement; a providing module 102 configured to notify the at least one target node of the state change information, so that the script bound to the at least one target node is executed or data is transmitted to the script bound to the at least one target node.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described apparatus may refer to the corresponding process in fig. 3, and will not be described in detail herein.
As shown in fig. 5, an embodiment of the present application provides an apparatus for communication between scripts, which is applied in a node for binding scripts in game development, and the apparatus includes: a confirmation module 201 configured to confirm that the attribute information of the node is changed; a sending module 202, configured to provide state change information corresponding to the change, so as to enable a script bound by a target node of the local node to be executed or transmit data to the script.
In some embodiments, the apparatus of fig. 5 further comprises: the monitoring module 203 is configured to acquire state change information of each node using the local node as a target node through monitoring, so that the script bound to the local node is executed or data is transmitted to the script bound to the local node.
It should be noted that the apparatus in fig. 5 corresponds to the method embodiment for communication between scripts executed on the node, and is capable of executing the steps related to the method embodiment, and the specific functions of the apparatus may be referred to the description above, and a detailed description is appropriately omitted here to avoid repetition.
Embodiments of the present application provide a computer-readable storage medium on which a computer program is stored, which when executed by a processor can implement the above-described method for inter-script communication.
As shown in fig. 6, an embodiment of the present application provides an information processing apparatus 700, which includes a memory 710, a processor 720, and a computer program stored on the memory 710 and executable on the processor 720, wherein the processor 720 may implement the functions of the modules in fig. 2 when reading the program from the memory 710 through the bus 730 and executing the program, and may also implement the method shown in fig. 3.
Processor 720 may process digital signals and may include various computing structures. Such as a complex instruction set computer architecture, a structurally reduced instruction set computer architecture, or an architecture that implements a combination of instruction sets. In some examples, processor 720 may be a microprocessor.
Memory 710 may be used to store instructions that are executed by processor 720 or data related to the execution of the instructions. The instructions and/or data may include code for performing some or all of the functions of one or more of the modules described in embodiments of the application. The processor 720 of the disclosed embodiments may be used to execute instructions in the memory 710 to implement the method shown in fig. 3. Memory 710 includes dynamic random access memory, static random access memory, flash memory, optical memory, or other memory known to those skilled in the art.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (14)

1. A method for communication between scripts, which is applied to data transfer or method call among scripts bound by a plurality of nodes in game development, is characterized in that the method comprises the following steps:
acquiring state change information of a first node, wherein the state change information is used for representing that a script between the first node and at least one target node of the first node has a communication requirement;
notifying the at least one target node of the state change information to cause a script bound with the at least one target node to be executed or to transmit data to the script bound with the at least one target node.
2. The method of claim 1, wherein prior to obtaining the state change information of the first node, the method further comprises:
acquiring registration information of each node in the plurality of nodes, wherein the registration information comprises: attribute information of each of the plurality of nodes, the attribute information being used to characterize a state of each of the plurality of nodes, and at least one target node of each of the plurality of nodes.
3. The method of claim 2, wherein the at least one target node obtains attribute information of nodes related to itself by listening.
4. The method of claim 1, wherein the script comprises a code file written in the Javascript language, wherein the code file is used to control game logic, store game data, or interface interactions.
5. A method for communication between scripts, applied to a node for binding scripts in game development, is characterized in that the method comprises the following steps:
confirming that the attribute information of the node changes;
and providing state change information corresponding to the change so as to enable the script bound by the target node of the node to be executed or transmit data to the script.
6. The method of claim 5, wherein the method further comprises: and acquiring state change information of each node taking the node as a target node through monitoring so as to enable the script bound with the node to be executed or transmit data to the script bound with the node.
7. An apparatus for inter-script communication, applied to data transfer and method call among scripts bound by multiple nodes in game development, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is configured to acquire state change information of a first node, and the state change information is used for representing that a script between the first node and at least one target node of the first node has a communication requirement;
A providing module configured to notify the at least one target node of the state change information, so that a script bound with the at least one target node is executed or data is transmitted to the script bound with the at least one target node.
8. An apparatus for communication between scripts, applied to a node for binding scripts in game development, the apparatus comprising:
the confirming module is configured to confirm that the attribute information of the node is changed;
a sending module configured to provide state change information corresponding to the change, so that a script bound by a target node of the local node is executed or data is transmitted to the script.
9. The apparatus of claim 8, wherein the apparatus further comprises: and the monitoring module is configured to acquire state change information of each node taking the local node as a target node through monitoring so as to enable the script bound with the local node to be executed or transmit data to the script bound with the local node.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, is adapted to carry out the method of any one of claims 1 to 6.
11. An information processing apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program is operable to implement the method of any of claims 1 to 6.
12. A system for communication between scripts applied in a game development engine, the system comprising:
a plurality of nodes binding a script, wherein the script causes the nodes to have a predetermined function or property;
the aggregation module is configured to directly communicate with each of a plurality of nodes to acquire attribute information of each node, and send state change information to a target node of each of the plurality of nodes, wherein the state change information is obtained by updating the attribute information.
13. The system of claim 12, wherein the script is packaged as a target script including a status acquisition function and a listening function, wherein the status acquisition function is implemented by a status acquisition submodule configured to acquire status change information of each node from the aggregation module, and wherein the listening function is implemented by calling a listening method to listen when the status of the rest of the nodes having the own node as a target node in the aggregation module changes.
14. The system of claim 13, wherein the script is further encapsulated as the target script having administrative functions for updating and managing the status acquisition submodule.
CN202010644087.1A 2020-07-06 2020-07-06 Method, device and system for communication between scripts Pending CN111858092A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010644087.1A CN111858092A (en) 2020-07-06 2020-07-06 Method, device and system for communication between scripts

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010644087.1A CN111858092A (en) 2020-07-06 2020-07-06 Method, device and system for communication between scripts

Publications (1)

Publication Number Publication Date
CN111858092A true CN111858092A (en) 2020-10-30

Family

ID=73153548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010644087.1A Pending CN111858092A (en) 2020-07-06 2020-07-06 Method, device and system for communication between scripts

Country Status (1)

Country Link
CN (1) CN111858092A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579062A (en) * 2020-12-23 2021-03-30 厦门极致互动网络技术股份有限公司 Data interaction method between Lua language and Unity
CN114225384A (en) * 2021-12-02 2022-03-25 广州三七极创网络科技有限公司 Communication method, system, equipment and storage medium based on combinable GM instruction
WO2024131120A1 (en) * 2022-12-20 2024-06-27 广州汽车集团股份有限公司 Onboard software execution method and apparatus, vehicle, and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109634561A (en) * 2018-10-16 2019-04-16 阿里巴巴集团控股有限公司 A kind of online visual programming method and device
CN111359216A (en) * 2020-02-13 2020-07-03 网易(杭州)网络有限公司 Game information processing method and device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109634561A (en) * 2018-10-16 2019-04-16 阿里巴巴集团控股有限公司 A kind of online visual programming method and device
CN111359216A (en) * 2020-02-13 2020-07-03 网易(杭州)网络有限公司 Game information processing method and device, electronic equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579062A (en) * 2020-12-23 2021-03-30 厦门极致互动网络技术股份有限公司 Data interaction method between Lua language and Unity
CN112579062B (en) * 2020-12-23 2022-04-29 厦门极致互动网络技术股份有限公司 Data interaction method between Lua language and Unity
CN114225384A (en) * 2021-12-02 2022-03-25 广州三七极创网络科技有限公司 Communication method, system, equipment and storage medium based on combinable GM instruction
CN114225384B (en) * 2021-12-02 2022-09-16 广州三七极创网络科技有限公司 Communication method, system, equipment and storage medium based on combinable GM instruction
WO2024131120A1 (en) * 2022-12-20 2024-06-27 广州汽车集团股份有限公司 Onboard software execution method and apparatus, vehicle, and storage medium

Similar Documents

Publication Publication Date Title
CN111858092A (en) Method, device and system for communication between scripts
US9792096B1 (en) System and method for pervasive software platform-based model driven architecture application generator
CN111079101B (en) Method and device for obtaining evidence of infringement based on block chain, electronic equipment and storage medium
CN111782340B (en) Data processing method, device, equipment and system based on byte codes
US8959504B2 (en) Update scanning
US11036522B2 (en) Remote component loader
Powell et al. The test and training enabling architecture (TENA)
CN109032820A (en) The compatible processing method and processing device of application version
Barboni et al. Sumo: A mutation testing strategy for solidity smart contracts
CN110339571A (en) Event generation method and device, storage medium and electronic device
van der Vegt et al. RAGE reusable game software components and their integration into serious game engines
CN107133160B (en) Server and client
CN114328217A (en) Application testing method, device, equipment, medium and computer program product
KR20150133902A (en) System and method for developing of service based on software product line
CN108920379B (en) Method and device for capturing lua code exception
CN112418447B (en) System, method, medium, and apparatus for providing machine learning service
US20220222982A1 (en) Method and server for supporting generation of scenarios for testing autonomous driving and/or advanced driver assistance system functionality
CN109388770B (en) Web page generation method and device
CN112860453B (en) Message management method, system, electronic device and storage medium
CN114298699B (en) Method for generating and acquiring non-homogeneous general evidence and device
CN108509553A (en) A kind of item file generation method and platform
Noseworthy Developing distributed applications rapidly and reliably using the TENA middleware
CN107015787A (en) A kind of method and device of interactive application Frame Design
Mahmoud Developing Middleware in Java EE 8: Build robust middleware solutions using the latest technologies and trends
Yammanuru et al. Enabling enterprise blockchain appdev teams

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination