playMaker

Author Topic: Photon: going to new scenes, but retaining multiplayer.  (Read 7112 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Photon: going to new scenes, but retaining multiplayer.
« on: March 06, 2013, 05:29:24 AM »
A bit of a tricky one this:

In my photon game, I've been building my world in one scene. Now I realise that for a number of reasons, they may be the need to have a player load another scene. The most obvious reason is, interiors. When a player arrives at a door, he can go through it and, normally, in a single player game, I would load a new scene, for just the interior of the building. and when he goes out that door, we would reload the exterior scene.

There are many reasons for this, firstly you can cheat a bit and have the interior, not be exactly the same dimensions as the exterior, secondly, simplicity, its nce to work in a clean new scene without a having to worry about accidentally destroying things or moving things you cant see cos the scene is so full of stuff. More importantly, it keeps the scenes down in file size, less optimising issues. And finally, lights, I am of course using a clever lighting system for exterior, and it kind of interferes with the lights inside a building (its hard to get very dark).

SO.. whats going to happen if I do just that? a Photon multiplayer triggers an area outside a door, and we fade out camera, load new scene, and fade in with character in new scene.
Is the Photon network lost?, does photon register that someone has left the room? And make that space available for a new player? (in my case the game is for max 4 players)

OR, is a new scene simply that, the same game, but anew scene, could another character follow him in there? (This is a game design issue, I might be able to avoid other characters following in may story. ("Sorry Only Priests are loowed in the Church) etc...

I could do a compromise if it was programming hell. I could keep it all happening in one scene, but have the interiors somewhere far away (under the terrain perhaps) and just spawn the players into these "virtual stage sets". This would solve the "its getting messy" and "being able to cheat" issues, but not lighting or file size.

Just wondering, cos its about time I decided, ONE GIMONGOUS SCENE, or lots of smaller ones.


MArk

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon: going to new scenes, but retaining multiplayer.
« Reply #1 on: March 06, 2013, 09:23:43 AM »
Hi,

 You can set a game object to not be destroyed on scene loading, so your players can survive a scene loading.

one other way is to use "additive" loading, where you never really delete anything that us currently in the scene. When using additive level loading, you are then responsible for deleting anything you don't need anymore in your scene.

 I suggest the second approach. have smaller scenes that only contains the new level, and load it additively to your main scene

bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon: going to new scenes, but retaining multiplayer.
« Reply #2 on: March 06, 2013, 04:29:12 PM »
SPrry I dont really follow you:
Quote
I suggest the second approach. have smaller scenes that only contains the new level, and load it additively to your main scene

Is this actually NOT loading another Scene at all? just enabling and disabling things? I have only ever just click load new Scene and the previous is destroyed as the new one is created, I have the player positioned in the right place (as if he just came thru a door) and if the User still has his finger on W, he carries right on walking on, as if nothing happened.

So what happens with additive? What happens to the previous Scene, is it there, on screen, just we+re not looking at it?

What happens to the OTHER players, if they dont follow you into this building, are they all happily in there own buildings? (which are all really separate scenes?)

I feel like IM asking he question again, sorry!!

 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon: going to new scenes, but retaining multiplayer.
« Reply #3 on: March 15, 2013, 10:19:20 AM »
Hi,

 don't worry :)

 ------
loading scene will destroy everything APART from gameObject explicitly marked as "dontdestroyOnLoad". there is an action for this.

-------
loading scene additively will NOT delete or destroy anything currently in your scene. There is not such thing as "previous scene" unfortunatly, I whish there was a way to track elements loaded per scene, but that's not the case. so you are responsible for managing elements in your scene if you want to destroy some elements of previous additive loading.

 does that make things clearer?

bye,

 Jean