- Borderfield's CGF Mission Editor -
[c o m p u t e r. g e n e r a t e d. f o r c e s]
- Your first mission -
Step 1: Configuring the Mission Editor
Before we can use the Mission Editor we need to configure a few options.
Go to 'Options' and select 'AQ2 Settings'.
We need to tell the Mission Editor where the ActionQuake2 folder is. To do so, hit the 'browse' button and navigate to your AQ2 folder. There will be a file called 'gamex86.dll'. Select this file and click 'open'. You'll notice that the corect path is displayed in the options window.
In the same window you can also configure some other settings, like a bullethole limit, splatlimit, ... .
Click 'Ok' to return to the Mission Editor.
Step 2: Preparing your first mission
A mission is composed out of 5 basic parts: info about the mission, locations, areas, forces and mission outcomes. You'll notice that each of those parts appears in the project form (= the window on the left the screen).
The first thing we want to do is give in the info about the mission. Click the 'CGF' node (= the parent node). A new window appears where you can give in the mission's name, your name (= the author) and the missions description. This description will be shown at the start of the mission. If you wnat multiple lines to be shown, you have to divide them using the following characters: '\n' (no quotes).
For example: 'The Matrix\nAgent Smith is on your trail.\nKill him before he kills you.' will show up as:The Matrix
Agent Smith is on your trail.
Kill him before he kills you.Next, click the 'Map properties' tab and give in the maps filename (not including the .bsp extension). Give in 'urban' as map filename.
You can also specify the map's properties so the AI can make advantage of this knowledge. To do this check the properties that apply to this map (open, dark, indoor, ...).
The Editor also allows you to add a 'map annotation'. This map annotation is usually used to show an ascii-art description of the map's layout.
Step 3: Adding locations
The bots use locations to navigate through a map. Every map has it's own set of proper locations. For your convenience I've included a file containing all the locations for urban.bsp in the distribution of the Mission Editor.
Right-click the 'Locations' node in the project window and click 'Import from file'. Navigate to the folder where the Mission Editor is installed and open the 'UrbanLocations.mlc' file. You'll see that a bunch of locations nodes were added to the parent 'Locations' node.
If you ever want to add your own locations, just right-click the parent 'Locations' node and select 'Add new location'.
Step 4: Adding areas
The bots use areas as a reference while being on patrol. Just like locations, every map has it's own set of proper areas. In a similar way as we've imported locations, you can import areas. Right click the 'Areas' node and import 'UrbanAreas.mlc'.
Step 5: Adding forces, teams and actors
Now that the locations and areas are setup, we can start adding actual actors in the mission. A mission must contain at least one player and zero or more bots (actor = a human player or a bot).
Every actor is member of a team and each team is part of a 'force'. This means you can create one force with two teams. These two teams will act on their own but will know they're part of the same force and won't fight each other. Only actors from different forces can shoot each other.
Add a new force by right-clicking the 'Forces' node and selecting 'Add new force', and click the new node that has appeared. You'll see a new window popping up where you can give in the force's name. Name the force 'Good Guys'. Make another force and rename it to 'Bad guys'.
Now right-click the 'Good Guys' node and select 'Add team'. Just like the forces you've created you can rename the teams as well. Name this team 'The Player'. Add another team to the 'Good Guys' force and name it 'Support'.
Now we're going to add the player and some bots. Right-click the 'Player' node and select 'Add actor'. Click the new node so the window with the actor properties appears. Give in the name of the player. Since we want this actor to be the player we have to check the 'Actor is player' option (duh).
The skill slider you see isn't used for a player so don't worry about it right now.
Off course we don't want to send the player into the game without weapons or ammo, so click the 'Weapons' tab and check the weapons you want to start with. Afterwards click the 'Ammo' tab and fill in the amounts of ammo to start with.
Now that the player is added to the game, we're going to give him some bots to support him. Add an actor to the 'Support' team and name him whatever you want. Make sure that the 'Actor is player' option is not checked. You can define the skill of the bot by using the slider (a value from 1 to 5). Just like we armed the player you can arm a bot.
So for we've set up the player and his support team. Now we're going to add some enemies. To do that, create a new team in the 'Bad Guys' force and add a few bots to the team (just like you've added bots to the Support team).
Step 6: Telling the bots what to do
Now that we's populated the map with actors, it's time to give them instructions. You have to tell them where to start (insert position), and what to do (patrol, attack, defend, ...)
CGF AI is based on team commands. This means you must not give individual commands to every bot, but instead you only have to instruct the team they belong to.
Click 'The Player' team so the properties window appears. Click the 'plan' tab in this window. You'll see a nice bright white textbox where you can give in the team commands. Since these commands might be hard to learn, the Mission Editor offers you the possiblilty to create commands in just a few step.
The first thing you need to instruct to a team is their insert position (= the place where they'll start at the beginning of the mission). To do so, click the 'Create new command' button just beneath the textbox. A popup menu will appear showing you all the different kinds of instructions you can choose from. Select 'Insert'. A new form will appear. You can now select the insert position simply by choosing the one you want from the dropdown box in the new from. Once you've done that you have three possibilities:
Insert code in plan: this will insert the correct code, based on what you've selected. Make sure the cursor was at the beginning of a new line before you select this options.
Copy code to clipboard: this option will copy the correct code, based on your selection to the clipboard. When you return to the plan's textbox, you can simply paste it at the position of your choice
Preview code: this option will show a new window containing the correct code that you should use to instruct the team. You'll need to copy&paste it yourself however.Because the player's team doesn't need more instruction than the insert position, we're already done.
Instructing bot teams however isn't as simple.
Open the plan of the 'Support team'.
Just like you've done for the Player Team, you can add an insert command for the Support Team.
Inserting other commands like patrolling, attacking and sniping is done in a similar fashion like the insert command. Check http://www.botepidemic.com/aid/cgf for more info about the individual commands.
Step 7: Defining mission outcomes
With the bots knowing what they have to do during the mission, there's only one more thing left: defining the mission outcomes.
Right-click the 'Mission outcome' node and add either a 'success' or a 'failure' and click the new node to change it's properties.
Select the force to which the mission outcome applies. This is (almost) always the force where the human player belongs to.
Give in a message that will be displayed when the objective it met (use the same format as the introduction message, see step 2)
Now's the hardest part of the mission outcome definition: giving in the action that triggers the mission outcome.
This trigger can be either a time-out o the fact that a player, team or force has been killed.
Use the syntax specified in the bot documentation at http://www.botepidemic.com/aid/cgf.
Finally, you have to give in the filename of the next mission. You can give in several filenames so CGF chooses one of them at random. Type in a filename and click the 'Add' button to add the file to the next missions list.
Step 8: Running the mission
First of all save your mission (File - Save project). It will ask for several filenames. You only need to remember the project filename. When you load a mission project, the Editor will automatically load the other files.
Now click the yellow light bulb icon in the toolbar to run CGF with your mission.
The mission will be compiled and checked for errors. If there are no errors found, Quake2 will be loaded, otherwise you'll get a warning message telling you to check your mission.
Once your satisfied with your mission you can do a full build (Project - Build). This command will create the mission script, a config file and a batch file so you can easily run your programs. You'll need to distribute all three of the files if you want other people to play it.
CGF is written by William van der Sterren. CGF Mission Editor is written by Incubus