5.2 Mission File Structure

This section will explain all the files that are created when you save a map, as well as describe which text files you will need to create to begin scripting.

When you save out a map, it creates the following files:

game.cfg -- Contains any data that isn't object related (Teams, weather, light time, team relations…)
objects.cfg -- Contains data about all objects in the environment (including regions, curves, paths, tags etc.)
terrain.blk -- Terrain geometry and texture information
terrain.bmp -- .BMP file that will be the minimap
(Note that you can edit game.cfg and objects.cfg manually in a text editor, as it's sometimes faster than loading up the editor to change a parameter. If you're not comfortable with editing these files manually there is no need to do so other than convenience.)

Next come the text files you need to create to get ready to script. There are two files that every mission looks for when it is loaded to see if there is a script to run. These two files provide "pointer" information for the mission. That is, they point to all the other configuration and script files the mission will be reading from. They are:

strategic.cfg -- The pointer file for AI configs (standard attack scripts/recruit types, base building/orders…)
types_mission.cfg -- The pointer file for all other scripts (enemy and player objectives, cineractives…)

Create two text files ("strategic.cfg" and "types_mission.cfg") and place them in your mission folder. Now, exactly what these files point to will depend on the mission and what you are trying to do, but there's a couple basic things you'll almost always want to include.

Open strategic.cfg in your text editor. Add the line:


#include "strategic_scripts.cfg"

and save. Now, this is telling the game to include a config file called "strategic_scripts.cfg". This particular config file contains a long set of standard AI controls, or the "mini-scripts" that we used while creating the game to perform often repeated tasks easily. The file strategic_scripts.cfg is present elsewhere in the build and does not need to be in your mission folder.
See the Section 4.8 AI for more info on strategic_scripts.cfg.

Now open types_mission.cfg. Add the line:


# include "types_objects_special.cfg"



and save. Types_objects_special.cfg is a list of objects that are often used. It also is present elsewhere in the build and doesn't need to be in the mission folder.

These two files are the start of the process. You will be adding more #include lines to them as you go through the process of scripting your mission.

Next, we'll create the text files that will hold your actual script. From here on out, you can name your text files whatever you want, but here is the way we generally did it in DR2. The following is assuming there will be two teams, a player and an AI. Create three text files in your mission folder, name them "objective_start.cfg" "objective_ai.cfg" "objective_player.cfg"

objective_start.cfg -- Loads initial scripts for player and AI. Will also be the "link" script that is specified in the Studio.

objective_player.cfg -- Contains all script for the player's team

objective_ai.cfg -- Contains all script for the AI team

Now, we've added these files to the folder, but the game won't know they are there unless we include it in the pointer file, types_mission.cfg

Open types_mission.cfg. Add the lines:


# include "objective_start.cfg"
# include "objective_ai.cfg"
# include "objective_player.cfg"


and save. The game will now know to look inside these files for scripts.