How to splitscreen/couch coop?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

I've tested this and it doesn't work.
DabbingSquidward wrote:Last time I recall only the window in focus would receive inputs, be it gamepad or otherwise.
That's precisely the problem, otherwise it would work well on a dual core pc. It doesn't work on windows, can this input problem be easily solved? That would be great.

Edit: allowing gamepads to work in the background would solve this.
DISCL_BACKGROUND: The application requires background access. If background access is granted, the device can be acquired at any time, even when the associated window is not the active window.
https://bell0bytes.eu/directinput/

Edit2: done. :mrgreen: https://github.com/drfrag666/gzdoom/com ... d52b9a3c14
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

If there are no objections this coud be merged into GZDoom as well.
@realdevs: someone could go ahead and do the same for SDL, that 'SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS' thing.

Edit: what about adding 'SDL_SetHint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1");' before 'if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)'?
Or should be 'SDL_setenv("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1", 0);' instead?
My linux machine is collecting dust right now.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

I've done the same for linux, Blzut3 has approved the changes. :) https://github.com/drfrag666/gzdoom/com ... f2bc79577e
If there's interest i could do a PR.
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: How to splitscreen/couch coop?

Post by Rachael »

Go ahead with the PR. Will have to get a few other Linux folks to test it, though.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

Will do. I wonder if it would be fine do do all the PRs from the same branch, AFAIK in theory it should work. :)
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: How to splitscreen/couch coop?

Post by Rachael »

No, Github does not work like that.

You have to create a new branch for every PR.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to splitscreen/couch coop?

Post by Graf Zahl »

Correction: It's not Github not working like that but Git not working like that.
A PR is nothing more than a work branch being asked to be merged back to the mainline, either by doing a real merge or a rebase. So any PR from some long running work branch will pull in all the changes that were made since branching off the mainline, i.e., it's not the commit being asked to be merged but the branch!
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: How to splitscreen/couch coop?

Post by Rachael »

Graf Zahl wrote:Correction: It's not Github not working like that but Git not working like that.
A PR is nothing more than a work branch being asked to be merged back to the mainline, either by doing a real merge or a rebase. So any PR from some long running work branch will pull in all the changes that were made since branching off the mainline, i.e., it's not the commit being asked to be merged but the branch!
Yes - this is exactly right.

I think it's important to remember a distinction of what a commit really is for Git: each commit actually is its entire own unnamed branch (albeit in a frozen state), with complete history. That's why there's such a major difference between "git cherry-pick" and "git merge" - they might seem like they do the same thing, but they don't. "git merge" attempts to combine two histories together, where "git cherry-pick" intentionally tries to strip away a commit's history (and that's why a cherry-picked commit always has its own hash that's different from the commit that it came from).

This is important for multi-participant workflow because that allows multiple simultaneous projects to happen at the same time, for them all to eventually be merged in. It's what keeps Git from having a panic attack when you merge together 5 different 2000-commit branches, even when they touch the same files. (Yes, merge conflicts happen, but in an ideal world they'd be more rare than the ones we get in GZDoom - still though, people do deal with them)
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

It works well, in D3D it's faster but this is a ultra-lowend laptop, i tested a bit with BDv21 using the gamepad for player 2.
Probably you'll get the best results in software and limiting the number of threads to half the cores but i'm not sure.
Done the PR. https://github.com/coelckers/gzdoom/pull/883

Of course a know what a merge is and that a cherry-pick is a rebase. I was thinking of resetting that branch and merging with master but that would screw older PRs and wouldn't be clean.
small moist
Posts: 4
Joined: Sun Dec 17, 2017 11:02 am
Graphics Processor: nVidia with Vulkan support

Re: How to splitscreen/couch coop?

Post by small moist »

DrFrag / Rachael -
In the SSZdoom comments a couple of years ago Rachael said "it should be possible to combine this and my earlier attempt into the modern codebase and produce a working split-screen GZDoom on the modern codebase with all the features."

With the multiple instances seeming to work, do you guys still think this project could benefit from this?
I can't find any of Racheal's earlier attempts at modding the engine, but i'd absolutely get to work on it.
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: How to splitscreen/couch coop?

Post by Rachael »

https://github.com/madame-rachelle/qzdo ... litscreen3

Keep in mind this is a) not complete, and b) it will not merge properly into the existing codebase, whatsoever. It might merge into LZDoom with a little trouble, though, but even if it does, you still need some sort of input discrimination for the two players, and you also need to put in some way to store the second player's configuration settings (skin/name/freelook/sensitivity/etc) permanently.

To put this into modern versions of GZDoom, much of this will have to be rewritten - but luckily this can certainly be used as a starting point for that. (If nothing else, to be used as a guidebook to how it can be done)

I'm putting this here as a learning tool/reference, nothing more. If you think you can salvage something from this, be my guest.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

The available info is there, as Rachael said her attempt was very hacky and invasive (isn't it the same for all splitscreen implementations?) and very incomplete.
I don't think this could be merged into LZDoom (it's based on 3.3 and that code is pre 2.4). You'd need to port the code and then there would be a lot of work to do. Besides, are you an expert programmer? Or better said are you a God? (like in the Ghostbusters movie) :)
Rachael wrote:It will be impossible to maintain this past the 2.4 release when the fundamental systems do start getting reworked, and inevitably the affected parts will have to be done from scratch.
viewtopic.php?f=45&t=55169&p=978828&hil ... en#p978068

AFAIK fake splitscreen works well enough and i don't know about performance but should be better with real splitscreen. But Rachael's implementation only works on GL with render buffers enabled (more modern hardware). Fake splitscreen is faster on software D3D and for better performance i've ported the feature to ZDoom32.
In SSZDoom it works only for D3D, player two is just a clone of player one and there are even two menus. And only XInput.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

Hey what happened? If you feel like doing it and you think you're capable go ahead, just don't break multiplayer. Many years ago i wanted to create my own port with splitscreen based on WDMP but i never did. :)
small moist
Posts: 4
Joined: Sun Dec 17, 2017 11:02 am
Graphics Processor: nVidia with Vulkan support

Re: How to splitscreen/couch coop?

Post by small moist »

Hey! I don't see a point in doing the split screen feature with one instance now.

The performance of LZDoom in 4 player split screen (1080P) on my I7 7700 was outstanding, and with great mod support. SSZDoom performed way below that (not unplayable), but the lack of features that a standalone engine fork would have outweigh the split screen feature / poor performance so honestly we already have Eternity banana split for that.

I did do some work though to make the experience more enjoyable:
-Modified the DeathCoin gzdoom mod to provide a lives based coop survival mode (set lives at the command line with +lives). I made this compatible with SSZdoom / GZdoom / LZdoom, working on mod compatibility. Also fixed some quality of life issues and simplified it more.

-Made a collection of config / batch files that open 4 players with 4 controllers (got that working last night). 4 xinput controllers with 4 buttons each all emulating one controller, and ill add some app settings files for that.

I believe this is a better workaround that can keep up with GZDoom and doom more in the long run.
I'll keep making / refining some Coop things that should help populate the COOP scene.

Thanks for the encouragement haha, and the resources.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: How to splitscreen/couch coop?

Post by drfrag »

Glad it works well, that's a very fast machine. I tried 2 players with my nephew and we had fun, runs well on my ultra-lowend laptop. Recently i've added support for 4 DInput joysticks at the same time with 32 buttons each, i've tested it with 2 cheap gamepads. :)
Post Reply

Return to “General”