呂裕翔
呂裕翔

Reputation: 41

How can I use (photon bolt) to create multiple rooms and make clients randomly join automatically?

I want to create 6v6 fps game. I have used the (headless server) that bolt sample provide to me Below are the problems that I encounter currently.

1.I don`t know how I can make server auto create multiple rooms for different fight such as room1 for 6v6 , room2 for another 6v6

2.I have no idea how I can make clients connect to server and randomly join empty rooms automatically. For example, There is button called (battle). I click the button and randomly have joined one of rooms automatically, however the game is not starting and there is sentence like (3/12) and (loading). When the sentence becomes (12/12), I enter the game and play.

I have searched many results for two questions, but I still find great solution. I hope I can get the best suggestion or method to finish two questions. Thank for your time.

Upvotes: 0

Views: 1296

Answers (1)

Ramon Melo
Ramon Melo

Reputation: 21

  1. The Headless sample will create and manage only 1 (one) room. You can spawn as many servers you want, but these need to be separated process.
  2. To make random matchmaking, currently, you will need to start a game as a Client and waits until you receive a SessionListUpdated() event in one of your classes that extends GlobalEventListener, there you will get a list of all available rooms. With the Sessions references, you can get room information, like the occupation ratio and choose which one to join.

You can check here an example of how to list the rooms: https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L56 And here you can check how to get some information from the Photon Sessions: https://github.com/BoltEngine/Bolt-Sample/blob/master/BoltInit.cs#L74

Upvotes: 1

Related Questions