tencent cloud

Feedback

How to Implement Multi-Person Interaction

Last updated: 2024-03-18 14:49:15

    Customer Scenarios and Practices

    This feature is suitable for scenarios such as multi-person interaction and live streaming, which can upload single-player/multiplayer games to the cloud. The streaming host is able to easily start a game on any device. By integrating interactive features in the live room, audience members can take a role in a multiplayer game by sending gifts or being invited. CAR pushes game video streams to the cloud, so that the live stream of the game can be watched in the live room in real time. This feature allows you to implement online game competition, online team battling, and online game sparring. It can also help increase the popularity and gift revenue of the live room.
    
    You can experience live multiplayer interaction in Technology Experience Center - Live multiplayer game.
    
    
    

    Scenario 1. Multi-person interactive live streaming

    Use case: A live streaming service provider needs to implement in-game interaction between the streaming host and the audience during live streaming.
    Implementation logic:
    When starting a stream, the streaming host connects to the cloud game and creates a room, and other players can send a request to the host or use the invitation link provided by the host to enter the room for multiplayer gaming.
    Other audience members can connect to the live stream and watch the in-game interaction between the host and other players.

    Scenario 2. Multiplayer arena game

    Use case: A cloud game company needs to implement a cloud multiplayer arena game.
    Implementation logic:
    The admin creates a cloud game room.
    Other players can queue up to play. The winner will continue playing the game, and the loser will switch to a viewer role or exit the game.

    Quick Connection

    First, you need to develop an application that can run stably on Windows and implement required features in the application.
    For example, the application should include basic game scenarios, support at least 1-4 players to join a room, and be controlled using a controller.
    
    After you have an application, you can perform the ‍following ‍steps.
    1. Activate CAR.
    2. Deploy an application as instructed in User Guides.
    3. Deploy your frontend and backend s‍ervice and ‍successfully ‍start ‍the ‍application ‍in ‍the ‍cloud. For ‍details, ‍see ‍Integration Demo.
    After completing the above steps, you can refer to the following instructions to integrate multiplayer interaction. To push cloud video streams to a live room, see here.

    Multiplayer Interaction Concepts

    The multiplayer interaction can be abstractly understood as a CAR room and a live stream (optional). After a room is created by a CAR player (room owner), other players (interactive audience) can enter the room through the room owner's UserId, and all the users in the room can see the same cloud image through connection via CAR.
    
    
    

    User types

    Room owner: The player that creates a room
    The room owner determines whether others have control over click, keyboard/mouse, and controller operations.
    The room owner manages the mic status of everyone in the room.
    Interactive audience: Users that enter the room and can have the role of a Player or a Viewer.
    An interactive audience member needs to request control from the room owner.
    When granted game control by the room owner, the member has the Player role.
    When not granted control by the room owner, the member has the Viewer role and has no game control.
    Interactive audience members can turn the local mic on or off.
    Streaming audience: Users that can watch the live stream but are not connected to a concurrency instance
    A streaming audience member can only watch the live streamed image and has no other permissions.

    CAR role description

    Host: The original creator of a room
    The host can switch the role of interactive audience members. When the host exits, the room is immediately terminated, and all interactive audience members automatically exit.
    Player: An interactive audience member who has game control
    The default maximum number of players is 7, which should actually be the same as the maximum number of players supported by the game.
    Viewer: An interactive audience member who does not have game control and can only watch the game
    The default maximum number of viewers is 7.
    Note:
    The room owner can switch a member's role to player to let the member control the application or to viewer to let them watch only.
    An interactive audience member can be a player or a viewer. The room owner can control which role each member has.

    Process

    Service activation

    Activate this value-added feature on the Multiplayer page in the console.

    The room owner creates a room

    1. The room owner's client sends a request to the business backend to start CAR, and the business backend calls the ApplyConcurrent() API to apply to reserve a CAR concurrency.
    2. The business backend calls the CreateSession() API to create a session, where HostUserId must be the same as UserId and Role can be Player or Viewer.
    Note:
    The process of creating a room in multi-person interaction mode is the same as the process of creating a session by calling the TencentCloud API, except that HostUserId needs to be entered in the latter case.

    An interactive audience member enters the room

    1. The member's client sends a request to the business backend to start CAR.
    2. The business backend calls the CreateSession() API to create a session, where HostUserId must be the same as the room owner's UserId and Role can be Player or Viewer.
    Note:
    Only the room owner needs to call ApplyConcurrent(), and members do not.

    Live stream push

    Switch the role

    1. The interactive audience member's client calls the TCGSDK.submitSeatChange() API to request a switch of the role to player or viewer.
    Note:
    A switch from viewer to player requires the information of the seat, which must be vacant.
    A switch from viewer to viewer can be made directly without a request.
    A switch from player to viewer can be made directly without a request.
    A switch from player to player requires the information of the seat, and a seat switch between players will result in a role switch in the game.
    In other words, a switch to player requires the seat information, while a switch to viewer does not.
    2. The room owner's client calls back the onMultiPlayerChange() API to get the member's request to switch the role and calls the TCGSDK.seatChange() API to switch the member's role.
    3. The member's client calls back the onMultiPlayerChange() API to get the response to the request for a role switch.

    Switch the mic status

    1. The room owner's client calls the TCGSDK.changeMicStatus() API to switch the status of the local mic or another user's mic.
    2. An interactive audience member's client calls the TCGSDK.changeMicStatus() API to switch the local mic status.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support