dop2000's Recent Forum Activity

  • Then put all data you need to save into a text variable. Then use "Browser Download" action as in my example to download it as a file to disk.

    In a desktop export you can use NWJS or FileSystem plugins to write data to a file, instead of downloading.

  • Do you need to save the entire game state, or only selected data?

    Here is how you save the entire game:

    dropbox.com/scl/fi/1oiv92mq6eu25afxv4sw2/SaveLoadToDisk_Browser.c3p

  • It would probably be easier to make a small level editor project. You can use your 40K sprites in it to build a map (because the performance doesn't matter). Use "For each TileSprite" to automatically convert them to a tilemap, and copy their values to an array.

    Then export Tilemap.TilesJSON and Array.AsJSON in the editor, and import these strings to your main game. Then all you'll have to do is load them into the tilemap and array.

  • First, you need to use "AJAX On Completed", or at least insert "Wait for previous action to complete" after AJAX request. Your array is empty because of that.

    Tilemap has expressions MapDisplayWidth and MapDisplayHeight which return number of horizontal and vertical tiles.

    And I don't understand why you are saving loopindex("x") and loopindex("y") in the array. If your array is the same size as the tilemap, then you can use its X/Y index for addressing.

    Tilemap.TileAt(X, Y) - tile at X/Y

    Array.at(X, Y) - value for that tile

  • Make the array the same size as your tilemap (width and height). And if you need to store 4 values per tile - set array depth to 4.

    Then, for example, if you need to get values for tile (x:30, y:50), you can use these expressions:

    Array.at(30,50,0)

    Array.at(30,50,1)

    Array.at(30,50,2)

    Array.at(30,50,3)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just tested - an empty 1000x1000x10 array uses ~100MB extra RAM. And it increases save size by about 2.5MB

  • You just match the x and y tile id to the x y position in the array, and use the z slots 0, 1, 2

    If one tile has 10 values and others have 0-2, this means the array will need to be 10 elements deep for just that one tile. It will be a waste of resources. In this case I would store the list of values as text ("1,2,3"), or as a JSON string.

  • I've never seen this. Are you sure that the layers are visible? Do you see them in Debug Mode? Maybe just the objects from these layers migrate to another layout. This can happen if objects are set as global.

  • You only need to pass runtime if it's used inside the function. (for example if the function needs to access C3 variables or C3 objects)

  • No, runtime.callFunction is for calling C3 functions defined in events. So to call just use UUID();

    But you need to pass runtime to it. So UUID(runtime);

    And in your script change the function to function UUID(runtime) {....}

    Look at my second screenshot.

  • There are several ways to do this.

    How many values do you need to store for each tile? Will the set of values be the same for all tiles, or different? For example, water tiles will have "depth" value, ground tiles will have "walk_speed" and "solid" values etc.

    Will there be many tiles without any values? You can think of a Tilemap as a 2D array, which stores tile type (ground, sand, water, rock). So you don't have to store this info in the array.

    Do you need to store the array with all these values in the project, or will it be randomly generated in runtime?

  • Put the file into Scripts folder and change its purpose to "Import for events".

    However, if you need to access runtime in the function, you might have to pass it as a parameter.

dop2000's avatar

dop2000

Online Now

Member since 26 May, 2016
Last online 11 Jan, 2025

Twitter
dop2000 has 256 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies