Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Fix: controller indices from multiple peers would clash #165

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

Belchy06
Copy link
Collaborator

@Belchy06 Belchy06 commented Mar 20, 2023

Problem

When multiple peers are connected, each peer's controllers will increment from 0.

This means that if player 0 has 2 gamepads, they'll be assigned index 0 and index 1 and when player 1 connects with two gamepads of its own, they'll also be assigned index 0 and index 1 as illustrated below:

image

Solution

The most suitable solution to this problem would be for the Pixel Streaming module to keep track of all of the in-use gamepad indices. When a new gamepad is detected by the peer, it sends a request to the application for a gamepad index that is free. The application responds with an index to use and the peer will then use this provided controller index for any subsequent calls to the application.

Compatibility

Backwards compatibility is preserved in this change by using the local controller index (the one that increments from 0) if the application doesn't provide the peer with an index. This case would happen if using a UE version less than 5.2 but using the latest frontend.

@Belchy06 Belchy06 linked an issue Mar 20, 2023 that may be closed by this pull request
@Belchy06 Belchy06 self-assigned this Mar 20, 2023
@Belchy06 Belchy06 added the bug Something isn't working label Mar 20, 2023
@Belchy06 Belchy06 added this to the 5.2 milestone Mar 20, 2023
@lukehb
Copy link
Contributor

lukehb commented Mar 20, 2023

Update PR with a link to the UE side commit when it lands too - as the two are both required for the solutions to be complete.

@lukehb
Copy link
Contributor

lukehb commented Mar 20, 2023

Have you tested this with multiple repeated controller plug/unplug attempts?

Copy link
Contributor

@lukehb lukehb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All feedback addressed. Merging.

@lukehb lukehb merged commit 9f124b2 into EpicGames:master Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

Gamepad indices clash with multiple peers
2 participants