Chunks as arrays and their effect on RAM

0 favourites
  • 8 posts
From the Asset Store
A total of 214 high quality and unique magic sound effects suitable for RPG, Battle Arena and more!
  • So I recently figured out infinite terrain generation with a chunk system.

    I've limited it down to 9600x320 chunks though for better world design

    So for fun I've made it constantly generate chunks in the world maps grid pattern, with the concept being that once every chunk is done, the lag will be so wonderfully unnoticeable. That many chunks though, with 1/10th second delay, would take about 85 hours to finish. After all, the world is 600x20 miles large so that's understandable.

    I'll add what I need to in the future, but I was thinking over the weekend I could let this run and see what happens. Maybe the RAM use of having 3 million arrays with 30 thousand elements each would lag, although I have been very careful with this chunk system to minimize lag. RAM might be a new issue for a world this large.

    What do you think will happen? I understand this is unplayable and I'll later have to make it generate them only as needed, but maybe this fast generation could also be implemented for a short time while the player is in a loading screen or in a pause menu maybe. Just a fun learning experience ^-^

  • If there is an issue with RAM use, what could I do to maybe shift the chunk's array information to some other thing that doesn't use RAM? Maybe some sort of File Save thing?

  • Also, running this chunk generator every tick isn't causing problems, but I've noticed only about 10% of my CPU is being used, thems rookie numbers how can i utilize more cpu? O:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can store them in localstorage

  • ~2Gb could be max ram use for chrome. Maybe they changed it now, but it used to have that limit.

  • Creating lots of arrays started to show noticeable slowing after 400 arrays. I changed it so now the array information is stored in a dictionary key, then destroyed, and then I use a JSON to parse through the keys when needed. This keeps the object count to a minimum but I'm unsure when that will still not be enough. 3 million keys is still a lot so I'll likely have to consider localstorage. O:

  • You can store them in localstorage

    I played your game Strawberry Punch! Very epic ^-^

  • I let it run for a bit and the dictionary had 3000+ keys with 30,000 elements each and there still wasn't any noticeable slowing down.

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