Array question

Blitz3D Forums/Blitz3D Beginners Area/Array question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.


Why not dim a larger array in the first place, and then set a maximum in your game for how many stations the player can build... an array of 100 or so lying around not doing much won't break the bank!



I was considering that, but it would use too much memory upfront, if each index also points to an unused (but existing) type-instance, with lots of fields in it.

I want the game to be expandable as much as I can (like X2).
In this game, the player can build an unlimited number of stations.

But since I will be making arrays that only hold a specific type of station (power plant, food factory, ...), the indexes will be low in the first place (a maximum of 10 per sector) and I want to have around 100 sectors.

Then it is easy (and quick) to copy the array to another first, then redim it and copy the data back to it.

I didn't considered a bank before, as I've not yet experienced with them.
I will try to understand those too and see if they are easier to use.

But can you use a bank for storing pointers to type-instances and access it like arrays of types (Array(index)\Fieldname = xxx)?