Entity switching method, device, system, and medium
By serializing entities on the game server and creating them on the user side, the problems of flickering and inconsistent appearance during entity switching are solved, imperceptible entity switching is achieved, and the visual effects of the game are improved.
Patent Information
- Application Number
- CN202010745581.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-29
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2040-07-29
AI Technical Summary
The existing technology causes flickering, inconsistent model appearance, and discontinuous movements when switching entities in the game, which affects the visual experience.
The first entity is serialized into data on the server side, and the second entity is created on the user side. The parameters are fully transferred during the serialization and deserialization process, thus achieving entity switching without user perception.
It avoids flickering during entity switching, ensures the consistency of model appearance and continuity of movement, and improves the smoothness and visual experience of entity switching.
Smart Images

Figure CN112044056B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image technology, and in particular to an entity switching method and apparatus, equipment, system, and medium. Background Art
[0002] An entity is any element in the game, such as a character or item. To facilitate operations like switching between maps, entering and exiting dungeons, and obtaining quests, you need to switch entities in the game.
[0003] For example, when switching from one game map to another, the current entity switching solution requires deleting the old entity in the game scene displayed to the user before creating the new one. Because the rendering of the new entity takes a certain amount of time, after the cross-map operation is triggered, the entity displayed in the game scene will disappear and then reappear, causing users to observe flickering and affecting the visual experience.
[0004] Moreover, in the game scene displayed to the user, the entity is mainly represented by the model corresponding to the entity. During the current entity switching process, the model corresponding to the old entity will also be switched to the model corresponding to the new entity. The appearance of the model is affected by multiple parameters such as position and motion state. Since the new entity may not inherit all the parameters of the old entity during the entity switching process, the appearance of the model corresponding to the old entity and the model corresponding to the new entity are inconsistent, and the movements are discontinuous. For example, assuming that the entity to be switched is a certain character, and assuming that the model corresponding to the character is performing a jumping action during the entity switching process, if some motion state parameters are lost during the entity switching process, the model corresponding to the character may fall to the ground as soon as it performs the jumping action in the game scene.
[0005] In summary, how to perform entity switching to avoid the flickering phenomenon caused by the current entity switching solution, as well as the inconsistent appearance and discontinuous movement of the models corresponding to the entities before and after the entity switching, has become a technical problem that needs to be solved urgently. Summary of the Invention
[0006] Embodiments of the present invention provide a physical switching method, apparatus, device, system, and medium for improving the smoothness of physical switching and enhancing visual effects.
[0007] In a first aspect, an embodiment of the present invention provides a physical switching method, the method comprising:
[0008] The server serializes the first entity into first entity data;
[0009] Create a second entity, and import the second entity data obtained by deserializing the first entity data into the second entity;
[0010] An entity switching instruction is sent to the user terminal, wherein the user terminal has loaded an entity display model corresponding to the server entity, and the entity switching instruction is used to instruct the user terminal to switch the server entity corresponding to the entity display model from a first entity to a second entity.
[0011] In a possible embodiment, the first entity and the second entity are in different service processes.
[0012] After the server serializes the first entity into first entity data, the method further includes: synchronizing the first entity data from a first service process where the first entity is located to a second service process where the second entity is located.
[0013] In a possible embodiment, the first service process and the second service process are respectively located in different server devices.
[0014] Synchronizing first entity data from a first service process where the first entity is located to a second service process, including: if the first entity is a player character, storing player component data in the first entity in a preset database; and transmitting the first entity data from the first service process to the second service process through a remote procedure call.
[0015] In a possible embodiment, the server serializes the first entity into first entity data, including: determining multiple entity components included in the first entity; and converting the multiple entity components into an entity data sequence.
[0016] Creating a second entity and importing the second entity data obtained by deserializing the first entity data into the second entity includes: creating an entity object to be configured; restoring the entity data sequence into multiple entity components; and configuring the entity object based on the multiple entity components to obtain the second entity.
[0017] In a possible embodiment, converting multiple entity components into corresponding entity data sequences includes: parsing multiple entity components and parameters from a first entity; and converting the multiple entity components and parameters into respective corresponding binary data sets.
[0018] Restoring an entity data sequence into multiple entity components includes parsing a binary data set into multiple sets of structured data, and using the multiple sets of structured data as multiple entity components and parameters.
[0019] Configuring the entity object based on the multiple entity components to obtain a second entity includes: importing the multiple entity components and parameters into the data structure of the entity object to obtain the second entity.
[0020] In a possible embodiment, the entity switching instruction carries an identifier of the second entity.
[0021] Switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity refers to: updating the identifier of the server-side entity corresponding to the entity presentation model to the identifier of the second entity.
[0022] In a possible embodiment, the running state of the second entity is inherited from the running state of the first entity.
[0023] The process of switching the server entity corresponding to the entity presentation model from the first entity to the second entity further includes: maintaining the running state of the entity presentation model to correspond to the running state of the first entity.
[0024] In a possible embodiment, after sending the entity switching instruction to the user terminal, the method further includes:
[0025] In response to the switching completion instruction fed back by the user end, the first entity data is deleted, and a notification message is sent to the user end, where the notification message is used to indicate that the first entity data has been deleted in the server end.
[0026] In a second aspect, an embodiment of the present invention provides a physical switching device, which is applied to a server, and includes:
[0027] A serialization module, configured to serialize the first entity into first entity data;
[0028] A creation module, configured to create a second entity and import the second entity data obtained by deserializing the first entity data into the second entity;
[0029] The notification module is used to send an entity switching instruction to the user terminal, wherein the user terminal is loaded with an entity display model corresponding to the server entity, and the entity switching instruction is used to instruct the user terminal to switch the server entity corresponding to the entity display model from a first entity to a second entity.
[0030] In a possible embodiment, the server includes a first service process where the first entity is located and a second service process where the second entity is located.
[0031] The entity switching device further includes a synchronization module. The synchronization module is specifically configured to: after the server serializes the first entity into first entity data, synchronize the first entity data from a first service process where the first entity resides to a second service process where the second entity resides. The second service process is the service process where the second entity resides. After deserializing the first entity data to obtain the second entity data into the second entity, the first entity data is deleted from the first service process.
[0032] In a possible embodiment, the first service process and the second service process are respectively located in different server devices.
[0033] When the synchronization module synchronizes the first entity data from the first service process where the first entity is located to the second service process, it is specifically used to: if the first entity is a player character, store the player component data in the first entity to a preset database; and transmit the first entity data from the first service process to the second service process through a remote procedure call.
[0034] When deleting the first entity data in the first service process, the synchronization module is specifically used to: send an entity deletion instruction to the first service process, where the entity deletion instruction is used to instruct the first service process to delete the first entity data.
[0035] In a possible embodiment, the serialization module is specifically configured to: determine a plurality of entity components included in the first entity; and convert the plurality of entity components into an entity data sequence.
[0036] The creation module is specifically used to: create an entity object to be configured; restore the entity data sequence to the multiple entity components; and configure the entity object based on the multiple entity components to obtain the second entity.
[0037] In a possible embodiment, when the serialization module converts the multiple entity components into corresponding entity data sequences, it is specifically used to: parse the multiple entity components and parameters from the first entity; and convert the multiple entity components and the parameters into their respective corresponding binary data sets.
[0038] When the creation module restores the entity data sequence into the multiple entity components, it is specifically used to: parse the binary data set into multiple groups of structured data, and use the multiple groups of structured data as the multiple entity components and the parameters.
[0039] When the creation module configures the entity object based on the multiple entity components to obtain the second entity, it is specifically used to: import the multiple entity components and the parameters into the data structure of the entity object to obtain the second entity.
[0040] In a possible embodiment, the entity switching instruction carries an identifier of the second entity.
[0041] Switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity refers to: updating the identifier of the server-side entity corresponding to the entity presentation model to the identifier of the second entity.
[0042] In a possible embodiment, the running state of the second entity is inherited from the running state of the first entity; switching the server entity corresponding to the entity presentation model from the first entity to the second entity further includes: maintaining the running state of the entity presentation model corresponding to the running state of the first entity.
[0043] In a possible embodiment, the entity switching device further includes a deletion module, specifically configured to:
[0044] After the notification module sends an entity switching instruction to the user terminal, in response to a switching completion instruction fed back by the user terminal, the first entity data is deleted, and a notification message is sent to the user terminal through the notification module, where the notification message is used to indicate that the first entity data has been deleted in the server.
[0045] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the entity switching method described above.
[0046] An embodiment of the present invention further provides a system, including a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the entity switching method described above.
[0047] An embodiment of the present invention provides a computer-readable medium on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the entity switching method described above.
[0048] In an embodiment of the present invention, the server serializes the first entity into first entity data, creates a second entity, and imports the second entity data obtained by deserializing the first entity data into the second entity. Thus, through the serialization and deserialization process, all parameters of the first entity are completely passed to the second entity, avoiding the phenomenon of incomplete parameter inheritance on the server side during the entity switching process, thereby ensuring the integrity of parameter inheritance. Based on the integrity of parameter inheritance, for the entity display model corresponding to the server entity loaded in the user side, the server side will also send an entity switching instruction to the user side. The entity switching instruction is used to instruct the user side to switch the server entity corresponding to the entity display model from the first entity to the second entity. Thus, the user side achieves a user-imperceptible entity switching process by changing the correspondence between the entity display model and the server entity. For the user side, not only does it not need to create and render a new entity, avoiding flickering, simplifying the entity switching process, and improving the efficiency of entity switching; in addition, since the switched server entity inherits all parameters of the entity before switching, the entity display model corresponding to the server entity can present a consistent appearance and continuous movement, greatly improving the smoothness of entity switching and improving the visual experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 A schematic diagram of a physical switching scenario provided by an embodiment of the present invention;
[0051] Figure 2 A flow chart of a physical switching method provided by one embodiment of the present invention;
[0052] Figure 3 A schematic diagram of the principle of an entity switching process provided by one embodiment of the present invention;
[0053] Figure 4 A schematic diagram of another entity switching process provided by an embodiment of the present invention;
[0054] Figure 5 A schematic structural diagram of a physical switching device provided by an embodiment of the present invention;
[0055] Figure 6 For Figure 5 A schematic structural diagram of an electronic device corresponding to the physical switching device provided in the illustrated embodiment. DETAILED DESCRIPTION
[0056] The present invention will now be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the present invention, rather than to imply any limitation on the scope of the present invention.
[0057] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including, but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as meaning "at least one embodiment." The term "another embodiment" is to be interpreted as meaning "at least one other embodiment."
[0058] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0059] The entity switching solution provided in the embodiments of the present invention is applicable to various entities. Examples of these entities include characters and props in games. For any entity, the logic associated with that entity must run on both the server and the client. The server primarily controls the entity's functional logic, while the client primarily controls the entity's presentation logic, such as its action effects. The logic running on the server and client is independent of each other.
[0060] In fact, the entity creation process can be: the server first creates the entity, and then the server triggers the user to create the entity display model (also called model) and corresponding visual effects that need to be presented.
[0061] Figure 1 A schematic diagram of an entity switching scenario provided by an embodiment of the present invention is shown as follows: Figure 1 As shown, the entity switching scenario includes: a server and a user. Optionally, at least one service process is running in the server.
[0062] exist Figure 1 In the example, it is assumed that the user end includes device a and device b. In practice, the user end can be a terminal device such as a smartphone, tablet computer, PC, laptop, etc. Optionally, the server end can be deployed on a cloud platform.
[0063] In fact, the user end can be a device such as a smartphone, tablet computer, PC, laptop computer, etc. The server end can be implemented as: a business instance, a virtual machine, a hardware device. For example, the server end can be implemented as a business instance deployed on one or more devices of the cloud platform. In simple terms, the server end can be understood as a software deployed on the cloud platform for executing the entity switching process. Alternatively, the server end can also be implemented as a virtual machine deployed on one or more devices of the cloud platform. The virtual machine is installed with application software for executing the entity switching process. Alternatively, the server end can also be implemented as one or more hardware devices among the many hardware devices that make up the cloud platform to execute the entity switching process.
[0064] In fact, the entity switching solution provided by the embodiment of the present invention is applicable to various entity switching scenarios, such as cross-map scenarios, entering / leaving copy scenarios, entering and exiting plane scenarios, and task acceptance scenarios.
[0065] The following specifically describes the technical problems existing in the existing entity switching solution provided by the embodiment of the present invention:
[0066] In existing entity switching solutions, after triggering an entity switching operation, the old entity must be deleted from the game scene displayed on the user side before a new entity is created. Because the rendering process of the new entity takes a certain amount of time, the entity in the game scene displayed on the user side will disappear and then reappear, causing the user to observe flickering of the entity, affecting the visual experience. Because the new entity may not inherit all the parameters of the old entity during the entity switching process, the model corresponding to the new entity may appear inconsistent with the model corresponding to the old entity and its movement may be discontinuous.
[0067] In summary, how to perform entity switching to avoid the flickering phenomenon caused by the current entity switching solution and the inconsistent appearance and discontinuous movement of the model before and after switching has become a technical problem that needs to be solved urgently.
[0068] To solve the above problems, the core idea of the physical switching solution provided by the embodiment of the present invention is:
[0069] The server first serializes the first entity into first entity data so as to pass the various parameters included in the first entity to the newly created entity. Then, the server creates a second entity and imports the second entity data obtained by deserializing the first entity data into the second entity. Thus, all the parameters of the first entity are completely passed to the second entity through the serialization and deserialization process, avoiding the phenomenon of incomplete parameter inheritance on the server during the entity switching process, thereby ensuring the integrity of parameter inheritance. On the basis of the integrity of parameter inheritance on the server, for the entity display model corresponding to the server entity loaded in the user terminal, the server will also send an entity switching instruction to the user terminal. The entity switching instruction is used to instruct the user terminal to switch the server entity corresponding to the entity display model from the first entity to the second entity. Thus, the user terminal changes the correspondence between the entity display model and the server entity, so that the entity display model in the user terminal corresponds to the switched server entity, thereby realizing a user-unaware entity switching process on the user terminal. For the user side, not only does it not need to create and render a new entity, avoiding the flickering phenomenon caused by deleting the old entity and creating a new entity on the user side, but also because the server-side entity after switching inherits all the parameters of the entity before switching, the entity display model corresponding to the server-side entity can present a consistent appearance and continuous movements, greatly improving the smoothness of entity switching and improving the visual experience.
[0070] After introducing the basic idea of the physical switching solution, various non-limiting embodiments of the present invention are described in detail below.
[0071] The execution process of the entity switching method is described below in conjunction with the following embodiments.
[0072] Figure 2 Flowchart of a physical switching method provided by an embodiment of the present invention. Figure 2 As shown, the entity switching method includes the following steps:
[0073] 201. Serialize the first entity into first entity data;
[0074] 202. Create a second entity, and import the second entity data obtained by deserializing the first entity data into the second entity;
[0075] 203. Send an entity switching instruction to the user terminal, where the entity switching instruction is used to instruct the user terminal to switch the server entity corresponding to the entity presentation model from the first entity to the second entity.
[0076] The entity switching method in the embodiment of the present invention is applied to a server, which is loaded with at least one entity. For the sake of distinction, all entities loaded by the server are collectively referred to as server entities, and the server entity to be switched is referred to as the first entity.
[0077] The user end loads an entity display model corresponding to the server end entity. Optionally, a corresponding relationship between the server end entity and the entity display model can be established in advance.
[0078] In actual applications, taking the first entity as an example, the entity creation process can be: the server first creates the first entity, and then the server sends relevant data of the first entity to the user end, such as the entity number of the first entity in the server end, to trigger the user end to create an entity display model corresponding to the first entity based on the relevant data, and render the visual effects corresponding to the entity display model.
[0079] Figure 3 For Figure 2 The interactive process corresponding to an entity switching method is shown in FIG. Figure 3 The interaction process between the server and the user is shown in detail, and the specific execution process of the entity switching method provided by the embodiment of the present invention is described in detail:
[0080] 301. Initiate entity switching process.
[0081] In actual applications, the entity switching process can be initiated by the server or the user. The conditions for initiating entity switching include but are not limited to: cross-map operations, operations entering and exiting dungeons, operations entering and exiting planes, and obtaining tasks.
[0082] In an optional embodiment, in response to a certain action instruction fed back by the user end, the server end determines the first entity to be switched and initiates a switching process of the first entity.
[0083] For example, let's assume the server is a game server and the user is a game client. Assuming an action command is a task acceptance command, if the user-controlled game entity triggers a task and confirms its acceptance, this is considered to have met the command trigger condition, triggering the game client to send a task acceptance command corresponding to the task back to the game server. The game server receives the task acceptance command, determines the first entity to switch to based on the task acceptance command, and initiates the switching process for the first entity.
[0084] Alternatively, in another optional embodiment, the entity switching process is initiated by setting a control item in the server. When the user selects the control item, the entity switching process is initiated.
[0085] 302. The server serializes the first entity into first entity data.
[0086] In order to ensure data consistency before and after entity switching, that is, the server entity after switching can completely inherit all data of the server entity before switching, in 302, the server needs to serialize the first entity into first entity data.
[0087] The first entity includes multiple entity components. For example, if the first entity is an entity in the game, the multiple entity components include, but are not limited to, a player component, an NPC component, a movement component, a backpack component, a spirit beast component, an equipment component, a skill component, and a status component. These entity components are essentially structured data used to configure the first entity. Optionally, the first entity data is actually unstructured data, such as binary data. Unstructured data is more convenient for data transmission and helps reduce data loss.
[0088] Specifically, serializing the first entity into first entity data may be implemented by: determining multiple entity components included in the first entity; and converting the multiple entity components into an entity data sequence.
[0089] Specifically, converting multiple entity components into an entity data sequence is specifically implemented as follows: the server parses multiple entity components and parameters from the first entity; and converts the multiple entity components and parameters into their respective corresponding binary data sets.
[0090] In practice, the server parses the first entity to extract multiple sets of structured data, namely, multiple entity components and parameters. Parameters include, but are not limited to, the model's position, motion, direction, item information, and character status information. Character status information, for example, is the character's health, while item information, for example, is the amount of currency in a backpack, item type, and item quantity. Consequently, the multiple entity components are converted one by one into their corresponding binary data sets, and the parameters are stored in the corresponding binary data sets of the entity components.
[0091] In practical applications, entity data sequences can be implemented as binary byte streams. By converting multiple entities one by one into their corresponding entity data sequences, it helps to reduce data loss during entity switching and ensure data consistency before and after entity switching.
[0092] Optionally, before serializing the first entity, preset type data, such as player component data, may be selected from the first entity, and the selected preset type data may be transmitted to the database to further prevent data loss during subsequent entity switching.
[0093] 303. The server creates a second entity and imports the second entity data obtained by deserializing the first entity data into the second entity.
[0094] Still taking the entity data sequence above as an example, deserializing the first entity data to obtain the second entity data, and generating the second entity based on the second entity data can be implemented as follows:
[0095] An entity object to be configured is created; an entity data sequence is restored into a plurality of entity components; and the entity object is configured based on the plurality of entity components to obtain a second entity.
[0096] Specifically, the server parses the first entity data into multiple groups of structured data, and these multiple groups of structured data are the restored multiple entity components and parameters. The multiple entity components here are consistent with the multiple entity components in step 302 above. Then, the server imports the multiple entity components and parameters into the data structure of the entity object to obtain the second entity. In simple terms, the server adds the above multiple entity components to the entity object to be configured, and sets the entity components added to the entity object to be configured based on the above parameters to obtain the second entity. Assuming that the entity object is a certain character, the parameters that need to be set for the entity components added to the entity object to be configured include but are not limited to: direction information, location information, the character's health information, and the props information and currency amount in the backpack.
[0097] 304. The server sends an entity switching instruction to the user terminal.
[0098] 305. The user end switches the server-side entity corresponding to the entity presentation model from the first entity to the second entity.
[0099] To implement entity switching on the user side, after generating the second entity, the server side needs to send an entity switching instruction to the user side. The entity switching instruction is used to instruct the user side to switch the server-side entity corresponding to the entity presentation model from the first entity to the second entity. Optionally, the entity switching instruction carries an identifier of the second entity.
[0100] After receiving the entity switching instruction, the user end switches the server-side entity corresponding to the entity presentation model from the first entity to the second entity.
[0101] Optionally, switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity refers to: updating the identifier of the server-side entity corresponding to the entity presentation model to the identifier of the second entity.
[0102] For example, assume that the server-side entity identifier is an entity number stored on the server. Assume that the entity number of the first entity is 0001 and the entity number of the second entity is 0010. Based on this, after receiving the entity switching instruction, the user end parses the entity switching instruction to obtain the entity number of the second entity, i.e., 0010, and thereby updates the entity number of the server-side entity corresponding to the entity presentation model from 0001 to 0010.
[0103] Essentially, the purpose of steps 304 and 305 is to, based on the integrity of server-side parameter inheritance, change the correspondence between the entity display model and the server-side entity so that the entity display model on the user side corresponds to the server-side entity after the switch, thereby achieving a user-imperceptible entity switching process on the user side. It is understandable that since there is no need to create and render a new entity on the user side, the flickering phenomenon caused by deleting old entities and creating new entities on the user side can be effectively avoided. Furthermore, the server-side entity after the switch inherits all the parameters of the entity before the switch, so that the entity display model corresponding to the server-side entity after the switch can present a consistent appearance and continuous movement.
[0104] The term "user-unaware" here refers not only to users of the client. Essentially, it refers to all relevant personnel who can view the client. This "user-unaware" can be understood as meaning that users will not experience any unsmoothness caused by entity switching in the 3D scene displayed on the client, such as flickering, inconsistent model appearance, or discontinuous motion.
[0105] On the basis of the integrity of the server-side parameter inheritance, it is also important to note that the operating state of the second entity is inherited from the operating state of the first entity. During the process of switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity, the user side will also maintain the operating state of the entity presentation model corresponding to the operating state of the first entity. In simple terms, this means that the second entity includes all the parameters of the first entity, so that all the parameters of the server-side entity corresponding to the entity presentation model remain unchanged during the entity switching process. In this way, the operating state of the entity presentation model can be maintained at the operating state presented when the entity presentation model corresponded to the first entity before the entity switching.
[0106] 306. The user end feeds back a switching completion instruction to the server end.
[0107] 307. The server deletes the first entity data in response to the switching completion instruction fed back by the user end, and sends a notification message to the user end.
[0108] Finally, the user end feeds back a switching completion instruction to the server end, and the server end receives the switching completion instruction fed back by the user end, which is used to indicate that the user end has switched the server entity corresponding to the entity display model from the first entity to the second entity, that is, the user end has completed the entity switching.
[0109] In response to the switching completion instruction, the server deletes the first entity data and sends a notification message to the user end, where the notification message is used to indicate that the first entity data has been deleted in the server.
[0110] In fact, in addition to the above-mentioned first entity data, the server can also delete other data related to the first entity, such as the entity logic and operation log corresponding to the first entity.
[0111] Through the above steps 301 to 307, the smoothness of entity switching between the server and the user can be improved.
[0112] Figure 4 For Figure 2 The interactive process corresponding to another entity switching method is shown. Assume that the first entity and the second entity are in different service processes in the interactive process. Figure 4 , the interaction process includes the following steps:
[0113] 401. Initiate entity switching process.
[0114] In actual applications, the entity switching process can be initiated by the server or the user.
[0115] 402. The server serializes the first entity into first entity data.
[0116] The first entity includes multiple entity components. Here, the multiple entity components can be understood as multiple sets of structured data used to configure the first entity. The first entity data can be understood as unstructured data, such as binary data.
[0117] Optionally, to ensure data consistency before and after entity switching and facilitate subsequent data transmission, multiple entity components need to be converted into entity data sequences one by one. Unstructured data is more convenient for data transmission and helps reduce data loss.
[0118] 403. The server synchronizes the first entity data from the first service process where the first entity is located to the second service process.
[0119] 404. The server creates a second entity in a second service process, and imports the second entity data obtained by deserializing the first entity data into the second entity.
[0120] The service process in which the second entity resides is referred to as the second service process. The first entity and the second entity are respectively in different service processes. It is understandable that different service processes can be in the same server device or in different server devices.
[0121] Specifically, assuming that the first service process and the second service process are respectively in different server-side devices, in 403, if the first entity is a player character, the server stores the player component data in the first entity in a preset database to prevent the loss of the player component data. Furthermore, the server transmits the first entity data from the first service process to the second service process through a remote procedure call (RPC). Specifically, the server encapsulates the first entity data in the first service process through the RPC framework, and in response to the call request of the second service process, transmits the encapsulated first entity data to the second service process. The method of transmitting the first entity data through the RPC framework can be implemented by calling a function or passing parameters.
[0122] Optionally, after importing the second entity data obtained by deserializing the first entity data into the second entity in step 404, the server deletes the first entity data in the first service process. In an actual application, the server sends an entity deletion instruction to the first service process, where the entity deletion instruction is used to instruct the first service process to delete the first entity data.
[0123] In practice, serialization, RPC, and deserialization processes are often implemented in conjunction.
[0124] For example, in the cross-server entity switching scenario, serialization, RPC, and deserialization processes are combined to implement cross-server entity switching scenarios, such as cross-map scenarios and entering and exiting dungeons.
[0125] Specifically, assuming that the first service process and the second service process are located in different server-side devices, after the first service process receives a call request from the second service process, it deserializes the call request based on the RPC framework to obtain call information. The first service process locates the first entity based on the call information and serializes the first entity through the RPC framework to obtain a serialized binary byte stream, namely the first entity data. Optionally, if the first entity is a player character, the player component data in the first entity is also backed up to a preset database. The first service process feeds the serialized first entity data back to the second service process via network transmission. Finally, after receiving the first entity data, the second service process creates an entity object to be configured, parses the first entity data, reconstructs multiple entity components and parameters (i.e., the second entity data), assigns the multiple entity components and parameters to the entity object, and outputs the second entity, thereby creating an entity object that is completely identical to the first entity (i.e., the second entity). Finally, the second service process notifies the first service process to delete the first entity data.
[0126] 405. The server sends an entity switching instruction to the user terminal.
[0127] 406. The user end switches the server-side entity corresponding to the entity presentation model from the first entity to the second entity.
[0128] To implement entity switching in the user terminal, the server terminal also needs to send an entity switching instruction to the user terminal, which carries the identifier of the second entity. After receiving the entity switching instruction, the user terminal updates the identifier of the server-side entity corresponding to the entity display model from the identifier of the first entity to the identifier of the second entity.
[0129] 407. The user end feeds back a switching completion instruction to the server end.
[0130] 408. The server deletes the first entity data in response to the switching completion instruction fed back by the user end, and sends a notification message to the user end.
[0131] Finally, the user end feeds back a switching completion instruction to the server end, and the server end receives the switching completion instruction fed back by the user end, which is used to indicate that the user end has switched the server entity corresponding to the entity display model from the first entity to the second entity, that is, the user end has completed the entity switching.
[0132] In response to the switching completion instruction, the server deletes the first entity data and sends a notification message to the user end, the notification message being used to indicate that the first entity data has been deleted in the server end. The switching completion instruction is also used to indicate that the user end has completed the entity switching.
[0133] Through the above steps 401 to 408, the smoothness of entity switching between the server and the user can be improved.
[0134] It should be noted that Figure 4 The interaction flow shown is similar to Figure 3 The steps of the interactive process shown are similar, that is, steps 401 to 402 are similar to steps 301 to 302, and steps 404 to 408 are similar to steps 303 to 307. The similarities are referenced to each other and will not be repeated here.
[0135] Figure 2During the execution of the entity switching method shown, the server completely passes all the parameters of the first entity to the second entity through the serialization and deserialization process, avoiding the phenomenon of incomplete parameter inheritance on the server side during the entity switching process, and ensuring the integrity of parameter inheritance. On the basis of the integrity of parameter inheritance, for the entity display model corresponding to the server entity loaded in the user side, the server side will also send an entity switching instruction to the user side, so that the user side can achieve a user-imperceptible entity switching process by changing the correspondence between the entity display model and the server entity. For the user side, not only does it not need to create and render a new entity, it avoids flickering, simplifies the entity switching process, and improves the efficiency of entity switching; moreover, since the server entity after switching inherits all the parameters of the entity before switching, the entity display model corresponding to the server entity can present a consistent appearance and continuous movements, greatly improving the smoothness of entity switching and improving the visual experience.
[0136] Furthermore, to prevent users from observing inconsistencies in model appearance and discontinuous movements, current game production processes often black out the user interface during the entity switching process, significantly reducing gameplay smoothness. Based on the entity switching method illustrated in the above embodiment, game production processes no longer need to incorporate design features that reduce gameplay smoothness in order to avoid flickering caused by traditional entity switching processes.
[0137] The physical switching devices of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these physical switching devices can be constructed using commercially available hardware components and configured according to the steps taught in this solution.
[0138] Figure 5 A schematic diagram of the structure of a physical switching device provided by an embodiment of the present invention. The physical switching device is applied to a server, such as Figure 5 As shown, the entity switching device includes: a serialization module 11, a creation module 12, and a notification module 13.
[0139] A serialization module 11, configured to serialize the first entity into first entity data;
[0140] A creation module 12, configured to create a second entity and import second entity data obtained by deserializing the first entity data into the second entity;
[0141] The notification module 13 is configured to send an entity switching instruction to the user terminal, wherein the user terminal is loaded with an entity display model corresponding to the server entity, and the entity switching instruction is configured to instruct the user terminal to switch the server entity corresponding to the entity display model from the first entity to the second entity.
[0142] Optionally, the server includes a first service process where the first entity is located and a second service process where the second entity is located.
[0143] The entity switching device also includes a synchronization module. The synchronization module is specifically configured to: after the server serializes the first entity into first entity data, synchronize the first entity data from a first service process where the first entity resides to a second service process where the second entity resides. The second service process is the service process where the second entity resides. After deserializing the first entity data to obtain the second entity data into the second entity, the first entity data is deleted from the first service process.
[0144] Optionally, the first service process and the second service process are respectively located in different server devices.
[0145] When the synchronization module synchronizes the first entity data from the first service process where the first entity is located to the second service process, it is specifically used to: if the first entity is a player character, store the player component data in the first entity to a preset database; and transmit the first entity data from the first service process to the second service process through a remote procedure call.
[0146] When deleting the first entity data in the first service process, the synchronization module is specifically used to: send an entity deletion instruction to the first service process, where the entity deletion instruction is used to instruct the first service process to delete the first entity data.
[0147] Optionally, the serialization module 11 is specifically configured to: determine a plurality of entity components included in the first entity; and convert the plurality of entity components into an entity data sequence.
[0148] The creation module 12 is specifically configured to: create an entity object to be configured; restore the entity data sequence to the multiple entity components; and configure the entity object based on the multiple entity components to obtain the second entity.
[0149] Optionally, when the serialization module 11 converts the multiple entity components into corresponding entity data sequences, it is specifically used to: parse the multiple entity components and parameters from the first entity; and convert the multiple entity components and the parameters into respective corresponding binary data sets.
[0150] When the creation module 12 restores the entity data sequence into the multiple entity components, it is specifically configured to: parse the binary data set into multiple groups of structured data, and use the multiple groups of structured data as the multiple entity components and the parameters.
[0151] When configuring the entity object based on the multiple entity components to obtain the second entity, the creation module 12 is specifically configured to: import the multiple entity components and the parameters into the data structure of the entity object to obtain the second entity.
[0152] Optionally, the entity switching instruction carries an identifier of the second entity.
[0153] Switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity refers to: updating the identifier of the server-side entity corresponding to the entity presentation model to the identifier of the second entity.
[0154] Optionally, the running state of the second entity is inherited from the running state of the first entity. Switching the server entity corresponding to the entity presentation model from the first entity to the second entity further includes: maintaining the running state of the entity presentation model corresponding to the running state of the first entity.
[0155] Optionally, the entity switching device further includes a deletion module, specifically configured to:
[0156] After the notification module 13 sends an entity switching instruction to the user terminal, in response to a switching completion instruction fed back by the user terminal, the first entity data is deleted, and a notification message is sent to the user terminal through the notification module 13, wherein the notification message is used to indicate that the first entity data has been deleted in the server.
[0157] Figure 5 The physical switching device shown can execute the methods provided in the aforementioned embodiments. For the parts not described in detail in this embodiment, please refer to the relevant descriptions of the aforementioned embodiments and will not be repeated here.
[0158] In one possible design, the above Figure 5 The structure of the physical switching device shown can be implemented as an electronic device.
[0159] like Figure 6 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 stores executable code. When the executable code is executed by the processor 21, the processor 21 at least implements the entity switching method provided in the aforementioned embodiment. The electronic device may also include a communication interface 23 for communicating with other devices or a communication network.
[0160] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0161] As needed, the systems, methods, and devices of the various embodiments of the present invention can be implemented as pure software (such as a software program written in Java), as pure hardware (such as a dedicated ASIC chip or FPGA chip), or as a system that combines software and hardware (such as a firmware system that stores fixed code or a system with a general-purpose memory and processor).
[0162] Another aspect of the present invention is a computer-readable medium having computer-readable instructions stored thereon, which, when executed, can implement the physical switching method of various embodiments of the present invention.
[0163] While various embodiments of the present invention have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limiting of the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The scope of the claimed subject matter is limited solely by the appended claims.
Claims
1. A physical switching method, characterized in that: The method comprises: In response to an action instruction fed back by the user, the server determines a plurality of entity components included in a first entity, the first entity being a game element to be switched and being in a first service process; parses the plurality of entity components and parameters from the first entity, the parameters including position information, motion state, direction information, item information, and character state information of a model; and converts the plurality of entity components and the parameters into respective corresponding binary data sets; Creating an entity object to be configured in a second service process, wherein the first service process and the second service process are respectively located in different server devices; If the first entity is a player character, storing the player component data in the first entity in a preset database; transmitting the binary data set from the first service process to the second service process via a remote procedure call; and sending an entity deletion instruction to the first service process, wherein the entity deletion instruction is used to instruct the first service process to delete the binary data set; Parsing the binary data set into multiple sets of structured data, and using the multiple sets of structured data as the multiple entity components and the parameters; importing the multiple entity components and the parameters into the data structure of the entity object to obtain a second entity; An entity switching instruction is sent to a user terminal, wherein the user terminal is loaded with an entity display model corresponding to a server entity, and the entity switching instruction is used to instruct the user terminal to switch the server entity corresponding to the entity display model from the first entity to the second entity.
2. The method according to claim 1, characterized in that The entity switching instruction carries an identifier of the second entity; Switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity means: The identifier of the server entity corresponding to the entity presentation model is updated to the identifier of the second entity.
3. The method according to claim 1, characterized in that The running state of the second entity is inherited from the running state of the first entity; The process of switching the server-side entity corresponding to the entity presentation model from the first entity to the second entity further includes: The running state of the entity presentation model is maintained to correspond to the running state of the first entity.
4. The method according to claim 1, wherein After sending the entity switching instruction to the user terminal, the method further includes: In response to the switching completion instruction fed back by the user terminal, the first entity data is deleted, and A notification message is sent to the user end, where the notification message is used to indicate that the first entity data has been deleted in the server end.
5. A physical switching device, characterized in that: The device is applied to a server, and includes: a serialization module configured to, in response to an action instruction fed back by a user terminal, determine a plurality of entity components included in a first entity, the first entity being a game element to be switched and being in a first service process; parse the plurality of entity components and parameters from the first entity, the parameters including position information, motion state, direction information, item information, and character state information of a model; and convert the plurality of entity components and the parameters into respective corresponding binary data sets; a creation module, configured to create an entity object to be configured in a second service process, the first service process and the second service process being located in different server-side devices; parse the binary data set into multiple sets of structured data, and use the multiple sets of structured data as the multiple entity components and the parameters; and import the multiple entity components and the parameters into a data structure of the entity object to obtain a second entity; a notification module, configured to send an entity switching instruction to a user terminal, wherein the user terminal has loaded an entity display model corresponding to a server-side entity, and the entity switching instruction is configured to instruct the user terminal to switch the server-side entity corresponding to the entity display model from the first entity to the second entity; Synchronization module: If the first entity is a player character, the player component data in the first entity is stored in a preset database; the binary data set is transferred from the first service process to the second service process through a remote procedure call; and an entity deletion instruction is sent to the first service process, where the entity deletion instruction is used to instruct the deletion of the binary data set in the first service process.
6. An electronic device for implementing physical switching, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the entity switching method according to any one of claims 1 to 4.
7. A system for implementing entity switching, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the entity switching method according to any one of claims 1 to 4.
8. A computer-readable medium for implementing entity switching, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the entity switching method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Cooperation method, server, client terminal and system
CN103546369A
Game interface switching method and device
CN105373379A
Method, device and system for game item transaction
CN105469296A