Dev blog #20101.09.2018
Hello everybody,
Today's Dev Blog is dedicated to the development made in our community. -DED- online squadron worked on implementing the online campaign functionality as an addition to our multiplayer mode for some time now. You can already play the working campaign on their server. Having accumulated a ton of experience on this matter, -DED- team decided to share it with other community members - perhaps this would be a good incentive for other multiplayer enthusiasts. So here is their guide:
How to make an online campaign The biggest challenge in fan-made online war-like projects comes from the lack of volunteer and qualified human-hours to create a required software. Thankfully, the possibilities included in IL-2 Sturmovik help remedy this - and we’ll tell you about exactly that. This will be a general overview since we’d like to explain you the general direction of where you should look.
To create an online campaign, you’ll need the following tools:
1.
Mission editor (available to everyone; chances are you’ll also need rcon and resaver utilities found in the bin folder of the game as well).
2.
Mission templates editor (it can be obtained from the developers if you’re serious about hosting an online war server and are willing to sign the NDA).
3.
Mission generator (obtainable by NDA, see above).
4.
Commander utility (this piece of software should link your missions together, this is what you need to code yourselves because there is no ‘out of the box’ solution).
5.
Statistics website (you can use the one made by Vaal or create yours).
Leaving commander utility and statistics completely to you and assuming you have experience with the mission editor (this is required) we can tell you about
template editor and
mission generator - how they work in general and how we use them to run our ‘Random expert’ server.
As you can tell from the names of these utilities, template editor (let’s call it
t-editor to differentiate it from mission editor we’ll call just editor) and mission generator (just
generator from now on) can create the missions automatically, saving you from untold hours of manual work and allowing for good variability of the online missions. It’s important to note that by variability we don’t mean ‘generating a new mission using the results of previous ones’ (this should be handled by you commander utility), but randomness using the variants included in the mission template.
To make it clear, ‘random’ in this guide means a random variant chosen from pre-made variants you have created. You can define the random limits yourself and we’ll show you how.
Let’s look at this simple chart:
Therefore, to create a mission the generator needs to have:
1.
Location database that defines the possible placement of the mission objects (it is created in the editor).
2.
Groups - these are the ‘bricks’ the mission is made of - created in editor as well (a group can contain a single unit or many ones and their links).
3.
Mission template - here you define the rules how the ‘bricks’ can be arranged and link them (it is done in t-editor).
4. Several files (
cfg, ini, dat) that define the mission building parameters (described in detail in File structure).
We don’t include here ‘on-the-fly’ changes in the database, groups or template that your commander utility will be making (you’ll need them to create an online campaign, be sure of this). However, these components are just plain text files so you our your programmer(s) won’t have trouble working with them.
It should be noted that:
l While creating a database you need to understand what will be placed in the locations you are adding, how these objects should look and how the mission will play (an airfield shouldn’t be placed in the river, a decoration shouldn’t block a road, etc.). It may be worth it to think about the groups placement rules in the template in advance to make it easier for yourself and simplify the template;
l While creating groups you need to think how they will be linked and how the mission will function as a whole (MCU logic in the mission editor, a desirable scenario);
l Finally, while creating the rules in the template, you need to keep the mission and locations database in mind so you won’t make a mistake in the random limits (to avoid things like red airfield in blue territory unless you specially want to do something like this).
To summarize, everything is interlinked.
*****
Now let’s take a closer look at the mission components.
Locations database Its elements are located in the
mission objects library in the editor. This database defines the possible locations on the map for placing groups or objects, their types and orientation (only for static placement, dynamic is provided by the template).
In the editor menu called location database you can export the database to a text file that can be converted into a format the generator can open using the special utility (under NDA), import a previously saved database into the map and combine separate databases into one. You can also filter out different object types to make your work and search easier.
Location database preparation is a boring work, but if you have planned the gameplay of your campaign in advance well, you won’t have to return to this step in the future.
Groups Since we assume you are familiar with the editor, let’s concentrate on the differences between groups in regular, manually created missions and groups intended for generator missions. These differences include the use of helper objects and operation peculiarities (while working with decorations).
Helpers are special class of editor objects.
1.
Reference point defines the group placement in a mission, its position is the same as the center of the location assigned to the group while the location, rotation and altitude are specified in the mission template. Reference point is required for any group.
2.
Output, Input - these are like ‘male’ and ‘female’ connectors that allow to connect groups in the mission template using target and object links, events and reports. After processing in generator, this results in the final mission logic. The names of these helpers are important to avoid confusion while working in t-editor. In addition, the names of the object link connectors should begin with OBJECT, but this is more related to t-editor usage.
3.
Dynamic - this helper specifies the object properties (an entity or MCU) in a group that can change dynamically from one mission to another by rules defined in the template. Clear names make your life easier, just like connector names. This helper allows making universal groups and make the missions variable with more randomness - for instance, a group of T-34 tanks created in the editor may become a group of KV tanks or even Opel trucks in the resulting mission depending on the template properties (see
Mission template).
4.
Preset description - groups with this helper will contain your mission briefings: main and secondary task descriptions and anything else you want to include in the briefing. The generator will use these texts to create the mission briefing automatically.
5. There are other helper types, but it’s likely you won’t need them.
Decoration and coordinate groups Since the engine of the game doesn’t allow to change ‘nationality’ of the decorations dynamically, the groups containing decorations that can change during the course of the campaign need to be prepared in two variants, ‘red’ and ‘blue’.
Moreover, some of these groups should be placed at a certain place on the map (airfields, railway stations, bridges, etc.). Such groups need to be specially named and listed in the generator settings file (see
File structure).
Neutral and static (that won’t change) decorations are fed to the generator in one special group, which doesn’t have a reference point unlike other ones but should be listed in the generator settings file and it needs to be converted using a special utility (NDA).
Mission template The template is the main build instruction for the generator. It defines all the groups in a mission, their placement on the map, their connections to each other and the randomness you can add.
It is created by t-editor which is essentially a graph editor that allows you to set it up in a natural way. You can alter unit type, coalition and properties in a group (and make them random), change MCU properties, set up orientation, distances or ranges for objects and groups.
T-editor is a powerful tool: both the older campaign mode and new career mode in the game were created using it.
File structure To make everything work as intended you need to be familiar with the file structure of the career/campaign files in the game. The excellent
unGTP--IL2 utility made by AnKor that unpacks the game resources will help you.
Take a look at
Scg.gtp file first - it contains the files required for mission generation. Having it unpacked, you’ll get the new folder named
Scg containing subfolders with numerical names - each one of these corresponds to one of the theatres of war (or one of the maps) in the career mode or quick mission builder. The t-editor configuration file
TemplateEditor.ini is located there as well.
Let’s take a look at the subfolder ‘
1’ which in our case contains the Stalingrad part of the Random expert server (in the game it contains the files for QMB on winter Lapino map, but we can use it for another purpose since the generator will use unpacked data as the primary source and ignore the files in the pack).
Let’s list the file in the order of importance (only the required ones, there are more of them but they have self-explanatory names usually).
TemplateEditor.ini - it defines where the t-editor should look for the groups for the current template. It contains links to the theatre of war, to model and object files, to the file containing the list of the coordinate groups (see
blocksFolder.ini), to folders and subfolders of the groups themselves.
You can alter only the theatre of war number to work with the different ones (if they have the same internal structure of course).
Blocks_quickmission folder contains all the groups the generator needs to build a mission. The name of this folder is kept as it is in the game, but it and its subfolders can be renamed if you want (but don’t forget to change the t-editor .ini file accordingly).
I18n folder contains the localized texts for mission names (
briefing.cfg) and date, time and weather info (template.cfg) which the generator will add to the mission briefing along with their values from
defaultparams.dat file (see below).
Templates folder contains the template files which you can order as you want (the name of a template is included in the command prompt when you launch the generator).
Actions.cfg file contains the rules that apply to the groups in the template and that are passed to the generator. The names of the variables are stored in
defaultparams.dat (see below), you can add your own variables for specific tasks.
Let’s take a look at a simple example - say, we need to make sure that a group of ships won’t appear during the winter season without making extra template. We specify the rule ‘delete_ships’ in t-editor and add the following lines to action.cfg:
Action
{
Name = "delete_ships";
Comment = "Deletes object in phase, if condition is true for object.";
NoHelper = 1;
NeedCondition = 0;
Complex = 1;
Import = 1;
Format = "no params and conditions";
Add
{
Action = "delete_object();";
Condition = "if($wtype<35);";
}
}
Here
$wtype is the name of one of the variables in
defaultparams.dat which specifies the weather preset, 34 is the last winter time preset in weather.cfg (note that we specify the rule so it will work for any preset which number is less than 35).
BlocksFolder.ini file contains the list of all the coordinate groups in the game with the links to the folders of these groups and each group in particular in the following format:
block = "z_!(index_number)","!x(x_coordinate)z(z_coordinate).Group"
Attention: all the groups that have strict map coordinates should have such names (example: !x16500z156000.Group). These groups should be stored in separate subfolders since ‘red’ and ‘blue’ variants will have the same names.
Countries.cfg file specify the coalitions in the game, you won’t need to change it.
Defaultparams.dat is the main configuration file for the generator. All parameters a player selects in the game interface in the Career or QMB mode is included in this file in case of an online campaign. It needs to be created, since there is no such file in ‘1’ subfolder by default. Your commander utility should alter this file to progress the campaign.
Here’s an example from our Random expert server (summer Stalingrad): //it’s required to begin with an empty line
$author = 72AG-DED- //if you open the resulting mission in the editor, you can see this in the ‘author’ field
$date = 01.05.1942 //mission date
$forests = graphics\LANDSCAPE_Stalin_s\trees\woods.wds //path to various required map files
$guimap = stalingrad-summer-1942 //path to various required map files
$hmap = graphics\LANDSCAPE_Stalin_s\height.hini //path to various required map files
$textures = graphics\LANDSCAPE_Stalin_s\textures.tini //path to various required map files
$mapId = graphics\LANDSCAPE_Stalin_s\height.dat //path to various required map files
$language = rus // default language in the editor
$loc_filename = base.ldf //path to location database
$missiontype = 2 //mission type in the editor, 2 means dogfight
$playercountryid = 101 //default player coalition ID, important for working with templates
$seasonprefix = su //season (su - Summer)
$period = 5 //Custom variable added to specify the mission plane set for a given date, the corresponding rules are set up in the template and in actions.cfg
$sunrise = 05:45 //Sunrise time (important for searchlights)
$sunset = 19:56 //Sunset time (important for searchlights)
$temperature = 12 //Air temperature in the mission, visible in the briefing
$time = 11:06:53 //Mission start time visible in the briefing
$winddirection = 225 //Wind direction visible in the briefing
$windpower = 1 //Wind speed near the ground, visible in the briefing
$wtype = 42 //Weather time preset, the corresponding weather description will be displayed in the briefing (see i18n folder)
$xposition = 230400 //This is the reference coordinate also included in the template, everything in the mission is relative to it. You can place it anywhere if needed.
$yorientation = 0 //Same as above.
$zposition = 358400 //Same as above.
$xtargetposition = 115200 //Second anchor point coordinate, similar to above.
$ztargetposition = 179200 //Same as above.
$tvd = scg\1\ //Path to the theatre of war folder.
$overlay = scene.Group:none //Path to the file containing the main decoration; ‘none’ means the generator should leave it ‘as is’; in theory, the generator can cut the decorations outside the specified radius, but in our missions we use the entire map and don’t use this option.
You can learn about the additional mission generation parameters from
mgen.log file having the logging turned on in
data\startup.cfg file.
Models.cfg and
Objects.cfg files contain the lists of models and objects names usable in the current theatre of war. Usually you don’t need to alter them.
Base.ldf.ldb file is the location database converted for the generator (it can be named differently); the source location database created by the editor should be placed next to this file (
base.ldf and
base.ldfbin files).
Please note that you can use several databases for one theatre of war, just put them in a different folder and make sure to set up the correct paths where needed.
Scene.Group.lgb is the main decoration for this theatre of war converted for the generator from the source file
scene.Group. It can be put in a different folder and renamed as well if needed.
Weather.cfg contains the list of the weather types. You can edit it ti remove the weather presets you don’t like (for instance, overcast ones).
*****
Therefore, having learned how to use the mission editor and the file structure of the offline career and/or QMB modes, you can ask for the
t-editor and
generator, which will
reduce the amount of work you need to do to make an online campaign two times, if not more.
Good luck!