AI Value Randomizer

Striving for unique and challenging game play.

Moderator: sinewav

Post Reply
User avatar
Graphic Artist
Posts: 6199
Joined: Wed Jan 23, 2008 3:37 am

AI Value Randomizer

Post by sinewav » Fri Jan 02, 2015 12:10 am

I play a lot of local games as you know, enough that I can somewhat predict how certain named AIs will react. To eliminate this, I wrote a script for randomizing AI values and run it occasionally. It overwrites aiplayer.cfg, so be sure to back up the original if you use this. I don't really know how the AI works, so please modify this script as you see fit. It does well enough that the bots are fairly tough.

Code: Select all

/* ArmagetronAD AI Randomizer v1, 2014 by a really cool guy
 * Overwrites aiplayers.cfg with strong values for every named AI
 * Place script in directory with the configuration file

$ainames = ["Name1", "Name2", "Name3", "Name4", "Name5"];

// Column header
$ai[] = "# ai-name\trs\ter\tvr\ttr\tcl\tpth\tlp\tcyc\ttun\tdet\tst\tstr\tsch\n";

for ($i=0; $i < count($ainames); $i++) {
	$ai[] = $ainames[$i]."\t".
	rand(5, 10)."\t".      // reaction speed
	rand(5, 10)."\t".      // emergency reaction
	rand(3, 10)."\t".      // viewing range
	rand(0, 6) * 5 ."\t".  // trace
	rand(3, 10)."\t".      // close combat
	rand(3, 10)."\t".      // path finding
	rand(6, 10)."\t".      // loop avoid
	rand(3, 10)."\t".      // cycle avoid
	rand(3, 10)."\t".      // avoid tunnel
	rand(3, 10)."\t".      // trace detect
	rand(0, 3)."\t".       // initial state
	rand(4, 6)."\t".       // drive straight
	rand(8, 12)."\n";      // state change

// Convert array to string and output results to console for user feedback
$outstring = implode($ai);
echo $outstring;

// Write the file
$file_handle = fopen("aiplayers.cfg", "w");
fwrite($file_handle, $outstring);
Last edited by sinewav on Fri Jan 02, 2015 7:52 am, edited 1 time in total.

Match Winner
Posts: 426
Joined: Mon Jul 30, 2012 10:35 pm

Re: AI Value Randomizer

Post by Durf » Fri Jan 02, 2015 1:16 am

Neat :)

Post Reply