Playmaker Forum

PlayMaker Help & Tips => PlayMaker Tutorials => Topic started by: will_brett on January 25, 2013, 07:56:55 PM

Title: Photon server tutorial
Post by: will_brett on January 25, 2013, 07:56:55 PM
Hi everyone.

I have been trying to figure out how to get photonserver working in playmaker. I know it's doable because i saw the thread on here and downloaded the package. Unfortunately I just cant figure out what to do once I've gone through the wizard and everything is green. I click play and nothing shows up. Are there any walk throughs or tutorials out there that can help me?

all the best

will
Title: Re: Photon server tutorial
Post by: jeanfabre on January 28, 2013, 01:12:14 AM
Hi,

What scene are you playing?

 the best approach right now is to try to play the photon scene itself, not the playmaker one, then you'll know if this is a problem with playmaker or else.


bye,

 Jean
Title: Re: Photon server tutorial
Post by: will_brett on February 01, 2013, 02:24:34 PM
Hi Jean,

thanks for replying.

I've got photon working now and I must say its much easier with playmaker than without.

I would still love to see some form of networking tutorial with playmaker though, similar to those on the playmaker site.

Cheers

WB
Title: Re: Photon server tutorial
Post by: jeanfabre on February 02, 2013, 03:38:24 PM
Hi,

 Yes, that would be great indeed.

the best I recommand right now, is to start small. Don't start with what you want to achieve ideally. Start with a basic cube, make it rotate simply, and have it working via the photon system. Once you will pick up the way it's working, how to create and manage rooms, and deals with network views, then you can tackle your real purpose.

 I have made extensive documentation on the demo, have you had a look? if yes, maybe you have suggestions as to where to improve or add more details.

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


bye,

 Jean
Title: Re: Photon server tutorial
Post by: will_brett on February 02, 2013, 03:47:41 PM
Hello Jean,

I have read your document and it's great, obviously a huge amount of work has gone into this. The only thing i have trouble with is there is so much information that I instantly felt overwhelmed. Using the document and the demo I have now built my own Chat room similar to the demo but without the demo worker and much simpler. Currently working on the GUI.

The next part Im trying to figure out is how to send items to other players so that it appears on their screen but not the player that sent it.

Thank you for your help

WB
Title: Re: Photon server tutorial
Post by: jeanfabre on February 08, 2013, 02:24:36 AM
Hi,

 Indeed, it's a stuggle to give a consise explanation of photon, playmaker and the concepts in generals. So you need to really keep up and study it over and over again, reading as much as you can from various sources until it starts to mentaly make sense, and YES, doing your own version and implementations is the best way to gain experience, so this is good you are getting down with making your own simple tests.

items/players is the same really, it's a gameObject you instantiate over the network. So if your player is for example creating a sphere, the sphere gameObject must obey the same rules as the player prefab, that is it has to have a photonView component at the very least so that all players see that sphere.

then if the sphere has to implement features, add a fsm to it and start adding feature using the same patterns as the player prefab ( that is if it has to behave in certain way, only the "is mine" version of the sphere should implement actions, and all the "is not mine" sphere should simply catch up with it.

Does that make sense? the player prefab is nothing special in it implementation over the network, it can be anything really.

bye,

 Jean
Title: Re: Photon server tutorial
Post by: Fletch on June 04, 2013, 03:19:57 AM
You guys make great tutorials... you should just put a few of them together to help us quickly figure out the Photon stuff.  So much can be done in video that a pdf just can't.
Title: Re: Photon server tutorial
Post by: Fletch on June 07, 2013, 01:19:58 PM
Is there a trick to getting the DemoWorker scene to work?

I get the following error when opening the scene.

Assets/Scripts/GameManager.cs(13,14): error CS0101: The namespace `global::' already contains a definition for `GameManager'

and

Assets/Scripts/ThirdPersonCamera.cs(4,14): error CS0101: The namespace `global::' already contains a definition for `ThirdPersonCamera'

And there doesn't seem to be any FSMs attached to any of the objects in the demoworker scene.  I'm certain I'm missing some step.

Title: Re: Photon server tutorial
Post by: Fletch on June 07, 2013, 03:43:08 PM
Okay... I must be doing something wrong.  I've got the Demoworker scene to work and am connected, running around with multiple people.  But all that is being done with the scene that comes with Demoworker.

So I want to use Playmaker to do all this same stuff.  So I import the Playmaker package and without even touching anything, I'm getting errors thrown.  Is there some step I'm missing that is suppose to clear these errors?
Title: Re: Photon server tutorial
Post by: Fletch on June 07, 2013, 04:07:44 PM
Seems to me it would have made it a lot more simple if the Playmaker version of the Demoworker was available for download somewhere.
Title: Re: Photon server tutorial
Post by: jeanfabre on June 07, 2013, 05:25:39 PM
Hi,

PlayMaker package doesn't come with the demos. So I guess you are importing the photon package from the asset store right?

PlayMaker is shipping Photon, so you don't need to actually import Photon separatly.

 Is it the case? else can you describe what package you are importing?

I personnaly as a rule of thumb never mix my projects with demos, because they take more resources, so it's always a good idea to have special projects ti run just the demos. in them projects, you then delete any duplicated scripts in your case "GameManager" and "ThirdPersonCamera" which are used by the photon demos, but clash with unity own standard scripts and maybe another package in the case of "GameManager" which is a common name.


 Bye,

 Jean
 
Title: Re: Photon server tutorial
Post by: Fletch on June 07, 2013, 06:02:11 PM
Okay... I've almost got this thing working but it's been a complete pain.  Looked at the start like it was going to be simple.

I'm now connecting through the Playmaker FSMs to the Photon cloud.  I can even instantiate but I'm getting errors with the chat FSM.  Here are my errors:

Could Not Create Action: Chat: chat: adds it to the current text: StringAddNewLine (Maybe the script was removed?)
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.ActionData:CreateAction(FsmState, Int32)
HutongGames.PlayMaker.ActionData:LoadActions(FsmState)
HutongGames.PlayMaker.FsmState:LoadActions()
HutongGames.PlayMaker.Fsm:InitData()
HutongGames.PlayMaker.Fsm:Init(MonoBehaviour)
PlayMakerFSM:Init()
PlayMakerFSM:Awake()

and

Could Not Create Action: Chat: chat: trim: StringDeleteLine (Maybe the script was removed?)
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.ActionData:CreateAction(FsmState, Int32)
HutongGames.PlayMaker.ActionData:LoadActions(FsmState)
HutongGames.PlayMaker.FsmState:LoadActions()
HutongGames.PlayMaker.Fsm:InitData()
HutongGames.PlayMaker.Fsm:Init(MonoBehaviour)
PlayMakerFSM:Init()
PlayMakerFSM:Awake()


and


Could Not Create Action: Chat: chat: is number of line maxed out: StringGetLineCount (Maybe the script was removed?)
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.ActionData:CreateAction(FsmState, Int32)
HutongGames.PlayMaker.ActionData:LoadActions(FsmState)
HutongGames.PlayMaker.FsmState:LoadActions()
HutongGames.PlayMaker.Fsm:InitData()
HutongGames.PlayMaker.Fsm:Init(MonoBehaviour)
PlayMakerFSM:Init()
PlayMakerFSM:Awake()


Title: Re: Photon server tutorial
Post by: Fletch on June 07, 2013, 10:47:20 PM
I can see that somehow the Chat script has been completely erased.  Not sure how to get it back or where it goes.
Title: Re: Photon server tutorial
Post by: jeanfabre on June 08, 2013, 12:06:45 AM
Hi,

I am not making sense of this, it seems that you are missing scripts here and there...

 Can you confirm you have done the following:

1: create a new project
2: import playmaker from the asset store
3: went to the sample download page: http://www.hutonggames.com/samples.php ( available from the welcome window of playmaker
4: downloaded the photon demos and installed it

what do you get then?

bye,

 Jean
Title: Re: Photon server tutorial
Post by: Fletch on June 08, 2013, 11:56:10 AM
Okay, I did a clean reinstall of Unity just to be sure I wasn't screwing something up somewhere.

I followed each step in your instructions and I fire up the playmakerTestGame scene and this is the error I get.


Assets/Photon Unity Networking/PlayMaker/Actions/PhotonViewGetID.cs(49,56): error CS1061: Type `int' does not contain a definition for `ID' and no extension method `ID' of type `int' could be found (are you missing a using directive or an assembly reference?)

What am I doing wrong?
Title: Re: Photon server tutorial
Post by: Fletch on June 08, 2013, 01:27:51 PM
Okay... I'm finally starting to see the light at the end of the tunnel. 

I've got the demo working now from within Unity.

The issues I'm having now seem to be in the output build and run.

I add that demo scene to the scene list in the build settings and press build and run. .. but it won't run.  It gives me a few more errors now.

They seem to be minor FSMs and that's why it's not killing the whole thing, but it is stopping it from building and running.  This is the page in the tutorials that it is having issues with.
https://hutonggames.fogbugz.com/default.asp?W872 (https://hutonggames.fogbugz.com/default.asp?W872)

The error is:
Remote Event not set
Chat:Chat target gui: send RPC chat : PhotonViewRPCBroadcastFsmEvent

I can see the issue when I open the FSM in question.  What remote event should that be?  All I have in the dropdown menu is none, room is busy, room is empty, photon/master client switched.

I'm almost there... please help this poor beggar!





Title: Re: Photon server tutorial
Post by: Fletch on June 08, 2013, 03:55:37 PM
Okay... this is interesting and should be of some interest to those out there who may be having the same issues.

The main issue with not having the CHAT RPC CALL event in the needed dropdown window was because of several obsolete code bits in a few of the C# scripts in the demo. 

It was:
active = true;

When it needed to be

SetActive(true);

Once I changed that I started to get the proper options in the dropdown windows.

There are still a few warnings that I need to fix now... again with the obsolete code.  This time it's GetTriangleStrip(int). 

With any luck, fixing those will let me build and run this thing.

Title: Re: Photon server tutorial
Post by: Fletch on June 08, 2013, 04:29:37 PM
Okay... Fixed all the errors and updated the C# scripts to correct the obsolete code. 

Happy to report that the demo is now working!!!

Bad news is it won't build and run.  After building, the Unity icon bounces in the tray on my screen once, then goes away and the app never gets going.

At this point I'm sorta at a loss.  I've fixed everything that was broken but it won't build.
Title: Re: Photon server tutorial
Post by: Fletch on June 08, 2013, 04:33:20 PM
Sorry about all these posts.  I just figured yall would want to know that I just got it working.

Future reference, don't "/" in the name of your app when you build it.  It won't build.

Thank you to everyone who was pulling for me.

Thanks also to the responses from the PlayMaker group!!
Title: Re: Photon server tutorial
Post by: jeanfabre on June 10, 2013, 01:03:45 AM
Hi,

 Ok, thanks for the findings, I'll fix these issues for Unity 4.

 also, don't use spaces in your path to your project, that also doesn't work very well with some frameworks and tools, I can't remember when I had this, but it was definitly frustrating... :)

bye,

 Jean
Title: Re: Photon server tutorial
Post by: jeanfabre on June 10, 2013, 02:05:25 AM
Hi,

 Have you solved this? you have other threads on the case. Just to check.

bye,

 Jean
Title: Re: Photon server tutorial
Post by: Fletch on June 10, 2013, 11:31:13 AM
It's almost working.... but no.

I get no errors now and it all seems to work.  But then in testing the following happens.

1st player enters the room and instantiates. 
2nd player enters the room and instantiates but also destroys all who instantiated before them.

Following this, the 1st player can still see the 2nd player running around but the 2nd player sees no one.

A warning comes up in the log when the 2nd player instantiates.  Here it is:

OnDestroy for PhotonView View (0)1001 on Player : Guest 2805  but GO is still in instantiatedObjects. instantiationId: 1001. Use PhotonNetwork.Destroy(). Loading new scene caused this.
UnityEngine.Debug:LogWarning(Object)
PhotonView:OnDestroy() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/Extension/PhotonView.cs:189)


Please help me!!!
Title: Re: Photon server tutorial
Post by: jeanfabre on June 11, 2013, 01:12:42 AM
Hi,

 Lots of struggle for you, we'll get there! I am not sure what happens on your end at the moment,

Are you on unity 3? 4? windows? mac? and where do you publish? web, desktop?


bye,

 Jean
Title: Re: Photon server tutorial
Post by: Iamnew on July 27, 2013, 06:46:35 PM
Hi guys! I see that this thread has been inactive for a while, but I am fumbling around with photon, and stumbled across some fatal errors

I started a fresh Unity project
I imported Playmaker from the asset store
I then opened the playmaker photon test-scene

Once the photon setup was completed and everything was green, i hit play. So far no problems - However, When i clicked "create room" and spawned as player1, the game paused in the editor and gave me the following error in the log:

Code: [Select]
Could Not Create Action: Fsm Photon player(Clone): Custom Property: delete property: PhotonNetworkDeleteOwnerCustomProperty (Maybe the script was removed?)
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.ActionData:CreateAction(FsmState, Int32)
HutongGames.PlayMaker.ActionData:LoadActions(FsmState)
HutongGames.PlayMaker.FsmState:LoadActions()
HutongGames.PlayMaker.Fsm:InitData()
HutongGames.PlayMaker.Fsm:Init(MonoBehaviour)
PlayMakerFSM:Init()
PlayMakerFSM:Awake()
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
NetworkingPeer:DoInstantiate(Hashtable, PhotonPlayer, GameObject) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1962)
PhotonNetwork:Instantiate(String, Vector3, Quaternion, Int32, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1498)
PhotonNetwork:Instantiate(String, Vector3, Quaternion, Int32) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1443)
HutongGames.PlayMaker.Actions.PhotonNetworkInstantiate:doInstantiate() (at Assets/Photon Unity Networking/PlayMaker/Actions/PhotonNetworkInstantiate.cs:95)
HutongGames.PlayMaker.Actions.PhotonNetworkInstantiate:OnEnter() (at Assets/Photon Unity Networking/PlayMaker/Actions/PhotonNetworkInstantiate.cs:48)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:Start()
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEvent)
PlayMakerFSM:OnLevelWasLoaded()

Looks like there was an error instantiating the player =(

Any help?

Thanks in advance,

-The new guy
Title: Re: Photon server tutorial
Post by: jeanfabre on July 29, 2013, 10:15:49 AM
Hi,

 yes, I forgot to remove this test fsm on the player. Please find a corrected prefab that will not have the offending fsm. The next releas of Photon for PlayMaker will have everything back to normal.

bye,

 Jean