Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Calin Leafshade on Sat 24/10/2009 09:26:06

Title: [SUGGESTION] Multi-Dimensional Arrays
Post by: Calin Leafshade on Sat 24/10/2009 09:26:06
Now I know this is possible to do using a function and a kind of wrapper for an array which transposes values into appropriate indices but i think having hard coded arrays that can be defined just as Array[100,100] would be a logical addition to the language.

Thoughts?
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Scarab on Sat 24/10/2009 10:03:02
Yeah, this would be really useful for me for programming the tile engine I'm coding at the moment, (I'm currently using the 'wrapper' function you mentioned), although I'm not entirely sure what applications this would have in adventure games.

I mean, if CJ's up for it, high fives all round, but he can only really be expected to add features which predominantly affect the genre AGS was designed for.
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Calin Leafshade on Sat 24/10/2009 10:34:24
MD arrays can be used for loads of things from a mathematical point of view.

The most obvious application i can think of is cartesian coordinates which are used all the time in graphics algorithms.

Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Khris on Sat 24/10/2009 10:40:04
Just FYI, you can already "trick" the engine into supporting two dimensional arrays of types like int:

// header

struct str_x {
  int y[100];
};

// script

str_x x[100];

// now one can do:
  x[40].y[20] = 3;


Of course it still isn't possible to do stuff like x[40].y[20].tile = 1;
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: OneDollar on Sat 24/10/2009 12:30:17
I'd find inbuilt support for multi-dimensional (or at least 2d) arrays really useful... but I'm trying to make non-adventure games with AGS. I can't think of much use for them in your average adventure game, but if there's enough support maybe CJ will make it a higher priority.
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Scarab on Sat 24/10/2009 12:33:44
Quote from: OneDollar on Sat 24/10/2009 12:30:17
if there's enough support maybe CJ will make it a higher priority.

Woot for e-Petitions! ;D

I mean granted limited adventure game use with this feature, non-adventure games are not that uncommon, and it will just add to AGS's already quite prominent versatility.
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Wonkyth on Sat 24/10/2009 12:37:30
I've also been using AGS to work on various (unfinished) non-adventure games, but the main relevant reason I can come up with is that when trying to transcribe non-AGS code modules, which are plenty to be found, that quite often they require multi-dimensional arrays, and they always assume that they are available.
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: discordance on Sun 25/10/2009 01:58:13
Funny, I was just wishing today that ags had two-dimensional arrays. Again, though, it was for a non-adventure project. I don't think I'd ever use them in an AG, but obviously there are plenty of crazy folk who love to use AGS for purposes unintended. :)
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Joseph DiPerla on Sun 25/10/2009 02:21:50
This has been discussed before. Maybe the LUA Plugin might be a good stand in?
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: RickJ on Sun 25/10/2009 05:22:15
Quote
I've also been using AGS to work on various (unfinished) non-adventure games, but the main relevant reason I can come up with is that when trying to transcribe non-AGS code modules, which are plenty to be found, that quite often they require multi-dimensional arrays, and they always assume that they are available.
This probably the best reason I've seen for implementing multi-dimensional arrays.  Otherwise the work-arounds work just fine.  Personally I would rather have improved support for stucts, struct in struct, struct and function pointers.  
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Wonkyth on Sun 25/10/2009 13:03:51
As structs are about the most useful thing in the whole scripting language, I'd second that! :)
Title: Re: [SUGGESTION] Multi-Dimensional Arrays
Post by: Shane 'ProgZmax' Stevens on Sun 25/10/2009 14:57:00
This is probably the third most requested addition to AGS and it's been discussed over and over again.  Yeah, there are work-arounds, yeah it would be great to have native support.  I just wish people would limit their suggestions and ideas to a single collective thread (which they gloss over to make sure it hasn't already been suggested).  Threads like this (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36284.220) streamline the process and give CJ one place to look to see all the current popular suggestions instead of having to jump around and look at repetitive posts.