Multipeer Connectivity (Swift): Prioritize LAN over Wi-Fi?

110 Views Asked by At

I am building an iOS game with Swift. I have implemented MPC for nearby players to connect and play a game with each other.

I have a strange situation:

Case 1 (no lag/latency): 2 simulators are connected to each other via MPC (on same MacBook)

Case 2 (no lag/latency): Device is connected (wired) to MacBook and connected to a simulator.

Case 3 (some/little latency): 2 real devices connected wirelessly via MPC on my own wi-fi network

Case 3 (lots of lag/latency): Device isn't wired to MacBook but is connected to simulator via MPC. Both devices are connected to same wireless network (university's wifi where router may be far)

Case 3 (lots of lag/latency): Device isn't wired to MacBook but is connected to simulator via MPC. The unwired device is connected to the wireless network (university's wifi where router may be far), while the MacBook has wi-fi enabled but is not connected to any network.

Case 4 (no lag/latency): Device isn't wired to MacBook but it is connected to simulator via MPC. The unwired device is connected to cellphone service (not wi-fi), while the MacBook has wi-fi enabled but is not connected to any network.

Case 5 (no lag/latency): Device isn't wired to MacBook but it is connected to simulator via MPC. Neither the unwired device or the MacBook are connected to cellphone service or wi-fi (just has wi-fi enabled).

I understand an issue here could be local routing through the schools wi-fi. Is there an MPC framework preference to have MPC bypass trying to leverage connected Wi-Fi networks between the devices? In the real world, app users wouldn't intuitively know (or want to) disable Wi-fi to mitigate latency. I want the devices to connect to prioritize connecting to each other without the help of other Wi-Fi networks (like LAN).

0

There are 0 best solutions below