Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Yanifska on April 01, 2014, 06:24:53 AM

Title: Turn Based Multiplayer, Photon, Offline Mode....
Post by: Yanifska on April 01, 2014, 06:24:53 AM
Hi,
I am considering to do some kind of match 3 game in multiplayer, where 2 players would play one after another.
Would that be hard to do ? I have almost finished the basic match 3 engine but I have no idea where to start with networking.
For example is possible to share an arraymaker list array accross the network ?

I have unity free, and I'd like to publish to desktop + ios + android.
Please share some tracks to follow.
Thank you,
Yaniv
Title: Re: How to start networking ?
Post by: Derphouse on April 02, 2014, 06:12:30 AM
If you don't have experience with networking in Unity, I'd suggest you read about it on the Unity site.

I think the easiest approach is to look at some of the guides with Photon Networking for Photon Cloud. You can find a lot of resources on their own site: Exitgames.com, as well as here on Playmaker forums there's a lot on Photon as well.

Honestly, if you don't make sure you have a good foundation of what you're getting into, you'll end up in a world of pain :D
Title: Re: How to start networking ?
Post by: Yanifska on April 02, 2014, 06:46:49 AM
Thanks, I have been reading through Unity's documentation and plamaker's manual yesterday, and I start to get a general idea of the process.

I still don't get how I can share a table between to player/devices, maybe by using easy save2 ?

Also is Photon much easier than standard unity network features ?
I believe what I have to do is quite easy, but yet it is hard when yo just begin... hehe.

Yaniv
Title: Re: How to start networking ?
Post by: jeanfabre on April 02, 2014, 07:07:19 AM
Hi,

 Photon networking will be a bit overwhelming for this, as what you want is a turned based system ,which doesn't imply real time data synchronization, only "state" synchronization.

https://www.exitgames.com/en/Turnbased

Signup for an early access, it's likely exactly what you are looking for.

Now, if you want to use Photon as is, then I would simply use RPC calls, but that's only solving one aspect, indeed you need to save the game state for async play, which can be done with any server side system ( Parse or your own php/mysql server)

Bye,

 Jean
Title: Re: How to start networking ?
Post by: Yanifska on April 02, 2014, 07:23:56 AM
Hi Jean,

Does the Playmakers actions will work with photon turn based ?
Does Photon works with arraymaker / How to sync array lists between devices?

Thank you Yaniv
Title: Re: How to start networking ?
Post by: jeanfabre on April 02, 2014, 07:27:07 AM
Hi,

 I really would like to support Photon Turn based indeed. It's currently not planned tho.

ArrayMaker does not support syncing between devices no. that's way too big and potentially a show stopper, synching shoudl always be very very granular, so instead implement the necessary variables to synch within an fsm, that's much more likely to perform as expected as your project grows.


Bye,

 Jean
Title: Re: How to start networking ?
Post by: Yanifska on April 02, 2014, 08:38:34 AM
ok thanks
can easy save2 or xml maker helps me here to save the state of my arrays ?
would that be an option?
Yaniv
Title: Re: How to start networking ?
Post by: jeanfabre on April 03, 2014, 01:06:55 AM
Hi,

 Indeed, it's one way out for sure.

bye,

 Jean
Title: Re: How to start networking ?
Post by: Yanifska on April 05, 2014, 03:18:17 PM
So I have been playing with photon these last 3 days and I am to the point where I successfuly instantiate my chip array on both client.
What worries me now, is that when I try to play previous scenes, that doesn't involve photon I get the following error message :

Working with photon network require that you add a 'PlayMaker Photon Proxy' component to the gameObject. You can do so from the menu 'PlayMaker Photon/components/Add photon proxy to scene'.

The Create Object action seems to be the troublemaker. I double checked I wasnt trying to instantiate photon related prefabs.

Do you have an idea why that would happend, and how to have both single player and multiplayer scenes cohabit in a same project.
Thanks,
Yaniv
Title: Re: How to start networking ?
Post by: jeanfabre on April 07, 2014, 06:55:18 AM
Hi,

 Interesting. Photon has an offline mode so that it's compatible. I haven't investigate that aspect. I will do this week. Please bump me towards the end of the week if I haven't replied before.

bye,

 Jean
Title: Re: How to start networking ?
Post by: Yanifska on April 10, 2014, 03:40:39 PM
Hi Jean,

When I instance (multiple) object(s) across the Photon Network, how can I store the newly instanced GameObject in a variable on the other player side as well (so I can add it to an array on the second player side as well ) ?


Btw did you find a solution to have offline mode ?
Thanks for your help
Yaniv
 
Title: Re: How to start networking ?
Post by: jeanfabre on April 11, 2014, 02:17:13 PM
Hi,

 You are missing a key concept with your question:

 the object you create on one side, is the SAME prefab as the one that is instantiated on other running instances.

So, you can have an Fsm on that prefab that when starting, ask the question "is mine", using the action of the same name, and if false, then you know you need to add yourself to an arraylist.

 Do you understand the concept of ownership within a networking system? the "PhotonViewGetIsMine" action is critical to understand here. Have you studied the sample provided to see how Photon is integrated in PLayMaker?

I haven't had a look yet at offline mode, but it's on my shortlist, so coming very very soon.

bye,

 Jean
Title: Re: How to start networking ?
Post by: Yanifska on April 12, 2014, 03:24:53 AM
I did look at the demo, and I understand the IsMine action , but somehow I didn't see how it would apply to my project because my objects can be instantiated at different moment and has to be treated differently each time, but I guess I can pass a string to help trigger a different set of actions on the object.

I think I have an idea how to work it out now.
Thanks for your help
Yaniv
Title: Re: How to start networking ?
Post by: Yanifska on April 16, 2014, 04:03:43 AM
The offline mode is discussed in this topic.

http://forum.exitgames.com/viewtopic.php?f=17&t=2486

I believe we just need an action to set the offline mode to true, don't we ?
Yaniv
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: jeanfabre on April 17, 2014, 02:29:55 PM
Hi,

 if that's just it... then simply use "set property" action and you are done.

bye,

 Jean
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....[SOLVED]
Post by: Yanifska on April 30, 2014, 02:46:25 AM
Hi Jean,

I have been working on other aspects of my game, but something just hit me.
It seems to me that turnbased is impossible to do with Photon Realtime at all, since photon instantiate requires both users to be connected. If one leave the room the game can't instantiate on the missing player side, am I right ?
It seems to me that it needs to be all done in Parse.
What do you think  about this ?

Yaniv
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: jeanfabre on April 30, 2014, 03:30:20 AM
Hi,

 yep, Parse would be a very good alternative. Be aware that photon is working on a specific turn based system at the moment, as well as a dedicated chat system as well.

https://www.exitgames.com/en/Turnbased

https://www.exitgames.com/en/Chat


Bye,

Jean
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: Yanifska on April 30, 2014, 03:35:55 AM
Yes,
I subscribed to the Photon Turnbased google group,
but with playmaker actions I don't think I will be able to do anything with it....
I know Google Play Game Service has something similar, but it is limited to google users....so I am not sure if it is an option and again no playmaker actions for the Turnbased functionalities.


Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: jeanfabre on April 30, 2014, 03:45:48 AM
Hi,

 yes, custom will be required. They'll be supported hopefully soon.

bye,

 Jean
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: nick_h82 on June 26, 2014, 06:38:58 PM
Hi Jean,

thanks for all your work on the Photon example, I've managed to create a vehicle that can be entered/exited, which can also contain a sub-vehicle that does the same, and can be carried or left in place. All this being synched. Great fun!

I have a question regarding the above offline mode- I'd quite like to run offline if the connection fails- it seems a more graceful way of failing. Therefore, I need to set.property as PhotonNetwork.offlineMode = true. My problem is I can't quite work out what script to set this on, as none of them seem to show this property.

Thanks,

Nick
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: jeanfabre on July 02, 2014, 07:30:07 AM
Hi,

 Please find attached the custom action to set the offline mode. It's untested, haven't had time to allocate on this currently, so tell me if that's all ok with you. This action will be part of the next release of Photon support for PlayMaker.

[EDIT] attachement seems broken for now. save this link (http://subversion.assembla.com/svn/playmaker_public/trunk/Photon%20Unity%20Networking/PlayMaker/Actions/PhotonNetworkSetOfflineMode.cs) to get it.


 Bye,

 Jean
Title: Re: Turn Based Multiplayer, Photon, Offline Mode....
Post by: nick_h82 on July 02, 2014, 05:59:41 PM
Thanks Jean, works perfectly.

Regards,

Nick