[Plugin] Photon Cloud

Post your completed addons to share with the community

Post » Mon Jul 25, 2016 8:31 am

Hi everyone! Here's Tobias writing. Vadim (who's our Contruct Master) is on vacation for two weeks. I will try to help where I can :)

2dgamedev wrote:if I join a room , then toggle IsOpen or isVisible , then leave the room and try to create a new room... I get this error and the room creation fails
Image


The image tells me that the value of IsVisible somehow turns into a "double" instead of the expected "boolean" (being true or false). Can't say what's happening here. Maybe you check which value you assign to IsVisible, when you do?

@andykenobi: The region code is "sa". How do you set the other regions? Maybe we have to edit "sa" into a list of regions (there was no update since we added the region).
I'll try to figure out. Maybe someone else can help right away?

@badmiracle: I will take a note and have to ask Vadim when he's back. This requires some knowledge about the versions since 4.0.0.1.
Can you work with 4.0.0.1 for a while longer?
B
5
S
2
Posts: 128
Reputation: 889

Post » Mon Jul 25, 2016 8:45 am

@ThePhotons Hey Tobias , thanks for the response but Im not sure its something I'm doing seeing as Construct 2 bascially doesnt allow you to "fuckup" writing syntax ~

Image

I,only have yes or no as my choices, now i spent almost the entire day and I have found a solution albiet a really stupid one.. and I understand the bug a little more ~

so heres how it goes down : the Host can shut the room. this breaks all the clients in the room except the host . the host is fine. If any client leaves , he can not make a game until he toggles the IsOpen boolen , ( doesnt even matter if hes in a room or not ) and that fixes the error and hes free to create games again .. i think whatever the host sends the clients to tell them to shut the room has a bug in it

heres the code that lets me once agian create rooms with a broken client

Image

^ if the above image is huge , open it in a new tab.. its scaling strange in the forum
Last edited by 2dgamedev on Tue Jul 26, 2016 9:53 am, edited 1 time in total.
B
11
S
1
Posts: 29
Reputation: 565

Post » Mon Jul 25, 2016 7:18 pm

&ThePhotons Do you not have a Marco Polo Tutorial for Construct 2? Like you guys have for Unity?

Im struggling to sync objects created by the master. ( Host ) Any advice?

Im using pathfinding and getting them to sync is a NIGHTMARE! Thanks in advance.
B
11
S
4
Posts: 14
Reputation: 807

Post » Tue Jul 26, 2016 12:27 am

@cliffordwh , send destination coordinates , and lerp the objects to those coordinates

aka

send the coordinates to variables called badguy.destinationX and badguy.destinationY , then lerp the current position to the destination , it will smooth out the jitters of hard coord sets

lerp(badguy.x,badguy.destinationX,0.2)
lerp(badguy.y,badguy.destinationY,0.2)
B
11
S
1
Posts: 29
Reputation: 565

Post » Tue Jul 26, 2016 9:46 am

@2dgamedev Thanks for that. Ill have a look at lerp.
B
11
S
4
Posts: 14
Reputation: 807

Post » Tue Jul 26, 2016 10:40 am

2dgamedev wrote:Hey Tobias , thanks for the response but Im not sure its something I'm doing seeing as Construct 2 bascially doesnt allow you to "fuckup" writing syntax [...] I,only have yes or no as my choices [...]

so heres how it goes down : the Host can shut the room. this breaks all the clients in the room except the host . the host is fine. If any client leaves , he can not make a game until he toggles the IsOpen boolen , ( doesnt even matter if hes in a room or not ) and that fixes the error and hes free to create games again .. i think whatever the host sends the clients to tell them to shut the room has a bug in it


I was not entirely aware that you don't write any code in Construct 2. Good to understand that.
That means there is a bug in our plugin, because the server does get a wrong kind of value where it should get bool (true/false). That much is clear from the error you posted above.

Closing a room means that no players can join anymore (once the server got your close command). The server updates the other clients in a room that this room is now closed but that does not mean clients should use this value when creating a new room.
Thanks to your analysis, I would say: Somehow the clients do use that value and this makes "Create Room" fail.

I created a task for Vadim to check this out when he's back. Because there's a workaround, I hope the wait-time will be bearable.


We don't have a "Marco Polo"-alike tutorial for Construct so far, sorry. To get some amount of docs done, we write almost all in C# and hope it's easy enough to read and "port".
https://doc.photonengine.com/en/realtim ... time-intro

Maybe someone from the community can do a tutorial? We're happy to post and credit any tutorials the community creates.
Last edited by ThePhotons on Tue Jul 26, 2016 10:42 am, edited 1 time in total.
B
5
S
2
Posts: 128
Reputation: 889

Post » Tue Jul 26, 2016 11:13 am

@ThePhotons I actually just managed to get this all to work. Im now going to take @2dgamedev advise to smooth out the jitters with Lerp.

Once i've tested and checked all. I'm going to write a tutorial on how to create a TD based game ( or realtime shooter ) with Sync objects spawned. ( using pathfinding too )

The trick is to balance as much local logic to reduce the number of events sent.
B
11
S
4
Posts: 14
Reputation: 807

Post » Thu Jul 28, 2016 12:19 pm

@cliffordwh: Cool to read you made it! Tutorials are always very welcome. Let us know if you need more input.
B
5
S
2
Posts: 128
Reputation: 889

Post » Thu Jul 28, 2016 6:12 pm

@ThePhotons I will post it once i can get the performance beter. Sending across 50 objects X & Y for the non host to sync is difficult without lag. I might have to add some interpolation to get that smoothed out.

What would you advise for something like that? Send over X, Y for 30 Plus objects every 1 0r 2 secs?

Strange thing is using the construct MP plugin i dont have that problem but it doesnt support IOS . :(
B
11
S
4
Posts: 14
Reputation: 807

Post » Tue Aug 02, 2016 3:22 pm

I have no insight what Construct is sending.
I guess it sends 5..20 updates per second and does some smoothing which fits your case well.

You can send x,y at least 10 times a second. At least, when the position changes. You can also send a direction/speed vector to allow smoothing should some update get lost or delayed (then the client can calculate where the object is going, based on this info).

For 50 objects, it might make sense to send just changed values. If the direction and speed does not change, you don't need to send position updates (e.g.), because the object moves in a predictable way.
B
5
S
2
Posts: 128
Reputation: 889

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest