Post tutorial Report RSS Adding New Bots in Quake 3: Arena

In this tutorial, you will learn how to turn a custom model into a bot. I'll be using the excellent Harley Quinn model to demonstrate the procedure, but the same principle can be applied to any custom player model.

Posted by on - Intermediate Server Side Coding

Tutorial written by Eutectic. Mirrored here for archival purposes. Note his example file/textures have been lost to time, however all of the images for this tutorial were preserved.


Adding New Bots in Quake 3: Arena

by Eutectic

If you're like me, you'll probably download every new player model for Quake 3 as soon as they come out. But have you ever wondered "how do I make those models actually become bots I can play against?" If that's the case, just read along.

In this tutorial, you will learn how to turn a custom model into a bot. I'll be using the excellent Harley Quinn model to demonstrate the procedure, but the same principle can be applied to any custom player model.

For this lesson, you'll need the Harley Quinn player model .pk3 file to be present in the /baseq3 folder. You can download it from here if you don't already have it.

Three things are required to make the bots work in the game:

  • The individual bot's AI files, which are named:
    • botname_c.c
    • botname_i.c
    • botname_t.c
    • botname_w.c
  • The bot's list file: bots.txt (by default)
  • Making the game use that bots list file

Making the AI files

For every bot in the game (angel, biker, etc), there are 4 bot AI files. They are all named the same as mentioned above, except botname is replaced with the actual name of each individual bot.

Instead of making new bot AI files from scratch---which would be complicated and beyond the scope of this lesson---we'll use the existing AI bot files as templates, rename them, and modify them to suit our purposes.

The first thing to do is to extract the necessary bot AI files from the game's pak0.pk3 file with WinZip:

addbots 01

Figure 1 - Extract Slash's 4 bot AI files from pak0.pk3.


Next, create a \botfiles\bots folder structure under the baseq3 folder and move the bot AI files you just extracted from the pak to that folder:

Moving the AI files to the botfiles\\\\\\\\\\\\\\\\bots folder

Figure 2 - Move the extracted bot AI files to the baseq3\botfiles\bots folder.


I could have extracted the AI files of any bot in the game to use as a template, but I chose Slash because of her characteristics: she's female like Harley and has about the level of skill I want Harley to have. This will save us some work when we modify the AI files later.


Rename the slash portion of the AI file names to harley:

Renaming the AI files to harley_*

Figure 3 - Rename the extracted bot AI files to make them Harley's AI files.


Open all the AI files in a good text editor with a search-and-replace function. Wordpad is a decent choice, although you'll have to work on each of the files individually. If you have one of the better text editors like UltraEdit32, or, if you installed Editpad during the Q3Radiant install (as recommended in the readme file), this will make things easier. Notepad is not a good choice because it lacks a search-and-replace function, is limited on filesizes, and is generally not suitable for serious editing. For this tutorial, I'll be using Editpad.

Launch Editpad and open all 4 AI files. Open the Find dialog by clicking on the Find toolbar button: addbots 05

  1. Type slash in the Text to find field and harley in the Replace with field.
  2. Make sure you set the All open documents radio button
  3. Click on the Replace All button.

Replacing slash with harley in the AI files

Figure 4 - Replace every instance of the word "slash" to "harley" in the 4 AI files.


Now save all your files by clicking the Save all toolbar button: addbots 06


Making the bots list file

In Quake 3 Arena, the bots list file determines what bots are in the game, what model each bot uses, the bot's name, and the AI files used by them. In a normal game, Q3A will use the file bots.txt by default but you can change that. (More on this later.) For now, we'll simply create a custom bots list file so we can include our new Harley bot in it. Don't worry, this part is very simple.

Open the pak0.pk3 file with WinZip and extract the file, bots.txt (located in the scripts folder). Rename the file to a name of your choice. In this example, I renamed it to mybots.txt. Move the file to your baseq3\scripts folder. Open it in EditPad and add the new bot entry (highlighted in black):

Adding Harley to the bot list file

Figure 5 - Add the Harley bot entry in the bots list file.


Here I inserted the Harley bot entry at the top of the file but you can insert it anywhere you want. The game will automatically sort them by alphabetical order in the Add Bots menu.


Save your file and exit EditPad. Your bots list file is ready.


Making the Game Use Your Bot's List File

At this point, if you launch the game and try to select the Harley bot from the Add Bot menu, you will see that it's not in the selection menu. Why? Because Q3A uses the file bots.txt by default to include all the bots in the game. This parameter is set by the g_botsFile cvar.

You'll probably conclude (like I did): "Hey! I'll just set the g_botsFile cvar from the console and restart the game". Uh-uh! No way, Jose. Can't do that. The g_botsFile cvar is a read-only cvar. Does this mean we can't change defaults? Actually, it means that you can't change it once the game is launched. Therefore, you have to set it with the command line option:

quake3.exe +set g_botsfile scripts/mybots.txt


If you want to make this easy, make a copy of your Quake 3 desktop shortcut, right-click the new icon, go to Properties, and include the command line option in the Target entry field. This is recommended over DOS-based script files, since it maintains the game's stability under the Windows environment.

You are now ready to try your new bot. Launch Quake 3 Arena with your new desktop shortcut. Select Single Player and click on the Skirmish button. Select the map you want and click on the Next button. Select one of the bot names in the list that appears and you can now select Harley from the Select Bot menu:

Harley is now in the bot menu

Figure 6 - Harley is now available in the Select Bot menu.


Of course, this tutorial is only about the basic things to do to add a new bot to the game. If you're up to it, you can open your bot AI files and tweak the bot's characteristics like accuracy, favorite weapon, chat message responses, etc. to give it a distinct behavior and personality.

Post comment Comments
Guest
Guest - - 689,614 comments

Why game doesn't show my bots if .pk3 file is named in some way? I created a file named A-bots but bots can't be added but if I change name in z-bots game lets me add them? Why??

Reply Good karma Bad karma0 votes
LithTechGuru Author
LithTechGuru - - 405 comments

This is an issue with Quake 3 based engines where if you're replacing something it's advisable to prefix the pk3 file with "z". The reason why is because it loads the z prefixed PK3 file last.

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: