HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Will AI script improve preformance?

01-26-2004, 11:22 PM#1
LegolasArcher
I am working as the trigger JASS guy in a TD. Enemies spawn on 8 sides and move towards the middle. If they come withing aquisition rang eof a targetm they attack it. If not they continue movement to center where they attack the commander units. As of now I have a trigger that alternates firing between the 8 spawns to check for attack and or movement. Unfortunatly once about 10 units spawn it lags like hell (better than all firing at once, still). How can a AI script improve this? Ive never writen one before, but I know some JASS- what more will I need to learn?

Thanks fo ryour time :D
01-26-2004, 11:51 PM#2
Vidstige
What to learn/do:

1. How to start an AI script.
2. Investigate common.j and common.ai.
3. Check: How to crash an AI script
4. Patience: Don't get to angry when WC hangs, check point 3 again...
01-27-2004, 12:03 AM#3
LegolasArcher
I'd still like to know If it would give a performance gain. Also, something more specific may be helpful
01-27-2004, 01:49 AM#4
Vidstige
If you haven't already, you should start with reading the AI & JASS FAQ. Regarding the performance, it is probaly easier to fix performance problem in a script, but i am not sure...
01-27-2004, 02:13 AM#5
Extrarius
What exactly does the laggy script do, just check when to make them attack? It sounds like just ordering the units to attack-move to the center might do what you want.
01-27-2004, 07:00 PM#6
LegolasArcher
Let me try and explain this. You build towers in the trech where they walk. If they are within aquisition range of a enemy they attack it. If not they continue moving towards the center.

After there are no enemies left in range they continue running to the center, and repaet. When they are in the center, they are ordered to attack move there position, but not leave the center region.

Its probally really easy, but Ive never done AI before, so Ill check that FAQ. Thank's.
01-27-2004, 07:15 PM#7
AIAndy
AI has only support for one attack group so if you need more than one AI will not help you (most of the things in it support building a base).
01-27-2004, 09:58 PM#8
Vidstige
I am quite convinced that I can create a lot of groups and make them attack whatever I feel using an AI script... I would have to write all the code myself though.
01-27-2004, 10:08 PM#9
AIAndy
Yes, sure, but in that case you do not use the extra natives AI provides and still lose the ability to use triggers and callbacks and such.
I think you are better off implementing that in trigger if you do not use the AI natives.
01-28-2004, 01:50 AM#10
dataangel
The reason it begins to lag like hell is probably because you're doing unit groups, which leak memory. To stop them from leaking memory, make a custom script action with this line before your unit group every time:

set bj_wantDestroyGroup = true

The only time you don't want to do this is when you store the unit group in a group variable. If you're just doing a "Unit Group XXXXX units and do actions" then you should include this line to stop leaks.