CN117180728A - Method and device for controlling activity data in game, storage medium and electronic equipment - Google Patents

Method and device for controlling activity data in game, storage medium and electronic equipment Download PDF

Info

Publication number
CN117180728A
CN117180728A CN202311206397.5A CN202311206397A CN117180728A CN 117180728 A CN117180728 A CN 117180728A CN 202311206397 A CN202311206397 A CN 202311206397A CN 117180728 A CN117180728 A CN 117180728A
Authority
CN
China
Prior art keywords
activity
global
controller
target operation
local
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
CN202311206397.5A
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.)
Shanghai Neteasy Brilliant Network Technology Co ltd
Original Assignee
Shanghai Neteasy Brilliant 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 Shanghai Neteasy Brilliant Network Technology Co ltd filed Critical Shanghai Neteasy Brilliant Network Technology Co ltd
Priority to CN202311206397.5A priority Critical patent/CN117180728A/en
Publication of CN117180728A publication Critical patent/CN117180728A/en
Pending legal-status Critical Current

Links

Abstract

The present disclosure relates to a method and apparatus for controlling activity data in a game, a storage medium, and an electronic device, and relates to the field of computer technology, where the method includes: determining a target operation activity for the target game, registering a global activity handle of the target operation activity to the global activity controller and registering a local activity handle of the target operation activity to the local activity controller; and responding to the global service node to execute the target operation activity, acquiring the activity data and the activity state related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and the acquired activity state to the local activity controller by the global activity controller so that the character service node can execute the appointed game service by accessing the local activity controller to acquire the activity data and the activity state. The present disclosure reduces the complexity of game service development and reduces the traffic within a game server cluster.

Description

Method and device for controlling activity data in game, storage medium and electronic equipment
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to an activity data control method in a game, an activity data control device in the game, a storage medium and electronic equipment.
Background
The operation activity is a series of functions which are periodically and time-saving and are held in the game for the purpose of improving the retention or paying. Many online games will conduct operation activities to pull up operation data and improve operation quality. The operation activity has rich expression form and has the characteristics of one-time development and multiple use.
In the related art, an activity template is developed in advance, and different activity parameters are configured according to operation requirements. For the management of the movable templates and parameters, a centralized management mode is generally adopted, the movable templates and the parameters exist in a server in a single-point form, are difficult to transversely expand, and are not suitable for a modern distributed game server. Wherein, a server cluster has a plurality of machines and a plurality of processes, each process comprises one or more services, and a single point is that only one service in the server cluster is used for managing operation activities.
Accordingly, there is a need to provide a new method of controlling activity data in a game.
It should be noted that the information of the present invention in the above background section is only for enhancing the understanding of the background of the present invention and thus may include information that does not form the prior art that is already known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a method of controlling activity data in a game, an apparatus for controlling activity data in a game, a storage medium, and an electronic device, thereby overcoming, at least to some extent, the problem that operation activities in the related art are not applicable to a modern distributed game server due to limitations and drawbacks of the related art.
According to one aspect of the present disclosure, there is provided an activity data control method in a game, including:
determining a target operational activity for a target game, and registering a global activity handle of the target operational activity with the global activity controller and a local activity handle of the target operational activity with the local activity controller;
and responding to the global service node to execute the target operation activity, acquiring activity data and activity states related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity states to the local activity controller by the global activity controller so that the role service node can execute a specified game service by accessing the local activity controller to acquire the activity data and activity states.
In an exemplary embodiment of the disclosure, the registering the global activity handle of the target operation activity with the global activity controller includes:
determining a global activity handle of global business logic for executing the target operation activity;
acquiring an activity type number of the target operation activity, performing hash calculation on the activity type number by using a distributed consistency hash algorithm, and determining a global activity controller matched with the target operation activity;
registering the global activity handle with the global activity controller.
In an exemplary embodiment of the disclosure, the registering the local activity handle of the target operation activity with the local activity controller includes:
acquiring a role service node in the server side for executing the game service corresponding to the target operation activity and a local activity handle of the role service logic in the role service node for executing the target operation activity;
registering the local activity handle in a local activity controller of a role service node executing the target operation activity.
In one exemplary embodiment of the present disclosure, the global service node performs the target operational activity, including;
The global activity controller obtains activity data of the target operation activity, and obtains time configuration data of the target operation activity according to the activity data;
and the global service node executes the target operation activity according to the time configuration data.
In an exemplary embodiment of the present disclosure, the global service node performing the target operation activity according to the time configuration data includes:
a global activity controller in the global service node obtains the current activity state of the target operation activity according to the time configuration data and the current time;
configuring a timer for a second active state according to a time parameter of the second active state in the time configuration data, and executing the target operation activity based on the timer; wherein the second active state is the next active state to the current active state.
In an exemplary embodiment of the present disclosure, after obtaining the current activity state of the target operation activity, the method further includes:
and synchronizing activity data of the target operation activity and the current activity state to the global activity controller.
In one exemplary embodiment of the present disclosure, performing the target operational activity based on the timer includes:
triggering to switch the current active state to the second active state through the timer;
and calling a state callback function of the global activity handle corresponding to the second activity state, and triggering and executing global business logic corresponding to the target operation activity through the state callback function.
In an exemplary embodiment of the present disclosure, after executing global business logic corresponding to the target operation activity by the state callback function, the method further comprises:
and updating the activity data of the target operation activity to obtain updated activity data.
In one exemplary embodiment of the present disclosure, acquiring, by the global activity controller, activity data and an activity state related to the target operation activity, and synchronizing, via the global activity controller, the acquired activity data and activity state to the local activity controller, includes:
and synchronizing the updated activity data and the second activity state to a local activity controller of the role service node.
In one exemplary embodiment of the present disclosure, a character service node performs a specified game service by accessing the local activity controller to acquire the activity data and the activity state, including:
the local activity controller of the role service node calls a state callback function of the local activity handle corresponding to the second activity state according to the updated activity data and the second activity state;
and triggering and executing the role business logic of the target operation activity through a state callback function corresponding to the second activity state.
According to an aspect of the present disclosure, there is provided an activity data control device in a game, including:
an activity handle registration module for determining a target operation activity for a target game, registering a global activity handle of the target operation activity to the global activity controller and registering a local activity handle of the target operation activity to the local activity controller;
and the operation activity realizing module is used for responding to the global service node to execute the target operation activity, acquiring the activity data and the activity state related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity state to the local activity controller by the global activity controller so that the role service node can execute the appointed game service by accessing the local activity controller to acquire the activity data and the activity state.
According to an aspect of the present disclosure, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the activity data control method in a game described in any of the above-described exemplary embodiments.
According to one aspect of the present disclosure, there is provided an electronic device including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of controlling activity data in a game of any of the above-described exemplary embodiments via execution of the executable instructions.
The method for controlling activity data in a game provided by the embodiment of the disclosure determines a target operation activity aiming at a target game, registers a global activity handle of the target operation activity to the global activity controller and registers a local activity handle of the target operation activity to the local activity controller; and responding to the global service node to execute the target operation activity, acquiring activity data and activity states related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity states to the local activity controller by the global activity controller so that the role service node can execute a specified game service by accessing the local activity controller to acquire the activity data and activity states. On one hand, the target operation activity aiming at the target game is realized through the global service node and the role service node, and the problem that the operation activity exists in a single point form in the related technology is solved; on the other hand, the global activity controller synchronizes the activity data and the activity state related to the operation activity to the local activity controller, so that the role service node does not need to remotely communicate with the global service node again when executing the designated game service, and only needs to access the activity data and the activity state acquired by the local activity controller, thereby reducing the complexity of developing the game service and reducing the communication quantity in the game server cluster.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention. It is evident that the drawings in the following description are only some embodiments of the present invention and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 schematically illustrates a flow chart of a method of activity data control in a game according to an example embodiment of the present disclosure.
Fig. 2 schematically illustrates a block diagram of an activity data control system in a game according to an example embodiment of the present disclosure.
Fig. 3 schematically illustrates a method flow diagram for registering a global activity handle of a target operational activity with a global activity controller according to an example embodiment of the present disclosure.
Fig. 4 schematically illustrates a method flow diagram for registering a local activity handle of a target operational activity with a local activity controller according to an example embodiment of the present disclosure.
Fig. 5 schematically illustrates a method flowchart of a global service node performing a target operational activity according to an example embodiment of the present disclosure.
Fig. 6 schematically illustrates a method flow diagram for a global service node to perform a target operational activity according to time configuration data according to an example embodiment of the present disclosure.
Fig. 7 schematically illustrates a method flow diagram for performing a target operational activity based on a timer according to an example embodiment of the present disclosure.
Fig. 8 schematically illustrates a flow chart of a method for a character service node to perform a specified game service by accessing a local activity controller to obtain activity data and activity status, according to an example embodiment of the present disclosure.
Fig. 9 schematically illustrates a flowchart of a method of activity data control in a game according to an example embodiment of the present disclosure.
Fig. 10 schematically illustrates a block diagram of an activity data control device in a game according to an example embodiment of the present disclosure.
FIG. 11 schematically illustrates an electronic device for activity data control in a game according to an example embodiment of the invention.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known aspects have not been shown or described in detail to avoid obscuring aspects of the invention.
Furthermore, the drawings are merely schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
The present exemplary embodiment first provides an activity data control method in a game, which may include the steps of:
s110, determining a target operation activity aiming at a target game, registering a global activity handle of the target operation activity to the global activity controller and registering a local activity handle of the target operation activity to the local activity controller;
step S120, responding to the global service node to execute the target operation activity, acquiring activity data and activity states related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity states to the local activity controller by the global activity controller so that the role service node can execute specified game service by accessing the local activity controller to acquire the activity data and activity states.
The activity data control method in the game determines a target operation activity aiming at a target game, registers a global activity handle of the target operation activity to the global activity controller and registers a local activity handle of the target operation activity to the local activity controller; and responding to the global service node to execute the target operation activity, acquiring activity data and activity states related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity states to the local activity controller by the global activity controller so that the role service node can execute a specified game service by accessing the local activity controller to acquire the activity data and activity states. On one hand, the target operation activity aiming at the target game is realized through the global service node and the role service node, and the problem that the operation activity exists in a single point form in the related technology is solved; on the other hand, the global activity controller synchronizes the activity data and the activity state related to the operation activity to the local activity controller, so that the role service node does not need to remotely communicate with the global service node again when executing the designated game service, and only needs to access the activity data and the activity state acquired by the local activity controller, thereby reducing the complexity of developing the game service and reducing the communication quantity in the game server cluster.
Hereinafter, each step involved in the in-game activity data control method according to the exemplary embodiment of the present disclosure will be explained and described in detail.
First, application scenarios and purposes of the exemplary embodiments of the present disclosure are explained and explained. Specifically, the embodiment of the disclosure can ensure that operation activities in the game server cluster are correctly executed on time, in order and on time according to the life cycle, and improve disaster recovery capability. The method mainly researches how to realize operation activities in the game server cluster and how to reduce the complexity of developing game services when realizing the operation activities, and reduces the communication traffic in the game server cluster.
In the method, a global activity handle and a local activity handle corresponding to a target operation activity are determined based on the target operation activity, the global activity handle is registered in a global activity controller of a service node to be global, the local activity handle is registered in the local activity controller, after registration, the global service node executes the target operation activity through the global activity controller and the global activity handle, in the process of executing the target operation activity, the global activity controller synchronizes the activity data and the activity state of the target operation activity to the local activity controller of a role service node, and the role service node executes a designated game service according to the synchronized activity data and the synchronized activity state.
Next, an explanation and explanation will be made of an activity data control system in a game related to an example embodiment of the present disclosure. Referring to FIG. 2, the in-game activity data control system may include a database 210, a plurality of global service nodes 220, and a plurality of role service nodes 230, a global activity controller 221 and a global activity handle 222 in the global service nodes 220, and one or more global activity handles 222 may be included in one global service node 220; a local activity controller 231 and a local activity handle 232 are included in the persona service node 230, and one or more local activity handles 232 may be included in one persona service node 230. The database 230 is used for storing activity data of the target operation activity; the global node 220 acquires the activity data of the target operation activity from the database 210, executes the global service logic of the target operation activity based on the activity data, synchronizes the activity data and the activity state to the local node 230, and the character service node 230 executes the designated game service based on the synchronized activity data and activity state.
Hereinafter, step S110 and step S120 will be explained and described in detail with reference to fig. 2.
In step S110, a target operation activity for a target game is determined, and a global activity handle of the target operation activity is registered to the global activity controller and a local activity handle of the target operation activity is registered to the local activity controller.
In this example embodiment, there may be one or more operations activities with inconsistent open time periods in the same time game, and in each operation activity, the activity content may be different according to the server progress. The number of the acquired target operation activities may be one or a plurality of, and is not particularly limited in this exemplary embodiment.
In this example embodiment, after determining a target operational activity, a global activity handle of the target operational activity may be registered with the global activity controller and a local activity handle of the target operational activity may be registered with the local activity controller.
Specifically, since the server cluster includes a plurality of global service nodes and a plurality of role service nodes, each global service node and each role service node are mutually independent, and after the global activity handle and the local activity handle of the target operation activity are registered in the global activity controller of the global service node and the local activity controller of the role service node, respectively, the global service node knows to which role service node the activity data should be transmitted.
In the game server cluster, there are multiple global service nodes 220, each of which represents a process, and each of which is deployed with a global activity controller, each of which is independent of the other and is only responsible for lifecycle management of the global activity handles registered thereon.
A plurality of global activity controllers exist in the game server cluster, the plurality of global activity controllers synchronize survival states with each other through heartbeat packets, and when a certain example of the global activity controllers fails to exit, other examples sense and migrate global activity handles managed by the failed example; for example, heartbeat packets may be sent between the instances, when the heartbeat packets time out, the instances may be considered to be faulty, and a normal process may be selected through a manager assignment, election algorithm, re-hash, and other modes after a process in the server cluster senses a certain instance fault, and a new instance of the service may be generated on the normal process by middleware such as ETCD (distributed application coordination service for sharing configuration and service discovery), zookeeper (Remote Dictionary Server, remote dictionary service), etc., when the instances are faulty, new topology information is synchronized to other nodes, so that other nodes sense the instance fault, in this example embodiment, the fault sensing is not specifically limited, and after processes in the server cluster sense a certain instance fault, a normal process may be selected by a manager assignment, election algorithm, re-hash, etc., and a new instance of the service may be generated on the normal process, and in this example embodiment, the fault migration mode is not specifically limited. When a service is not a single point, that is, there are multiple instances of the service executing the same code and processing the same service, the instances are independent from each other, and an interface is provided for the outside and the service is provided together by means of a distributed consistency hash algorithm, polling, random drop point and the like.
For example, the game server cluster has three global service nodes, each running on a different machine, each node having a global activity controller instance, G1, G2, G3; four role service nodes are respectively operated on different machines, and each role service node is provided with a local activity controller instance which is L1, L2, L3 and L4. There are now two types of operational activities in games: activity a: generating a monster during the activity and conducting a ranking prize according to the injury amount of the player to the monster, and B activity: the experience gained by the player is doubled during the activity.
After the game server cluster is started, the global activity handle setpoint of the A activity is registered on the global activity controller G1, the global activity handle setpoint of the B activity is registered on the global activity controller G2, and no global activity handle is registered on G3. Assuming that G1 fails, after G2 and G3 sense that the failure occurs, the global activity handle of the A activity is reselected to G2 or G3 for registration and reloading of the repository data.
Referring to fig. 3, registering a global activity handle of the target operation activity with the global activity controller may include:
S310, determining a global activity handle of global business logic for executing the target operation activity;
s320, acquiring an activity type number of the target operation activity, performing hash calculation on the activity type number by using a distributed consistency hash algorithm, and determining a global activity controller matched with the target operation activity;
and S330, registering the global activity handle to the global activity controller.
Hereinafter, step S310 to step S330 will be further explained and explained. Specifically, first, determining a global activity handle of global business logic for executing a target operation activity in a server cluster; then, in the game server cluster, each global activity controller obtains a unique number in the cluster through a distributed consistent hash algorithm, for the target operation activity, the activity type number of the target operation activity needs to be obtained, the unique number of the global activity controller corresponding to the target operation activity can be determined through the distributed consistent hash algorithm based on the activity type number of the target operation activity, and after the unique number is determined, the global activity handle is registered in the global activity handle corresponding to the unique number.
Referring to fig. 4, registering a local activity handle of the target operation activity with the local activity controller may include:
s410, acquiring a role service node in the server side for executing the game service corresponding to the target operation activity and a local activity handle of the role service logic in the role service node for executing the target operation activity;
and S420, registering the local activity handle into a local activity controller of the role service node executing the target operation activity.
Hereinafter, step S410 and step S420 will be further explained and explained. Specifically, since the server cluster includes a plurality of role service nodes, the role service nodes of the corresponding game service for executing the target operation activity in the server cluster and the local activity handles of the role service logic for executing the target operation activity in the role service nodes for executing the game service are acquired first; after the local activity handle executing the character service logic is acquired, the local activity handle is registered in the corresponding local activity controller.
In the embodiment of the present example, through the global service node and the role service node, the problem that the operation activities exist in a single point form in the related art and all operation activities are unavailable once the failure occurs is solved, so that the lateral expansion of the game is facilitated, and the disaster recovery capability is improved.
In step S120, in response to the global service node executing the target operation activity, acquiring, by the global activity controller, activity data and an activity state related to the target operation activity, and synchronizing, via the global activity controller, the acquired activity data and activity state to the local activity controller, so that the character service node can execute a specified game service by accessing the local activity controller to acquire the activity data and activity state.
In this example embodiment, the global service node performs global service logic of the target operation activity through the global activity handle therein, and the character service node performs character service logic of the target operation activity through the local activity handle therein to complete game service corresponding to the target operation activity.
Referring to fig. 5, the global service node performing the target operation activity may include;
step S510, the global activity controller obtains activity data of the target operation activity, and obtains time configuration data of the target operation activity according to the activity data;
and S520, the global service node executes the target operation activity according to the time configuration data.
Hereinafter, step S510 and step S520 will be further explained and explained. Specifically, after the global activity handle is successfully registered, the global activity controller loads the activity data of the target operation activity, obtains the time configuration data of the target operation activity according to the configuration data in the activity data, and after obtaining the time configuration data, the global service node can execute the target operation activity according to the time configuration data. The time configuration data are corresponding times of different activity states of the target operation activity; the configuration data may include an open time, a settlement time, etc. of the target operation activity, or may be a numerical configuration related to the playing method of the target operation activity, such as a rewarding configuration, a monster configuration, etc., and the configuration data is not specifically limited in this example embodiment; the configuration data can also comprise repository data, wherein the repository data is a series of data which is generated in the target operation activity and needs to be stored in a lasting mode, such as activity progress, operation records of users, random results and the like, and the data has nonrenewability and needs to be stored in time so as to be reloaded and recovered after the server cluster is restarted or an instance fails to migrate. The repository data may also be activity data a number of times ago, as the data is used to play in-game presentation data, after the target global activity controller obtains the data, the stored data may be synchronized to the local node. For example: ranking list data corresponding to the last week of ending activities need to be shown; or when the character which is not logged in for a long time flows back, recording the repairing basis of the active state in the character data; or a certain activity task is taken from a week activity of a certain character, cleaning, rewarding and reimbursement are needed when logging in the week, and the method is not particularly limited in the example embodiment.
Further, referring to fig. 6, the global service node performing the target operation activity according to the time configuration data may include:
step S610, a global activity controller in the global service node obtains the current activity state of the target operation activity according to the time configuration data and the current time;
s620, configuring a timer for the second active state according to the time parameter of the second active state in the time configuration data, and executing the target operation activity based on the timer; wherein the second active state is the next active state to the current active state.
Hereinafter, step S610 and step S620 will be further explained and explained. Specifically, after obtaining time configuration data of the target operation activity, when the server is started, a global activity controller in the global service node calculates a current activity state of the target operation activity according to the current time and the time configuration data, configures a corresponding timer according to a time parameter of a next state of the current activity state, namely a second activity state, and executes the target operation activity based on the timer. The activity state of the target operation activity may be activity start, end, settlement, and the like, and the state of the target operation activity is not particularly limited in this example embodiment.
After the global activity controller of the global service node obtains the activity data of the target operation activity, the activity data may be synchronized into the local activity controller of the role service node.
Still further, referring to fig. 7, performing the target operation activity based on the timer may include:
step S710, triggering to switch the current active state into the second active state through the timer;
and S720, calling a state callback function of the global activity handle corresponding to the second activity state, and triggering and executing global business logic corresponding to the target operation activity through the state callback function.
Hereinafter, step S710 and step S720 will be further explained and explained. Specifically, when the time reaches the time parameter of the second active state, triggering the change of the current active state through a timer, and modifying the current active state into the second active state; when the activity state is changed, the global activity controller calls a state callback function of the global activity handle, and triggers the global service node to execute global service logic corresponding to the target operation activity through the state callback function and the obtained repository data in the activity data; for example, a series of lifecycle activities such as triggering target operation activity initialization, activity settlement, etc., which is not limited in this example embodiment; the state callback function is a callback function corresponding to the second active state, for example, when the second active state is an active start callback function, the state callback function may be an active start callback function. The timer ensures the normal conversion of the activity state of the target operation activity.
In this example embodiment, after executing the global business logic corresponding to the target operation activity by the state callback function, the in-game activity data control method further includes:
and updating the activity data of the target operation activity to obtain updated activity data.
Specifically, when the global business logic is executed through the global activity handle, the activity data may be modified, so that the activity data of the target operation activity needs to be updated to obtain updated activity data.
After obtaining updated activity data, obtaining, by the global activity controller, activity data and an activity state related to the target operation activity, and synchronizing, via the global activity controller, the obtained activity data and activity state to the local activity controller, may include:
and synchronizing the updated activity data and the second activity state to a local activity controller of the role service node.
Specifically, after obtaining the update activity data, the global activity controller can synchronize the update activity data and the second state data to the local activity controller of the persona business node via RPC (Remote Procedure Call ) communication. After synchronizing the data, referring to fig. 8, the character service node performs a designated game service by accessing the local activity controller to acquire the activity data and the activity state, which may include:
Step S810, the local activity controller of the role service node calls a state callback function of the local activity handle corresponding to the second activity state according to the updated activity data and the second activity state;
and S820, triggering and executing the role business logic of the target operation activity through a state callback function corresponding to the second activity state.
Hereinafter, step S810 and step S820 will be further explained and explained. Specifically, after the local activity controller of the role service node obtains the updated activity data and the second activity state, the updated activity data and the second activity data are stored, the updated activity data, the second activity state and the activity data and the current activity state obtained by the server when the server is started are compared, and when the updated activity data and the second activity data are found to change, a state callback function corresponding to the second activity state of the local activity handle is called, so that the local activity handle is based on the updated activity data, and the role service node is triggered to execute the role service logic corresponding to the target operation activity through the state callback function, so that the corresponding game service is completed. The local activity controller is used as a local cache of the character service node, and can directly acquire the activity data in the process when the game service needs to access the activity data without requesting the global activity controller through RPC communication, thereby reducing the development complexity of the game service and reducing the communication quantity in the game server cluster.
Executing the game service may include acquiring an online virtual character located at the character service node, notifying the online virtual character or updating character data of the online virtual character based on an execution result of executing the corresponding character service logic.
For example, the game server cluster has three global service nodes, each running on a different machine, each node having a global activity controller instance, G1, G2, G3; four role service nodes respectively run on different machines, and each node is provided with a local activity controller instance which is L1, L2, L3 and L4. There are now two types of operational activities in games: activity a: generating a monster during the activity and conducting a ranking prize according to the injury amount of the player to the monster, and B activity: the experience gained by the player is doubled during the activity.
After the game server cluster is started, the local controllers L1 to L4 register the local activity handles of the A, B activities. And G1, calculating according to the activity configuration of the A activity to obtain the starting time and the ending time of the A activity, calling a state callback interface of the global activity handle of the A activity when the A activity starts, wherein the state callback interface can be the activity starting callback interface, initializing a ranking list and notifying the activity state change to L1-L4. And after receiving the A activity state change notification, the L1-L4 call a state callback interface of the A activity local activity handle, carry out activity starting notification on the online virtual objects on the nodes where the L1-L4 are positioned, and brush out the activity monster in the appointed scene. The virtual object attacks the active monsters, attack data is synchronized to the global activity controller for repository, and the global activity handle triggers the calculation of the leaderboard at regular time.
And G2, calculating according to the activity configuration of the activity B to obtain the starting time and the ending time of the activity B, calling an activity starting callback interface of a global activity handle of the activity B when the activity B starts, calculating experience addition multiplying power by the global activity handle of the activity B according to parameters such as the server starting time, the server grade and the like, and synchronizing the experience addition multiplying power with the activity state to L1-L4. And after receiving the B activity state change notification, the L1-L4 call a state callback interface of a B activity local activity handle to perform activity opening notification on the online virtual objects on the nodes where the L1-L4 are located. When the online virtual object obtains experience during the activity, the experience addition multiplying power recorded on the local activity controller of the node B activity is read to perform experience addition.
The method of controlling activity data in a game according to an exemplary embodiment of the present disclosure is further explained and illustrated below with reference to fig. 9. The method for controlling the activity data in the game can comprise the following steps:
s910, setting a timer by the global activity controller, and calculating an activity state;
s920, when the activity state is changed, requesting activity data from a database, and loading the activity data;
S930, calling a state callback interface of the global movable handle;
step S940, synchronizing the activity data and the activity state to a local activity controller of a local node;
s950, when the synchronization fails, performing synchronization retry;
s960, the local activity controller calls a state callback interface of the local activity handle;
s970, notifying the online virtual roles or changing the angle data;
and S980, storing the role data into a database.
The method for controlling the activity data in the game provided by the example embodiment of the present disclosure has at least the following advantages: on one hand, the global service node is utilized to execute the target operation activity, the role service node is utilized to execute the game service of the target operation activity, and the problem existing in the related technology in a single-point form is solved through the global service node and the role service node; on the other hand, the operation activity exists in a single point form, when the process of the operation activity is crashed or the machine is down, the service is unavailable, the user experience is affected, the problem that the service is unavailable when the process of the operation activity is crashed or the machine is down is solved through the global service node, the disaster recovery capability is improved, and meanwhile, the game experience of a user is improved; in still another aspect, the local activity controller stores the data synchronized by the global activity controller, so that when the state callback interface of the local activity handle is invoked, the data can be directly obtained in the role service node, and the global activity controller of the target operation activity is not required to be requested through RPC communication, thereby reducing the complexity of game service development and reducing the communication traffic in the game server cluster.
The exemplary embodiment of the present disclosure also provides an activity data control apparatus in a game, as shown with reference to fig. 10, may include: the activity handle registration module 1010 and the operation activity implementation module 1020. Wherein:
an activity handle registration module 1010 for determining a target operation activity for a target game, and registering a global activity handle of the target operation activity to the global activity controller and a local activity handle of the target operation activity to the local activity controller;
and an operation activity implementation module 1020, configured to respond to the global service node to perform the target operation activity, obtain, by using the global activity controller, activity data and an activity state related to the target operation activity, and synchronize, via the global activity controller, the obtained activity data and activity state to the local activity controller, so that the role service node can perform a specified game service by accessing the local activity controller to obtain the activity data and activity state.
The specific details of each module in the above-mentioned activity data control device in the game have been described in detail in the corresponding activity data control method in the game, so that the details are not repeated here.
In an exemplary embodiment of the disclosure, the registering the global activity handle of the target operation activity with the global activity controller includes:
determining a global activity handle of global business logic for executing the target operation activity;
acquiring an activity type number of the target operation activity, performing hash calculation on the activity type number by using a distributed consistency hash algorithm, and determining a global activity controller matched with the target operation activity;
registering the global activity handle with the global activity controller.
In an exemplary embodiment of the disclosure, the registering the local activity handle of the target operation activity with the local activity controller includes:
acquiring a role service node in the server side for executing the game service corresponding to the target operation activity and a local activity handle of the role service logic in the role service node for executing the target operation activity;
registering the local activity handle in a local activity controller of a role service node executing the target operation activity.
In one exemplary embodiment of the present disclosure, the global service node performs the target operational activity, including;
The global activity controller obtains activity data of the target operation activity, and obtains time configuration data of the target operation activity according to the activity data;
and the global service node executes the target operation activity according to the time configuration data.
In an exemplary embodiment of the present disclosure, the global service node performing the target operation activity according to the time configuration data includes:
a global activity controller in the global service node obtains the current activity state of the target operation activity according to the time configuration data and the current time;
configuring a timer for a second active state according to a time parameter of the second active state in the time configuration data, and executing the target operation activity based on the timer; wherein the second active state is the next active state to the current active state.
In an exemplary embodiment of the present disclosure, after obtaining the current activity state of the target operation activity, the method further includes:
and synchronizing activity data of the target operation activity and the current activity state to the global activity controller.
In one exemplary embodiment of the present disclosure, performing the target operational activity based on the timer includes:
triggering to switch the current active state to the second active state through the timer;
and calling a state callback function of the global activity handle corresponding to the second activity state, and triggering and executing global business logic corresponding to the target operation activity through the state callback function.
In an exemplary embodiment of the present disclosure, after executing global business logic corresponding to the target operation activity by the state callback function, the method further comprises:
and updating the activity data of the target operation activity to obtain updated activity data.
In one exemplary embodiment of the present disclosure, acquiring, by the global activity controller, activity data and an activity state related to the target operation activity, and synchronizing, via the global activity controller, the acquired activity data and activity state to the local activity controller, includes:
and synchronizing the updated activity data and the second activity state to a local activity controller of the role service node.
In one exemplary embodiment of the present disclosure, a character service node performs a specified game service by accessing the local activity controller to acquire the activity data and the activity state, including:
the local activity controller of the role service node calls a state callback function of the local activity handle corresponding to the second activity state according to the updated activity data and the second activity state;
and triggering and executing the role business logic of the target operation activity through a state callback function corresponding to the second activity state.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Furthermore, although the steps of the methods of the present invention are depicted in the accompanying drawings in a particular order, this is not required to either imply that the steps must be performed in that particular order, or that all of the illustrated steps be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.
Those skilled in the art will appreciate that the various aspects of the invention may be implemented as a system, method, or program product. Accordingly, aspects of the invention may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
An electronic device 1100 according to this embodiment of the invention is described below with reference to fig. 11. The electronic device 1100 shown in fig. 11 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 11, the electronic device 1100 is embodied in the form of a general purpose computing device. Components of electronic device 1100 may include, but are not limited to: the at least one processing unit 1110, the at least one memory unit 1120, a bus 1130 connecting the different system components (including the memory unit 1120 and the processing unit 1110), and a display unit 1140.
Wherein the storage unit stores program code that is executable by the processing unit 1110 such that the processing unit 1110 performs steps according to various exemplary embodiments of the present invention described in the above-described "exemplary methods" section of the present specification. For example, the processing unit 1110 may perform step S110 as shown in fig. 1: determining a target operational activity for a target game, and registering a global activity handle of the target operational activity with the global activity controller and a local activity handle of the target operational activity with the local activity controller; s120: and responding to the global service node to execute the target operation activity, acquiring activity data and activity states related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity states to the local activity controller by the global activity controller so that the role service node can execute a specified game service by accessing the local activity controller to acquire the activity data and activity states.
The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a Random Access Memory (RAM) 11201 and/or a cache memory 11202, and may further include a Read Only Memory (ROM) 11203.
The storage unit 1120 may also include a program/utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
The bus 1130 may be a local bus representing one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a bus using any of a variety of bus architectures.
The electronic device 1100 may also communicate with one or more external devices 1200 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1100, and/or any devices (e.g., routers, modems, etc.) that enable the electronic device 1100 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 1150. Also, electronic device 1100 can communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 1160. As shown, network adapter 1160 communicates with other modules of electronic device 1100 via bus 1130. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 1100, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks, redundant array of independent disks) systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present invention may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present invention.
In an exemplary embodiment of the present invention, a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification is also provided. In some possible embodiments, the various aspects of the invention may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the invention as described in the "exemplary methods" section of this specification, when said program product is run on the terminal device.
A program product for implementing the above-described method according to an embodiment of the present invention may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF (Radio Frequency) and the like, or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
Furthermore, the above-described drawings are only schematic illustrations of processes included in the method according to the exemplary embodiment of the present application, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.

Claims (13)

1. The method is characterized by being applied to a server, wherein the server comprises a global service node and a role service node, the global service node is provided with a global activity controller, and the role service node is provided with a local activity controller, and the method comprises the following steps:
Determining a target operational activity for a target game, and registering a global activity handle of the target operational activity with the global activity controller and a local activity handle of the target operational activity with the local activity controller;
and responding to the global service node to execute the target operation activity, acquiring activity data and activity states related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity states to the local activity controller by the global activity controller so that the role service node can execute a specified game service by accessing the local activity controller to acquire the activity data and activity states.
2. The in-game activity data control method according to claim 1, wherein the registering the global activity handle of the target operation activity to the global activity controller includes:
determining a global activity handle of global business logic for executing the target operation activity;
acquiring an activity type number of the target operation activity, performing hash calculation on the activity type number by using a distributed consistency hash algorithm, and determining a global activity controller matched with the target operation activity;
Registering the global activity handle with the global activity controller.
3. The in-game activity data control method according to claim 1, wherein the registering the local activity handle of the target operation activity with the local activity controller includes:
acquiring a role service node in the server side for executing the game service corresponding to the target operation activity and a local activity handle of the role service logic in the role service node for executing the target operation activity;
registering the local activity handle in a local activity controller of a role service node executing the target operation activity.
4. The in-game activity data control method of claim 1, wherein the global service node performs the target operation activity, comprising;
the global activity controller obtains activity data of the target operation activity, and obtains time configuration data of the target operation activity according to the activity data;
and the global service node executes the target operation activity according to the time configuration data.
5. The in-game activity data control method of claim 4, wherein the global service node performs the target operation activity according to the time configuration data, comprising:
A global activity controller in the global service node obtains the current activity state of the target operation activity according to the time configuration data and the current time;
configuring a timer for a second active state according to a time parameter of the second active state in the time configuration data, and executing the target operation activity based on the timer; wherein the second active state is the next active state to the current active state.
6. The in-game activity data control method according to claim 5, characterized in that after obtaining the current activity state of the target operation activity, the method further comprises:
and synchronizing activity data of the target operation activity and the current activity state to the global activity controller.
7. The in-game activity data control method according to claim 5, wherein executing the target operation activity based on the timer comprises:
triggering to switch the current active state to the second active state through the timer;
and calling a state callback function of the global activity handle corresponding to the second activity state, and triggering and executing global business logic corresponding to the target operation activity through the state callback function.
8. The in-game activity data control method of claim 7, wherein after executing global business logic corresponding to the target operational activity by the state callback function, the method further comprises:
and updating the activity data of the target operation activity to obtain updated activity data.
9. The in-game activity data control method according to claim 8, wherein acquiring, by the global activity controller, the activity data and the activity state related to the target operation activity, and synchronizing, via the global activity controller, the acquired activity data and activity state to the local activity controller, comprises:
and synchronizing the updated activity data and the second activity state to a local activity controller of the role service node.
10. The in-game activity data control method of claim 9, wherein a character service node performs a specified game service by accessing the local activity controller to acquire the activity data and an activity state, comprising:
the local activity controller of the role service node calls a state callback function of the local activity handle corresponding to the second activity state according to the updated activity data and the second activity state;
And triggering and executing the role business logic of the target operation activity through a state callback function corresponding to the second activity state.
11. An activity data control device in a game, wherein the activity data control device is applied to a server, the server comprises a global service node and a role service node, the global service node is provided with a global activity controller, and the role service node is provided with a local activity controller, the device comprises:
an activity handle registration module for determining a target operation activity for a target game, registering a global activity handle of the target operation activity to the global activity controller and registering a local activity handle of the target operation activity to the local activity controller;
and the operation activity realizing module is used for responding to the global service node to execute the target operation activity, acquiring the activity data and the activity state related to the target operation activity by the global activity controller, and synchronizing the acquired activity data and activity state to the local activity controller by the global activity controller so that the role service node can execute the appointed game service by accessing the local activity controller to acquire the activity data and the activity state.
12. A storage medium having stored thereon a computer program, which when executed by a processing unit implements the activity data control method in a game according to any of claims 1-10.
13. An electronic device, comprising:
a processing unit; and
a storage unit configured to store executable instructions of the processing unit;
wherein the processing unit is configured to perform the in-game activity data control method of any one of claims 1-10 via execution of the executable instructions.
CN202311206397.5A 2023-09-18 2023-09-18 Method and device for controlling activity data in game, storage medium and electronic equipment Pending CN117180728A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311206397.5A CN117180728A (en) 2023-09-18 2023-09-18 Method and device for controlling activity data in game, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311206397.5A CN117180728A (en) 2023-09-18 2023-09-18 Method and device for controlling activity data in game, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117180728A true CN117180728A (en) 2023-12-08

Family

ID=88988513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311206397.5A Pending CN117180728A (en) 2023-09-18 2023-09-18 Method and device for controlling activity data in game, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117180728A (en)

Similar Documents

Publication Publication Date Title
US10887167B2 (en) Adaptive software-defined storage for cloud storage workloads
CN109639794A (en) A kind of stateful cluster recovery method, apparatus, equipment and readable storage medium storing program for executing
US9864801B2 (en) Responsive layout based on behavioral intent in a multi-tenant platform-as-a-service (PaaS) system
CN109542744B (en) Method, device, storage medium and terminal for detecting abnormal starting problem of terminal
CN110083455B (en) Graph calculation processing method, graph calculation processing device, graph calculation processing medium and electronic equipment
CN110083541B (en) Game test method, game test device, computer storage medium and electronic equipment
CN109731334B (en) State switching method and device, storage medium and electronic device
US11126920B2 (en) Interaction scenario display control method and information processing apparatus
CN108628716B (en) Information receiving and managing system, method and device
CN107666493B (en) Database configuration method and equipment thereof
CN112835688A (en) Distributed transaction processing method, device and storage medium
CN110138577B (en) Cluster creation method, first server and readable storage medium
CN107665141B (en) Database configuration method and equipment thereof
CN112527397A (en) Method and device for modifying basic input output system options and computer equipment
CN111104147A (en) BMC upgrading method, device, terminal and storage medium
CN109739619A (en) A kind of processing method, device and storage medium based on containerization application
US8719622B2 (en) Recording and preventing crash in an appliance
CN111506331A (en) Server BMC refreshing method, system, terminal and storage medium
CN112044061B (en) Game picture processing method and device, electronic equipment and storage medium
TWI507889B (en) Management node , method , machine 一accessible medium and system for reservation and execution image writing of native computing devices
EP4006725A1 (en) Virtual machine migration processing and strategy generation method, apparatus and device, and storage medium
JP2023518779A (en) Network connection method and apparatus for training participants of common training model
CN117180728A (en) Method and device for controlling activity data in game, storage medium and electronic equipment
CN109495298B (en) Method and device for managing nodes in OpenStack system
CN115629785A (en) Upgrading method, electronic device and storage medium

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