-1

So assume a hypothetical situation where I have a sidescrolling game, and the world is stored in a 2D array. You can walk "infinitely" to the right, and the game adds new data to the array as you explore new terrain.

Is there any issue that could raise with this? Performance? Stability? Errors?

Of course it's technically not "infinite", because nobody is going to walk sideways for an infinite amount of time. I'm talking about an array that's size or limits are not pre-defined.

DO NOT give me an alternate solution, I do not want it. I just want to know if there may be a problem with doing this.

edit: I'm not asking "is there a limit", I'm more thinking about other concerns like performance. For example, will the array slow down to halt if it has to rapidly keep expanding while it's already holding 100,000 items in it?

user3032989
  • 99
  • 2
  • 7

1 Answers1

0

yes there is an upper limit it is 2^32 -1 it's a restriction in javascripts memory !

Source: http://4umi.com/web/javascript/array.php

c0d3junk13
  • 1,162
  • 9
  • 6