Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: serenefox on March 17, 2017, 03:06:23 AM

Title: Photon Question about spawning a level across the server.[SOLVED]
Post by: serenefox on March 17, 2017, 03:06:23 AM
Hi everybody!

So I recently started making my 6th game an I figured it was time I moved into some multiplayer since I purchased the photon PUN+ awhile back and never used it.

So here is my question I am trying to generate a level with a plugin called Dungen. The problem I am having is how to get the spawned pieces to sync across the server.

I thought at first to network instantiate them each with a photon view component but upon doing more research I learned that the method might not be good for performance.

Then I thought about RPCs but when I implemented it the game hit a spike like I have never seen before in the profiler. Can anyone give me some heads up on the best way to do this.

Basically the dungeon gets spawned under a root gameObject as individual prefabs.

Any info would be appreciated.

Thanks
Title: Re: Photon Question about spawning a level across the server.
Post by: jeanfabre on March 17, 2017, 03:13:43 AM
Hi,

 yes, this would be an instant fail if you had the whole level with photonviews on each walls :)

 what you need here is to share the level generation data with another mean, ivy your own server for example.

 the master player ( the one who create the room )  is going to generate the level, you shoudl then upload this level generation data to your server with a reference to the room name it relates too, then other players joining this room, will simply get this generation data.

 but you should not use Photon for this, you could use a buffered RPC ( which means this rpc call stay in cache for any new player joining to get it), that rpc could have the generation data, but if it's too big, then it will be a problem, rpc data is constrained in size.

 So get in touch with the author of this dungon creator to see if there is the possibility to get and set dungon generation using a string or some data that can be stored online somehow.

 if not, then this is going to be tricky indeed. Also, if this is your first game in multi player, dynamic scenery is maybe too much, I would first make a project with less features, to get acquainted with all the things you need to learn for MP.

 Bye,

 Jean
Title: Re: Photon Question about spawning a level across the server.
Post by: serenefox on March 17, 2017, 04:18:50 AM
Thanks for your reply and support jean! I got it to sync the random/procedurally generated dungeon efficiently! I wouldn't have been able to figure it out properly without what you explained.
Title: Re: Photon Question about spawning a level across the server.
Post by: jeanfabre on March 20, 2017, 04:43:30 AM
Hi,

 excellent :) I am glad I could help.

 Bye,

 Jean