MODULE: MultiArray v1.0 - Multidimensional dynamic arrays

Started by monkey0506, Fri 17/08/2007 00:31:45

Previous topic - Next topic

monkey0506

Implements functions for working with multidimensional dynamic arrays. Supports int, String, and float. Supports any number of dimensions of any size, but note that the total product of every dimension's size can be no larger than 1000000 (one million) as this is the current maximum size of a dynamic array.

Download BROKEN!
Read the manual online

This module was really never very useful given the number of iterations it used in trying to verify the size of the arrays. In practice it was better to create a specialized function than use the functions the module offered.

With regard to a question that was raised, AGS 3 does support dynamic arrays which is how this module was implemented. The problem with this module was that there isn't currently a way to check the size of a dynamic array so I tried to verify the size.

I may release a modified version, but until then I highly recommend taking a look at my Stack module. You can push any type of data, including other stack objects onto each stack, so simulating the multidimensional array functionality wouldn't be terribly difficult.

Monsieur OUXX

#1
Hi,

Your multi-array looks perfect!

Just a question : it's using dynamic arrays. The module only works with AGS 3.0, right?

It meets the infinite dereferencing "requirement" (hurray!  ;)).

At the beginning I planned to do things the same way (passing the data to functions using small built-in arrays), but I changed my mind, for some reason. I think it had something to do with the fact that you have to duplicate the code for every data type.

I'd say that the main problem (for my own purposes) would be that it doesn't allow to reference an array from another array.


[EDIT]OOOoops, this was supposed to be a Private Message to Monkey, sorry for the inconvenience...I can't delete my message[/EDIT]
 

monkey0506

Quote from: Monsieur OUXX on Mon 19/11/2007 12:13:50Just a question : it's using dynamic arrays. The module only works with AGS 3.0, right?

Yes.

Quote from: Monsieur OUXX on Mon 19/11/2007 12:13:50you have to duplicate the code for every data type.

The closest thing AGS has to type-casting is String.Format but then the user would still have to call a casting function every time they pass a non-String value; and then call it again every time they retrieve the value.

If AGS allowed type-casting or if AGS could do a) pointers to custom structs and b) dynamic arrays within custom structs (of pointers to custom structs) then this would be simpler.

Quote from: Monsieur OUXX on Mon 19/11/2007 12:13:50I'd say that the main problem (for my own purposes) would be that it doesn't allow to reference an array from another array.

What exactly do you mean by this? Perhaps an example would help here.

Dualnames

Ah blast...If only I wasn't using AGS2.72 Anyway I'm sure this module will be one hell of a use.. Good job. Good to see you're still helping the rest of us..
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Monsieur OUXX

Quote from: Dualnames on Tue 20/11/2007 08:50:36
Ah blast...If only I wasn't using AGS2.72

Monkey's dynamic arrays module is also of great help and it works with AGS 2.72 ;)
 

monkey0506

Quote from: Monsieur OUXX on Tue 20/11/2007 09:10:07Monkey's dynamic arrays module is also of great help and it works with AGS 2.72 ;)

Referring to the VectorClass module which, as you proved, is actually quite slow since all the data is stored in Strings...

Oh also Monsieur, could you please post an example of what you mean by "referencing an array from another array"? I'm still unsure what you mean. Thanks.

Monsieur OUXX

Quote from: monkey_05_06 on Wed 21/11/2007 06:26:28
Monsieur, could you please post an example of what you mean by "referencing an array from another array"? I'm still unsure what you mean. Thanks.

Yeah. It's not the most vital feature ever, but it can come usefull sometimes :

(Java-like syntax) - provided that those types exist
Code: ags

//somewhere in the code
Vector globalVector = new Vector();

...

//somewhere else in the code
Vector vector1= new Vector();
globalVector.push(vector1);

...

//somewhere else in the code (where we don't even know of the existence of vector1)
Vector vector2= new Vector();
globalVector.push(vector2);


globalVector "references" vector1 and vector2, but neither vector1 nor vector2 know the existence of the other, and they also don't know the internal structure of globalVector.

Such situations can come handy for example when you load the different fields of a global config file, or... I don't know.
 

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Rocco

Downloadlink is broken,  :'(
please can you reupp the module and Manual?

monkey0506

I don't currently have a copy of the module/manual at hand, though a copy of all the int functions is included in the first post. Notably this module was slower than intended on larger scale projects, so unless you actually need the vectorization perhaps another method might be better anyway.

Rocco

ok, thx
is it intended for implementation in future versions of AGS?
could be very useful for modul developers.

monkey0506

This could be made simpler if dynamic arrays were allowed within structs. This would allow me to ensure that the dimension sizes are always valid, as well as keeping the total array size in a variable, saving several loop iterations per function call.

As it stands now, the best solution I can give is to provide specialized functions using the theoretical methodology presented here; in this incarnation it's practically worthless.

Cronos

The download link seems to not be correct or something can you please check to see if th url is right?

rbaleksandar

Quote from: Cronos on Mon 19/01/2009 07:52:20
The download link seems to not be correct or something can you please check to see if th url is right?

They've probably deleted it. Can we use dynamic arrays in AGS 3 or do we still need this plugin. Haven't tried yet. If not, could you please post where I can download it.

Thanks in advance!
I am a mighty pirate. Arrrrgh!

SMF spam blocked by CleanTalk