The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How do I make fusion join a random room with active players?

Cullis_Wullis
2023-01-02 23:05:30

How do I make fusion join a random room with active players in it that doesnt have a session name like 693468978-6837-7358793587

Comments

Isaac_Augusto
2023-01-03 11:55:58

Hey,

You can just left the session field blank on the StartGameArgs when starting a game with GameMode.Client .

GameMode.Client: Will join a random room, if no room was found, throws an exception.

GameMode.AutoHostOrJoin: Will join a random room, if no room was found, It will create one.

GameMode.Shared: Same as AutoHost.


Photon Fusion Team

Isaac Augusto

Cullis_Wullis
2023-01-04 00:45:53

Hey, thanks for the response! I use shared and do just that for joining a random room but I was wondering if it is possible to have fusion generate a more simple room name when creating a room (if no room was found of course). From what I have seen it seems to generate very long complex session names when no session name is given. Example being something like: 67206702068-684936-6439869

Isaac_Augusto
2023-01-04 12:33:16

Hi,

Currently, the session name is a GUID created by the matchmaking system.

But, what you can do it's make your own flow to connect to a session. Like the following:

Try to connect normally to a random session, but with the DisableClientSessionCreation (I may have misspell the naming) attribute of StartGameArgs set to True

  • .

  • Since now the client can't crate a session if none was found, it will throw an exception that no session was found.

  • You can now handle the exception and try to start a new game (with clients being able to create a session) with a new session name that you can generate... a 6 digits code for instance.


Isaac Augusto

Photon Fusion Team

Cullis_Wullis
2023-01-04 13:17:14

Thank you very much for the help! One more question I'm still pretty new to fusion so this may he an obvious question but will fusion also throw an exception if the room has reached max players (set in network project config)? Thanks again for all the help!

Isaac_Augusto
2023-01-05 13:35:25

Hey,

Yes, it will.

You can take a look on ShutdownReason.


Isaac Augusto

Photon Fusion Team

Back to top