playMaker

Author Topic: Ideas plans and prototypes about create room, join room and leave room.[SOLVED]  (Read 8448 times)

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
I want to discuss with community about this.
Let´s beging with the example scene of the Photon Playmaker integration.

1-This scene we have a lobby and a room on it.Right?

So if I would like to have an scene for the lobby and another scene for the map. What is the best way to make it?
I read about this custom process is made with load level additive. Is an solution I think.
But it isn´t so easy to use.
In the example scene we have menu manager, game manager and the enabler.

I have tested with level additive but sometimes I get problems as (when I create the room it creates but then disconnects and goes again to my menu scene), (when I connect a client on that room makes the same think of the first).

2-How can I make this work?

3-And should I have a PlayMaker Photon Proxy per scene?

4-In Menu scene to you recommend to me have menu manager.And in the map scene have the game manager?

If you guys need screen shots please say it.
Bye
Thank you
« Last Edit: October 02, 2012, 05:54:39 PM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15076
  • Official Playmaker Support
    • View Profile
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #1 on: September 26, 2012, 10:23:58 PM »
Hi,

Yes you are correct, in the photon demo, there is only one scene for both the lobby and the room.

 I don't think that level additive is the solution for your set up.

 If you have one scene acting as a lobby and one scene acting as the room, you simply need to call the room scene from the lobby.

 the key here is understand what gets enabled and disabled based on wether the player is in the lobby or the room, then simply have them various gameObject in their respective scene.

https://hutonggames.fogbugz.com/default.asp?W859

It will implies a lot of duplication in photon testing ans queries, but that's fine.

 If you have trouble with this, I can put together a version that works with two scenes, one for the lobby and one for the room.

bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #2 on: September 27, 2012, 05:16:32 AM »
Hi Jean
Thank you for reply
I'm gonna try to make it when I get home. I'm in school now.
I will study this part again very well and I' gonna try to inplement your way.
I'm gonna try to don't take more your time. Thank you
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #3 on: September 28, 2012, 03:42:49 PM »
Hi
I´m so sorry about that but I´m not getting it working well.
In the lobby scene I have the menu manager and an PlayMaker Photon Proxy.
In the "map1" scene I have the game manager.

In Create Room FSM-
When I say create he goes to create room state. I have photon create room and load level "map1".

I hit play. I hit create room and he creates, he instantiates the demo worker and by 5 seconds he is on server. But after that the comes again to my lobby scene. Seems he ban me.
I see this on console and I think that is the problem.

1-
Quote
createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: -3 (Not authorized). Parameters: {}.
UnityEngine.Debug:LogError(Object)
PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:127)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:709)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:846)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:65)

2-
Quote
PLayMaker Photon proxy:OnPhotonCreateRoomFailed
UnityEngine.Debug:Log(Object)
PlayMakerPhotonProxy:OnPhotonCreateRoomFailed() (at Assets/PlayMaker/Photon Networking/Scripts/PlayMakerPhotonProxy.cs:578)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
NetworkingPeer:SendMonoMessage(PhotonNetworkingMessage, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1400)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:849)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:65)
Do you think that this is the problem?
Thank you.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15076
  • Official Playmaker Support
    • View Profile
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #4 on: September 30, 2012, 10:03:26 PM »
Hi,

 Ok, I'll make a variation of the demo to work with two separate scenes. If you don't here anything by the end of the week, please bump this thread :)

bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
    • View Profile
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #5 on: September 30, 2012, 11:23:36 PM »
This is very interesting to me too. I'm currently using the Demo from Photon for the network part of my game, and its working well. However as a non-coder, changing one small thing is hard. I don't specifically need a seperate Lobby scene, but would prefer that the Room name was hard-coded, and automatically created if no-one else had done so, but if they had, to skip to join room, instead.

However I would like a kind if menu where you can choose WHICH room to join, from a pre-determined list if maps.
(it's a fighting game, where you can choose arenas.

In this menu you should be able to Name your character and choose an arena.(which map).

Further down the road I would like this menu to be able to access variables from all running rooms, and display the name and score if the player with currently best score. For this I'm going to need to send score info to all clients, ( for an in game scoreboard, And read the top score to the main menu.

Even later I want this variable sent out of Unity all together so high scores can be shown on a website, but I realise that is a whole OTHER ball game!

Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15076
  • Official Playmaker Support
    • View Profile
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #6 on: October 01, 2012, 03:38:21 AM »
HI,

 indeed, this demo is only your way out of learning how Photon is integrated in PLaymaker. It is important that you gain knowledge of this before moving on into doing your own stuff.

In this case, it's only a matter of presentation and UI. In this demo, the ui was done in testing mode kind of way, where obviously for a real game, the ui would offer something totally different, like for example, a set of hardcoded rooms, or a more robust way to create/join rooms, etc etc.

 If you ask very granular questions on this forum, you are likely to get answers and progress this way. However if you need consultancy or developement work force to help you move faster on sensitive projects, do not hesitate to pm me, so that we can arrange something.

Let's wait for me to do this new demo variation, and then we'll see if that helps you progress in your game.

bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #7 on: October 01, 2012, 01:31:34 PM »
Hi,

 Ok, I'll make a variation of the demo to work with two separate scenes. If you don't here anything by the end of the week, please bump this thread :)

bye,

 Jean

Thank you so much Jean.
Bye

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15076
  • Official Playmaker Support
    • View Profile
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #8 on: October 02, 2012, 04:41:38 AM »
Hi,

 ok, I did the changes to the demo so that there is a scene for the lobby and a scene for the room. Follow the steps below and you'll get the same. I have attached the two scenes for you to have a working version to study.

1: make two copy of the the "playMakeTextScene" and name them "demo_lobby" and "demo_room"
2: select "demo_lobby"
3: delete the following gameObjects: "chat", "enabler" and "game"
4: open the fsm "Menu/connection"
5: in the state "we are in, reload", remove the "load level num" action and add a "load level" action and set the level name property to "demo_room"
6: open "demo_room"
7: delete the following gameObjets: "menu" and "enabler"
8: in the publish settings, have "demo_lobby" as scene 0 and "demo_room" as scene 1

and that's it, now you have separate scenes for your lobby and room.

Before this, the "enabler" gameObject was responsible of deleting and activating the various "chat", "game" and "menu" depending on the context,

if you have questions, let me know,

 bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #9 on: October 02, 2012, 01:37:11 PM »
Thank you so much Jean!! :)
Believe I was thinking that part of "we are in, reload" was the solution. Thank you so much.

But in the games that have different maps he is always loading the "demo_room" and it´s bad.
So I created an global string variable called "ID Map".
When you are joining, creating an room with a specific map you will say set string value of "ID Map" to name of that specific map.

For example you have two maps.
You join to "map1", you say set string value to "map1", he joins.
You leaves the room.
You want to join to "map2", you say set string value to "map2", he joins.
That´s it!

But thank you so much Jean.

Bye

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15076
  • Official Playmaker Support
    • View Profile
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #10 on: October 02, 2012, 05:54:22 PM »
Hi,

 Perfect Sebastio. This demo is meant to be modified just like you did, so that it fit your purpose, I am glad you have extrapolated on this demo to achieve what you wanted.

bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: Ideas plans and prototypes about create room, join room and leave room.
« Reply #11 on: October 04, 2012, 06:41:24 AM »
Hi,

 Perfect Sebastio. This demo is meant to be modified just like you did, so that it fit your purpose, I am glad you have extrapolated on this demo to achieve what you wanted.

bye,

 Jean

Thank you Jean.
But the best thing come from you. You are the best.
Bye
« Last Edit: October 04, 2012, 06:55:00 AM by Sebastiao »