Cross-platform multi-device interaction method and system and storage medium
By setting a preset communication protocol between the operation end and the game device end, converting virtual handle operation events and synchronizing game status, the problem of inconsistent virtual handle experience in multiplayer games is solved, and a low-latency, efficient cross-platform multi-device interactive experience is achieved.
Patent Information
- Application Number
- CN202510914157.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-10
AI Technical Summary
Existing virtual controllers in multiplayer games lack a unified cross-platform communication standard, resulting in inconsistent multiplayer gaming experience, high latency, operation conflicts, and inability to synchronize game status in a timely manner, affecting multiplayer collaboration or combat experience.
By setting a preset communication protocol between the operation end and the game device end, converting virtual handle operation events into event messages, and processing these events on the game device end, and synchronizing game status change events into synchronization messages, a unified communication standard is achieved to ensure low latency and efficient data interaction.
It achieves consistency in cross-platform and multi-device interaction, improves the multi-device interaction experience, ensures the synchronization of game screen and game status, and reduces delays and operation conflicts.
Smart Images

Figure CN120754530A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of interactive technology, and in particular to a cross-platform multi-device interaction method, system, and storage medium. Background Art
[0002] A virtual controller can be understood as a tool that simulates the functions of a physical controller through software. It simulates physical buttons, joysticks, etc. through software, and can realize controller operations on electronic devices such as mobile phones, computers, tablets, etc. without physical hardware. It is particularly important in game control.
[0003] The existing interaction between virtual controllers and gaming devices, i.e., the hardware devices that run the game, has the following problems: virtual controllers generally support single-player operation. When different virtual controllers are used across platforms, the lack of a unified cross-platform communication standard may lead to inconsistent multiplayer gaming experiences, high latency, and operational conflicts. In multiplayer games, the game states of different players cannot be synchronized in a timely manner, which may cause the game screen to be out of sync and the controls to be disordered, affecting the multiplayer collaboration or combat experience. Summary of the Invention
[0004] The present invention provides a cross-platform multi-device interaction method, system and storage medium, which can achieve consistency in cross-platform multi-device interaction and enhance the multi-device interaction experience.
[0005] In a first aspect, an embodiment of the present invention provides a cross-platform multi-device interaction method, which is applied to a cross-platform multi-device interaction system, wherein the system includes a gaming device terminal and multiple operating terminals that support virtual controllers and involve cross-platforms in the same local area network. The method includes:
[0006] When a virtual handle operation event is detected, the operation terminal converts the virtual handle operation event into an event message based on the preset communication protocol content corresponding to the virtual handle operation event, and transmits the event message to the game device terminal;
[0007] Upon receiving the event message, the game device processes the virtual handle operation event corresponding to the event message;
[0008] Through the game device end, when a game status change event is detected, the game status change event is converted into a synchronization message based on the preset communication protocol content corresponding to the game status change event, and the synchronization message is transmitted to the operation end connected to the game device end to synchronize the game status.
[0009] In a second aspect, an embodiment of the present invention provides a cross-platform multi-device interaction system, including a gaming device terminal and multiple operating terminals supporting virtual controllers and involving cross-platforms in the same local area network;
[0010] The operation terminal is configured to, upon detecting a virtual handle operation event, convert the virtual handle operation event into an event message based on a preset communication protocol content corresponding to the virtual handle operation event, and transmit the event message to the game device terminal;
[0011] The game device side is used to process the virtual handle operation event corresponding to the event message when the event message is received;
[0012] The game device end is used to convert the game state change event into a synchronization message based on the preset communication protocol content corresponding to the game state change event when a game state change event is detected, and transmit the synchronization message to the operation end connected to the game device end to synchronize the game state.
[0013] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0014] The technical solution of an embodiment of the present invention is as follows: upon detecting a virtual controller operation event, the operator terminal converts the virtual controller operation event into an event message based on the preset communication protocol content corresponding to the virtual controller operation event, and transmits the event message to the game device terminal; upon receiving the event message, the game device terminal processes the virtual controller operation event corresponding to the event message; upon detecting a game state change event, the game device terminal converts the game state change event into a synchronization message based on the preset communication protocol content corresponding to the game state change event, and transmits the synchronization message to the operator terminal connected to the game device terminal to synchronize the game state. This solution establishes a unified communication standard for communication between the game device terminal and multiple operator terminals that support virtual controllers and involve cross-platform communication. The corresponding communication messages are encapsulated according to the preset communication protocol content for communication, achieving efficient, low-latency, and compatible data exchange across different operating systems in a local area network. The game device terminal processes the virtual controller operation event, combined with the setting of the game state synchronization mechanism, to achieve game screen synchronization and game state synchronization on the operator terminal. Furthermore, consistency of cross-platform multi-device interaction is achieved, improving the multi-device interaction experience.
[0015] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 This is a flowchart of a cross-platform multi-device interaction method provided according to the first embodiment of the present invention;
[0018] Figure 2 This is a flowchart of a cross-platform multi-device interaction method provided according to the second embodiment of the present invention;
[0019] Figure 3 This is a flow chart of a device discovery mechanism provided according to the second embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0021] It should be noted that the terms "first," "second," and the like in the present invention are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0022] Example 1
[0023] Figure 1 This is a flowchart of a cross-platform multi-device interaction method provided according to Example 1 of the present invention. This embodiment is applicable to situations where a game device end interacts with multiple operating ends that support virtual handles and involve cross-platforms. The method is applied to a cross-platform multi-device interaction system, which includes a game device end in the same local area network and multiple operating ends that support virtual handles and involve cross-platforms.
[0024] It should be noted that the game device end can be understood as a hardware device running a game, such as a vehicle-mounted entertainment system, a smart television, a projector, a computer, etc., which is not limited here. The operation end can be a hardware device supporting a virtual handle and capable of communicating with the game device end, such as a smart phone, a tablet, etc., which is not limited here.
[0025] The plurality of operation ends in the embodiment of the application can control the game device end as a virtual handle. The plurality of operation ends involve cross-platforms, such as operation end one being an Android operating system and operation end two being an IOS operating system. The virtual handle can be understood as a tool for simulating the function of an entity handle through software, and the essence is to convert touch operations into instructions required by games or applications, such as simulating entity rocker control direction movement through a virtual rocker in the screen, or realizing the function of a key corresponding to a key through a virtual key in the screen.
[0026] The number of game device ends and operation ends under the same local area network is not limited, such as both can be multiple. In an actual game scene, multiple operation ends can be connected with a game device end as virtual handles, the number of virtual handles connected with the game device end is determined according to the number of devices supported by the game device end and actual application needs, different operation ends represent different game players, and multi-player games are realized. The embodiment of the application can be understood as a multi-player game scene.
[0027] As shown in the method shown in Figure 1 , the method comprises:
[0028] S110, through the operation end, in the case of detecting a virtual handle operation event, converting the virtual handle operation event into an event message based on the preset communication protocol content corresponding to the virtual handle operation event, and transmitting the event message to the game device end.
[0029] The virtual handle operation event can be an event of a game player operating a virtual handle. The event message can be obtained by converting the virtual handle operation event, and the operation end needs to transmit the message to the game device end. The purpose of transmitting the event message is to synchronize the operation end to the game device end that the operation end has executed what kind of operation through the virtual handle.
[0030] The virtual handle operation event can include but is not limited to a rocker event and a key event. The rocker event is a touch event generated by sliding a rocker in the virtual handle, which is used to control direction movement, such as controlling the movement of a game character and the rotation of a view angle. The key event is an event generated by clicking a key in the virtual handle, such as realizing jumping, using a prop, pausing a game, exiting a game, etc.
[0031] The preset communication protocol content can be a pre-defined protocol for communication between the gaming device and the operator terminal where the virtual controller resides. This allows for a standardized encapsulation format for messages that need to be exchanged between the two terminals. For example, messages that need to be exchanged can be formatted to contain multiple fields, each field forming a key-value pair with a field name and field value. Multiple key-value pairs are then encapsulated into messages that need to be exchanged, such as event messages or subsequent synchronization messages.
[0032] In this step, when the operator detects a joystick event in a virtual handle operation event, the preset communication protocol corresponding to the joystick event, i.e., the standard encapsulation format corresponding to the joystick event, can be used to encapsulate the operator identifier corresponding to the joystick event, the control of the movement direction by the joystick event, and the pressing status of the joystick into an event message, and then transmit the joystick event event message to the game device via the local area network. Specifically, for each operator, when connecting to the game device, the game device will assign it a unique operator identifier. The operator identifier corresponding to the joystick event is the operator identifier of the operator where the joystick event occurred.
[0033] In this step, when the operator detects a key event in a virtual handle operation event, the preset communication protocol corresponding to the key event, i.e., the standard encapsulation format corresponding to the key event, can be used to encapsulate the operator identifier corresponding to the key event, the function to be implemented corresponding to the key event, etc. into an event message, and the event message corresponding to the key event is transmitted to the gaming device via the local area network. The operator identifier corresponding to the key event is the operator identifier of the operator where the key event occurred.
[0034] It should be noted that, in the operating terminal, one or more of the joystick event and the key event may occur at the same time. When the joystick event and the key event occur at the same time, the operating terminal processes the two events at the same time.
[0035] S120. Upon receiving the event message, the game device processes a virtual handle operation event corresponding to the event message.
[0036] Through the game device end, when the event message corresponding to the joystick event is received, the virtual handle operation event corresponding to the event message is processed, that is, the operation end to be controlled by the joystick event is determined through the operation end identifier in the event message, and the operation end to be controlled is controlled through the control of the moving direction and the pressing status of the joystick in the event message, such as controlling the game character corresponding to the operation end to move in direction, rotate the perspective, etc.
[0037] Through the game device end, when receiving the event message corresponding to the key event, the virtual handle operation event corresponding to the event message is processed, that is, the operation end controlled by the key event is determined through the operation end identifier in the event message, and the operation end controlled is controlled through the function corresponding to the key event in the event message, such as controlling the game character corresponding to the operation end to realize jumping, using props, game pause, game exit, etc.
[0038] Through the game device end, the virtual handle operation event of the operation end connected thereto is processed, and the operation of the operation end on the virtual handle can be synchronized to the game picture in time.
[0039] S130, through the game device end, in the case of detecting a game state change event, based on the preset communication protocol content corresponding to the game state change event, the game state change event is converted into a synchronization message, and the synchronization message is transmitted to the operation end connected to the game device end to synchronize the game state.
[0040] The game state change event can be an event indicating the game state change of the operation end connected to the game device end. The game state of the operation end (i.e. game player) connected to the game device end can be game pause, game in progress or game exit. The triggering of the game state change event can be achieved by changing the game state of the game player through the control of the virtual handle on the operation end.
[0041] The synchronization message can be obtained by converting the game state change event, and the game device end needs to transmit the message to the operation end connected thereto. The purpose of transmitting the synchronization message is to synchronize the operation end with the game state change to the operation end connected to the game device end.
[0042] In this step, through the game device end, in the case of detecting a game state change event, the operation end identifier corresponding to the game state change event, the game state changed, and the message content composed of the operation end identifier and the game state are encapsulated into a synchronization message by using the preset communication protocol content corresponding to the game state change event, that is, the standard encapsulation format corresponding to the game state change event. The synchronization message is transmitted to the operation end connected to the game device end through the local area network. The operation end identifier corresponding to the game state change event is the operation end identifier of the operation end where the game state change event occurs.
[0043] Through the game device end, the game state change of the operation end can be synchronized to other operation ends connected to the game device end, so that other operation ends perform corresponding game state processing, such as interface or interaction adjustment according to the synchronization message, such as displaying a mask for game pause, returning to the main interface for game exit, etc., to realize the game state synchronization of the operation end.
[0044] The technical solution of an embodiment of the present invention is as follows: upon detecting a virtual controller operation event, the operator terminal converts the virtual controller operation event into an event message based on the preset communication protocol content corresponding to the virtual controller operation event, and transmits the event message to the game device terminal; upon receiving the event message, the game device terminal processes the virtual controller operation event corresponding to the event message; upon detecting a game state change event, the game device terminal converts the game state change event into a synchronization message based on the preset communication protocol content corresponding to the game state change event, and transmits the synchronization message to the operator terminal connected to the game device terminal to synchronize the game state. This solution establishes a unified communication standard for communication between the game device terminal and multiple operator terminals that support virtual controllers and involve cross-platform communication. The corresponding communication messages are encapsulated according to the preset communication protocol content for communication, achieving efficient, low-latency, and compatible data exchange across different operating systems in a local area network. The game device terminal processes the virtual controller operation event, combined with the setting of the game state synchronization mechanism, to achieve game screen synchronization and game state synchronization on the operator terminal. Furthermore, consistency of cross-platform multi-device interaction is achieved, improving the multi-device interaction experience.
[0045] Example 2
[0046] Figure 2 This is a flowchart of a cross-platform multi-device interaction method provided according to Example 2 of the present invention. This embodiment is based on the above-mentioned Example 1, and further refines the conversion of the virtual handle operation event into an event message based on the preset communication protocol content corresponding to the virtual handle operation event, wherein the virtual handle operation event includes a joystick event and a key event, and the preset communication protocol content corresponding to the joystick event is the first content, and the preset communication protocol content corresponding to the key event is the second content; and further refines the conversion of the game state change event into a synchronization message based on the preset communication protocol content corresponding to the game state change event, wherein the preset communication protocol content corresponding to the game state change event is the third content.
[0047] like Figure 2 As shown, the method includes:
[0048] S111. When a joystick event is detected through the operating end, the first content corresponding to the joystick event is determined, where the first content includes the field names and field values corresponding to the joystick command field, the operating end identification field, the moving coordinate field, and the press status field; the key-value pairs formed by the field names and field values of each field in the first content are encapsulated as an event message corresponding to the joystick event; and S113 is executed.
[0049] The joystick command field can identify the encapsulated event message as an event message corresponding to a joystick event. The field name can be represented by "cmd", and the field value can be a value that identifies a joystick event, such as "20", which is not limited here. "cmd" is the abbreviation of command.
[0050] The operator identifier field identifies the operator corresponding to the encapsulated event message. The field name can be "playerId," and the field value can be the operator identifier, such as "1," without limitation. "playerId" is the abbreviation of the player's identifier (Id).
[0051] The movement coordinates field indicates the location to which the joystick event should be used to move. Fields indicating horizontal movement can be represented by "x" and their values are the normalized coordinates to which the horizontal movement should be directed. Fields indicating vertical movement can be represented by "y" and their values are the normalized coordinates to which the vertical movement should be directed.
[0052] The press state field can indicate the joystick press state corresponding to the joystick event. The field name can be represented by "pressed" (also known as press), and the field value can be "true" indicating that the joystick is pressed or "false" indicating that the joystick is not pressed.
[0053] The event message corresponding to the joystick event can be expressed in the following format:
[0054] {
[0055] "cmd":"20",
[0056] "playerId":"Operation terminal identifier",
[0057] "x":"normalized coordinates to be moved horizontally",
[0058] "y":"normalized coordinate to which the vertical movement is to be made",
[0059] "pressed":"true" / "false"
[0060] }
[0061] For example, if the operating end is identified as "1", the normalized coordinate to be moved horizontally is "1.0", the normalized coordinate to be moved vertically is "0", and the field value of "pressed" is "true", then the joystick event indicates that the game player with the operating end identified as "1" presses the joystick and moves horizontally to the far right end.
[0062] S112. When a key event is detected through the operating terminal, the second content corresponding to the key event is determined, where the second content includes the field names and field values corresponding to the key command field, the operating terminal identification field, and the key code field; wherein different field values of the key code field correspond to different key functions; the key-value pairs formed by the field names and field values of each field in the second content are encapsulated as an event message corresponding to the key event; and S113 is executed.
[0063] The key command field can identify the encapsulated event message as an event message corresponding to a key event. The field name can be represented by "cmd" and the field value can be a value identifying a key event, such as "10", which is not limited here.
[0064] The operator identification field can identify the operator corresponding to the encapsulated event message. The field name can be represented by "playerId" and the field value can be the operator identifier such as "2". There is no limitation here.
[0065] The key code field can identify the code of the key triggered by the key event. The field name can be represented by "keyCode" (also known as key code), and the field value can be a key code such as A, B, etc. Different key codes represent different functions, such as A for jumping and B for using props. There is no limitation here.
[0066] The event message corresponding to the key event can be expressed as follows:
[0067] {
[0068] "cmd":"10",
[0069] "playerId":"Operation terminal identifier",
[0070] "keyCode":"Key code value"
[0071] }
[0072] For example, if the operating end is identified as "2" and the key code value is A, the key event indicates that the game player whose operating end is identified as "2" presses key A to make the corresponding game character jump.
[0073] S113: Transmit the event message to the gaming device via the operating terminal.
[0074] S121. Upon receiving the event message, the game device processes the joystick event and / or the key event corresponding to the event message.
[0075] The game device end parses the received event message; if "cmd" in the event message corresponds to "20", it is a joystick event, and further parses other fields "playerId", "x", "y", "pressed" in the event message, and executes the direction movement indicated by "x" and "y" in the state indicated by "pressed" on the operation end indicated by "playerId".
[0076] The game device end parses the received event message; if "cmd" in the event message corresponds to "10", it is a key event, and further parses other fields "playerId", "keyCode" in the event message, and executes the function of the key indicated by "keyCode" on the operation end indicated by "playerId", such as sending instructions required to implement the function to the game character or session corresponding to the operation end.
[0077] S131, through the game device end, in the case of detecting a game state change event, determining the third content corresponding to the game state change event, the third content including the field name and field value of the synchronization command field, the operation end identification field, the game state field and the message content field; wherein the field value of the game state field indicates game pause, game in progress or game exit, the field value of the message content field is determined based on the operation end identification field and the game state field; the key-value pairs formed by the field name and field value of each field in the third content are encapsulated as the synchronization message corresponding to the game state change event.
[0078] The synchronization command field can identify the synchronization message corresponding to the game state change event, the field name can be represented by "cmd", and the field value can be a value identifying the game state change event such as "30", which is not limited here.
[0079] The operation end identification field can identify the operation end corresponding to the synchronization message, i.e. the operation end of the game state change, the field name can be represented by "playerId", and the field value can be an operation end identification such as "1", which is not limited here.
[0080] The game state field can identify the game state, the field name can be represented by "gameState" (also known as game state), and the field value can be a game state value, such as game state values "1", "2", "3" representing game pause, game in progress or game exit, respectively.
[0081] The message content field can indicate the content to be delivered by the synchronization message, the field name can be represented by "message" (also known as message), and the field value is composed of the operation end identification corresponding to the operation end identification field and the game state corresponding to the game state field.
[0082] The synchronization message corresponding to the game state change event can be expressed as follows:
[0083] {
[0084] "cmd":"30",
[0085] "playerId":"Operation terminal identifier",
[0086] "gameState":"Game state value",
[0087] "message":"The game status of the operation terminal corresponding to the operation terminal identifier is xxx"
[0088] }
[0089] For example, if the operation terminal identifier is "1", the game status value is "1", and the field value corresponding to "message" is "the game status of the operation terminal with the operation terminal identifier "1" is game paused", then the game status change event indicates that the game player with the operation terminal identifier "1" has paused the game.
[0090] S132. Transmit the synchronization message to the operation terminal connected to the game device terminal through the game device terminal to synchronize the game status.
[0091] The technical solution of the embodiment of the present invention, according to the preset communication protocol content, encapsulates the event messages corresponding to the joystick events, the event messages corresponding to the key events, and the synchronization messages corresponding to the game status change events into key-value pairs formed by the field names and field values of multiple preset fields for transmission, thereby realizing the synchronization of the game screen and the game status on the operating end, and achieving the effect of real-time control in a multiplayer game environment.
[0092] The following describes the device discovery mechanism for any console in a local area network. This mechanism uses User Datagram Protocol (UDP) multicast to discover gaming devices that can connect to the console. UDP multicast can be implemented using specific addresses and port numbers, which are not limited here.
[0093] Figure 3 FIG. 1 is a flow chart of a device discovery mechanism provided according to the second embodiment of the present invention. Figure 3 Shown, including:
[0094] S310. Broadcast a discovery request message through the operation terminal, wherein the discovery request message is encapsulated by a key-value pair consisting of the field names and field values corresponding to the discovery request command field, the device type identification field, the operating system identification field, and the communication protocol version identification field.
[0095] S320. Through the game device side, when the discovery request message is received, a response message of the discovery request message is fed back to the operation side, and the response message is encapsulated by a key-value pair formed by the field names and field values corresponding to the response command field, device name field, device identification field, communication address field, communication port field, supported game type field and supported connection number field.
[0096] S330: Receive the response message through the operating terminal, display a list of connectable game device terminals, and select a game device terminal from the list of connectable game device terminals to establish a connection.
[0097] S340: Allocate an operating terminal identifier to the connected operating terminal through the game device.
[0098] The operator, as the active initiator, periodically broadcasts a discovery request message, such as once every two seconds. The discovery request message requests the discovery of gaming devices that can connect to the operator. It includes a key-value pair consisting of the discovery request command field, the device type identifier field, the operating system identifier field, and the communication protocol version identifier field, each corresponding to a field name and field value.
[0099] Among them, the discovery request command field can identify the discovery request message, the field name can be represented by "cmd", and the field value can be a value that identifies the discovery request, such as "100", which is not limited here.
[0100] The device type identification field can identify what type of device the operating terminal is connected to the game device terminal. The field name can be represented by "deviceType" (also known as device type), and the field value can be the device type such as a virtual handle.
[0101] The operating system identification field can identify the operating system of the operation end. The field name can be represented by "os" and the field value can be "Android" or "IOS".
[0102] The communication protocol version identification field can identify the communication protocol version. The field name can be represented by "version" (also known as version), and the field value can be a version number such as "1.0.0".
[0103] The discovery request message can be expressed as follows:
[0104] {
[0105] "cmd":"100",
[0106] "deviceType":"Device type",
[0107] "os":"Android" / "IOS",
[0108] "version":"version number"
[0109] }
[0110] The game device end listens to a specific UDP port, and in the case of receiving a discovery request message, feeds back a response message of the discovery request message to the operation end. The response message is a message of the game device end responding to the operation end that it can be connected, including key-value pairs of field names and field values of a response command field, a device name field, a device identification field, a communication address field, a communication port field, a supported game type field, and a supported connection number field.
[0111] The response command field can identify the response message, the field name can be represented by "cmd", and the field value can be a value identifying the response message such as "101", which is not limited here.
[0112] The device name field can identify the device name of the game device end, the field name can be represented by "deviceName" (also known as device name), and the field value is the actual device name.
[0113] The device identification field can identify the device identification of the game device end, the field name can be represented by "deviceId" (also known as device ID), and the field value is the actual device identification, which can be represented by an ID number.
[0114] The communication address field can identify the communication address of the game device end, the field name can be represented by "ip", and the field value is the actual device communication address, which can be represented by an Internet Protocol (IP) address.
[0115] The communication port field can identify the communication port of the game device end, the field name can be represented by "port" (also known as port), and the field value is the communication port number.
[0116] The supported game type field can identify the supported game type of the game device end, the field name can be represented by "supportedGames" (also known as supported games), and the field value is the supported game type such as competitive type, party type, etc.
[0117] The supported connection number field can identify the maximum number of operation ends that the game device end supports to connect, the field name can be represented by "maxPlayers" (also known as maximum number of players), and the field value is the maximum number of operation ends that the game device end supports to connect.
[0118] The response message can be represented in the following form:
[0119] {
[0120] "cmd":"101",
[0121] "deviceName":"device name",
[0122] "deviceId":"device ID",
[0123] "ip":"device communication address",
[0124] "port":"device communication port number",
[0125] "supportedGames":[supported game types],
[0126] "maxPlayers":maximum number of connected operation terminals
[0127] }
[0128] Through the operation terminal, a response message of the game device terminal is received, and a device name of the game device terminal corresponding to the received response message is displayed on a list of connectable game device terminals for the user to select. The user can select one game device terminal in the list to establish a Transmission Control Protocol (TCP) based communication connection. It should be noted that if the game device terminal sends a response message and the operation terminal does not receive it within a certain time period, such as 3 seconds, the discovery is considered to be a failure.
[0129] Through the game device terminal, an operation terminal identifier is assigned to the connected operation terminal. Different operation terminals correspond to different operation terminal identifiers. The operation terminal identifier is maintained internally in the operation terminal and is bound to the session of the connection.
[0130] The above device discovery mechanism does not require pre-configuration of IP addresses, supports plug-and-play, and has good cross-platform compatibility.
[0131] The following describes a multi-player connection and management mechanism in a multi-player game scenario in a local area network.
[0132] In an embodiment, the method further includes:
[0133] Through the game device terminal, in a case where the operation terminal actively disconnects or no heartbeat packet is detected for more than a first set time period, the operation terminal identifier assigned to the operation terminal is recovered.
[0134] That is, when the operation terminal actively disconnects or no heartbeat packet is detected for more than a first set time period (such as 30 seconds), the game device terminal recovers the operation terminal identifier assigned to the operation terminal.
[0135] In an embodiment, the method further includes:
[0136] Through the game device, when it is detected that the disconnected operating terminal attempts to reconnect within the second set time period, the disconnected operating terminal is allowed to try to reconnect using the operating terminal identifier before the disconnection. If the reconnection is unsuccessful, a new operating terminal identifier is released for reconnection.
[0137] That is, the game device determines the connection activity of the operating terminal through heartbeat detection (such as once every 5 seconds). If the operating terminal is detected to be disconnected, the disconnected operating terminal is allowed to try to reconnect within a second set time period (such as 60 seconds) with the operating terminal identifier before the disconnection; if the reconnection is successful, the player status is restored, otherwise a new operating terminal identifier is released for use by the new connection.
[0138] In one embodiment, the method further comprises:
[0139] By the game device side, based on the operator terminal identifier of the connected operator terminal, establishing an independent buffer input for the connected operator terminal;
[0140] Through the game device side, the input of the connected operator terminals is distinguished and processed synchronously in the game loop according to the operator terminal identifier.
[0141] The game device creates an independent input buffer for each connected terminal based on its terminal ID. This means that each terminal is allocated a separate memory space to temporarily store its input to prevent confusion between operations from different terminals. The memory space corresponding to each terminal is distinguished by its terminal ID. During the game loop, the game device uses each terminal's terminal ID to distinguish input from different terminals and synchronize the input processing.
[0142] Example 3
[0143] An embodiment of the present invention provides a cross-platform multi-device interaction system. This embodiment is applicable to situations where a gaming device interacts with multiple operating terminals that support virtual controllers and involve multiple platforms. The system includes gaming devices and multiple operating terminals that support virtual controllers and involve multiple platforms on the same local area network.
[0144] The operation terminal is configured to, upon detecting a virtual handle operation event, convert the virtual handle operation event into an event message based on a preset communication protocol content corresponding to the virtual handle operation event, and transmit the event message to the game device terminal;
[0145] The game device side is used to process the virtual handle operation event corresponding to the event message when the event message is received;
[0146] The game device end is configured to, in the case that a game state change event is detected, convert the game state change event into a synchronization message based on preset communication protocol content corresponding to the game state change event, and transmit the synchronization message to an operation end connected to the game device end to synchronize the game state.
[0147] The cross-platform multi-device interaction system provided by the embodiment sets a unified communication standard for communication between the game device end and multiple operation ends supporting virtual handles and involving cross-platforms, encapsulates corresponding communication messages according to preset communication protocol content for communication, and realizes efficient, low-latency and compatible data interaction of different operation systems in a local area network; through processing of the virtual handle operation event by the game device end and in combination with the setting of the game state synchronization mechanism, the game screen of the operation end is synchronized and the game state is synchronized; further, the consistency of cross-platform multi-device interaction is realized, and the multi-device interaction experience is improved.
[0148] Further, the virtual handle operation event includes a rocker event, the preset communication protocol content corresponding to the rocker event is first content, and the virtual handle operation event is converted into an event message based on the preset communication protocol content corresponding to the virtual handle operation event, including:
[0149] The first content corresponding to the rocker event is determined, and the first content includes field names and field values of a rocker command field, an operation end identifier field, a movement coordinate field and a pressing state field respectively;
[0150] The key-value pairs formed by the field names and field values of the fields in the first content are encapsulated into the event message corresponding to the rocker event.
[0151] Further, the virtual handle operation event includes a key event, the preset communication protocol content corresponding to the key event is second content, and the virtual handle operation event is converted into an event message based on the preset communication protocol content corresponding to the virtual handle operation event, including:
[0152] The second content corresponding to the key event is determined, and the second content includes field names and field values of a key command field, an operation end identifier field and a key code field respectively; different field values of the key code field correspond to different key functions;
[0153] The key-value pairs formed by the field names and field values of the fields in the second content are encapsulated into the event message corresponding to the key event.
[0154] Further, the preset communication protocol content corresponding to the game state change event is third content, and the game state change event is converted into a synchronization message based on the preset communication protocol content corresponding to the game state change event, including:
[0155] determining third content corresponding to the game state change event, the third content including a field name and a field value of a synchronization command field, an operation terminal identification field, a game state field and a message content field respectively; wherein the field value of the game state field indicates game pause, game in progress or game exit, and the field value of the message content field is determined based on the operation terminal identification field and the game state field;
[0156] forming key-value pairs of the field name and the field value of each field in the third content, and encapsulating the key-value pairs as a synchronization message corresponding to the game state change event.
[0157] Further, the operation terminal is further configured to broadcast a discovery request message, the discovery request message being encapsulated by key-value pairs formed by a field name and a field value of a discovery request command field, a device type identification field, an operating system identification field and a communication protocol version identification field respectively;
[0158] The game device terminal is further configured to, in a case where the discovery request message is received, feed back a response message of the discovery request message to the operation terminal, the response message being encapsulated by key-value pairs formed by a field name and a field value of a response command field, a device name field, a device identification field, a communication address field, a communication port field, a supported game type field and a supported connection number field respectively;
[0159] The operation terminal is further configured to receive the response message and display a list of connectable game device terminals to select a game device terminal to establish a connection through the list of connectable game device terminals.
[0160] The game device terminal is further configured to allocate an operation terminal identification for the connected operation terminal.
[0161] Further, the game device terminal is further configured to, in a case where it is detected that the operation terminal actively disconnects or no heartbeat packet is detected for more than a first set time length, recycle the operation terminal identification allocated for the operation terminal.
[0162] Further, the game device terminal is further configured to, in a case where it is detected that the disconnected operation terminal attempts to reconnect within a second set time length, allow the disconnected operation terminal to attempt to reconnect using the operation terminal identification before disconnection, and release a new operation terminal identification for reconnection if the reconnection is unsuccessful.
[0163] Further, the game device terminal is further configured to, based on the operation terminal identification of the connected operation terminal, establish an independent buffer input for the connected operation terminal; and in a game loop, distinguish and synchronously process the input of the connected operation terminal according to the operation terminal identification.
[0164] The cross-platform multi-device interaction system provided by the embodiment of the present invention can execute the cross-platform multi-device interaction method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0165] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the cross-platform multi-device interaction method provided by any embodiment of the present invention.
[0166] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0167] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0168] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A cross-platform multi-device interaction method, characterized in that: Applied to a cross-platform multi-device interactive system, the system includes a gaming device end in the same local area network and multiple operating ends supporting virtual controllers and involving cross-platforms, the method includes: When a virtual handle operation event is detected, the operation terminal converts the virtual handle operation event into an event message based on the preset communication protocol content corresponding to the virtual handle operation event, and transmits the event message to the game device terminal; Upon receiving the event message, the game device processes the virtual handle operation event corresponding to the event message; Through the game device end, when a game status change event is detected, the game status change event is converted into a synchronization message based on the preset communication protocol content corresponding to the game status change event, and the synchronization message is transmitted to the operation end connected to the game device end to synchronize the game status.
2. The method according to claim 1, characterized in that The virtual handle operation event includes a joystick event, the preset communication protocol content corresponding to the joystick event is a first content, and based on the preset communication protocol content corresponding to the virtual handle operation event, the virtual handle operation event is converted into an event message, including: Determining first content corresponding to the joystick event, the first content including field names and field values corresponding to a joystick command field, an operating terminal identification field, a movement coordinate field, and a press status field; The key-value pairs formed by the field name and the field value of each field in the first content are encapsulated as event messages corresponding to the joystick event.
3. The method according to claim 1, characterized in that The virtual handle operation event includes a key event, the preset communication protocol content corresponding to the key event is a second content, and based on the preset communication protocol content corresponding to the virtual handle operation event, the virtual handle operation event is converted into an event message, including: Determining second content corresponding to the key event, the second content including field names and field values corresponding to a key command field, an operation terminal identification field, and a key code field; wherein different field values of the key code field correspond to different key functions; The key-value pairs formed by the field name and the field value of each field in the second content are encapsulated as event messages corresponding to the key event.
4. The method according to claim 1, wherein The preset communication protocol content corresponding to the game state change event is a third content, and based on the preset communication protocol content corresponding to the game state change event, the game state change event is converted into a synchronization message, including: Determining third content corresponding to the game state change event, the third content including field names and field values corresponding to a synchronization command field, an operation terminal identification field, a game state field, and a message content field; wherein the field value of the game state field indicates game pause, game in progress, or game exit, and the field value of the message content field is determined based on the operation terminal identification field and the game state field; The key-value pairs formed by the field name and field value of each field in the third content are encapsulated as synchronization messages corresponding to the game state change event.
5. The method according to claim 1, wherein Also includes: Broadcasting a discovery request message through the operation terminal, wherein the discovery request message is encapsulated by a key-value pair formed by the field name and field value corresponding to the discovery request command field, the device type identification field, the operating system identification field, and the communication protocol version identification field; Upon receiving the discovery request message, the game device sends back a response message to the operation end, wherein the response message is encapsulated by key-value pairs formed by the field names and field values corresponding to the response command field, the device name field, the device identification field, the communication address field, the communication port field, the supported game type field, and the supported connection number field; The operation terminal receives the response message and displays a list of connectable game device terminals, so as to select a game device terminal from the list of connectable game device terminals to establish a connection; The game device allocates an operator terminal identifier to the connected operator terminal.
6. The method according to claim 1, characterized in that Also includes: When the gaming device detects that the operator terminal actively disconnects or there is no heartbeat packet for more than a first set time, the operator terminal identifier allocated to the operator terminal is recovered.
7. The method according to claim 1, characterized in that Also includes: Through the game device, when it is detected that the disconnected operating terminal attempts to reconnect within the second set time period, the disconnected operating terminal is allowed to try to reconnect using the operating terminal identifier before the disconnection. If the reconnection is unsuccessful, a new operating terminal identifier is released for reconnection.
8. The method according to claim 1, characterized in that Also includes: By the game device side, based on the operator terminal identifier of the connected operator terminal, establishing an independent buffer input for the connected operator terminal; Through the game device side, the input of the connected operator terminals is distinguished and processed synchronously in the game loop according to the operator terminal identifier.
9. A cross-platform multi-device interactive system, characterized in that: This includes gaming devices on the same local area network and multiple operating terminals that support virtual controllers and involve cross-platform operations; The operation terminal is configured to, upon detecting a virtual handle operation event, convert the virtual handle operation event into an event message based on a preset communication protocol content corresponding to the virtual handle operation event, and transmit the event message to the game device terminal; The game device side is used to process the virtual handle operation event corresponding to the event message when the event message is received; The game device end is used to convert the game state change event into a synchronization message based on the preset communication protocol content corresponding to the game state change event when a game state change event is detected, and transmit the synchronization message to the operation end connected to the game device end to synchronize the game state.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Game state synchronizing method and system
CN108159691A
Virtual handle control method based on Android device and storage medium
CN115837159A