How do I set a tilemap from json

  • Hi Folks

    first a general question. With the multiplayer object one can add an ICE - TURN Server which i did and which works great. What i am interested in: Is the TURN Server always in use or only when there is a NAT Problem inbetween. I noticed, that local connections getting through with a ping of 1, which means there can be no TURN server inbetween.

    To my other question: We are talking about a multiplayer envoirement.

    When the peer layout loads it creates a tilemap.

    Whenever the tilemap needs to be updated the peer sends a message "tilemap" to the host. The host then answeres this specific peer with the tilemap. After that the peer sets the tilemap according to the host message (as json)

    Problem is, on the peer side, the tilemap always looks like another instance of the same tilemap which is in a total different layout. I cant get it to update...

    Here is the part where the host sends:

    and what the peer should do:

    Thanks to the debug2 text i know that the peer is actually receiving the tilemap.

    Is anything wrong with the loading from JSON part or am i missing something else?

    Thansk and kind regards

    Patrick

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Apparently when i manually download and paste the tilemap it works.

    The downloaded string looks a lot different from the asjson output. is this a bug or is this intended?

    Downloaded: {"c2tilemap":true,"width":40,"height":40,"data":"466x-1,0,1,2,37x-1,9,10,11,37x-1,18,19,20

    AsJson: {"c2":true,"ex":{},"ivs":{"5849307574877662":0.8},"w":{"x":-128,"y":0,"w":5152,"h":5152,"l":425702197544442,"zi":0,"hX":0,"hY":0},"behs":{"8028382427356587":{"

    What am i doing wrong here?

  • Update: Dont use Load, use Set ->

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