The Great Big All-In-One Help Thread

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
Heinermann
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

The Great Big All-In-One Help Thread

Postby Heinermann » Sun May 06, 2007 5:19 am

Please make sure you post the version of Starcraft you are using, and the error message. If there is no popup, go to the StarcraftErrors directory and find the most recent error log.

We need to know the more detailed information so that more advanced users can take a look at the instructions at fault and tell you exactly what is happening and how to fix it.


Check http://dl.dropbox.com/u/733696/BW_CrashList.txt for a list of known (1.16.1) crashes.


############################

This is an ongoing summary of things to watch out for in Ai script coding that will either cause Starcraft to lockup/crash OR the Ai to go stagnant/idle:

I've tried changing unitdef.ini for mod AI writing, but SCAIEdit tells me there are syntax errors, and rejects my script?
see post #2.

My Ai crashes... Now what?

see this topic

My Ai was performing great, but then after adding more advanced blocks it all went to crap. Why does SCraft not do what it is supposed to do?
[quote name='Racine from BWAI 1.00 Readme']...the Blizzard scripts have an average of 1200 lines of code, which is a very big number of lines compared to all of the Insane scripts and others. But the number of code lines is really not a good judgment to say if a script will do good or not. I noticed that, in general tendencies, the shorter the script is, the better it works.[/quote]Keep it simple.. trim the fat.

LOCKUPS/CRASHES:
Loops w/out a wait statement
Simultaneous running Attack_do statements
A wrong defensebuild/defenseuse command for unit


STAGNANT OR IDLE AI:
Supply Limit reached.
Define_max statement conflict
Wrong race
Mixed up build/train command


A loop w/out a wait statement:

I found that ALL looping blocks NEED at least ONE wait statement.
The following looping blocks will crash:[spoiler]:cash
give_money
goto cash

:zerglings
train 12 zergling
attack_add 12 zergling
attack_prepare
attack_do
attack_clear
goto zerglings

:greater_spire
notowns_jump hive greater_spire
build 1 greater_spire 80
wait_buildstart 1 greater_spire
multirun air_upgrades[/spoiler]
fixes:[spoiler]:cash
give_money
wait 1500
goto cash

:zerglings
train 12 zergling
attack_add 12 zergling
attack_prepare
wait 300
attack_do
attack_clear
goto zerglings

:greater_spire
wait 300
notowns_jump hive greater_spire
build 1 greater_spire 80
wait_buildstart 1 greater_spire
multirun air_upgrades[/spoiler]
Racine's 1.10Ai had such a crash. If you played a TvT game it would crash around the 20 min mark. Here is the block that was fixed for BWAI3.1.
Original block:[spoiler]:block19
attack_add 10 siege_tank
attack_add 10 goliath
attack_prepare
train 8 vulture
train 16 siege_tank
train 14 goliath
train 20 siege_tank
attack_do
attack_clear
attack_add 16 siege_tank
attack_add 10 vulture
attack_add 10 goliath
attack_prepare
train 10 siege_tank
train 6 goliath
train 12 siege_tank
train 10 goliath
train 16 siege_tank
train 14 goliath
attack_do
attack_clear
goto block19[/spoiler]fixed:[spoiler]:block19
attack_add 10 siege_tank
attack_add 10 goliath
attack_prepare
train 8 vulture
train 16 siege_tank
train 14 goliath
train 20 siege_tank
attack_do
attack_clear
attack_add 16 siege_tank
attack_add 10 vulture
attack_add 10 goliath
attack_prepare
train 10 siege_tank
train 6 goliath
train 12 siege_tank
train 10 goliath
train 16 siege_tank
train 14 goliath
attack_do
attack_clear
wait 200
goto block19[/spoiler]

[quote name='Killer_Kow(MM)']Trying to make your AI train more units than its supply depots can handle can cause a freeze. That happened to me once, I was so confused[/quote]

Yes, excellent point. One way to avoid this freeze is to possibly include a suicide loop somewhere to sort of reset the "supply" in case script freezes.
An expansion loop might be just the right amount of time. for instance;

:expo_loop
expand 99 newtown
wait 6500
send_suicide 0
goto expo_loop

Here are some more things to watch out for:
crash:

Wrong use of the defensebuild command.
Here these are classified wrong either because they are not Air/ground units or don't have that type of attack.
defensebuild_gg 1 valkyrie
defensebuild_aa 1 siege_tank
etc.
note: Especially pay close attention to these tags if you've modified the units via a mod.

stagnant Ai:
Define_max conflict.
Here you've predefined a max number of units but now are trying to train more.
Here's an example from Blizzard's Zerg script that shows a "reset' of the define_max command.[spoiler]define_max 24 zergling
...
:block18
...
resources_jump 1000 0 block23
wait 900
goto block19

:block23
define_max 40 zergling <--- without this line next line would freeze Ai.
train 40 zergling
wait_train 40 zergling
attack_add 40 zergling
define_max 30 zergling
goto block19[/spoiler]
Stagnant Ai:
wrong race/tech.
Terran can't build zerg units, Zerg can't build Terran units. (obviously non- UMS Ai)
I know this sounds a bit stupid.. but I've been guilty of this one.
side note: A mind-control Protoss script can use the other 2 races.. Michel made such a MIND-CONTROL script. Maybe I can post it in Showcase.

Here's an email that Michel once sent. This is also posted at Tutorial thread.. but works here too.[spoiler]
- 15 buildings of a type is max (if you need more, say photon cannons,
you need to expand or do another start_town, build 1 nexus in multirun)

- 25 probes pro town is max (if you build 30 in main, your script locks
up - if you need more expand or do another start_town, build 1 nexus,
build 1 probe etc.)

- once a Zerg script builds a hydrie den, there is a possibility it
will stop attacking (on send_suicide 0) and training after 45 minutes

- also I never got the script to build more than 50-60 Hydralisks,
which is not a lot on a 200 supply max (perhaps you can help me with this)

- once a Zerg script loses all Overlords, there is a possibility it
will stop training/building (about same effect as killing scv while
building)

- only use the give_money command in a single thread (I generally do a
multirun loop, like: :cheat_loop, wait 1500, give_money goto
cheat_loop), if you use multirun loop >>and<< use seperate give_money commands in
your main build thread the building/training has hickups (periods where
ai is idle)

- this I don't know for sure, but I generally put all build command in
de main thread (no other thread), except for probe training, photon
cannon building - times when I had build commands in other thread it
became harder to check the amount of buildings of a type and I sometimes had
to rewrite the whole script because something was causing a hickup, and
I didn't know what and where

- I get the best training results if I use a notowns_jump added to keep the script from trying to train
units it can't train yet (i.e. Archon without templar_archives)

- use define_max 255 to keep the ai from building this type
of unit (make sure you don't call train after it, or
the script will lock up)

Michel
[/spoiler]ADDED FROM OLD FORUM: ISOLATING ERRORS
Hopefully you've been routinely testing your script as you create it? Your problem shouldn't be too hard to find since your last updated version. No? Well, if you have no idea where or what could be causing problem, here are some steps to at least isolate the problem.

One simple way to isolate potential problem areas is to
create a small loop to divert script at questionable locations.

Add an empty loop to the end of your script such as
:loop
wait 1500
goto loop


Test for errors by adding a goto loop statement at a place you're not too sure about. If test works, delete statement and move on.

the following code has a critical error. The goto loop isolates the corrupt block on the 3rd test.[spoiler]build 14 drone 80
wait_buildstart 14 drone
goto loop <----- test1 pass/delete line
multirun evo_upgrades
build 1 lair 80
wait_buildstart 1 lair
build 1 hydralisk_den
wait_buildstart 1 hydralisk_den
goto loop <----- test2 pass/delete line
multirun primary_attack
goto loop <----- test3 fail!
multirun hydra_upgrades
build 1 queen_nest 80
build 1 hive 80
...

:evo_upgrades
upgrade 1 z_melee_attack 30
wait 3000
upgrade 1 z_missile_attack 30
wait 3000
upgrade 1 z_carapace 30
stop

:primary_attack
train 12 zergling
train 12 hydralisk
wait_train 8 hydralisk
attack_add 12 hydralisk
attack_add 12 zergling
attack_prepare
wait 300
attack_do
attack_clear
notowns_jump hive primary_attack
stop

:hydra_upgrades
wait 400
notowns_jump hydralisk_den hydra_upgrades
upgrade 1 hydralisk_range 30
wait 2500
upgrade 1 hydralisk_speed 30
wait 2500
tech lurker_aspect 70
place_guard lurker 0
place_guard lurker 1
defenseuse_gg 1 lurker
defensebuild_gg 1 lurker

:lurkers
attack_add 8 lurker
goto lurkers[/spoiler]btw here is the reason hydra_upgrades block crashes:
[spoiler]:hydra_upgrades
wait 400
notowns_jump hydralisk_den hydra_upgrades
upgrade 1 hydralisk_range 30
wait 2500
upgrade 1 hydralisk_speed 30
wait 2500
tech lurker_aspect 70
place_guard lurker 0
place_guard lurker 1
defenseuse_gg 1 lurker
defensebuild_gg 1 lurker

:lurkers
attack_add 8 lurker
wait 1200
goto lurkers[/spoiler]


Also once again, running your changes in a premade replay will be the quickest way to view changes/fixes. :)
Ahzz
Posts: 131
Joined: Wed Apr 25, 2007 6:03 am

Postby Ahzz » Sun May 06, 2007 7:17 pm

yes this is very nice... Though the exact areas where to add the wait x command is a bit weird. Some are clear though. Also, does it have to be wait 300 or can it be even wait 10 or wait 1 or wait 50? if so, then it's no trouble at all since wait 10,1,or even 50 are really small amounts of time and can be added almost at any point if it even sounds suspicious.
Ahzz
Posts: 131
Joined: Wed Apr 25, 2007 6:03 am

Postby Ahzz » Fri May 11, 2007 1:24 pm

100 is about 10 seconds? yes?
Ahzz
Posts: 131
Joined: Wed Apr 25, 2007 6:03 am

Postby Ahzz » Fri May 11, 2007 5:33 pm

yes, good to know. might make a big difference.
Ahzz
Posts: 131
Joined: Wed Apr 25, 2007 6:03 am

Postby Ahzz » Sun May 13, 2007 7:49 pm

hey...

I've got a crash problem in ahzz no...

I've only removed give moneys, and I have added build gateways/barracks/factories blocks. It seems to crash at the point it has about 4 gateways and a expansion. Here are my blocks

:5_gate
wait 10
build 5 gateway 80
wait_buildstart 5 gateway
wait 10
resources_jump 690 120 6_gate
wait 10
goto 5_gate

:6_gate
wait 10
build 6 gateway 80
wait_buildstart 6 gateway
wait 10
resources_jump 750 150 7_gate
wait 10
goto 6_gate

:7_gate

blah blah.

In any case, thats just about only thing I've added. I cannot see why it'd crash. Anyone know a solution? it'd really help.

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 1 guest