Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Arttii · Jan 18, 2015 at 10:23 PM · photonroomdungeon

Multipalyer for a Room based game

Hi,

So I am in the process of adding multiplayer to my game. The game itself is roombased, think Binding of Isaac. So the contains a large amount of rooms, the player can transition from one room to the other, and I want for other player to be present as well. I am at a bit of loss as to how to implement this. I thought about doing a custom server, because the logic itself is not that complicated, but I do not think that is feasible, so instead I am looking at using something like Photon.

My current problem is the approach to take. I am thinking that I should have many rooms per Master server and each room has a scene, this way player can transition from room to room and Photon is already geared to handling a lot of rooms.

So my questions are:

  1. Is this a sensible approach?

  2. Is it possible to precreate many rooms on Photon and if so how?

  3. Whats an easy way to transition from room to room

Thanks for the help.

P.S I tried just joining another room from a scene with Photon, but this does not seem to work with something along the lines of

  Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.



Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by tobiass · Jan 20, 2015 at 03:49 PM

You will have to make up an ID for each room (you will need this anyways to load a level). This ID can be the roomname for Photon. You don't have to create the room at all. Simply call JoinOrCreateRoom(string roomName, ...) and set the ID as roomName. The server will join you or create the room on the fly as needed. If anyone else gets in the room, this client will join. Done.

A drawback: The rooms are suited for a small amount of players. If your game becomes popular and everyone goes into the same room, then this room can be overcrowded and things might go wrong on weaker networks and platforms.

A solution to that would be to use your own room-ID as Custom Room Property. You can use those Custom Room Properties as filter for (random) matchmaking in JoinRandomRoom(). You basically check if a client can join a random room with the room-ID. If not, this client creates such a room, applies the room-ID as Custom Property and it can be found by the next player.

Again: No pre-made rooms needed.

In PhotonNetwork.CreateRoom() you can set the Custom Properties as part of a RoomOptions object. Also set roomOptions.customRoomPropertiesForLobby. See the API documentation PDF in the PUN package for details.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Arttii · Jan 20, 2015 at 03:52 PM 0
Share

Well the problem with that is that I want each room to hold separate scenes I cannot coordinate this if the rooms are not precreated right?

avatar image tobiass · Jan 20, 2015 at 04:11 PM 0
Share

There is a room-ID per scene. When you go through a door, you find out where it leads and load the scene and join the fitting room.

There is no state and no scene on the server - unless a room is in use. If a player goes to a specific place where no one else was, then the room starts from scratch.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Photon Networking create room issue 1 Answer

How to get all created rooms and join any one of them in PHOTON 2 Answers

Photon Private Room Help 0 Answers

Join room and create if not existing. 0 Answers

Why doesn't this work 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges