Assistive
Technology


Imagination

A.I. Wars Chinese


John Reder




  Home | Downloads | Gear | Tactical Neuronics   Updated JUNE 2023
FORTRESS OF FLAGS: A.I. SANDBOX


FoF AIS banner

(c) 2002-2007, John A. Reder, all rights reserved.


100% FREE full version Download
Click here to get the A.I. Sandbox version 2.0.0 FREE!(1.5MB)
and develop your own army A.I. in any computer language you wish and share it with others!


Player/Developer Forum
Talk about Fortress of Flags A.I. Sandbox here

What is it?

The A.I. Sandbox version of Fortress of Flags is designed to challenge people who love to write code. Many players of A.I. Wars have expressed their desire to have a game where you can write your own A.I. in any language you choose. This game is designed to allow such interaction.  This game should appeal to other non-programmer players who might enjoy this game through playing against the A.I.'s developed by those who choose to accept this challenge! Did I mention that it's FREE!

The unique quality about this version of Fortress of Flags (a strategy game similar to Stratego) is that it's designed to interface with an external 'Control Harnesses' executable written by anyone who accepts this challenge. The control harness can be written in any language or scripting tool you choose.

Don't have a scripting tool or code compiler? Get a Free one from Microsoft, they give away FREE Express Editions of VB, C#, J# and Web Developer (click here to download one of them)

Your control harness needs to be able to do three things:

1) Create a 'config.ini' file in the home directory of the Fortress of Flags 3D game engine (FoF3DGE) and launch the 'FoFAIS.exe' program so it can start the game.

2) Scan the FoF3DGE home directory for the existence of a file called 'AIDataInput.xml' and import it for use by your control harness.

3) Make decisions based on the 'AIDataInput.xml' contents and write a 'AICommand.xml' file to the FoF3DGE home directory with the correct instruction for the 'Red flag army' to execute (hence, taking your turn as the A.I. player). Then return to step 2 and wait for teh human player to make their move generating another 'AIDataInput.xml' file.

YOUR GOAL IS TO CREATE YOUR OWN CONTROL HARNESS WHICH WILL PLAY THE PART OF THE RED ARMY A.I. OPPONENT!

 

This version comes with a starter kit:


An example VB6 (Microsoft Visual Basic 6) Control Harness is included named 'ExampleControlHarness.exe' Its source files are:


ControlHarness.vbp
ControlHarness.vbw
ControlHarness.frx
ControlHarness.frm
 

It is well commented so feel free to reuse any code within it that you wish. This is just a simple program that allows you to simulate the A.I. moves by issuing manual moves using its map viewer interface and your mouse clicks (click on any red flag to have it shown in the left navigation cross and click on one of the cross squares to tell it to move in that direction), which generates the output AICommand.xml file matching the Red army flag move order you just issued. Since I already wrote the original A.I. player embedded in the regular single player version of Fortress of Flags, I decided to do a movement simulation tool designed for testing and learning purposes. It simply reads in the AIDataInput.xml and generates a visual map of the battlefield and allows you to move a red army flag, generating the properly formatted AICommand.xml file for the game engine to consume and translate to the red flag moving within the game. I didn't want to cloud your potential A.I. designs with pre-conceived notions derived from how I might write this type of logic. I'm interested in seeing how you might go about developing one without any general guidelines. I do plan create one in the future but (for now) I'm simply curious to see what ideas get expressed without any prompting from me.

You have my permission to create any type of control harness you wish, as long as no harm is done to any computer it's installed on, or interfaces with. Players who share control harnesses are advised to scan them for viruses and be weary of control harness executables that aren't written by a trusted source. It is recommended that control harnesses be shared with both the executable files and their source along with any installation requirements that it might have. Weary users should review the shared source and recompile it on their own systems to be safe. Developers are welcome to create harnesses that interface with web services if you wish to protect your A.I. logic routines from curious eyes, but the installed client interface should be distributed with its source if possible. You are welcome to share your work or example code using the Harness Library link on the left menu. Please archive your files into a single package (.zip) file before uploading

SCHOOLS AND TEACHERS ARE WELCOME TO USE THIS AS AN EDUCATIONAL TOOL! COMPETITION IS ENCOURAGED! PLEASE SHARE YOUR RESULTS AND CODE FOR OTHER PLAYERS TO LEARN FROM AND ENJOY!


Technical notes about the 'Control.ini' file:
This is a three line text file.

Line 1 is the location of the Map file.
Line 2 is the location of the .SAV file (saved game data you wish to start with or resume from a actual saved game) Otherwise this line should say 'None'.
Line 3 is a 1 or a 0. A '1' forces the FoF3DGE to launch in full screen mode. A '0' is windowed mode (640x480).

Example 'Control.ini' file contents:
-----------------------
Narrow Pass.map
None
0
-----------------------

Technical notes about the 'AIDataInput.xml' file:
This FoF3DGE generated file is created after every Blue army move or in cases of a Red army command resulting in error. The xml follows this format (see note D to see how you can create an example file):
-----------------------
<Root>
<LastMove Success='True'/>
<MapGrid>
<Map X='1' Y='1' Terrain='Stone' FlagID='0' Army='None' Rank='None' Revealed='False'/>
...
<Map X='80' Y='40' Terrain='Stone' FlagID='0' Army='None' Rank='None' Revealed='False'/>
</MapGrid>
</Root>
-----------------------

The 'LastMove' node will have Success=True if the game just started, or after a valid/successful Red army command is issued. The 'MapGrid' node contains a 'Map' node for every square on the 80x40 FoF3DGE battlefield (all 3200 squares). The first square is at location X=1, Y=1 which is the bottom right square on the Blue army end of the battlefield. The last entry at location X=80, Y=40 is the top left corner of the battlefield (as viewed from the Blue armies end looking in the direction of the red army. The 'FlagID' attribute contains the FoF3DGE key/address of that specific Flag object in memory. Use this when issuing commands to the game engine. The Terrain attribute will be one of four types 'Grass', 'Rock', 'Water' or 'Stone'. Stone squares cannot contain flags and are used to create battlefield boundaries and obstacles. Rock and Water allow some special Flags to use them and Grass allows all flags to move on it (see original Fortress of Flags game documentation for details). The 'Army' attribute is either 'Red' or 'Blue'. The 'Rank' attribute gives you the flag type for all Red army flags and only Blue army flags that have been revealed during play. The 'Revealed' attribute is most useful to help your A.I. determine if the human (Blue army) player is aware of your flags rank.


Technical notes about the 'AICommand.xml' file:
This is the file your Harness should be designed to issue. It is a SINGLE line XML file that must contain the same positioning as the example (the FoF3DGE is very limited in its xml parsing options):
-----------------------
<Root><Command FlagID='XXXX' Direction='X' SerpentJump='XX'/></Root>
-----------------------

The 4 character 'FlagID' attribute comes from the key provided by the 'AIDataInput.xml' 'Map' node. The single character Direction attribute should be one of the following 'N' for North, 'S' for South, 'E' for East or 'W' for West. The 2 character 'SerpentJump' attribute is relative to how many spaces you want your flag to move, if it is a 'Serpent', non Serpent flags will ignore this attribute. Non Serpent flags can simply use '00' or '01' but anything is accepted as long as it's two characters in length.


Other notes:
a) By default the 'Blue' flag army is controlled by the player using the FoF3DGE and the Control Harness controls the 'Red' flag army.

b) Both the FoF3DGE and the example control harness create their .XML files as .TMP files first (while writing to them) and rename them once they're completely written. This minimizes the potential of the two programs trying to use the same file at the same time, this could cause a file 'lock' condition which could result in a game crash or error.

c) The flag artwork has been separated from the FoF3DGE allowing developers to create custom flags using the provided artwork or create custom game pieces that arent flags giving the game a new unique look. We assume no responsibility for inappropriate content generated by FoF A.I. Sandbox developers. Please be careful to review the image contents provided by independent players/developers before using.

d) To generate a test copy of the 'AIDataInput.xml' file, launch the FoF3DGE and make a Blue flag move (click on its center pole mark) and use the one of the 'W','S','A','D' keys to move it. Terminate/Close the FoF3DGE game (Esc) and locate the 'AIDataInput.xml' file in its home directory.

e) If you are making a multiplayer harness remember that in order to get both players armies to match, you can use a saved game (.sav) file and put its name on line 2 of the 'control.ini' file before launching, you will need to reverse the save game battlefield data and flag Army (R's and B's) for player 2 and have his control harness generate the proper 'control.ini' to load the flipped file. The save .sav file format is as follows:

Note: see FlipSave.BAS file for VB6 example in the Harness Library (on left menu).
-----------------------
first line is the proper map file name xxxxxx.map
...
Remaining 80 lines of battlefield flag data starting from top left corner with 40 squares for each row.
000 = no flag
Bxx = Blue Flag
Rxx = Red Flag
xx = rank value of flag 01-12
...
-----------------------

You will need to write a routine to flip all of this square data over so the first square in row 1 column 1 becomes the last square in row 80 at column 40. You could also import custom Army location files generated by the original game or create a mode in your control harness to allow players to place their flags in a custom interface, then create a .sav file and proper 'control.ini' for each of the two game engines to load.

f) The first release of the FoF A.I. Sandbox is v2.0.0.

g) Please report all bugs and enhancement ideas using the 'Community' Tactical Neuronics player forum link on the left menu or E-mail them to John.Reder@TacticalNeuronics.com

Credits:

Concept, 3D engine and example control harness were programmed by: John A. Reder ...the rest is up to you! :)

 


Fortress of Flags
GameBoy Advance
Atari
Vectrex Adventure Stidio Retired Games One-Switch Home Arcade Articles
A.I. Wars
Featured 9/98



A.I. Wars
Awarded

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



AI Wars 3D


Advertise Here
(c) 1996-2021 John A. Reder