Dialogue For Split Screen Using a Gamepad

Announcements, support questions, and discussion for the Dialogue System.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

For this quest, the house would be in the same scene. But, in others there could be a chance of situations like this (moving the NPC somewhere) to being in other scenes.

I would like to put the players in different scenes if possible, so they could roam free and not depend on each other. But, main quests they would be together. I haven't actually learned how to put them in different scenes yet. Plus right now I only have this one scene, which may be the only scene I'll have for my demo.

The Thief would not be able to do the herb quest. I do want to be able to give the players different quests whenever I want to assign it. A player talking to a NPC who they don't get a quest from will just have a different dialogue conversation.

I would like to give the two players conversation trees with choices. I definitely was hoping to give them the ability to talk to each other about different things they might be going through.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Hi,
Lockes_TheThief wrote: Fri Apr 30, 2021 4:17 pmFor this quest, the house would be in the same scene. But, in others there could be a chance of situations like this (moving the NPC somewhere) to being in other scenes.

I would like to put the players in different scenes if possible, so they could roam free and not depend on each other. But, main quests they would be together. I haven't actually learned how to put them in different scenes yet. Plus right now I only have this one scene, which may be the only scene I'll have for my demo.
Thanks for the info. I was asking for two reasons:

1. To understand how you plan to handle multiple scenes, and

2. To suggest how to move Sonya the Sage around. If the starting scene and the Quest House were separate scenes, for example, you'd typically have a separate instance of the Sage in each scene, and you'd make each one active or inactive based on quest states. You can still do the same thing if it's all in the same scene, or you could actually move a single Sage GameObject to different places in the scene.
Lockes_TheThief wrote: Fri Apr 30, 2021 4:17 pmThe Thief would not be able to do the herb quest. I do want to be able to give the players different quests whenever I want to assign it. A player talking to a NPC who they don't get a quest from will just have a different dialogue conversation.
Sounds good. In that case, you'd set it up in one of two ways (your preference):

1. Two Dialogue System Triggers that play different conversations. Set Conditions > Accepted GameObjects on one to The Thief, and on the other to The Muse.

2. Or a single Dialogue System Trigger that starts a single conversation. The conversation can check which player is talking and branch accordingly.
Lockes_TheThief wrote: Fri Apr 30, 2021 4:17 pmI would like to give the two players conversation trees with choices. I definitely was hoping to give them the ability to talk to each other about different things they might be going through.
That's possible. A little trickier, though. Two ideas: (I don't know what it is with me and two of everything today.)

1. For player-player conversations, use some kind of shared UI that spans both screens.

2. Or show a separate UI in each player's screen area. They'll need to be coordinated. While The Muse is deciding on a response menu choice, The Thief's UI could either be hidden, or it could say something like "Waiting for reply from other player...".

In either case, you may end up needing to script a custom IDialogueUI implementation. If you're a little comfortable with C#, the IDialogue interface is pretty simple. It just has a few methods such as ShowSubtitle() and ShowResponses().

---

To get started, I recommend familiarizing yourself with the basics of single-player Quest Machine, and then with the integration. Watch tutorial videos 1, 2, and 6.

After that, set up Dialogue System Trigger(s) on Sonya the Sage to play conversation(s). If you have questions, let me know whether you went for 2 Dialogue System Triggers + 2 conversations or 1 Dialogue System Trigger + 1 conversation.

Make sure Sonya the Sage says different things to The Thief and The Muse. Once that's working, make a Quest Machine quest and get the integration working with it.
Andy Miira
Posts: 4
Joined: Wed Dec 23, 2020 11:11 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Andy Miira »

Lockes_TheThief wrote: Thu Apr 22, 2021 2:33 am It's gotta be something with my project itself. I have the unity package you gave me in my project and the menu issue happens the same (player 2 talks to NPC but the menu response appears on player 1 screen). It doesn't happen on the separate project you gave me in the DM.
Hi, I'm also interested in using Dialogue System in a split-screen game.
I followed the steps described on this thread (without the Opsive Character Controller parts), but I'm having the same issue mentioned above (player 2 talks to NPC but the menu response appears on player 1 screen). What was the solution for this issue? Can it be shared here?

In my case, I already use a "VN Template Standard Dialogue UI" for single-player mode. My game has a co-op multiplayer mode, and I'm having difficulty to set up the VN Template in each player's Screen Space canvases.

@TonyLi Could you make another split-screen dialogue example, but using Dialogue System only, without Opsive or other external assets? Thanks!
Andy Miira
Posts: 4
Joined: Wed Dec 23, 2020 11:11 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Andy Miira »

Tony Li wrote: Fri Apr 16, 2021 11:19 am
Lockes_TheThief wrote: Fri Apr 16, 2021 2:06 amNext I was able to get the bubble to work, sort of...It seems to favor player 1's screen
The default bubble prefab has a short script named AlwaysFaceCamera that orients the bubble to face whatever camera Unity has designated as the "MainCamera". Since you're in split screen mode, presumably with two cameras, it looks like it's just arbitrarily choosing one of the cameras. We'll probably need to use a modified version of AlwaysFaceCamera.

Should bubbles appear on both sides? Or only the side of the player who's talking with the NPC?
Another thing I want to ask: How can I "duplicate" a bark, to show it on both players' sides at the same time? (for instance, a Bubble UI Bark, called by BarkOnIdle)
I made a modified version of AlwaysFaceCamera that accounts for multiple players, I managed to make the logic that sets the correct m_mainCamera for each player.

On its Start() method, I tried to simply Instantiate() a clone of the current AlwaysFaceCamera GameObject (the Bubble Bark UI object), in case I'm in split-screen mode. Then, I set the respective player camera to the m_mainCamera of the original object and the clone.

And I use different Camera Culling Masks for each player camera, so I also set each Bark canvas to a specific layer, that will only be shown in its respective player camera (and masked in the other camera). This part of the logic is working correctly.

By the way, this "clone initialization logic" only happens in the original AlwaysFaceCamera, this part of the logic is skipped in the clone's AlwaysFaceCamera Start() method.

Unfortunately, just using Instantiate() didn't work, the cloned Bark object never displays its bark bubble.
What would be a better way to do this?

A screenshot for reference: (there should be another Bark bubble "crossing" the one that's visible)
capture_20210501_040324_001.png
capture_20210501_040324_001.png (191.27 KiB) Viewed 1108 times
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Andy Miira wrote: Fri Apr 30, 2021 9:44 pmHi, I'm also interested in using Dialogue System in a split-screen game.
I followed the steps described on this thread (without the Opsive Character Controller parts), but I'm having the same issue mentioned above (player 2 talks to NPC but the menu response appears on player 1 screen). What was the solution for this issue? Can it be shared here?
Each UI should be in a Screen Space - Camera canvas. Make sure the correct player's camera is assigned to the canvas. (I believe this was the issue earlier in this thread.)

Typically you'll make each player's UI a child of the player GameObject. Add a Dialogue Actor component and assign the UI as a custom menu panel. Make sure you've also assigned a unique player actor (as defined in your dialogue database) to each player's Dialogue Actor component.

Then make sure the Dialogue System Trigger (or however you're starting the conversation) uses the correct player GameObject as the conversation actor.
Andy Miira wrote: Fri Apr 30, 2021 9:44 pm@TonyLi Could you make another split-screen dialogue example, but using Dialogue System only, without Opsive or other external assets? Thanks!
I'll try to put something together this weekend.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Another thing I want to ask: How can I "duplicate" a bark, to show it on both players' sides at the same time?
A bark UI usually has one world space canvas.

Make a subclass of StandardBarkUI with two world space canvases: one on player 1's culling layer, the other on player 2's culling layer. Override the SetUIElementsActive(), Bark(), and Hide() methods so they work on both canvases.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

Is there a way to make the NPCs dialogue wait for player input before transitioning to the next bit of dialogue? It seems to just pop up for a certain amount of time then goes to the next thing until it gets to the player.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Yup! Set the Dialogue Manager GameObject's Display Settings > Subtitle Settings > Continue Button dropdown to Always.

Then add a continue button to your dialogue UIs, and assign it to the subtitle panel's Continue Button field. (Examine the Basic Standard Dialogue UI to see how it's set up.) Add a UI Button Key Trigger to the continue button, and specify an input action. This will bind the input action as a hotkey to the continue button.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

Cool, thanks. I almost got it working. But, how do I set the Continue Button? It isn't responding to any controller buttons, only the escape button on the keyboard.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

By the way, I chose the single dialogue system that is supposed to check which gameobject is interacting with it. But I don't seem to have it working properly yet, as both characters can still communicate with Sonya.
Post Reply