Struggling with simple JSON condition ;-;

0 favourites
  • 15 posts
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • I want to check each of the first 100 values of the json (Chunk_Width and Chunk_Height are both equal to 10,

    If that value is greater than zero (all 100 values are, but this is for testing) then it should activate the action. I just can't get the number after the dot to equal the loopindexs ;-; I want it to be like

    "data."&str(loopindex("x")*loopindex("y")) or something T-T

    Tagged:

  • This looks somewhat closer to what I'm looking for maybe? I'm still missing something vital ;-;

  • I'm trying to mimic this:

    I want data.(loopindex("x")*loopindex("y"))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The idea is that there is currently 100 different numbers in the JSON under key "data" and I want to compare each value in "data" and if it's greater than 0, I want to add a new value at the end

  • Can you post the JSON file? It's difficult to answer your question not knowing the JSON structure.

  • In a previous function I add 100 noise values to "data" and in the debugger it looks like this:

    Is that the sort of file information that would help? ;-;

  • It looks like this is working O_O

    Does that look like a good solution?

  • It looks like this is working also? O_O I am new to using JSON and I looked all over for something like this, I think it is working!! :D

  • I am v excited, it looks like this system is working :D

  • Seems like it's a simple 1-d array, it would be easier to edit the header a little bit and load it into the array.

  • I am making a procedurally generated "infinite" map using a chunk based system.

    At first I made every chunk an array object but after 400+ array objects the game slowed a lot.

    So now I make the array, generate the info, then put the info into a dictionary with the key being it's coordinates, then delete the array.

    It seems to be working fine, even after 3000+ keys/chunks, but I am trying to optimize it to minimize lag when new chunks are generated or loaded from the dictionary.

    I'm hoping for larger chunks so that the player can see far away, and in the future you won't be able to escape enemies unless they are very far away. Like, half a mile away if you're running from a dragon.

    Right now if chunks are only 10 tiles across it generates and loads seamlessly but 30 tiles across isn't very far for most purposes. If chunks are 30 tiles across there is slight delay on generation and no delay on loading. If chunks are 50 tiles across then there is lag both ways

    I am new to using Construct as an adult, so in the past two weeks I have learned lots of critical information and am able to make fancy things, but I'm still very new. I don't know where to begin to minimize chunk generation delay and maximize render distance, I guess I'm just trying out random things and seeing what works.

    Ideally if I could keep the initial array system that would be great, but 400+ array objects is causing big lag

  • I think oosyrag suggested you use seeded random in another post. I would probably try that - instead of generating and storing the whole terrain, only generate a small part of it on demand. You can always re-generate any chunk from the seed.

    Of course, if players can modify the terrain, you will have to store the modifications and restore them.

  • Yeah, it took some time to implement that but I got it working, generating chunks only as needed. If a new chunk is needed, I make an array, fill it with noise with seeded random on z0, then fill z1 with what terrain type it is, then fill z2 with the tile to use since I'm using a tile bitmasking method to generate edges like this:

    and then z0,z1,z2 are moved to a dictionary with a key for the chunk location and the array is deleted.

    I would like to save it to some sort of array formation that isn't an object since 400+ array objects (even though they are dormant) caused lag

    3000+ keys though and I noticed no change. Still there is a noticeable lag when a chunk is generated, less lag if it's just loaded from the dictionary. Is there a good method of storing data in an array formation that isn't an object?

  • My project was working but I noticed a critical issue, I fixed it and now it's working a lot better <3 I'm pretty confident I have a strong base to test it's limits now.

  • There's a procedural generation template that load data in chunks like this you might wanna check it out

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