Topic: Waiting for players to ready up in multiplayer

Dear UFE

We are wanting to add a UI interface so that when a person joins a room, they will have various options and then have to ready up.  I have been looking into photon and most of this is coming together as expected however UFE's default behaviour is that if one player hosts a game, as soon as the second player has joined, both players automatically launch into the character select.

I have tried supressing this behaviour in the hostgamescreen.cs
protected virtual void OnPlayerConnectedToMatch(MultiplayerAPI.PlayerInformation player)
and commenting out circa line 64
// UFE.StartNetworkGame((float)UFE.config.gameGUI.screenFadeDuration, 1, false);

This does stop the game from launching partly however as soon as another person joins, I am getting a lot of errors.
It looks very much like there is other behaviour that I need to supress.  Please can you advise where I should look for this?

Your help will be very much appreciated.

Share

Thumbs up Thumbs down

Re: Waiting for players to ready up in multiplayer

Some additional information, I may have found a way to hold the system back in part however as soon as a second person connects, it starts getting inputs from them so they are even controlling the cursor in one of the menus.  If I wanted to hold back the input section from instantly switching to the remote inputs, where would be the best place to do this?  Kind regards

Share

Thumbs up Thumbs down

Re: Waiting for players to ready up in multiplayer

A feature like this is not as easy as it sounds. You need to deconstruct a lot of interfaces on UFE 2 to achieve that.
I actually already built an interface like that for UFE 3, but its currently a work in progress (Photon only).

https://i.ibb.co/Jxqw9x4/image.png
https://i.ibb.co/L03zN8C/image.png
https://i.ibb.co/BZk6p8m/image.png
https://i.ibb.co/PCQwNnS/image.png

UFE 3 will initially be available for Tier 4 Patreon only (Must have UFE 2 Source and be a Tier 4 Patreon).
I should have an official announcement and invitation rules on UFE 3 next week. Stay tuned.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

4 (edited by Crux-Actual 2023-08-02 03:58:42)

Re: Waiting for players to ready up in multiplayer

Mistermind wrote:

A feature like this is not as easy as it sounds. You need to deconstruct a lot of interfaces on UFE 2 to achieve that.
I actually already built an interface like that for UFE 3, but its currently a work in progress (Photon only).

https://i.ibb.co/Jxqw9x4/image.png
https://i.ibb.co/L03zN8C/image.png
https://i.ibb.co/BZk6p8m/image.png
https://i.ibb.co/PCQwNnS/image.png

UFE 3 will initially be available for Tier 4 Patreon only (Must have UFE 2 Source and be a Tier 4 Patreon).
I should have an official announcement and invitation rules on UFE 3 next week. Stay tuned.

Hi Mistermind , thanks for looking into this for us.  Unfortunately we are quite far on in the project and I don't believe that for this current game migrating to UFE will be viable.  I have had some success so far but the current issue what may be most helpful is with the specific part of the code which transfers control (inputs) to the remote player which seems to happen as soon as two people are detected in a room.  Controlling the logic for if both players are ticked in and only then progressing to the character selection screen seems quite possible but if can you direct me to what specifically transfers the players control to the remote that will be most helpful. I think it may be in StartNetworkGame() within UFE.cs where it says "UFE.remotePlayerController.Initialize(UFE.p2Controller.inputReferences);" however if I hold this back for whatever reason, I get a lot of exceptions.   Another possibility is in UFE.cs GetPlayer2Controller().  I have tried a few changes here such as forcing it to return localPlayerController or p2Controller but thus far I haven't been able to get it to work.
If need to suppress this auto control switching behaviour as well until both sides are ready, please can you advise on how to best do this?
.
PS Were are using Photon and have the Source version of UFE2.

Share

Thumbs up Thumbs down