Assistive
Technology


A.I. Wars Chinese


John Reder
A.I. Wars
Featured 9/98



A.I. Wars
Awarded

A.I. Wars Rated 5 by AgentLand
ZDNet 4 star rating


  Home | Downloads | Tactical Neuronics   Updated DECEMBER 2024

Cybug A.I. Command Language

(CAICL)

1.1 Quick Reference

General Commands:

; [comments]

assign v# ~v#

assign v# [any value]

assign v# #[system_variable]

attempt repairs

author [developer’s name]

beep

cloak on

cloak off

cmath v# = (simple or complex math formula)

cross scan

corner scan

data link command [additional command to insert]

data link resource fuel (value)

data link resource ammo (value)

debug on

debug off

discharge energy

fire weapon

generate random

gosub [routine name]

goto [line label]

gps scan x [x position] y [y position]

if ammo is > # then [additional command]

if ammo is < # then [additional command]

if ammo is = # then [additional command]

if bump barrier then [additional command]

if not bump barrier then [additional command]

if damage is > # then [additional command]

if damage is < # then [additional command]

if damage is = # then [additional command]

if facing north then [additional command]

if facing south then [additional command]

if facing east then [additional command]

if facing west then [additional command]

if not facing north then [additional command]

if not facing south then [additional command]

if not facing east then [additional command]

if not facing west then [additional command]

if fuel is > # then [additional command]

if fuel is < # then [additional command]

if fuel is = # then [additional command]

if grenade ready then [additional command]

if grenade not ready then [additional command]

if missile ready then [additional command]

if missile not ready then [additional command]

if no ammo then [additional command]

if random is 1 then [additional command]

if random is 2 then [additional command]

if random is 3 then [additional command]

if random is 4 then [additional command]

if scan found barrier then [additional command]

if scan found enemy then [additional command]

if scan found tree then [additional command] (Armor Commander only)

if scan found friend then [additional command]

if scan found flag then [additional command]

if scan found mine then [additional command]

if scan found nothing then [additional command]

if shield is up then [additional command]

if shield is down then [additional command]

if...then...end if

if x coordinate is < # then [additional command]

if x coordinate is > # then [additional command]

if x coordinate is = # then [additional command]

if y coordinate is < # then [additional command]

if y coordinate is > # then [additional command]

if y coordinate is = # then [additional command]

if value (variable) (>, <, =, <>, >=, <=) (value or variable) then [additional command]

iff code [any code number or word(s)] (The Insect Mind Only)

launch missile

launch grenade

lay mines on

lay mines off

long range scan

lower shield

math v# = (value) (+, -, *, /) (value)

move forward

move backward

name [unit name]

password [security password]

queen

raise shield

return

scan forward

scan right

scan left

scan perimeter

scan position 1

scan position 2

scan position 3

scan position 4

scan position 5

scan position 6

scan position 7

scan position 8

scan relative 1

scan relative 2

scan relative 3

scan relative 4

scan relative 5

scan relative 6

scan relative 7

scan relative 8

self destruct

set grenade fuse (value or variable)

turn right

turn left

User Variables:

v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, va, vb, vc, vd, ve, vf, vg, vh, vi, vj, vk, vl, vm ,vn ,vo ,vp, vq, vr, vs, vt, vu, vv, vw, vx ,vy, vz

Hive (Team) Variables:

h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, ha, hb, hc, hd, he, hf, hg, hh, hi, hj, hk, hl, hm ,hn ,ho ,hp, hq, hr, hs, ht, hu, hv, hw, hx ,hy, hz

System Variables:

#alive

#bloodmodeon

#burn

#cloakstatus

#cur_ammo

#cur_fuel

#cur_head

#cur_life

#cur_score

#damset1

#damset2

#damset3

#damset4

#damset5

#damset6

#damset7

#damset8

#damset9

#damset10

#damset11

#damset12

#damset13

#damset14

#damset15

#damset16

#damset17

#damset18

#enemy_d

#enemy_h

#enemy_x

#enemy_y

#friend_d

#friend_h

#friend_x

#friend_y

#heatlevel

#inbound

#lastcybugon

#max_fuel

#max_life

#overheatoff

#overheatset

#random

#scan

#set_ammo

#shield

#smartclickoff

#snodeoff

#strat_x

#strat_y

#x_pos

#y_pos

 

2.1 Command Language Syntax

All commands must be typed using the syntax given including spaces.

The A.I. compiler converts most commands to lower case before interpreting.

2.2 Unit Identification and Security

name [unit name] - This sets the units name.

Example:

name Warrior 1

author [player name] - This sets the authors name.

Example:

author John Doe

password [security password] - This sets the units security password. If this line is entered in the units code the units AI will not allow editing or debugging without a proper security password entered in the battle setup screen.

Example:

password allison

iff code [any code number or word(s)] (The Insect Mind Only) - Identify friend or foe. Units with matching IFF codes will show up as a friend on any scan.

Units with matching IFF Codes are considered to be on the same team. The team score is the total score of all Cybugs with matching IFF codes.

Example:

iff code skull crushers

queen this mutates a perfectly innocent Cybug into a Hive Queen! Queens are designed to be protected because the battle can be set to end upon her death. The dead queen penalizes her team with a point deduction to her score. Queens can be used as battle goals like a flag would be in a capture the flag game.

Team games can be set up with Cybugs and Queens on each team using the same iff codes and team variables to transmit the Queens location to assist in her protection.

Example:

queen

 

2.3 Debugging

debug on - saves any following commands that are seen by the unit to the debug watch buffer. This buffer can be viewed by selecting the debug watch button from the battle summary screen.

Example:

debug on

WARNING: you may wish to remove these statements from AI files that you distribute because this will allow other users to see portions of your code when they view the debug watch for that unit.

Note: an active debug watch will slow down the battle due to the extra processing overhead created.

debug off - stops saving command information to the debug watch buffer.

Example:

debug off

Debug on and off are used with the debug watch screen. This screen is only available in the registered version.

beep - Plays the windows default beep sound. Useful in debug mode to determine if a section of code is being read in the units AI.

Example:

if bump barrier then beep

Note:

; - Comments: Lines that begin with a semi-colon are considered comments and will be ignored by the A.I. interpreter.

Example:

; this is a comment line

2.4 Program Branching

goto [label name] - This will jump from one section of the units AI code to another line (label) in the program. Label names can be anything followed by a colon ":".

Example:

start:

move forward

goto start

gosub [routine name] - This will jump you from one section of the units AI code to another sub routine. Sub routines start with line labels and end with the keyword return.

Example:

start:

move forward

if bump barrier then gosub bhit

goto start

bhit:

generate random

if random is 1 then turn right

if random is 2 then turn left

if random is 3 then gosub turnit

if random is 4 then fire weapon

return

turnit:

turn right

turn right

return

 

2.5 Unit Rear Data and Resource Ports

data link command [command]

This inserts the command into the opposing Cybugs program at the current program read marker, it can be used against friendly and enemy Cybugs. This will replace whatever command existed in that memory space with the new one which could damage the opposing Cybugs overall program.

Note: this link is only possible if the two Cybugs are touching rear to rear and shields of the attacking cybug are down.

Examples:

Data link command iff code myteamiff

Data link command if missile ready then self destruct

data link resource fuel (value)

data link resource ammo (value)

This removes specified resources from the opposing Cybug, it can be used against friendly and enemy Cybugs.

Note: this link is only possible if the two Cybugs are touching rear to rear and shields are down on the initiating cybug. If the specified amount is larger than the Cybugs current reserves then the remaining reserves will be depleted and the linking Cybug will get what is available.

Examples:

Data link resource fuel 300

Data link resource ammo 25

 

2.6 Unit Damage Status and Repairs

if damage is > # then [additional command]

if damage is < # then [additional command]

if damage is = # then [additional command]

If damage is greater than, less than, or equal to the percent given then execute the command to the right of the word then.

Note: do not include a percent sign "%". Valid percent entries are 0 through 99

Example:

if damage is > 95 then self destruct

if fuel is > # then [additional command]

if fuel is < # then [additional command]

if fuel is = # then [additional command]

If fuel is greater than, less than, or equal to the percent given then execute the command to the right of the word then.

Note: do not include a percent sign "%". Valid percent entries are 0 through 99

Example:

if fuel is < 99 then goto hide

attempt repairs - This will try to repair any damage that the unit has. You have a 1 in 10 chance of it working. This requires a lot of energy therefore you cannot have shields raised while attempting this, a repair attempt will be ignored if the shield is raised.

A successful repair attempt will lower your damage by one point.

WARNING: There is also a 5% chance that you will damage the fuel system when you attempt repairs during operation this will cause your unit to burn fuel less efficiently.

Advanced commands:

#cur_life & #max_life: see system variables

#cur_fuel & #max_fuel: See system variables.

#burn: See system variables.

 

2.7 Randomizing Units AI

generate random - generates a random number between 1 and 4.

Example:

generate random

if random is 1 then [additional command]

if random is 2 then [additional command]

if random is 3 then [additional command]

if random is 4 then [additional command]

If the random number generated by the generate random command is equal to the number specified then execute the command to the right of the word then

Example:

if random is 4 then turn right

Advanced command:

#random: see system variables

 

2.8 Scanning for objects and other units

long range scan - This will scan the entire distance between the unit and the edge of the battlefield.

gps scan x [x position] y [y position] - global position scanner looks at the specified x and y coordinates and returns what it finds. The x position and y position are the x and y coordinates of the battle map.

Examples:

gps scan x 10 y 13

if scan found enemy then

gosub hunter

end if

or

gps scan x #enemy_x y #enemy_y

Coordinates (top left corner = x:1, y:1, bottom right corner x:43, y:30)

scan forward - This will scan the area of 5 spaces out directly in front of the unit.

Note: 5 spaces is the range of the primary weapon.

scan right - This will scan the area of 5 spaces out from the right of the unit.

scan left - This will scan the area of 5 spaces out from the left of the unit.

scan perimeter - This will scan all spaces directly around the unit.

scan position 1 - This scans one space directly north of the unit.

scan position 2 - This scans one space directly northeast of the unit.

scan position 3 -This scans one space directly east of the unit.

scan position 4 -This scans one space directly southeast of the unit.

scan position 5 -This scans one space directly south of the unit.

scan position 6 -This scans one space directly southwest of the unit.

scan position 7 -This scans one space directly west of the unit

scan position 8 -This scans one space directly northwest of the unit.

scan relative 1 - This scans one space directly in front of the unit.

scan relative 2 - This scans one space directly front right of the unit.

scan relative 3 -This scans one space directly right of the unit.

scan relative 4 -This scans one space directly rear right of the unit.

scan relative 5 -This scans one space directly behind the unit.

scan relative 6 -This scans one space directly rear left of the unit.

scan relative 7 -This scans one space directly left of the unit

scan relative 8 -This scans one space directly front left of the unit.

cross scan - This scans one space north, south, east and west of the unit.

corner scan - This scans one space northeast, southeast, northwest and southwest of the unit.

if scan found barrier then [additional command]

if scan found enemy then [additional command]

if scan found friend then [additional command]

if scan found flag then [additional command]

if scan found mine then [additional command]

if scan found nothing then [additional command]

If the scan returns the presence of a a barrier, enemy, friend or flag then execute the command to the right of the word then.

Note: If a scan that searches in more than one direction such as the cross scan, perimeter and corner scan finds more than one object type (i.e.; barrier flag and enemy) the scan will return items in the following priority (the top takes priority over the bottom):

    • Enemy / Friend
    • Mine
    • Flag
    • Barrier

Example:

scan position 5

if scan found enemy then fire weapon

 

Advanced commands:

#scan, #enemy_h and #enemy_d : see system variables.

#enemy_x & #enemy_y

To help your unit locate other units in battle, you may use the variables #enemy_x and #enemy_y. These variables will give you the X and Y locations of the closest AI unit (friend or enemy). See the System variables section for more information on how to use these variables. The Tracker.ai program is an example of how to utilize these variables.

Example:

if x coordinate is = #enemy_x then turn right

 

2.9 Movement and location

move forward - Moves unit one space forward in its current direction. This command will have no effect if a barrier blocks its path.

Example:

move forward

 

move backward - Moves unit one space backwards from its current direction. This command will have no effect if a barrier blocks its path.

Example:

move backward

 

turn right - Turns unit to face right from its current direction.

Example:

turn right

turn left - Turns unit to face left from its current direction.

Example

turn left

if facing north then [additional command]

if facing south then [additional command]

if facing east then [additional command]

if facing west then [additional command]

If the unit is facing north, south, east or west then execute the command to the right of the word then.

Example:

if facing east then turn left

if not facing north then [additional command]

if not facing south then [additional command]

if not facing east then [additional command]

if not facing west then [additional command]

If the unit is not facing north, south, east or west then execute the command to the right of the word then.

Example:

if not facing east then turn left

if x coordinate is < # then [additional command]

if x coordinate is > # then [additional command]

if x coordinate is = # then [additional command]

if y coordinate is < # then [additional command]

if y coordinate is > # then [additional command]

if y coordinate is = # then [additional command]

If the units X or Y coordinate equals the number specified then execute the command to the right of the word then.

Coordinates (top left corner = x:1, y:1, bottom right corner x:43, y:30)

Example:

if x coordinate = 18 then turn right

if bump barrier then [additional command] - Use this to check and see if movement is blocked by a barrier. If a barrier is blocking the units path then it will execute the command to the right of the word then.

Example:

if bump barrier then turn right

if not bump barrier then [additional command] - Use this to check and see if movement is not blocked by a barrier. If a barrier is not blocking the units path then it will execute the command to the right of the word then.

Example:

if not bump barrier then turn right

Advanced Command:

#cur_head current heading

1=North

2=East

3=South

4=West

 

2.10 Weapons Control

Weapons use ammo and possibly fuel to use. The default settings are shown in an Appendix below. These settings can be changed.

fire weapon - Fires the units primary weapon. This is a projectile that does maximum damage to an unshielded enemy unit at close range. Shields and range effect the amount of damage given. Shielded units are completely protected from medium and long range shots.

Note: the range of the weapon is 5 spaces in front of the Cybug. You cannot fire this weapon when shields are raised.

Example:

fire weapon

launch missile - Launches missile. The missile will travel in the direction fired until an object is hit. Missiles do 90% damage to units that are hit with their shields down. They do 70% damage to any unit nearby the detonation with their shields down. Units with shields up will receive 30% less damage overall.

WARNING: do not fire the missile with your shields up or the missile will misfire doing 90% damage to the launching unit.

Note: Missiles require 300 fuel and 10 ammo to fire. These damage and requirement settings can be changed.

Example:

if ammo is > 10 then

launch missile

end if

 

launch grenade - Launches grenade. The grenade will travel in the direction fired until a object is hit or its fuse setting has been reached. grenades do 70% damage to units that are hit with their shields down. They do 50% damage to any unit nearby the detonation with their shields down. Units with shields up will receive 30% less damage overall.

WARNING: do not fire the grenade with your shields up. The grenade will misfire doing 70% damage to the launching unit.

Note: Grenades require 200 fuel and 5 ammo to launch. These settings can be changed.

Example:

if ammo is > 10 then

launch grenade

end if

 

set grenade fuse (value or variable) - This will set the distance a grenade travel before it detonates. Grenades will not travel less than 2 spaces unless they hit another object.

Example:

set grenade fuse 12

 

discharge energy - This will discharge a blast of energy from your unit causing it one point of damage. Any enemy unit caught in this blast will take two points of damage (note: these damage settings can be changed). An energy discharge will destroy any flags and mines in the blast area. This is a good way to sweep for mines and deny any other players flags if your damage is zero.

Example:

if scan found enemy then

discharge energy

end if

self destruct - This is a last resort. A unit that self destructs will not leave a flag. Any unit caught in the blast wave of a self-destructing unit will receive blast wave damage equal to the amount of damage points remaining on the destructing unit and the maximum damage setting. Example: if maximum damage is set to 10 and the destructing unit has 3 damage points then the blast wave will do 7 points of damage to any unit directly next to the self destructing unit.

Example:

if damage is > 95 then self destruct

lay mines on - While this is on the unit will lay a mine every time it moves forward or backward one space. A mine requires 2 ammo to produce.

Example:

if scan found enemy then

lay mines on

end if

lay mines off - This stops the laying of mines when the unit moves one space forward or backward. A mine requires 2 ammo to produce.

if ammo is > # then [additional command]

if ammo is < # then [additional command]

if ammo is = # then [additional command]

If the Cybugs ammo is greater than, less than or equal to the number given then execute the command to the right of the word then.

Note the maximum amount of ammo a unit can carry is 99.

Example:

if ammo is > 10 then lay mines on

or

if ammo is < 10 then lay mines off

if no ammo then [additional command]

If the unit has no ammo remaining then execute the command to the right of the word then.

Example:

if no ammo then goto hideout

if missile ready then [additional command]

If the missile has enough fuel and ammo to launch then do the command to the right of the word then.

Example:

if missile ready then launch missile

Note: this doesn’t check the status of the shield be sure to lower shield before firing a missile.

if missile not ready then [additional command]

If the missile doesn't have enough fuel and ammo to launch then do the command to the right of the word then.

Example:

if missile not ready then fire weapon

if grenade ready then [additional command]

If the grenade has enough fuel and ammo to launch then do the command to the right of the word then.

Example:

if grenade ready then launch grenade

Note: this doesn’t check the status of the shield be sure to lower shield before firing a grenade.

if grenade not ready then [additional command]

If the grenade doesn't have enough fuel and ammo to launch then do the command to the right of the word then.

Example:

if grenade not ready then fire weapon

 

Advanced Commands:

#cur_ammo & #set_ammo: See system variables.

 

2.11 Protection

raise shield - Raises shield to protect unit from medium and long range enemy fire and minimizes short range weapon blasts. The shield only protects against projectiles the shield is defenseless against energy discharges, overloads and self destruct blast waves. The shield requires most of the units power therefore, you cannot fire weapon or attempt repairs with the shield raised. Using the shield causes your Cybugs power source to generate heat. Overuse of the shield can cause your Cybug to overheat. If your Cybug overheats your power source will force a shutdown in order to cool off. Your Cybug will be unable to function until it’s power source has cooled off and your shields will shut off until another raise shield command is executed.

Example:

lower shield

fire weapon

raise shield

lower shield - Lowers shield to allow weapon firing and to attempt repairs.

if shield is up then [additional command]

if shield is down then [additional command]

If the units shield is raises or lowered then execute the command to the right of the word then.

Example:

if shield is down then fire weapon

Advanced Command:

#shield: See system variables.

cloak on

This turns on the Cybugs cloaking device, enabling it to avoid nearest enemy scans using the enemy_x, y, d and h variables.

Note: This device consumes 10 fuel and two ammo per click to run.

Nearest enemy scans will return the nearest enemy that is not cloaked or will return a zero if the only enemy remaining is cloaked.

Example:

Cloak on

cloak off

This turns on the Cybugs cloaking device off. This will happen on its own if the Cybug runs out of enough fuel or ammo to sustain it or if the Cybug uses a weapon.

Example:

Cloak off

 

3.1 Nesting

if … then

end if

You may nest if statements by using the following syntax:

if scan found flag then

if damage is = 0 then

turn right

turn right

end if

end if

the command compiler sees these commands in this manner:

line 1:

if scan found flag then if damage is = 0 then turn right

line 2:

if scan found flag then if damage is = 0 then turn right

Warning: you must be careful not to check for two conditions at the same time for example:

if scan found flag then

scan forward

if scan found barrier then

turn right

end if

end if

the command compiler sees these commands in this manner:

line 1:

if scan found flag then scan forward

line 2:

if scan found flag then if scan found barrier then turn right

Notice that line 2 cannot work because scan cannot be both a flag and a barrier.

Keep in mind how the compiler sees nested commands so you do not fall into this trap.

 

3.2 User Variables

You have 41 user variables that you can use in your AI code:

v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, va, vb, vc, vd, ve, vf, vg, vh, vi, vj, vk, vl, vm ,vn ,vo ,vp, vq, vr, vs, vt, vu, vv, vw, vx ,vy and vz

team variables include:

h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, ha, hb, hc, hd, he, hf, hg, hh, hi, hj, hk, hl, hm ,hn ,ho ,hp, hq, hr, hs, ht, hu, hv, hw, hx ,hy and hz

Note: team variables are shared by all Cybugs with the same iff code.

you may assign these variables any value and or text you wish and use them throughout your AI code.

Note: remember that v0 and vo are not the same variable one uses the Number zero and the other uses the letter "o".

Variables have their names and their values:

if you want to reference its value you must place a tilde in front of it’s name example:

if the variable v2 had a value of 67 and you wanted to use its value in a command you would address v2 in the following manner:

assign v7 ~v2

This command passes the value of 67 to the variable v7.

These variables can also be manipulated using the following commands and system variables:

 

3.3 System Variables

System variables can be referenced but cannot be changed. They always begin with the "#" symbol.

The system variables are:

#cur_fuel Current fuel value

#max_fuel Battle Start fuel setting

#cur_ammo Current ammo value

#set_ammo Battle start ammo setting

#cur_score Current score

#random Last random number generated

#scan Last scanned item

0 = nothing

1 = barrier

2 = enemy

3 = mine

4 = friend

5 = flag

6 = tree (Armor commander only)

#shield shield status 1 = on, 0 = off.

#burn current fuel burn rate

Note: The burn rate will increase every time the unit sustains damage.

#x_pos current unit X coordinate

#y_pos current unit Y coordinate

#cur_life current damage value

#max_life maximum damage setting

#cur_head current heading

1=North

2=East

3=South

4=West

#enemy_x closest enemy x position

#enemy_y closest enemy y position

#enemy_h closest enemy heading

1=North

2=East

3=South

4=West

#enemy_d closest enemy damage value

#friend_x closest friend x position

#friend_y closest friend y position

#friend_h closest friend heading

1=North

2=East

3=South

4=West

#friend_d closest friend damage value

#strat_x x position of strategy node

#strat_y y position of strategy node

#alive Number of remaining Cybugs

#inbound Inbound enemy missile or grenade

0=no inbound object

1=From the North

2=From the East

3=From the South

4=From the West

#heatlevel Current Cybug heat level

#cloakstatus 0 = off 1 = cloaked

#overheatset Current overheat setting

#overheatoff 0= Overheat possible 1=off

#snodeoff 1=Strategy node off 0=on

#smartclickoff 1=1 command 1 click 0=10 logic commands or 3 scan commands In a single click

#bloodmodeon 1=bloodmode enabled 0=off

#lastcybugon 1=last cybug bonus on 0=off

 

Battle damage settings

#damset1 Mine

#damset2 Missile direct hit

#damset3 Missile fragment

#damset4 Primary weapon range 1

#damset5 Primary weapon range 2

#damset6 Primary weapon range 3

#damset7 Overload

#damset8 Energy discharge on enemy

#damset9 Energy discharge on self

#damset10 Missile direct hit with shield

#damset11 Missile fragment with shield

#damset12 Primary weapon range 1 shield

#damset13 Primary weapon range 2 shield

#damset14 Primary weapon range 3 shield

#damset15 Primary weapon range 4

#damset16 Primary weapon range 4 shield

#damset17 Primary weapon range 5

#damset18 Primary weapon range 5 shield

#damset19 Grenade direct hit with shield

#damset20 Grenade direct hit

#damset21 Grenade fragment with shield

#damset22 Grenade fragment

 

Note: #inbound will report an inbound missile or grenade even if its path to your Cybug is blocked.

Note: #strat_x and #strat_y will both return a value of zero if the strategy node is turned off in a tournament.

3.4 Advanced Commands

assign v# ~v#

assign v# [any value]

assign v# #(system_variable)

The assign command assigns a variable a specific value

examples:

assign v6 ~v1

or

assign v2 300

or

assign v0 #cur_fuel

You may also assign a variable a text value for use in your code for example:

assign vh turn right

if scan found enemy then ~vh

 

math v# = (value) (+, -, *, /) (value)

The math statement is used to do math calculations to a variable. It calculates from left to right.

"+" = add

"-" = subtract

"*" = multiply

"/" = divide

Example:

math v4 = ~v4 + ~v3

or

math v4 = ~v4 + #cur_ammo

or

math v6 = ~v6 / ~v3 + 7

Detailed example:

if the value of v6 is 10 and the value of #cur_ammo is 100 and the command read:

math v0 = #curr_ammo / ~v6 + 4

this would make v0 have a value of 14.

This is what the compiler would see:

v0 = (100 / 10) + 4

v0 = 14.

Looping Example:

gosub loopit

 

loopit:

assign v1 1

next:

move forward

math v1 = ~v1 + 1

if value ~v1 = 10 then return

goto next

 

cmath v# = (simple or complex formula)

The cmath statement is used to do complex math calculations to a variable. It calculates using advanced math rules. It calculates within parentheses and does calculations on division and multiplication first.

The cmath command can also use the higher math functions specified here.

Example:

cmath v4 = (~v4 + ~v3) * 3

or

cmath v4 = ~v4 + (#cur_ammo / 2)

or

cmath v6 = ((~v6 / ~v3)+(7 / 2)* 3)

 

3.5 High level if statements

if value (variable) (>, <, =, <>, >=, <=) (value or variable) then [additional command]

If the condition of the statement is true then do the command to the right of the word then.

Examples:

if value ~v6 > 100 then fire weapon

or

if value #set_ammo > ~v6 then

self destruct

end if

or

assign v3 #scan

if value ~v3 <> barrier then

raise shield

move forward

end if

 

Note: high level if statements must start with these two words:

"if value"

A common mistake in using high level if statements is made when the programmer forgets to use the value keyword! Many low level if statements do not use the value keyword and this causes some confusion.

The registered debug watch feature will catch this.

Examples:

Correct Use:

if value #set_ammo > ~v6 then

launch missile

end if

Incorrect Use:

if #set_ammo > ~v6 then

launch missile

end if

_____________________________________

4.1 Appendix: Battle Notes

  • If you take a flag with full power (no damage) your system will overload and you will take 50% damage.
  • If you are damaged and you take a flag all damage will be repaired and 30 ammo will be added along with 350 units of fuel.
  • If a Cybug hits a mine it will do a percentage of the maximum damage setting to the unit.
  • Fuel and energy are separate. Fuel is only needed for mobility and cooling for the onboard computer. Running out of fuel only means that your A.I. unit will not be able to move forward, backward or turn.
  • Strategy nodes will give the Cybug one point for every click that the Cybug occupies the square. If the Cybug can hold this position for most of the battle this can add up to thousands of points!
  • Map coordinates (top left corner = x:1, y:1, bottom right corner x:43, y:30)
  • In the past all commands took one click each, this put smarter Cybugs at a disadvantage, so now A.I. Wars calculates clicks in the following order: Movement and weapon command lines take up a single click, Scanning takes up about a third of a click and logic commands take up one tenth of a click per line with the exception of blank lines, labels, name, password and author commands which take up no part of a click at all. To make your Cybug more efficient you can stack commands when possible into a single command line, for example: (Note: this example would appear on a single line in the AI code.)

if facing north then if ammo is > 10 then if fuel is > 99 then fire missile

 

4.2 Appendix: Scanning

A long range scan scans forward from the bugs location until it sees an object up to the full length of the battlefield.

A gps scan scans any designated x and y coordinate given in the command.

Scan examples are shown in the ‘View Cybug’ option, found in the title screen.

 

4.3 Appendix: Weapons and Damage

Note: Damage values reflect default settings. These settings can be changed.

Primary Weapon (Projectile Gun)

Range 5 Spaces.

Maximum Damage to unshielded units within 1 space is 5

Maximum Damage to unshielded units within 2 spaces is 4

Maximum Damage to unshielded units within 3 spaces is 3

Maximum Damage to unshielded units within 4 spaces is 2

Maximum Damage to unshielded units within 5 spaces is 1

Maximum Damage to shielded units within 1 space is 2

Maximum Damage to shielded units within 2 spaces is 1

Ammo used when fired is 1

Shields must be down to fire

Missiles

Range Unlimited.

Maximum Damage to Unshielded units is 90%

Maximum Damage to shielded units is 60%

Splash damage to Unshielded units is 70%

Splash damage to shielded units is 40%

Ammo used when fired is 10

Shields must be down to fire

Grenades

Range Unlimited. Range set by fuse.

Maximum Damage to Unshielded units is 70%

Maximum Damage to shielded units is 40%

Splash damage to Unshielded units is 50%

Splash damage to shielded units is 20%

Ammo used when fired is 5

Shields must be down to launch

Land Mines

Range is limited to its occupying space.

Maximum damage to Unshielded units is 50%

Maximum damage to shielded units is 50%

Ammo used to produce is 2.

Energy Discharge

Range all spaces surrounding Cybug.

Damage caused to discharging Cybug is 1.

Maximum damage to Unshielded units is 2.

Maximum damage to shielded units is 2.

No Ammo is used to discharge energy.

Energy discharges also destroy Mines and Flags.

Self Destruct

Range all spaces surrounding Cybug.

Damaged caused to destructing bug as well as all surrounding Bugs is the difference between the destructing bugs current damage and the maximum battle damage setting.

Blast Damage to all surrounding A.I.Bots is the same number.

No ammo is used and no flag is left.

System Overload

System Overloads occur when a fully energized unit attempts to add more energy (taking a flag). This causes an overload and will do 50% damage.

Fuel Burn Rate

This is the rate at which a unit burns fuel. The burn rate increases every time a unit sustains damage and or fails at a repair attempt. The burn rate cannot be repaired or slowed during battle.

Damage, Points & Burn Rate Grid

WT = Weapon Type

PW1 = Primary Weapon Range 1

PW2 = Primary Weapon Range 2

PW3 = Primary Weapon Range 3

PW4 = Primary Weapon Range 4

PW5 = Primary Weapon Range 5

MSL = Missile

MSLS = Missile Splash Damage

GRE = Grenade

GRES = Grenade Splash Damage

MIN = Mine

EDC = Energy Discharge

SDT = Self Destruct

SOL = System Overload

AR = Ammo Required

DCE = Damage caused to enemy with Shields Up/Down

DCS = Damage Caused to Self with shields Up/Down

EBR = Enemy Burn Rate Increase with shields Up/Down

PTS = Points added to Score of firing unit for hitting enemy with shields Up/Down

WT

AR DCE DCS EBR PTS

PW1

1 2/5 0/0 2/5 40/100

PW2

1 1/4 0/0 1/4 20/80

PW3

1 0/3 0/0 0/3 0/60

PW4

1 0/2 0/0 0/2 0/40

PW5

1 0/1 0/0 0/1 0/20

MSL

10 60/90% 90%/0 6/9 300/500

MSLS

10 40/70% 40/70% 4/7 200/400

GRE

10 40/70% 70%/0 12/18 600/1K

GRES

10 20/50% 20/50% 2/4 100/200

MIN

2 50/50% 0/0 5/5 0/0

EDC

0 2/2 1/1 2/2 100/100

SDT

0 * * 10 100/100

SOL

0 0/0 50/50% 5/5 0/0

*Variable depending of remaining Energy Points

** Missiles and grenades will score a direct hit on the firing unit itself, if fired while shields are still up.

Note: You do not get points for harming yourself with a misfired or closely detonated missile.

Other Fuel Burn Factors:

  • All forward, backward and turning movements require fuel at a cost of one burn rate cycle. Cybug movements become more costly as it’s burn rate increases.
  • One Fuel unit is burned every 10 Clicks for the onboard computer cooling device.
  • Missiles use 300 fuel to load and fire.
  • Grenades use 200 fuel to load and launch.
  • Cloaking uses 10 fuel per click.

Other Scoring Factors:

  • 50 Points for every life point (number of remaining points between current Cybug damage and Maximum damage) remaining and -50 for every damage point over maximum damage. This can be turned off using the Blood Mode option.
  • Final score equals total score minus the current units burn rate.

Fortress of Flags
GameBoy Advance
Atari
Vectrex Adventure Stidio Retired Games One-Switch Home Arcade Articles

AI Wars 3D

(c) 1996-2025 John A. Reder