Battlefield Botinator 5 

A tutorial by: cajunwolf

Tutorials


Index

Background

We must thank Benji_$$$ (Ben Leman) for the Battlefield Botinator as he is the author of this program. Botinator is a great little program for adding basic ai to a Battlefield map. It will do a bf1942 map but was designed for Battlefield Vietnam. Ben later modified it to work with bf1942 after I had version 3 or 4 doing it by had modifying the output files. Ben wrote Botinator back in the days when adding ai to a map was done by very few of us using the tutorials and help of Arc D Wrath. Along comes the debugger tool and the ability to create pathmaps with the game engine. Now days there is a program out called BFSPC or "Battlefield Singleplayer Creator" by HellishER that does the best job on bf1942 and mods maps. Actually his program sets up the networking better. But Botinator sets up a basic BFV map for bots better still because of the way it sets up the StrategicAreas and basic strategies. In the end its your choice as to which works better for you. I have used both to set up BFV maps and combined the output files on many occasions.

Back to Index

What Botinator Does

Now this tool will give your map Basic AI support. What I mean is that it will have the bots moving on the map with both sides using a basic Attack strategy. This is of course dependant on how good your pathmaps come out of the debugger. They might have to have some basic edits to get them to even work as this is a map to map thing. You will be able to play the map in COOP or Single Player mode. You have to understand here that AI is a map specific thing and you will have to learn how to edit and write strategies, edit the StrategicAreas.con file, and hand edit your pathmaps to get bots to use the right strategies at the right time to play your maps well. I suggest you read the tutorials by "Arc D Wrath" along with the EA/DICE official AI Documents.  Both of these are a must read to be able to understand and edit the Battlefield AI. I have a tutorial, Pathmapping with ED42 which will get you hand editing your debugger created pathmaps. This tutorial shows you my new technique for working with pathmaps in ED42. Not familiar with ED42? I have a tutorial, Setting up and using the Editor42 Battlefield editor Part One that will get you going. Once you get bots fighting on a map this will  not seem so daunting and you will begin to understand AI a little more.

Back to Index

What the Tutorial Covers

This tutorial covers the use of the Battlefield Botinator version 5, a tool for adding quick  SinglePlayer and COOP support for Battlefield Vietnam maps. It will do bf1942 maps and its mods with edits. What I am going to show you is how to use this tool to add AI and prepare your map to create pathmaps in the debugger.  This tool is\was a work in progress beta by Benji_$$$ and you use it at your own risk. The Author nor myself takes any responsibility what so ever in any way for anything that might happen.

What I am going to show you is how to get the proper ai files into your map using the Botinator. Once that is done I will explain  how to finish setting up the map in order for the debugger to make you a set of pathmaps. Later you can learn to edit the pathmaps in Editor 42 by reading my tutorial Pathmapping with ED42. Depending on the map and how it pathmaps you might have some success right off the bat. Either way you will have to hand edit your pathmaps to get the bots to use the map right.

Let me say something about the map you plan to use. I know everybody has a map they have spent hours, weeks, or in some cases months on and cannot wait to be able to play it with bots. AI is a very map specific thing. I have more people complaining they cannot get it to work or the game is crashing to the desktop because they are trying to use it on a map that will need serious edits before AI will ever work if at all. I strongly suggest that you use a very simple map or make a "Test_Map" to learn this on. Make a small map and put some hills and valleys. Add three or four control points with buildings, solider spawns, jeeps, and tanks, no boats at this time that is a whole new ball game. You can use helicopters and planes because they do not use pathmaps. Remember to have all spawns out in the open. Let me say that again, have all spawns out in the open not in buildings or bunkers. don't try to make it pretty, just simple. You will learn why later. One you have AI in this simple map and working right, you will better understand what you will need to do with the map you want AI in.

Back to Index

Skill Level

 

Back to Index

Tools

Back to Index

Setting up the Map

Botinator requires your map be extracted in order to work with it. I suggest, if you haven't already, to make a working folder for the map you are working with. I also strongly suggest you place a backup of the original map in this folder. As you work on the ai for this map, you will be adding more to this "working folder", but that's another tutorial. Now I am going to suggest the following. You can take my advice and go ahead or not, your choice.  In most cases, that is say 90% of the time it works no problem but sometimes things go bad for some reason or the other if you do not rem out the object spawns. If you do not do this the BFV pathing engine for some strange reason looks at them as a static and paths them so. Another problem is there could be a vehicle\weapon conflict that causes a CTD. First pathmapping does not take into consideration the object spawns. They are dynamic and the bots since them as so. Pathmapping concerns only the static objects and terrain. Once the map is extracted to a working folder and backed up we are ready to begin.

Back to Index

Getting Started

Ok start the Botinator and you will get this screen. Don't worry about the Advanced Tweaker as it was never finished and doesn't work. We have ED42 and FourCentsShy's tool that we use to edit with.

 

 

On this next screen just click the "Next" button.

 

 

Now this often confuses people. Here we want to Browse to the working folder where we have our extracted map. Now read carefully here. You want to click on the base path folder which is "BfVietnam" (or bf1942 if your doing a Battlefield 1942 map) and open it to the "Levels" folder, open it and click on the map name folder which in this case is called "Dumb_Test" (don't ask) just like I show in the next image and click OK.

 

 

Notice where I have my mouse pointer.

 

 

The next screen looks like this. Make sure you have the path right and click ok.

 

 

Now it will ask you some questions. The answer to this one is of course no. Unless the base belongs to us just select natural. It doesn't matter because we are going to have to edit this all in the StrategicAreas.con file once finished with this part.

 

Here it copies all the necessary files into your map. This will finish and take you to the next screen.

 

 

Here the choices are fairly obvious, Tanks are Tanks, Jeeps are Cars and so on. Use Heli for choppers, jets, and planes. Other for anything that does not fit the above categories. It doesn't matter because we will be editing the AIpathFinding.con file once finished. This is optional stuff anyhow. If you make a mistake don't worry keep clicking.

 

 

This next screen is the end of the Botinator's job. Just close the window (Cancel or click the "X" in the top right to x out of program).

 

 

 

This step confuses a lot of people. Basically the Botinator has done its job at this point for a Battlefield Vietnam map.  All it needs to do is remove the scripts\lines of code that evokes the Battlefield debugger to generate the pathmaps when you load into COOP and shows the stats on screen in game. If you want it to remove this and the stats LEAVE IT RUNNING until you have run in COOP to generate your pathmaps. Then click the next button and it will remove the lines that call the debugger and show the stats.  I prefer to do this myself and there is a feature in the Advance Tweaker that will add remove the stats. I quit the program at this point by clicking the "X" in the top right corner. Either way you do it is your choice, if this is your first time with AI,  I suggest you leave the Botinator running through the next step. Just minimize it 

  IF you are doing a Battlefield 1942 map there are additional editing steps yet to do.  Benji_$$$ has some upgrades yet to do for full bf 1942 support. This tool was designed originally for BfVietnam maps and just recently has bf 1942 support. This will be fixed in the up coming version. Skip this next step until you have complete the edits farther on down.

Ok if we are doing a BfVietnam map lets fire up WinRFA and pack our map back into the game levels directory and start the map in COOP mode. It will take longer to load as the debugger is generating your pathmaps. Once the maps loads you will see the stats all over the screen and bots spawning in with you. They will either just stand around or take off moving in all directions sometimes running into things. The reason is the Botinator puts a set of all black pathmaps into the maps new Pathfinding folder so the debugger will generate all the pathmaps at one time. The Bots should move but if they do not don't worry about it yet. Lets get your new pathmaps in your map first. Quit the game and extract your map back to the working folder. Now open it up to the "Pathfinding" folder and open it. Leave this window open and in another explorer window navigate to the games root directory like so.

If it is a Battlefield Vietnam map go here.

"C:\Program Files\EA GAMES\Battlefield Vietnam"

You will find a new folder called "BfVietnam" in here will be your new pathmaps.

If it is a Battlefield 1942 map go here.

"C:\Program Files\EA GAMES\Battlefield 1942"

You will find a new folder called "bf1942" in here will be your new pathmaps.

You can view the"Level0Map8bit.raw" pathmaps in Photoshop or any other image editor that supports this format. The other pathmaps are stored in EA/Dice's special format and cannot be opened without being converted with special tools ... go figure. Here is what the "Infantry1Level0Map8Bit.raw" looks like. This one is from my bf1942 test map.

 

Are you starting to see here how the bots find there way around? They cannot go where there is white. You will see where the debugging engine has pathed the bridge and other objects. Also note its pathed out where the out of bounds area material is placed.

Now the "Level0Map8bit.raw" maps are not used by the game and can be removed to save map size but save them somewhere as the Botinator uses them in the Advanced Tweaker section for the pathmap editor. You can save them in a backup folder somewhere if you are concerned about map size.

Which ever  map version you are doing copy all the new pathmaps into the maps "Pathfinding" folder over writing all the all black pathmaps that are in there. Let me say that again, Copy All the New Pathmaps into Your Maps "Pathfinding" folder. Remember the one we left open? 

Now if you left the Botinator running from the above step click next now and Botinator will remove the lines of code that run the debugger and stats. If you quit the program and want to run the stats so you can see what is going on I will explain how to do this farther down. You for sure need to disable the debugger mode or it will generate pathmaps every time you load into COOP. Now pack your map up and load into coop. The bots should take off and attack, kill, and take bases. You should now be able to load into Single Player mode also. If this does not happen you have done something wrong along the way. Retrace your steps and see. It works if you have everything set up right.

Now the additional steps for battlefield 1942 maps. The only difference and hence our edit is the call in the "AIpathFinding.con" file for the second layer maps and the difference between the boats / landing craft searchmap calls. Open it up in notepad and you will see this. The items in RED are the calls for second layer maps and bf 1942 does not use these but BfVietnam does so we have to remove them. Remove ALL the lines in red and be careful because if you mess up you will be saying hello to Mr. desktop.  I highlighted the area in neon green so you can see what each number means in the searchMap call.

 

if v_arg1 == host
rem *** pathfinding debug mode
rem game.aiPathfindingDebuggingActive 1

rem *** Set number of maps ***
rem ai.setNSearchMaps 2 *** DEPRICATED ***
rem ai.setNSearchTypes 2 *** DEPRICATED ***

rem *** Set number of AStar resources ***
rem ai.numAStarResources 12
rem *** Setup map parameters ***
rem *** Tank ***
rem ***
searchMap name/ waterHeight/ waterDepth/maxSlope/brush/lowClipLevel/hiClipLevel/ 
rem
considerAITypes/createSecondLayerMap/ firstLevel-secondlevel-thirdlevel (for second layer map)
rem ***
searchType name/mapNum/minSearchLevel
rem *** Tank ***
ai.addSearchMap Tank0 0 0 30 3.0 0.3 2.5 0
0 1.0/3.0/7.0 
ai.addSearchType Tank 0 0
ai.setMapSpawnPoints 0 605/274 , 590/270 , 374/389 , 414/612 , 600/834 , 582/828
ai.setSmoothing 0 20
rem *** Infantry ***
ai.addSearchMap Infantry1 0 1.5 40 1.0 0.4 2.0 1
0 1.0/3.0/7.0 
ai.addSearchType Infantry 1 0
ai.setMapSpawnPoints 1 610/256 , 605/822 , 380/407 , 500/560 , 521/463 , 430/619 , 581/270 , 577/834
ai.setSmoothing 1 10
rem *** Boat ***
ai.addSearchMap Boat2 1
1.4 30 4.0 0.3 2.5 0 0 0/0/0 
ai.addSearchType Boat 2 2
ai.setMapSpawnPoints 2 
ai.setSmoothing 2 20
rem *** Landingcraft ***
ai.addSearchMap LandingCraft3 1
1.4 30 4.0 0.3 2.5 0 0 0/0/0 
ai.addSearchType LandingCraft 3 2
ai.setMapSpawnPoints 3 
ai.setSmoothing 3 20
rem *** Car ***
ai.addSearchMap Car4 0 0 35 3.0 0.3 2.5 0
0 1.0/3.0/7.0 
ai.addSearchType Car 4 0
ai.setMapSpawnPoints 4 606/267 , 606/262 , 381/413 , 435/622 , 426/622 , 598/819 , 586/819 , 395/384
ai.setSmoothing 4 6
rem *** Load maps ***
ai.loadMaps
run StaticObjects.con
ai.createAllMaps
endif

Now the areas in Blue may need to be edited as they are different for battlefield 1942 and the Botinator still uses the BFV settings. You need to look at some of the stock bf maps and make changes and additions to suite the particular situation of your map for  "Boat2" and "LandingCraft3" searchmaps only. The settings below will generate pathmaps in most cases.

rem *** Boat ***
ai.addSearchMap Boat2 1
1.4 30 4.0 0.3 2.5 0 2 5 
ai.addSearchType Boat 2 2
ai.setMapSpawnPoints 2 
ai.setSmoothing 2 20
rem *** Landingcraft ***
ai.addSearchMap LandingCraft3 1
  1.4 30 4.0 0.3 2.5 0 2 5 
ai.addSearchType LandingCraft 3 2
ai.setMapSpawnPoints 3 
ai.setSmoothing 3 20

The 2 5 added to the end is 2 space 5 by the way and not 25. This means create and use level 2 through level 5 pathmaps for Boats and LandingCraft. Battlefield Vietnam uses level 0 through level 3 pathmaps for boats. The other three items are water depth, max slope, and hull width or brush size.

Now pack it up and run in COOP mode like above to generate your pathmaps then copy them over into your map. This should run like the BfVietnam map above. 

Now to edit this file and the "AI.con" file for the debugger and stats calls.

On the bottom of the "AIpathFinding.con" file above we need to do this.

 

rem *** Load maps ***
ai.loadMaps
rem run StaticObjects.con
rem ai.createAllMaps
endif

See the rem's in red? These two calls are what tell the debugger to create pathmaps. You want to delete or rem these out or every time you load into COOP it will generate pathmaps. We already have ours so lets turn this feature off.

Now open the "AI.con" file in notepad and you will see the following.

 

rem ************** LEVEL SPECIFIC AI SETTINGS ***************************

aiSettings.setWorldMapSize 1024 1024
aiSettings.setViewDistance 305
aiSettings.setInformationGridDimension 32

rem ********************** START THE AI *********************************

rem *** Init AI using current settings ****
ai.init 2

rem *** init Botmanager ***
AIBotManager.setLodLevelTicks 6 6 6
AIBotManager.setLodLevelPriority 6 4 2
AIBotManager.setPlannedDecisionMakingThreshold 0.5 1.0 3.0
AIBotManager.setUnplannedDecisionMakingThreshold 0.3 0.8 2.0
AIBotManager.setDecisionMakingInterleave 2 2
AIBotManager.setSensingQuotient 2 1
AIBotManager.setSystemQuotient 30 40 30

rem *** Strategic map dimension, MUST BE DONE BEFORE CREATING SAI! ***
ai.saiMapXDimension 64
ai.saiMapYDimension 64

rem *** Create Strategic AI ***
ai.createSAI

rem *** Enabled or disabled as default ***
ai.saiEnable 1
game.showAIstats
1
ai.showBotStats
1

rem *** Bot statistic ***
ai.botStatisticUpdateSpeed 3


run AIPathFinding.con

rem *** Create strategically important areas ***
run ai/StrategicAreas

rem *** Load and set strategies for each side ***

run ai/conditions
run ai/prerequisites
run ai/Strategies

ai.addSAIStrategy 1 TeamAAttack
ai.addSAIStrategy 1 TeamADefend
ai.addSAIStrategy 1 TeamARepulse
ai.addSAIStrategy 2 TeamBAttack
ai.addSAIStrategy 2 TeamBDefend
ai.addSAIStrategy 2 TeamBRepulse

 

You see the numbers in RED? These are the switches that turn on or off the AI and BOT stats. 1= stats on and 0=stats off. If you want to leave the AI stats on so you can see your StrategicAreas, strategies being played by each team, and much more useful information then leave this line like so.

game.showAIstats 1

You will want to turn off the bot stats unless you need to know what each bot is doing and where he is headed which is rare. Set this line like so.

ai.showBotStats 0

You can also add or remove stats in the Botinator's Advanced Tweaker.

Now your all set to add AI to Battlefield Vietnam and Battlefield 1942 maps. If you want to do a mod of bf 1942 or BfVietnam you will have to do some editing in the AIpathFinding.con file. The problem with doing a mod is the lack of AiMeshes. These are mesh files stored in the Battlefield 1942\BfVietnam game archive. The debugger uses them in pathing the static objects for the infantry searchmaps. They are the most detailed maps and are the only ones the AiMeshes are used for. You will need to disable them and increase the brush size in the infantry searchmaps only. Like so.

 

rem *** Infantry ***
ai.addSearchMap Infantry1 0 1.5 40
2.0 0.4 2.0 0  
ai.addSearchType Infantry 1 0
ai.setMapSpawnPoints 1 610/256 , 605/822 , 380/407 , 500/560 , 521/463 , 430/619 , 581/270 , 577/834
ai.setSmoothing 1 10

 

After the "40" which is the max slope a bot can climb, you see we have increased the brush size to 2.0 from 1.0 and on the end we changed the 1 to a 0 to turn off the AiMeshes. If you do not do this you will probably get a freeze, or see Mr. Desktop. If it does generate pathmaps the Infantry maps will be streaked and no good.

This should get you going for most Mods. If you have GMAX or 3DsMax you can make the AiMeshes for custom objects in your mod maps.

Custom objects can cause problems. You  can disable them to generate pathmaps by re-naming the "objects.con" file in the objects folder in your maps root to "objects.bak".

If you are on the metric system you will need to set your computer to the US number system to run the Botinator or you will get some really wild coordinates in your searchmaps calls which usually brings you to yes you guessed it, Mr. Desktop. Just switch it back once you finish running the program. This should be fixed in the next version.

One last thing to look for. Somehow during the process a line gets written  to the conquest template you want to rem or remove. Look at the conquest in the maps root directory and in the Games Type folder and rem or remove this line if found.

run ai

If not you will not be able to play the map in conquest mode and it will CTD.

This completes the tutorial and I think I have covered all the bases. If you have trouble with the Botinator or just want to learn more about AI editing  I and many others can help you at the following forums. Address ALL questions or comments in the AI editing forums  of these sites please.

Battlefield Single Player

and

Legion of The Dragon

If you have comments or suggestion on this tutorial email here

Comments and Suggestions

Note, DO NOT email questions about the Botinator here, use the forums if you want an answer.

Back to Top