[Plugin] Photon Cloud

From the Asset Store
2D realistic cloud pack has 11 different clouds included.
  • Sorry for reposting, but at the end I think my question should be here.

    So I have a family called Tiles with different objects and their instances. I am struggling a lot with being able to figure out which condition I need and the corresponding expression (how, what to fill in) to be able to pick only the instance of an object inside a family that is being dragged/dropped. I am dragging/dropping an instance of this Tiles family itself. So where touch/drag,drop starts/ends it should be exactly where the picked up instance of Tiles is.

    If I do the following, of course all instances in the family move along:

    Also to be honest, I have no idea how this syntax exactly work that I filled into the data when raising the event and the other syntax of setting the position (rl2x&"|"&rl2y and int(tokenat(Photon.EventData,0,"|"))). I just took them over from someone.

    Any help would be much appreciated!

    Edit:

    Basically what I'd like to achieve in the end is that whatever a player does in the layout, others are able to see it. There are just a bunch of instances that can be moved around and options to toggle on/off instances and score text input fields that everyone can access (and that also need to be updated when input has been made). So each change in instance position etc. needs to be made visible to all players.

    Think of it as if it was a jigsaw puzzle where all players can move the pieces and the position would be updated to all players after a player has moved a piece

  • I have still not found any solution now after 3-4 days of trying tons of possibilities, reading through this thread and other documentation forms.

    I just know it must be something simple I'm missing/overlooking that has to do with picking instances.....

  • I have still not found any solution now after 3-4 days of trying tons of possibilities, reading through this thread and other documentation forms.

    I just know it must be something simple I'm missing/overlooking that has to do with picking instances.....

    you must specify which sprite that should get the updated position. now you just send it to the family and not specify anything. There is a lot of tutorials and youtube videos,a dn examples who explaines this

  • Thanks. Do you have any link to a specific tutorial? Where should I search for on youtube?

    So the sprites inside the family have to be specified? I learned that you could pick an instance from a family, have seen some examples where people could pick an instance like that without specifying the independent sprites in the family. Just can't reproduce it right now myself....

  • Thanks. Do you have any link to a specific tutorial? Where should I search for on youtube?

    So the sprites inside the family have to be specified? I learned that you could pick an instance from a family, have seen some examples where people could pick an instance like that without specifying the independent sprites in the family

    You can pick whichever sprite you want. But when you raise event 1 you need to specify which sprite that should be affected. Now you send it to the family, which means all sprites in the family will get that position.

    So use some variable/name/index etc to specify which sprite/puzzle piece that you want to change position for, this reference should be passed in the message as well of course.

    You must always remember that the sender and the receiver is different persons, which have no idea what the other one did, the only information you get is the data in the message.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So far I know exactly the things you just mentioned. The thing I am struggling with is syntax of the expression fields. So HOW do I specify which instance using UID, global/instant variable, comparing value etc. etc.

    I just have touch/drag drop, so no fancy mechanisms

  • The problem is that you can not specify the family, UID of an instance and X,Y position in the same expression. Therefor there is a middle step needed here and I am just not familiar enough with everything to be able to write it.

    Edit:

    Well actually it is photon dependent, because the data that you send and that is received is notated differently than what I am used to in Construct. What kind of syntax is that? Is it a specific language that we can learn/see the IDE of somewhere?

    So for example when I send the position there is:

    Tiles.X&"|"&Tiles.Y

    Then when you want photon to take over the data there is:

    int(tokenat(Photon.EventData,0,"|")) for X and

    int(tokenat(Photon.EventData,1,"|")) for Y

    I guess that I need a certain kind of data notation to write into the raisevents and onevents. Where can one learn such practices/syntax? Can anyone just help me out with just this for now by posting a screenshot or pseudo code? Please? I am super desperate

  • In your example the | is the delimiter for the fields in the message.

    Tiles.X & "|" & Tiles.Y & "|" & Tiles.Angle & "|" & Tiles.UID

    Would be a json message for thesprites X and Y coordinate and the angle and the UID

    Then when you receive the message you can get the data with this command:

    int(tokenat(Photon.EventData,XXX,"|"))

    the "int" means turning it into an integer, otherwise it is text. the XXX means where in the message the data is stored, 0 is always first. in this example above Photon.EventData,3,"|" would be the UID of the sprite you sent.

  • Wow, that was very well explained, thank you so much! So it is possible to send multiple states of the instance along. I knew it! So would it mean that you could send the animation frame nr. as well in this manner? Which would be: Tiles.AnimationFrame for index 4?

    So now I understand the data communication, but still struggling with the logic... sorry. Where does the int(tokenat(Photon.EventData,3,"|")) for the UID go?

    I tried this for example

    but it did not work so far

  • Just some tips here.

    Always start with an easier project, just a test one. Since you obviously have no idea of how it is working you should first just try to understand how to send messages, with which data, and how to receive it and how you can fetch the data.

    I would suggest you create a textbox where you print out the received message for the receiver, so you fully understand what you are actually receiving. Also (when you are finished testing) you should not really send such message to yourself, only to Others. And of course you can send AnimationFrame data, you can send exactly whatever data you want.

    Good luck! :)

  • Thank you so much for the tips.

    Would you please also take a look at my last example, where do you think the photon.eventdata 3 has to go?

    Right now I set is as a condition (see screenshot). But it doesnt work

  • Another holistic question/approach:

    Is there any way where all changes that happen in the layout are updated automatically at every 0.2 seconds.

    Like I wrote earlier, the only changes that could happen are positions of sprite instances, text changes (score) and opacity changes.

    Maybe I am too stuck on the idea that after every action a message has to be reporting everything about the actor that had undergone interaction/change, and there could be a way where all positions, angles etc. is mass processed the whole time?

  • All is working now. Thank you so much for the effort you took to post and help

  • Another holistic question/approach:

    Is there any way where all changes that happen in the layout are updated automatically at every 0.2 seconds.

    Like I wrote earlier, the only changes that could happen are positions of sprite instances, text changes (score) and opacity changes.

    Maybe I am too stuck on the idea that after every action a message has to be reporting everything about the actor that had undergone interaction/change, and there could be a way where all positions, angles etc. is mass processed the whole time?

    That would be a terrible approach. Never ever mass send messages for everything to everyone all the time.

    The best practice for multiplayer games is the opposite, send as few messages as possible.

    Read more on the photon forum or general multiplayer web pages for best practice.

    (Lerp the positions from the position data in the messages instead, after an update.)

  • I guess i found a bug here, when i set my actor name to username variable for the first time, its working fine. After second time i change my username variable, my actor name won't be set to newer one. Anyone facing this problem ?

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)