ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

MP Modes

From ModEnc
Revision as of 08:17, 27 November 2009 by EvilRenegade (talk | contribs) (Replacing Template:TTL with Template:F.)
Jump to navigation Jump to search

This is a tutorial on creating and editing MP mode ini files, and some of the problems you may encounter.


Getting Started

This tutorial assumes you already have a reasonable understanding of modifying the rulesmd.ini file.

First of all, update Yuri's Revenge to the latest version, 1.001. Make sure your ini files are based on the 1.001 ini files (Hint: look at expandmd01.mix ;) ).
Then make sure you have checked out the YR Unofficial 1.002 Mini-Patch, which demonstrates a multitude of ini file fixes.
Once your base ini file set is up to date you can begin modifying the RA2/YR "Rules Of Engagement".

Rules Of Engagement

You know how to modify rulesmd.ini. The 'Rules Of Engagement' refers to the ini file settings stored in rulesmd.ini and also the MP mode ini files.

Treat an MP mode ini file like a miniature rules ini file.
When you play a specific game mode in Yuri's Revenge, the game will load the main rules file and then it will load a specific MP mode ini file which contains ini settings that will override or add to those settings already present in the main rules file.

For example, in a mode file you may have just a single entry:

[E1]
Strength=200

In this case, the difference between a normal game and your new game mode is that the GI has 75 extra strength.

If you look at the MP mode ini files that come with Yuri's Revenge you will see how the various game modes are defined. For example, mpmwmd.ini (Megawealth) contains the ini override settings necessary to disable the Refineries and Ore Miners, and change the prerequisites of the other structures in the game (which normally require a Refinery before they can be built).

Finally, it seems that all MP game modes must have the following entry:

[MultiplayerDialogSettings]
AlliesAllowed=yes    (or AlliesAllowed=no if it is a Free For All mode)

Beyond that, any override settings are up to you. Just make sure you follow the normal procedures for rules entries. It is a good idea to base your mode file(s) on similar mode files already present.

Note: You cannot define a weapon in the main rules and then give it to a unit in a mode file. Doing so will cause an Internal Error in-game. All weapons must be parsed by a unit in the main rules file.
To do this, create a dummy, non-buildable unit in the main rules first and give the weapon to that unit.
There may be other situations like this that you will have to look out for.


The Multiplayer Mode Definition File (mpmodesmd.ini)

This file defines all the multiplayer game modes that are present in the game.

There are 5 multiplayer mode sections in mpmodesmd.ini.

[Battle] This is a standard battle mode.
[ManBattle] These modes may only be played in network and internet games. AI players are not allowed.
[FreeForAll] Players may not ally with each other.
[Unholy] The Unholy Alliance mode is in this section.
[Cooperative] The Cooperative mode is in this section.

It is not known if all modes have to be defined in their appropriate section. For example, 'players may not ally with one another' is a setting defined in the Free For All MP mode ini file so the Free For All mode may not have to be defined in the [FreeForAll] section for it to work. However, there is no reason not to define each mode in its appropriate section anyway.1

Let's take a look at the 'Free For All' mode.

2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAllMD.ini, standard, true

It is a free for all mode and hence it is defined in the [FreeForAll] section.

The first item defined in this mode is its slot position in the list of available modes when you choose the mode and map you are going to play on. The 'Free For All' mode is the second one in the list because its index number is '2'. Look at the other modes defined in mpmodesmd.ini. Notice how the mode whose index number is '3' is the third one in the list of modes in game.
Never leave out an index number. If you define a mode with index '15' you must have first defined a mode with index '14' (if you miss a number out, the game mode will still be playable but the selected mode will revert back to mode '1' after playing).

The second item defined is the name of the multiplayer mode. In the string table ra2md.csf, the entry 'GUI:FreeForAll' (in the GUI section) will have a value of 'Free For All'.
This is the title that is displayed in the graphical user interface (GUI) of Yuri's Revenge.

The third item defined is the description of the multiplayer mode. This description appears in the bar at the bottom of the screen when selecting a multiplayer mode. In the string table ra2md.csf, the entry 'STT:ModeFreeForAll' (in the STT section) will contain the description of the 'Free For All' mode.

The fourth item defined is the name of the MP mode ini file . MPFreeForAllMD.ini contains the Free For All rules 'addendums'.

The fifth item defined is the type of map that this mode may be used with. Map types include 'standard', 'teamgame', 'megawealth', 'duel', 'meatgrind', 'navalwar' and 'cooperative'. The type(s) of a map is set in the map editor and a map may be more than one type.
'Free For All' may be used with any 'standard' map.

The final item defined is whether or not maps created by the random map generator are allowed. 'true' means they are allowed, 'false' means they are not allowed.

1 I believe the different headings invoke certain logic specific to certain game mode types. For free for all it makes the AI attack other AI's as well as the player and UnholyAlliance make the game give all available base units. You might want to re-write this section with that in mind - Blade


MP mode-related Bugs

There is a strange bug with MP mode ini files that can cause some undesireable rules overrides.
There are 3 known cases:


Pip= & OccupyPip=

Let's take the GI as an example. We are going to edit the GI as follows:

[E1]
Strength=200

When we play in-game we will find that both the colour and shape of the GI's pip (when inside a transport or occupying a building) have been changed or 'messed up'.

The same applies to any infantry unit you modify.
To fix this problem, you must do the following:

[E1]
Strength=200
Pip=white
OccupyPip=PersonBlue

You must restate these pip settings for every infantry unit you mention in the MP mode ini file.


PrismSupportModifier=

When you modify the [General] entry, the PrismSupportModifier flag gets changed. It causes a supported Prism Tower to do instant-kill damage to its target.
To fix this problem, all you have to do is restate the flag:

[General]
SecretInfantry=SNIPE,DESO,TERROR,YURI,MYNEWUNIT
PrismSupportModifier=150%

InfantryType + DeploysInto = IE

Also you should be aware of the really awkward IE that is listed as #14 in the known causes for internal errors list (redefining [in any way] an infantry that has (Un-)DeploysInto= set causes an IE when a human player scrolls the map to the AI war factory).

Implications

These bugs create a rather worrying problem as they pose the question: "What other flags get buggered by MP mode ini files?" If you discover any more, please post them above.

In light of the above bugs, it is a good idea to avoid using mode files wherever possible, and keep as little code in them as possible. When modifying an entry, try to restate the entire entry's code, just to avoid this bug making an appearance.

This page is basing on the Multiplayer Mode INI Tutorial by Marshall