Relentless AIscript

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
perpetual
Posts: 2
Joined: Mon Feb 15, 2010 2:52 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Relentless AIscript

Postby perpetual » Mon Feb 22, 2010 2:56 am

Hi!

I just recently stumbled upon this page and noticed the possibility of writing for Starcraft. I wrote several AIscripts for Age2 the Conquerors so I thought it would be interesting to try something different and dug out my Broodwar CD.

After several hours of trial and error I managed to get my script halfway decent. However it sometimes crashes in longer games against Terrans (haven't tested against yet against P and against Z it doesn't happen for some reasons) and I have no idea why. I decided to release the unfinished script so someone more experienced may spot the error.

It rushes with 2 Gate Zealots and then expands and goes Dark Templars. No cheats included.

Edit: Crashes seems to be fixed. Attachment changed.
Equalizer
Posts: 83
Joined: Wed Sep 23, 2009 3:49 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Equalizer » Mon Feb 22, 2010 4:05 am

Looks like your script has a similar problem as that Pandut had with his zerg not too long ago.

The ai doesn't like looped build instructions.
It consistantly causes invalid memory terminal errors.

I found that if I ran your script against my terran using AIvsAI TvP Tau Cross.rep the game would crash.

By making the observer_tech block and add_gates_III block stop after running instead of looping it no longer crashed.

I can't garentee that this is the only bug as I didn't test the modified script thuroughly but in general the script is very clean and plays well so I doubt there are other issues.
Halachee
Posts: 11
Joined: Sat Mar 29, 2008 7:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Halachee » Mon Feb 22, 2010 5:26 am

Hi. You came to the right place for help. Equalizer is a good troubleshooter too so gluck with your scripts.

[quote name='perpetual' post='9323' date='Feb 21 2010, 06:56 PM']I wrote several AIscripts for Age2 the Conquerors[/quote]

I have this link bookmarked for some reason but it looks like you need to register to check out. Do you konw anything about it?
User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Archon_Wing » Mon Feb 22, 2010 7:24 am

Very impressive and simple script design! Sadly, SC AI is much more limited than AoC AI.

Your expansion loop is running as part of your second expo; typically we run it as part of the main thread. Not really sure if that does anything bad:

--second_exe--
start_town()
build(1, Protoss Nexus, 80)
wait_buildstart(1, Protoss Nexus)
wait(1300)
build(1, Protoss Pylon, 45)
wait_build(1, Protoss Nexus)
get_oldpeons(4)
multirun(build_probe)
build(1, Protoss Photon Cannon, 5)
wait_buildstart(1, Protoss Photon Cannon)
build(2, Protoss Photon Cannon, 5)
wait_build(2, Protoss Photon Cannon)
goto(exe_timer)
--exe_timer--
wait(7200)
expand(99, subsequent_exe)
goto(exe_timer)
--subsequent_exe--
start_town()
build(1, Protoss Nexus, 80)
wait_buildstart(1, Protoss Nexus)
wait(1300)
build(2, Protoss Pylon, 60)
wait_build(1, Protoss Nexus)
get_oldpeons(15)
multirun(build_probe)
build(1, Protoss Photon Cannon, 5)
wait_buildstart(1, Protoss Photon Cannon)
build(2, Protoss Photon Cannon, 5)
wait_build(2, Protoss Photon Cannon)
stop()

Ideally, the 2nd exe should just stop--- and the expansion loop can be called as a multirun somewhere back up there.

It's been a theory that the AI doesn't like more than one attack_do running at a time. It may crash. Thus it's usually a good idea to keep all attacks confined to a single thread (with waits in between them of course) and then ending in a final attack loop block. So instead of calling "basic force" and "attack force" I would just have the script call one multirun called "attack manager" which will handle all attacks. Late game it can end at the final_force

it'd look like:
CODE
#additional waits needed
--attack manager--
#--zealot_rush--
wait_build(1, Protoss Gateway)
attack_add(9, Protoss Zealot)
wait_force(9, Protoss Zealot)
attack_do()
attack_clear()
clear_combatdata()
#stop()
#--basic_force--
attack_add(8, Protoss Zealot)
attack_add(4, Protoss Dragoon)
#stop()
#--advanced_force--
# attack_add(4, Protoss Dark Templar)
# wait_force(4, Protoss Dark Templar)
attack_add(10, Protoss Dark Templar)
attack_add(16, Protoss Zealot)
attack_add(9, Protoss Dragoon)
wait_force(6, Protoss Dark Templar)
wait_force(12, Protoss Zealot)
attack_prepare()
clear_combatdata()
attack_do()
attack_clear()
wait(100)
#goto(final_force)
--final_force--
wait(100)
notowns_jump(Protoss Arbiter Tribunal, advanced_force)
attack_add(30, Protoss Zealot)
attack_add(16, Protoss Dragoon)
attack_add(10, Protoss Dark Templar)
attack_add(1, Protoss Arbiter)
wait_force(1, Protoss Arbiter)
wait_force(8, Protoss Dark Templar)
wait_force(12, Protoss Zealot)
wait_force(6, Protoss Dragoon)
clear_combatdata()
attack_do()
attack_clear()
multirun(air_check)
wait(100)
goto(final_force)

Also, make sure you heed all PYAI warnings, especially the unused label ones. The other thing is to make sure research and upgrades are never repeated; they will probably crash.

Good luck!
perpetual
Posts: 2
Joined: Mon Feb 15, 2010 2:52 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby perpetual » Mon Feb 22, 2010 5:45 pm

User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Archon_Wing » Mon Feb 22, 2010 7:08 pm

User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Archon_Wing » Tue Feb 23, 2010 4:07 am

I took a look at the new script. It was done very well. Even though the script is not adapted to PvT it pretty much slaughtered every T script I have besides AccelT and Unleaded. :o Racine and Easychat T put up a reasonable fight, but got smashed when arbiters came out. Other scripts either died outright to zealots or could never go beyond their natural and were merely just surviving but never really had a chance :P

It could also sometimes beat Unleaded by going around the terran army and countering the base. ;) AccelT's defense was too solid for that though.

This script could probaly be moved to the showcase/AI database soon. ;)

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 11 guests