Телефон в качестве контроллера

Всем привет, какое то время работаю в ue и сейчас у меня появилась идея. Хочу использовать свой телефон в качестве контроллера для определенных действий в игре. То есть, у меня есть игра на пк, подключаю телефон, каким либо способом, и теперь могу активировать некоторые действия с него. Например, все управление в самой игре, на пк, но, допустим, включить фонарик в игре могу нажав на кнопку в приложении на телефоне. Возможно ли это как то сделать?

I know it is possible:

https://www.youtube.com/watch?v=VjaYqyYqKtE

But that is the only app I know which does it.

Yes, this is exactly what I want to do, but still, fallout 4 has a different engine. Although I’m glad that such technology already exists

I don’t know if you require an app on the phone to be able to read touch input on the PC over usb or network. If you can read the inputs on PC you still need a way for Unreal Engine to read them. Possibly a plugin like this:

RawInput Plugin in Unreal Engine | Unreal Engine 5.1 Documentation

The core idea is to have game run some server and your phone app to send signals to that server.

I’m not aware about best practices for this task, but the simplest you can done with UE is:

  1. to start tcp server (ue has build-in support for client&server sockets, but not for http servers, so http is out of questions if you want to keep things simple)
  2. implement some simple messaging protocol so you can send(FString) and have a delegate message_received(const FString&) (simplest protocol would be the [4bytes for message length]+[message], tcp will handle the rest of problems)
  3. Pick any method you like to build phone app, that supports raw tpc sockets, build app and implement the same protocol
  4. Make sure to implement a discovering mechanism. For example multicast request in current network or scanning all IPs or just enter PCs IP on the phone directly
  5. Tie all this up together, so you can successfully exchange messages between PC and your app
  6. Build a protocol (on top of one made in p.2) that implements the meaningful gameplay logic between devices. I can recommend sending JSONs back and forth since they are quite easy for understanding and debug and have an UEs build-in support.

Probably there should be a lot of a places for improvements, but at least it will work as a proof of concept