Jump to content
LaunchBox Community Forums

Recommended Posts

While playing around with RetroArch 1.60 at work today, i threw this plugin together to quickly launch netplay sessions.

It works great in lan but i haven't tested it via WAN... you'll probably need a good connection for it to work decently over wan for now.

I haven't added the framesettings etc. yet, it's as simple as can be.

If you want to test it, make sure that the host and client both use the same core in retroarch and EXACTLY the same rom, retroarch will say nope otherwise :)

Here's a short video of me testing it locally with mk2(pool fatality, pit fatality, fatality!) f yeah :D :

If there's any interest i'll update this with more features and saving of the nickname etc.

LBP_SimpleRetroarchMultiplayer.dll

  • Like 5

Share this post


Link to post
Share on other sites

Any update on this? This is one of the big issues for me since I want to play Retro games with my friend in Texas, and I have set him up with LaunchBox and the games and its nice and easy for him, but the Netplay just is a hassle. 

Share this post


Link to post
Share on other sites

Netplay with Retroarch is something I believe @Jason Carr has planned for this next round of updates for the next official build. Of course I could be wrong and Jason could change is mind but I believe he mentioned that being next because it was the next most voted thing on the last poll.

Share this post


Link to post
Share on other sites

@Izegod I somehow missed this thread but just stumbled on your video here: 

This is exactly what I was looking to do to integrate Retroarch Netplay, awesome job! The only pain point I can foresee is that supposedly Retroarch requires the ROM files to be scanned in for it to work. Is that your observation as well?

Also, would you be willing to share your source code with me to help me get it integrated faster? I would be looking to basically implement it exactly as you have done it, but with an interface that is more integrated into LaunchBox and Big Box. I'll certainly credit you for that code. :)

Share this post


Link to post
Share on other sites

@Jason Carr the roms checksum has to be same and it'll work... i've never scanned my roms with retroarch :)

I'll just paste the HORRIBLE class here:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unbroken.LaunchBox.Plugins;
using Unbroken.LaunchBox.Plugins.Data;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualBasic; //need this for the inputbox... obsolete with proper gui

//I apologize for this horrible code but maybe you can still use something from it :P

namespace LBP_SimpleRetroarchMultiplayer
{
    public class Class1 : IGameMenuItemPlugin
    {
        public string Caption
        {
            get
            {
                return "RetroArch Multiplayer";
            }
        }

        public System.Drawing.Image IconImage
        {
            get
            {
                return null;
            }
        }

        public bool ShowInBigBox
        {
            get
            {
                return true;
            }
        }

        public bool ShowInLaunchBox
        {
            get
            {
                return true;
            }
        }

        public bool SupportsMultipleGames
        {
            get
            {
                return false;
            }
        }

        public bool GetIsValidForGame(IGame selectedGame)
        {
            if (PluginHelper.DataManager.GetEmulatorById(selectedGame.EmulatorId).Title == "Retroarch") //emulator is retroarch? ok for netplay!
                return true;

            return false;
        }

        public bool GetIsValidForGames(IGame[] selectedGames)
        {
            return false;
        }

        public void OnSelected(IGame[] selectedGames)
        {
            return;
        }

        public void OnSelected(IGame selectedGame)
        {
            var emulator = PluginHelper.DataManager.GetEmulatorById(selectedGame.EmulatorId);
            var platform = PluginHelper.DataManager.GetPlatformByName(selectedGame.Platform);
            var emulatorPlatform = emulator.GetAllEmulatorPlatforms().ToList<IEmulatorPlatform>().Find(p => p.Platform == platform.Name);

            Process myArch = new Process();
            myArch.StartInfo.FileName = Path.GetFullPath(emulator.ApplicationPath); //retroarch doesn't like shortened paths so i use the GetFullPath function
            myArch.StartInfo.Arguments = emulatorPlatform.CommandLine + " " + '"' + Path.GetFullPath(selectedGame.ApplicationPath) + '"';
            myArch.StartInfo.WorkingDirectory = Path.GetDirectoryName(Path.GetFullPath(emulator.ApplicationPath)); //set working directory to retroarch.exe's dir

            var addCommand = "";

            if (MessageBox.Show("Do you want to host?" + Environment.NewLine + "If you choose no, you will connect as the client.", "Netplay setup", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                addCommand = addCommand + "-H "; //-H = Host
                addCommand = addCommand + "--nick " + Microsoft.VisualBasic.Interaction.InputBox("Please enter your nickname:","Multiplayer setup");
            }
            else
            {
                addCommand = addCommand + "-C " + Microsoft.VisualBasic.Interaction.InputBox("Please enter the Server IP or Hostname:", "Multiplayer setup"); //-C = Connect to server as client
                addCommand = addCommand + " --nick " + Microsoft.VisualBasic.Interaction.InputBox("Please enter your nickname", "Multiplayer setup");
            }

            
            myArch.StartInfo.Arguments = myArch.StartInfo.Arguments + " " + addCommand; //add our new command to the arguments
            myArch.Start(); //launch
        }
    }
}

Maybe you can still salvage something from it... it doesn't really do anything except start retroarch with parameters :D

I didn't develope this any further cause there wasn't much interest :(

  • Like 2

Share this post


Link to post
Share on other sites
5 minutes ago, Izegod said:

i've never scanned my roms with retroarch

That's good to hear, I was foreseeing this being a big issue but if there is a way around it that is very good.

  • Like 1

Share this post


Link to post
Share on other sites

If this can get implimented and working well with Launchbox, this would be huge!! Its my single most wanted feature at this point. I have noticed it the past when Netplay was redone last year, that you did have to have the roms scanned in RetroArch for it to work, and they needed to be used with the same core and same files, but if you and the other player have the same stuff, it did work pretty well. I haven't tried in a long long time as I was waiting for this. I really hope you guys can figure it out!

  • Like 1

Share this post


Link to post
Share on other sites

You only need to have the roms scanned in retroarch if you use the integrated serverbrowser of retroarch afaik... so it can join a sesssion properly by checking if you have the correct rom.

By starting it via commandline you directly tell it which rom to use... so no need to check it's own database :)

It's just important that both players use the EXACT same core (you have to set this up before!) and the EXACT same rom... if there is a crc missmatch during the handshake retroarch won't sync the games or abort the connection.

  • Like 2

Share this post


Link to post
Share on other sites

Alright, so I have this integrated in the latest beta:

 

@Izegod I forgot to put your name in the change log for this beta, but I have it in there for the next one. Thanks again for the plugin and the code. :)

I'm having a bit of trouble testing it, so if anyone can jump on testing it and let me know how it goes, I'd appreciate it. :)

  • Thanks 2

Share this post


Link to post
Share on other sites

lol that was fast. i'll test it when im back from work later today :D

EDIT: meh... just startet lb @ work cause i wanted to test it:

rnetplaynew.thumb.jpg.de14515d44163780110e8b91bdc4cd55.jpgWorks great actually @Jason Carr :D

Edited by Izegod
  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Izegod said:

lol that was fast. i'll test it when im back from work later today :D

EDIT: meh... just startet lb @ work cause i wanted to test it:

rnetplaynew.thumb.jpg.de14515d44163780110e8b91bdc4cd55.jpgWorks great actually @Jason Carr :D

Woot! Good to hear. Now if only I could get it working myself... ;)

Share this post


Link to post
Share on other sites
On 2/5/2018 at 11:27 PM, Izegod said:

lol that was fast. i'll test it when im back from work later today :D

EDIT: meh... just startet lb @ work cause i wanted to test it:

rnetplaynew.thumb.jpg.de14515d44163780110e8b91bdc4cd55.jpgWorks great actually @Jason Carr :D

Looks like you are running two copies of Retroarch locally... correct? Or are you remoting in and running one instance locally and the other remotely? Because I can't get it to work from outside the network yet. 

I'm having some weird slowdown issues though running Netplay. Contra on NES for instance runs fine just loading up the game without netplay, but with netplay enabled, it runs a bit slower and has choppy audio. 

Edited by TheMadMan007

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×