Question about tilemap, and json

0 favourites
  • 11 posts
From the Asset Store
Enchanted Forest & Cave 16x16 Tilemap with Environment Sprites
  • Hi. I have a layout , which loads a tilemap tile by tile, and i want to store it to load it's state in the next layout.

    I've tried using the actions download, and load in the next layout, without any sucess. I've also tried to store in a text variable the tilemap.tilesJSON, and set the tilemap from it in the next layour, and didn't work.

    What i'm doing wrong? Thanks for your time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was doing almost that, saving a tilemap as json to dictionary or array, and then load it when I need it - on same or different layout, without any problems whatsoever (did not test with newest stable C2 version). So probably there is a problem in your events, cause I don't think Ashley changed something in tilemap recently.

  • I was doing almost that, saving a tilemap as json to dictionary or array, and then load it when I need it - on same or different layout, without any problems whatsoever (did not test with newest stable C2 version). So probably there is a problem in your events, cause I don't think Ashley changed something in tilemap recently.

    Can you explain me the exact process of it? I've tried with different approachs but i haven't done it yet.

  • Here's array solution

    To save

    On key S pressed -> Array: Set value at 0 to Tilemap.AsJSON

    To load

    On key L pressed -> Tilemap: Set JSON string from Array.At(0)

    and that's it.

  • Here's array solution

    To save

    On key S pressed -> Array: Set value at 0 to Tilemap.AsJSON

    To load

    On key L pressed -> Tilemap: Set JSON string from Array.At(0)

    and that's it.

    Well, this definitively worked, but i have a new problem. My tilemap is 2800x2300 (yes, i know that's not a good idea) so when i try to save it, nw.js just closes.

  • Hi. I have a layout , which loads a tilemap tile by tile < copy those events to the next sheet

  • Hi. I have a layout , which loads a tilemap tile by tile < copy those events to the next sheet

    That's the first thing i did, and it worked. But it takes a lot of time, and i want to separate the loading layout and the gameplay mechanics. Isn't it possible to save as json a really huge array or tilemap?

  • How big?

    When I'm going between layouts (main map <-> sub maps) On leaving the layout I'm saving to a Dictionary:

    • Dictionary with all my variables
    • Array with player characters infos
    • Array with Inventory state
    • Array with NPCs
    • Array with NPCs that can be respawned
    • Array with keys used in game
    • 6 tilemaps - 4 different tilemap objects, each max 1920x1920 in size on layout

    and then on loading next layout I'm loading everything back from that dictionary - that is really 1 huge dictionary. And it takes max 3 seconds to save and load on my old Samsung Galaxy S3 mobile, on PC it's instant.

    So I don't know how big stuff you must have to tak a lot of time to save/load.

  • How big?

    When I'm going between layouts (main map <-> sub maps) On leaving the layout I'm saving to a Dictionary:

    - Dictionary with all my variables

    - Array with player characters infos

    - Array with Inventory state

    - Array with NPCs

    - Array with NPCs that can be respawned

    - Array with keys used in game

    - 6 tilemaps - 4 different tilemap objects, each max 1920x1920 in size on layout

    and then on loading next layout I'm loading everything back from that dictionary - that is really 1 huge dictionary. And it takes max 3 seconds to save and load on my old Samsung Galaxy S3 mobile, on PC it's instant.

    So I don't know how big stuff you must have to tak a lot of time to save/load.

    2800x2300 tiles, 16 pixels for tile... 44800 x 36800. I guess that must be the reason of the crash.

  • Why not add in a loading screen that could be playable until it loads I missed the old interactive loading screen maybe you can do that so that it isnt a boring wait.

  • Your initial layout can be designated as a "Loader layout" and it will be fully active while your other Layouts are loading.

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