Global AI API question

Global AI API question

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

Global AI API question

Post by munch »

OK, so looking at the Global AI API, there are quite a few methods for getting various maps like height map, LOS map etc. and they return like a char* or a float* or something like that, instead of char ** or float **.

What I want to know is, how is the data arranged? Is it really a 1D array, or is it actaully a 2D array written down as a 1D array. Or am I missing something? (probably)

Can someone please explain how to use the return values from these functions? Example code would be good. I'm looking for something like this:

Code: Select all

unsigned char ** metalMap =  (unsigned char **)  GetMetalMap()
Which is my best guess, but probably wrong.

Ta.

Munch
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

yuk, Fear the 4 functions of map do I above all globalAI callback functions. Napalm said something about just using it as an array...
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

//the following functions are used to get information about the map
//dont modify or delete any of the pointers returned
//the maps are stored from top left and each data position is 8*8 in size
//to get info about a position x,y look at location
//(int(y/8))*GetMapWidth()+(int(x/8))
//some of the maps are stored in a lower resolution than this though

right from the .h file
User avatar
[K.B.] Napalm Cobra
Posts: 1222
Joined: 16 Aug 2004, 06:15

Post by [K.B.] Napalm Cobra »

y/ 8) ?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

(int ( y / 8 ) )
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

Post by munch »

SJ wrote://the following functions are used to get information about the map
//dont modify or delete any of the pointers returned
//the maps are stored from top left and each data position is 8*8 in size
//to get info about a position x,y look at location
//(int(y/8))*GetMapWidth()+(int(x/8))
//some of the maps are stored in a lower resolution than this though

right from the .h file
LOL thanks SJ. I hate it when I bother writing decent comments and folk don't read 'em... and here I am guilty of just that. Apologies, and thanks for leaving good comments!

Cheers

Munch
Post Reply

Return to “AI”