Python lists work very well, if you aren't afraid of using Python. You could set a few methods to easily modify the array and retrieve information and then leave the rest in backend.
Yep I'm very afraid of python Mipey, too many brackets & stuff. Proper written programming languages and me don't mix, I have tried since the late 80's but nothing ever sticks. The only written language I ever got a decent grasp of was AMOS on the Amiga, and when I say decent I mean it went further than
10 print "Hello"
20 goto 10
Speaking of Python, it also has array objects that can be imported via the internal array module or the external NumPy module. It may be a bit more than you'd want to bite off right now, though. The 3-D array that you're using should work fine, too.
Don't short-sell your abilities, Minor. I've considered doing this sort of procedural generation in the past, but the idea scared me away before I even got started.
Anyway, just because I feel compelled to point it out, this application practically begs for http://en.wikipedia.org/wiki/Bitwise_operation">http://en.wikipedia.org/wiki/Bitwise_operation</a>]bitwise operations. Unfortunately, I don't see any support for them in Construct, other than through Python.
Basically, you can just use a 2-D list or array which contains integer values. Each integer value can have different bits set for any given on/off or true/false state that you need to track. For instance, you can keep the status of bordering land in the four cardinal directions in four bits. Expressing the values in binary notation (with 0b prefix) makes it more obvious what bits are set.
0b0001 (if land to north)
0b0010 (if land to south)
0b0100 (if land to west)
0b1000 (if land to east)
You can set the bits with the OR operator (|):
0b0001 | 0b0100 ( = 0b0101)
and test them with the AND operator (&):
0b0111 & 0b0100 ( = 0b0100, testing for bit 3 set)
Bah, too much to go into here, really. Feel free to ignore the whole bitwise thing... Mostly just me reminiscing about 8-bit computer programming practices that aren't widely used anymore.
Keep up the good work. I like your creations so far.
Thanks encouragement and for the info . Bitwise does seem like something that would make what I'm trying to do a bit easier.
Right now on with an Array-Loopy question.
How would you go about extending a loop? for example: Below is my Array #=sea 1=land
#####
##11#
##1##
#####
#11##
#1###
#####
I want to scan the array to find land that is connected to another piece of land and give each the same number in a "z" index/cell/slot/thingy. Then find the next land unconnected to the first and find the land connected to that land etc. So my array above would look like this:
#####
##11#
##1##
#####
#22##
#2###
#####
I know how to use the array to check neighbours as I use that for the Cellular automata part of the project. It's just looping through grouping them via a number per land mass and finishing the loop without it going on for ever.
Does that make any sense?
Thanks again for all the help. I really am learning stuff here that I never thought I'd learn .