Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Gamepad / Streaming Netplay (todo / guide) #2486

Open
andres-asm opened this issue Nov 28, 2015 · 21 comments
Open

Network Gamepad / Streaming Netplay (todo / guide) #2486

andres-asm opened this issue Nov 28, 2015 · 21 comments

Comments

@andres-asm
Copy link
Contributor

andres-asm commented Nov 28, 2015

So far the implementation works but there is no client, to test, set your network gamepad port to 55400 (just commited a fix that will set that by default) under network settings, and enable the gamepads for the players you want.

Should look like this:
gamepad

I open one port for each controller, so:
player1 = 55400
player2 = 55401
player3 = 55402
etc.

Then you can use any tool to generate traffic to send a character array that will be converted to the bitmask of the pressed buttons.

For instance sending "128" will be converted to 128 (with atoi) which means "press d-pad right", i guess there could be a better representation, also a better representation will be needed to send analog inputs.

To test I included a small test program that will send "128", sleep for roughly 1 frame and send 128 again, this should make a character move forward

To use it on the same host just compile it (set your port to 55400 in RetroArch to make it easier) and just run it.

gcc -o udp-test libretro-common/utils/udp-test.c
chmod +x udp-test
./udp-test

Todo:

  • support analogs
  • support some kind of authorization
  • make a builtin client in RetroArch (so one retroarch instance can control another one)
  • add an authorization mechanism

Second part would be to hook up the built-in ffmpeg sink to be able to stream a non post processed framebuffer (and audio) to get some sort of streaming netplay ala GameStream co-op


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@duduke
Copy link
Contributor

duduke commented Dec 18, 2015

Can this be used to support virtual gamepads running of a smartphone?

@andres-asm
Copy link
Contributor Author

Yes but i haven't programmed a client yet

On Fri, Dec 18, 2015, 5:59 AM Dudu Akiva notifications@github.com wrote:

Can this be used to support virtual gamepads running of a smartphone?


Reply to this email directly or view it on GitHub
#2486 (comment)
.

@duduke
Copy link
Contributor

duduke commented Dec 21, 2015

Thanks, awesome. looking forward to this.

@TheCherry
Copy link

Very awesome. We just need that client (inside retroach) + analog support. I need to play Super Smash Bros 64 with a friend. :))

@gouchi
Copy link
Member

gouchi commented Feb 19, 2016

For the time being, you can try to use Packet Sender
https://f-droid.org/repository/browse/?fdfilter=packet&fdid=com.packetsender.android

Working well !

@andres-asm
Copy link
Contributor Author

lol that's pretty cool, I'll try to start coding a gamepad core this weekend

@gouchi
Copy link
Member

gouchi commented Feb 25, 2016

Nice ! Thank you !

@TheCherry
Copy link

Any news? Is there a way to control now a game with Analogsticks via packages?

@gouchi
Copy link
Member

gouchi commented Jun 2, 2016

@TheCherry Development has started but it is still a WIP.

@dan83sama
Copy link

Following the previous #3246

Yes, I use the built-in ffmpeg recording.
cmd= retroarch --record rtmp://192.168.1.219:1935/retro/mystream --recordconfig stream.cfg
cfg=
vcodec = libx264
acodec = aac
pix_fmt = yuv420p
scale_factor = 2
threads = 3
video_crf = 25
video_preset = ultrafast
video_tune = zerolatency
audio_global_quality = 75
sample_rate = 44100
format = flv

I use a rtmp server(works over net), but works in rtp,udp,...
I would recommend a rtsp server(live555,red5,...) or rtmp server(nginx,...), udp and others only works in the same net.

@andres-asm
Copy link
Contributor Author

Yeah I used nginx once, but do you thing there is a way to do it without a server?
I tried an udp stream but I used to get lots of frame drops.

I also tried rtp directly but that needs two streams.

Still, thanks for the info I'll play with it.

@dan83sama
Copy link

It is not necessary a server, I use server to works over network, it works too in udp.
To work in udp change format to mpegts in cfg file (flv to mpegts in cfg file), and try to play with ffplay, I recommend this cmd to ffplay:
ffplay -probesize 32 -sync ext -fflags nobuffer -vf "setpts=(0.5*PTS)" udp://xxxxxxxx

@andres-asm
Copy link
Contributor Author

@dan83sama I tried your cfg and nginx it works lags is really bad, but on your video it looks perfectly smooth, any pointers?

@dan83sama
Copy link

@fr500 Add me to steam for chat better.
Creo que eres español o hablas español, agregame a steam y por hay hablamos mejor, pero que si va perfecto.
http://steamcommunity.com/id/dan83/

@parkerlreed
Copy link

Considering this has been implemented for a while now, is Android not supported as a server? It's missing all the network gamepad options under Settings > Network, while they exist on desktop.

@Shyri
Copy link

Shyri commented Apr 13, 2018

Hey guys @fr500 @dan83sama , did you get anywhere with the video stream thing? Do you think it would work for netplay?
Also as @parkerlreed says Network Remote seems to be missing on Android (v1.7.1), isn't it supported?

@Shyri
Copy link

Shyri commented Apr 25, 2018

Hey guys, sorry to come here again. I'm asking just to know, if it is worth the effort I am happy to spend some time working on it. But before doing it I'd like to know if you hit a dead end in the past

@andres-asm
Copy link
Contributor Author

Someone baked it out, and then something changed something that broke it.
When I do stuff, it's removed and then broken down I don't feel like working on such stuff anymore, sorry.

@inactive123
Copy link
Contributor

inactive123 commented Aug 12, 2018

I baked it out because it didn't work. If you want I can bake it in again, but this time we really have to focus on making it work and also having proper documentation for it. I could not even understand how to use it last time around.

I will repeat again, i will give it a fair shot and I would like to see it being an embedded core.

@andres-asm
Copy link
Contributor Author

rubdos on IRC asked about it and I wanted to point out what was going on.
I wasn't looking at old issues and commenting out at random.

I don't have any interest on fixing this.

@andres-asm
Copy link
Contributor Author

Sadly I spent a few nights on this and I can't get it any lower than 10 frames. This is using a native framebuffer, intra-frame refresh, no b-frames, zerolatency preset and h264_nvenc:
https://streamable.com/cftfv

I figure the player is a bit part of the equation. Sadly RA's ffmpeg player doesn't even like this stream (used ffplay for testing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants