Splitscreen Multiplayer + Multiples of the same scene + input problems

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Metal Zero X
Posts: 4
Joined: Mon Apr 28, 2025 9:08 am

Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Metal Zero X »

Hello! I'm new to the forums here and it seems like a very nice place. I have been a lurker for a few weeks but now I need some help!


I'm making a co-op splitscreen game (like Stardew Valley) where people can experience their own cutscenes. The cutscenes are separate scenes that are loaded additively, off screen, then the player views them. During this time, their actual player is invulnerable and hidden in the game world, that is, they return to where they were after the cutscene.

The cutscene itself is just NPCs having a conversation, that the player clicks through (using a controller), where each dialogue entry just has an Actor and no conversant (there are also upwards of 5 characters in a conversation). They use overhead text bubbles which works great.

If a player starts a cutscene, and then halfway through, another player starts the same cutscene, how do I specify which actors the dialogue system should use, since they would all have duplicates? Is there a way to confine the conversation locally to a scene so they don't interrupt each other? They would be in placed at different coordinates with different cameras.

Also, player one always seems to take control of the conversation regardless of the order that the players sign up (keyboard then controller, or controller then keyboard). I use the new input manager but have a custom solution where player inputs are generated and an action map is created from a scriptable instance at launch. These exist on their own separately loaded scene that isn't destroyed, but easily accessed globally. Is there a way that you can completely disable the auto-input of the Dialogue System Controller, so that I can specify the controls for the player who loaded the scene? Currently I think I've disabled all the checkboxes and components, yet player one is still able to press the submit button on their action map to progress the conversation.

Any and all help would be greatly appreciated! Thank you so much :)
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Tony Li »

Hi,

For multiplayer input, this forum post links to two useful Input System tutorials. Each player will need its own dialogue UI, and that dialogue UI's canvas should read from that player's input. To tell the player to use a specific dialogue UI, add an Override Dialogue UI component to the player and assign the dialogue UI. (Basic Standard Dialogue UI is fine since you're using overhead bubbles.)

The simultaneous cutscene sequences are more challenging since each player will have their own unique instance of the cutscene scene. However, you can use variables to make things simpler. Below, I'll rough out what I think should be a workable solution -- although, full disclosure, I haven't tested this myself.

Set the Player actor as the listener of all dialogue entries in the cutscene conversation.

Let's say your cutscene scene has NPCs named Ann, Bob, and Carl with DialogueActor components that will help the Dialogue System find the NPC GameObjects. When you load the cutscene scene for player 1, save references to Ann, Bob, and Carl's Dialogue Actor components.When you load the cutscene scene for player 2, separately save references to Ann, Bob, and Carl's Dialogue Actor components in that scene, too.

Add a script with an OnConversationLine(Subtitle) method to the Dialogue Manager. In this method, check the value of DialogueLua.GetVariable("Actor") to determine whether this line is for player 1 or player 2. Then, for each NPC call CharacterInfo.RegisterActorTransform() to register the correct player's NPCs, such as:

Code: Select all

CharacterInfo.RegisterActorTransform("Ann", player1Ann);
I might be able to suggest alternatives if this isn't workable/practical.
Metal Zero X
Posts: 4
Joined: Mon Apr 28, 2025 9:08 am

Re: Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Metal Zero X »

Hi Tony, thank you so much for your reply, this forum is such a great place. I really appreciate you taking the time to write things out.

I have come up with a solution that I will post soon once I clean up the code and get some sleep. :D
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Tony Li »

Great! I'm looking forward to seeing what you came up with.
Metal Zero X
Posts: 4
Joined: Mon Apr 28, 2025 9:08 am

Re: Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Metal Zero X »

Alright! So, this was a doozy but very rewarding and I'm learning a lot more as I delve deeper into the Dialogue System.

Input

Firstly, the input system I have is an interesting one. It does use the new input system, and the inputs are registered to a scriptable object which can be easily input into any inspector at runtime to sync up commands globally. Individually, they are instanced on creation because there are multiple players that need their own inputs. I totally blanked and forgot that I could just implement the I{Map}Actions interface and set the callbacks to my cutscene manager script for whichever player launched their cutscene. With that, I could just call my actions like this:

Code: Select all

    public void OnFaceButtonWest(InputAction.CallbackContext context)
    {   // 'U' Key
        if (context.phase == InputActionPhase.Performed)
            OnContinue();
    }
The OnContinue() just calls the Standard Dialogue UI, which I set when the cutscene loads to whichever player loaded it. You mentioned each player needed their own Standard Dialogue UI, and that worked a treat. Passed that in on cutscene SceneLoad. Combined with the input, I now almost had individual control over each cutscene.

Conversation Instances

This was the tricky part, but this post really helped on simultaneous actors, particularly the scene project example near the bottom of the page: https://pixelcrushers.com/phpbb/viewtop ... ors#p28268

Tony your code examples within that project were extremely useful - thank you so much.

I basically created a conversation and then made a custom editor that checked the conversation and created GameObject fields for each actor within that conversation. Each of those game objects had their respective 'Dialogue Actor' actors field that noted who they should be via name, but it doesn't really matter since they can be dynamically assigned. This way I can support conversations with as many people as I want! Thank you, Tony!!

At runtime, when the new scene is loaded, the conversation is cloned, and each dialogue entry is matched with the actors in the scene, as they're simultaneously being registered as new unique actors, and then the dialogue UI overheads are automatically found and applied. Works like a charm!

This is all then cleaned up and removed so there aren't any extra conversations or actors.

Result

The result is that I can now have four split screen players running around a world. They can each individually load a new cutscene additively that plays their own instance of a conversation that is within the Database and assume complete control over the dialogue choices/actions/continues. All four players can also view the same cutscene at the same time and progress at their own pace without interrupting one another, if that oddly ever happened.

I have a bit of script cleaning up/factorising to do, but otherwise I'm really pleased with the result. This implementation (and just the Dialogue System in general) is going to save me a bucket load of time and make scripting and localising the game a breeze! Hope this made sense, and apologies if it did not. Not used to writing posts at all :D

Time to replace all my previous dialogue entries: lol:
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Tony Li »

Clever solution! Thanks for taking the time to write it up. I'm looking forward to seeing it in action. My friends and I love to play 4-player local multiplayer games, so I'll definitely check it out when it's released.
Metal Zero X
Posts: 4
Joined: Mon Apr 28, 2025 9:08 am

Re: Splitscreen Multiplayer + Multiples of the same scene + input problems

Post by Metal Zero X »

Thank you so much for all of your help. I have a few more questions but they're about different things, so I'll open a new thread if I can't find the answer.

And definitely! We are all about multiplayer and co-op, so it sounds like a plan :)
Post Reply