SplitScreen-Me / splitscreenme-nucleus

Nucleus Co-op is an application that starts multiple instances of a game for split-screen multiplayer gaming!
https://www.splitscreen.me/docs/what-is-splitscreen-me
GNU General Public License v3.0
856 stars 50 forks source link

✨ [Question/Request] Allow multiple `different` executable (.exe) files to be launched for each instances. Not just 1 same .exe for all instances #36

Closed rizdaprasetya closed 1 year ago

rizdaprasetya commented 1 year ago

I have searched through the issues and didn't find my problem.

Problem

Note: I am very new at writing handler scripts, so this could be issue on my side for not understanding the project & its documentation, so PCMIIW and point me to the right way. I am familiar with JS programming, just not yet with the project.

Update: current alternative working solution.

Possible Solution

Would be really helpful if the scripts can support:

Additional information

Background

I have 2 little nieces, on weekends they will borrow my PC to play games. But you know kids, they like to disagree a lot & want to play 2 different games on 1 same PC!

So there are:

I messed around and eventually found out that it definitely POSSIBLE (I confirmed it) using Proto Input (your other awesome project). Tested on games: Untitled Goose Game & Lost Ember (and several other lighter indie title, not triple-A games), can confirm it works beautifully!

With Proto Input I ran 2 .exe instances (Game-1 == GooseGame && Game-2 == LostEmber), configured it to redirect each of the 2 controller for each game. Boom, it is possible now for the 2 kids to play 2 different games split screen.

Now doing the manual set up (for each time I want to run those games) via Proto Input GUI is tedious. Being a lazy guy, I want to do this via Handler JS script (via Nucleus Coop). But then I found this problem.

Why is this useful?

I think Nucleus Coop have a LOT of potential and untapped market, like this one!

Currently it is only splitscreen for 1 same game. Why not expand it to also support splitscreen for 2 different games. I believe it is also called multiseat gaming (unfortunately most multiseat solution require separate monitor, but with Nucleus Coop it is possible with only 1 monitor). So maybe a better term is Splitscreen Multi Seat Gaming.

Imagine these use-cases:

This is some game-changing revolutionary tech (esp. for people on poor country like me & with gaming PC gear cost sky rocketing)!

And once again will restore the glory of PCMusterRace! /JK 😂

Kudos

Btw this project is really awesome! Really really helpful for us split-screen fans. Kudos to all contributors! 👍 Thanks!

Mikou27 commented 1 year ago

Already doable by different ways. Thanks for the suggestion and nice feedback.

rizdaprasetya commented 1 year ago

doable by different ways

Sounds good then, maybe there is a much more efficient way to achieve this use case than what I initially thought. Can you share how? or point me to the right resource/link?

Because I did some searching for this splitscreen multiseat gaming, but found very little resources (that actually works). Then I tried to create nucleus coop handler, but reading the docs made me unsure on how to achieve it. Or if you have snippet of Handlers JS script that I can refer, please do share. Thanks!

Mikou27 commented 1 year ago

I have no specific resources that could help you other than the regular Nucleus documentation. https://www.splitscreen.me/docs/create-handlers . You can ask for help on our discord https://discord.com/invite/QDUt8HpCvr someone may have something to share with you. I wish you luck ;) .

rizdaprasetya commented 1 year ago

Thanks, Going thru the docs again, I think one possible way to run different .exe for each instance is using Game.Play function.

I assume that function will run for each instances before the .exe started, which means I can attempt to change the Game.LauncherExe which will apply to that particular instance. Will try that.

Before asking here, I thought that function will run after the .exe started, apparently the behavior was not explicitly documented. I think once I confirmed the behavior, I can try to open PR to the docs to clarify this info, might be useful to other who is unsure like me.

Will try Discord to if need further help. (personally not a fan of a private forum platform which is un-indexed on search engine. I wish Discord is search engine friendly, at least like Reddit, would definitely helps avoid duplicate question like this thread.)

Mikou27 commented 1 year ago

You're on the right way, you can restrict a lot of methods per player in the Game.Play function. Agreed that discord is not always ideal but this is where the community is the most active.

rizdaprasetya commented 1 year ago

Ok finally after testing on last weekend, I found the answer (how), maybe useful for other people looking for this.

Here's how to run multiple different game executable (.exe files) for each Player Instances, on Nucleus Co Op JS handler script.

Something like this snippet (I used array to specify for each).

...
var gameExes = [];
gameExes[0] = "H:\\Games\\Feather\\Feather.exe"; // .exe file target that will be executed for Player 1 (index 0)
gameExes[1] = "H:\\Games\\Slime Rancher 2\\SlimeRancher2.exe"; // .exe file target that will be executed for Player 2 (index 1)

Game.Play = function() {
  var id = Context.PlayerID;

  Game.ExecutableName = gameExes[id];        // haven't actually test without this line will work or not, adding it by default
  Game.ExecutableToLaunch = gameExes[id];        // without this somehow doesn't work
};
...

Maybe tomorrow i'll open a PR on the official docs, to include this useful info for anyone wondering.

P.S. I did encounter other issue for my ultimate goal though: input not properly split b/w instances, and window resizing sometimes failed, NucleusCoOp app crashing, etc.. But that's a separate concern, & I guess I need some trial & error to figure out. For now I still use ProtoInput GUI to achive Multi-Seat Splitscreen PC gaming. Till later when I found a way to make my handler script more stable.

Thanks for the answer & direction!