Latest Uploads
Extraterre ... .0.1 (zip)

dantheman363

Monty Teas ... Screenie 1

steve_ancell

Santa Clau ... ed his bag

waroffice

manic_platdude.png

spinal

Tetris Clone

steve_ancell

Super blues bros.

spinal

Forum Home

Making an array of arrays in blitzmax?

UserMessage
Posted : Saturday, 24 September 2011, 22:55 | Permalink | Mark Here
Mog


Hey guys,

Been a while - have been doing other projects lately but started up programming again, and like usual, blitzmax and its arrays are making me rage.

Im trying to convert some C# code from someones perlin noise example, and i came across this little line:

-->

Basically they're trying to make an array of 2 dimensional arrays indexed by octaveCount, problem is- blitzmax doesn't like doing this it seems. Anyone have any idea how this could be done- essentially making an Array of Arrays?

-----
I am Busy Mongoose - My Website

Dev PC: AMD 8150-FX, 16gb Ram, GeForce GTX 680 2gb

Current Project: Pyroxene
Posted : Sunday, 25 September 2011, 00:08 | Permalink | Mark Here
shroom_monk


WW Entries : 8
(I wouldn't know, since I don't use BM), but surely doesn't BlitzMax support three-dimensional arrays? A quick search of the internet suggested it did. I'm sure that's what this is rather than an 'array of arrays'.

-----
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Posted : Sunday, 25 September 2011, 00:10 | Permalink | Mark Here
Jayenkai


WW Entries : 103
I haven't trusted Multi-Dim arrays for a long long time.
I can't remember exactly what language it was that put me off them, but it messed my multi-dims up, caused a lot of "Why is THAT happening?!" bugs, I realised what it was, got all peed off (like I do!), and pretty much stopped using them for good.
Grr..
Evil!!!


Jay-style Multidims just need a good multiplier, but also require you to specify your sizes beforehand. If you're one of those coders who inexplicably find a need to keep ReDimming things, you're going to hate this!

-->

-->

You'll probably want to make a function for the inny bit!
-->
but... You'll also want to watch out for too-many function jumpy things.
Also best to save the array's position into a variable where you're reusing it over and over again.

-----
Posted : Sunday, 25 September 2011, 12:01 | Permalink | Mark Here
Evil Roy Ferguson


WW Entries : 3
BlitzMax supports two different kinds of multidimensional arrays out of the box:

"Rectangular" arrays:
-->
or, if the size of each dimension isn't known until later:
-->

The kind of array you were trying to do also exists, but "jagged" arrays are a bit more awkward in BlitzMax. As far as I am aware you have to manually new up the arrays inside each level of the array.

-->

I'm not sure what the original code is doing, but it'd be nice if you could use the "rectangular" arrays instead.

Jay, Blitz3D had issues with 'real' multidimensional arrays in types, IIRC, but it was also crazy enough to have multiple types of array to begin with. You don't have to live like this anymore.
Posted : Sunday, 25 September 2011, 12:22 | Permalink | Mark Here
Mog


Roy - What jay does with 'Blitzarrays' could be used in types - kind of a bastard hack way of multidims within a type.

Now on to blitzmax, i kind of figured out what was needed, although it's a little kludgy in my opinion - it's done with slicing.

-->

note the [,][] - making an array of 2-dims, now..

-->

-----
I am Busy Mongoose - My Website

Dev PC: AMD 8150-FX, 16gb Ram, GeForce GTX 680 2gb

Current Project: Pyroxene
Posted : Sunday, 25 September 2011, 13:17 | Permalink | Mark Here
dna


I wish you had posted you technique for dimensional arrays before Jay.
Your method makes more sense for the Blitz series compilers.

The old NewDos and NewDos80 type of compilers made up for this need by using some initial assigning before hand.

Good Job.

-----
DNA
Latest Posts
RoadRash!
spinal Sun 09:53
Noel's Graduation
spinal Sun 09:49
Screen Burn of the Mind
rockford Sun 09:01
Audio Rant
steve_ancell Sat 19:16
Wrong Partition!!!!?
spinal Sat 11:24
Progress / Location Bars
Afr0 Sat 03:15
eBay Lies
spinal Fri 23:44
Shoutbox Topic - 968
dna Fri 19:42
Development via GUI
JL235 Fri 07:59
Meh
Afr0 Fri 04:13
More

Latest Items
News : Newsletter #176
Jayenkai Sat 04:49
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
rockford Fri 13:14
Techy : AppleTV
Jayenkai Thu 09:40
Blog : Graphviz
steve_ancell Sat 14:17
Pets : Top-Down Shadow Hack
Jayenkai Tue 05:52
Snippet : JNKrunch v1.0
Jayenkai Sat 07:20
News : Newsletter #173
waroffice Fri 04:47
Blog : Material Loading
Cower Fri 02:08
Pets : I Done Won A Thing
shroom_monk Sun 11:31
Pets : Repurposing A Lexer
Cower Mon 22:06
Bah : Feeling a Little Angry
spinal Mon 11:26
News : Newsletter #170
Dabz Sat 00:34
Showcase : sbfgen
Cower Sat 16:57
More

Who's Online
Cower
Sun, at 10:01
spinal
Sun, at 10:00
rockford
Sun, at 09:38
Jayenkai
Sun, at 09:36
9572AD
Sun, at 08:32
CodersRule
Sun, at 08:29
Evil Roy Ferguson
Sun, at 08:13
steve_ancell
Sun, at 08:04
Afr0
Sun, at 07:52
shroom_monk
Sun, at 06:28
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.