Page 1 of 1

Shared AI memory

Posted: 04 Jan 2006, 22:10
by krogothe
I noticed the CreateSharedMemArea function on the callback class...
how does it work? Can i store different data types in that area? anyone tried using it?

Because so far it seems pretty pointless since AIs can easily share variables (and probably arrays and pointers, havent tested that but im pretty confident it works), which works for speeding up things like loading/saving data (only 1 AI does it, checks flag) and sharing enemy and allied information.
If all that can already be done, without juggling about data in a limited, confusing thing why does that function exist?

Posted: 04 Jan 2006, 22:40
by AF
how exactly are you juggling your data then? Granted I know of many ways, but I'm curious how you're doing it.

Look at OTAI v1.01/2 specifically its mex algorithm, ti uses these functions extensively.

Posted: 04 Jan 2006, 23:05
by krogothe
ill have a look thanks for the tip!

theres no juggling, you declare the variables and theyre shared....

Posted: 05 Jan 2006, 02:13
by jcnossen
Using these functions, AI's from different DLLs can share memory, not only from the same dll... But I agree that's a very limited use :roll:

Posted: 05 Jan 2006, 03:00
by krogothe
yeah so they are like world peace, a great idea but it just aint gonna happen :-)
glad i havent missed anything important in my plans yet!
but sometimes shared vars is plain annoying! I had 2 KAIs allied and one kept building cons and the other kept building attack units since they shared the units and this coincidence happened. Its all fun and games having one KAI doing the economy and the other attack/defence until after the fifth minute where the military AI has such a small base it gets crushed and then its 1v2

Posted: 05 Jan 2006, 20:35
by Veylon
You can use it to share any kind of data. If you have an array of some sort, it is pretty easy to put that array into shared memory. Like AF said, I used it for the mex positions. You could also use to have common attack teams, understanding about metal patches, reservations of prime real estate, or anything else.

We really should have a thread for discussing how the different AI's could have a common communication interface.