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

Game Modes System: Difference between revisions

From ModEnc
Jump to navigation Jump to search
rw
ATHSE (talk | contribs)
update
 
(6 intermediate revisions by 6 users not shown)
Line 1: Line 1:
This is a tutorial on creating and editing MP mode ini files, and some of the problems you may encounter.
__TOC__


In {{ra2}} a system of customizable 'Game Modes' was introduced. The parent INI <tt>MPModes(md).ini</tt> configures the available modes, and under what player arrangement each mode is available, while also specifying which INI to load for the main characteristics of each respective mode. New modes can be defined, but they must fall under specific hardcoded categories, which will be detailed below.
<br><br>
Any multiplayer maps that list a mode in <tt>GameMode=</tt> under [Basic], will be shown to the player in the game lobby, when that mode is selected as a map filter. Unfortunately, the current crop of map editors don't handle new game modes perfectly, and they can be lost when re-saving a map using them.


== Getting Started ==
== Getting Started ==
This tutorial assumes you already have a reasonable understanding of modifying the <tt>rulesmd.ini</tt> file.
The first thing to understand is that game mode INIs, are like selective {{ini|rules}} overrides, they cannot override {{ini|art}} or {{ini|ai}} in any way. This means you can fiddle with the unit properties, or the [[Owner|ownership]] of buildings, but you can't add new [[Cameo|cameos]], nor can you tell it to load new voxels in place of existing units, unless that art is already defined in {{ini|art}}.
 
<br><br>
First of all, update Yuri's Revenge to the latest version, [[YR Patch|1.001]]. Make sure your ini files are based on the 1.001 ini files (Hint: look at <tt>[[Expand(md)|expandmd01.mix]]</tt> ;) ).<br>
When you play a specific game mode in RA2, the game will load the {{ini|rules}} first, then it will load the game mode INI contents, changing existing values or adding new tags as specified. For example, in a game mode, you may have just a single entry:
Then make sure you have checked out the [[YR1002|YR Unofficial 1.002 Mini-Patch]], which demonstrates a multitude of ini file fixes.<br>
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 <tt>[[rules.ini|rulesmd.ini]]</tt>. The 'Rules Of Engagement' refers to the ini file settings stored in <tt>rulesmd.ini</tt> and also the MP mode ini files.
 
Treat an MP mode ini file like a miniature rules ini file.<br>
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.<br>
 
For example, in a mode file you may have just a single entry:
  [E1]
  [E1]
  Strength=200
  Strength=200
In this case, the difference between a normal game and your new game mode is that the GI has 75 extra strength.
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, <tt>[[mpmw.ini|mpmwmd.ini]]</tt> (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).
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, <tt>MPMW(md).ini</tt> (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:
Finally, it seems that all MP game modes must have the following entry except 'Free For All':
  [MultiplayerDialogSettings]
  [MultiplayerDialogSettings]
  AlliesAllowed=yes   ''(or AlliesAllowed=no if it is a Free For All mode)''
  AlliesAllowed=yes
Beyond that, any override settings are up to you.
Beyond that, any override settings are up to you.
Just make sure you follow the normal procedures for rules entries.
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.
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 [[IE|Internal Error]] in-game. All weapons must be parsed by a unit in the main rules file.<br>
==Notes==
To do this, create a dummy, non-buildable unit in the main rules first and give the weapon to that unit.<br>
{{NeedsTesting|Defining a weapon in the {{ini|rules}} and then giving it to a unit in a game mode INI only, will cause an [[Internal Error/YR|Internal Error]]. All weapons must be parsed by a unit in the main rules file.}}
There may be other situations like this that you will have to look out for.


To alleviate this, create a dummy unit with {{F|TechLevel|-1|link}} in the {{ini|rules}} first and give the weapon to that unit, or give it to an existing dummy unit such as [XCOMET].


== The Multiplayer Mode Definition File ([[mpmodes.ini|mpmodesmd.ini]]) ==
== The Multiplayer Mode ==
This file defines all the multiplayer game modes that are present in the game.
The [[mpmodes.ini|MPModes(md).ini]] file defines all the multiplayer game modes that are present in the game.


There are 5 multiplayer mode sections in <tt>mpmodesmd.ini</tt>.
There are 5 multiplayer mode categories, that all game modes must fall into:
{|
{| class="wikitable"
|[Battle]
|This is a standard battle mode.
|-
|-
|[ManBattle]
|[Battle] || This is a standard battle mode for multiplayer/skirmish maps.
|These modes may only be played in network and internet games. AI players are not allowed.
|-
|-
|[FreeForAll]
|[ManBattle] || The human-only mode to be played in network and internet games. AI players are not allowed.
|Players may not ally with each other.
|-
|-
|[Unholy]
|[FreeForAll] || A mode where players may not ally with each other, and every AI is an enemy to each other.
|The Unholy Alliance mode is in this section.
|-
|[Unholy] || The Unholy Alliance mode allowing all factions access to all Sides structures and units.
|-
|[Cooperative] || The Cooperative mode for PvE 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 [{{TTL|FreeForAll}}] section for it to work. However, there is no reason not to define each mode in its appropriate section anyway.{{Fnl|1}}
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' mode INI, but the mode may not have to be defined in the [{{f|FreeForAll|link}}] section for it to work? However, there is no reason not to define each mode in its appropriate section anyway.


Let's take a look at the 'Free For All' mode.
Let's take a look at the 'Free For All' mode.
  2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAllMD.ini, standard, true
  <tt>2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAllMD.ini, standard, true</tt>
 
It is a free for all mode and hence it is defined in the [{{TTL|FreeForAll}}] section.<br>
 
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 <tt>mpmodesmd.ini</tt>. Notice how the mode whose index number is '3' is the third one in the list of modes in game.<br>
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 [[CSF|string table <tt>ra2md.csf</tt>]], the entry <tt>'GUI:FreeForAll'</tt> (in the GUI section) will have a value of 'Free For All'.<br>
It is the basic free-for-all mode, where everyone is everyone elses enemy, but otherwise has no special rules, and hence it is defined in the [FreeForAll] section.
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 <tt>ra2md.csf</tt>, the entry '<tt>STT:ModeFreeForAll</tt>' (in the STT section) will contain the description of the 'Free For All' mode.
The first parameter 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 is 2. Looking at the other modes defined in <tt>MPModes(md).ini</tt>, notice how the mode whose index number is 3, is the third one in the list of modes in game.  


The fourth item defined is the name of the MP mode ini file . <tt>[[mpfreeforall.ini|MPFreeForAllMD.ini]]</tt> contains the Free For All rules 'addendums'.<br>
It is recommended to never leave out an index number. If you define a mode with an index of 15, you must have first defined a mode with an index of 14, skipping numbers will still be playable, but the selected mode will revert back to mode '1' after playing.


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.<br>
The second parameter defined is the name of the multiplayer mode. In the [[CSF|string table]], the entry <tt>'GUI:FreeForAll'</tt> (in the GUI section) will have a value of 'Free For All'. This is the title that is displayed in the map selection window.
'Free For All' may be used with any 'standard' map.<br>


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.
The third parameter 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 <tt>ra2(md).csf</tt>, the entry <tt>STT:ModeFreeForAll</tt> (in the STT section) will contain the description of the 'Free For All' mode.


{{Fn|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}}
The fourth parameter defined is the name of the INI defining all the specific changes to the base game in this mode. <tt>MPFreeForAll(md).ini</tt> contains the 'Free For All' rules, while <tt>MPMeat(md).ini</tt> will contain rules for 'Meat Grinder' mode.


The fifth parameter 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. Some modes like 'Free For All' may be used with any 'standard' map, since it doesn't alter the fundamental gameplay in ways suitable only for a map designed specifically for it. 'Mega Wealth' is one such mode that does require unique maps versions.<br>


== MP mode-related Bugs ==
The final parameter decides whether this mode is applicable in the random map generator, either true (allowed) or false (disallowed).
There is a strange bug with MP mode ini files that can cause some undesireable rules overrides.<br>
There are 3 known cases:


{{bugs}}
There are a few strange bugs with game mode INI files that can cause some undesireable rules overrides. In many cases it is safer to add the entire object/section {{ini|rules}} code to the game mode INI, so that re-stating just a few tags will not reset others to defaults, but where it is safe to do so, like changing [[TechLevel]], the bare minimum can be added.


=== Pip= & OccupyPip= ===
<big>Pip= & OccupyPip=</big><br>
Let's take the GI as an example. We are going to edit the GI as follows:
Let's take the GI as an example. We are going to edit the GI as follows:
  [E1]
  [E1]
  Strength=200
  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'.
When 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 corrupted. And the same applies to any infantry unit modified this way. To fix this problem, the <tt>Pip</tt> and/or <tt>OccupyPip</tt> will have to be restated for every infantry unit mentioned in the game mode INI.


The same applies to any infantry unit you modify.<br>
Example:
To fix this problem, you must do the following:
  [E1]
  [E1]
  Strength=200
  Strength=200
  Pip=white
  Pip=white
  OccupyPip=PersonBlue
  OccupyPip=PersonBlue
You must restate these pip settings for every infantry unit you mention in the MP mode ini file.


<big>PrismSupportModifier=</big><br>
When you add the [General] section to a map, in order to modify any of the tags under it, the [[PrismSupportModifier]] value gets reset. It causes a supported Prism Tower to do instant-kill damage to its target, unless the tag is also added along with the changes.


=== PrismSupportModifier= ===
Example:
When you modify the [{{TTL|General}}] entry, the {{TTL|PrismSupportModifier}} flag gets changed. It causes a supported Prism Tower to do instant-kill damage to its target.<br>
To fix this problem, all you have to do is restate the flag:
  [General]
  [General]
  SecretInfantry=SNIPE,DESO,TERROR,YURI,MYNEWUNIT
  SecretInfantry=SNIPE,DESO,TERROR,YURI,MYNEWUNIT
  PrismSupportModifier=150%
  PrismSupportModifier=150%


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


=== Implications ===
<big>Image=</big><br>
These bugs create a rather worrying problem as they pose the question: "What other flags get buggered by MP mode ini files?"
Using {{f|Image|link}} to override or replace {{f|TechnoType|link}} image in game mode file can come with couple of unwanted side effects, listed below.
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.
# Any tags in the original art entry (the one referred to from main rules file) that are not not found and thus overwritten in the new replacement one, will be carried over. This is prone to cause display issues, for example when the two art entries have different amount of animations attached to them.
# Some tags do not get overridden even if they are specified in the new art entry.  


::''This page is basing on the Multiplayer Mode INI Tutorial by Marshall''
::''This page is originally based on the Multiplayer Mode INI Tutorial by Marshall''
[[Category:RA2/YR Tutorials]][[Category:General Editing Information]]
[[Category:RA2/YR Tutorials]][[Category:General Editing Information]]

Latest revision as of 01:26, 22 April 2025

In Red Alert 2 a system of customizable 'Game Modes' was introduced. The parent INI MPModes(md).ini configures the available modes, and under what player arrangement each mode is available, while also specifying which INI to load for the main characteristics of each respective mode. New modes can be defined, but they must fall under specific hardcoded categories, which will be detailed below.

Any multiplayer maps that list a mode in GameMode= under [Basic], will be shown to the player in the game lobby, when that mode is selected as a map filter. Unfortunately, the current crop of map editors don't handle new game modes perfectly, and they can be lost when re-saving a map using them.

Getting Started

The first thing to understand is that game mode INIs, are like selective rules(md).ini overrides, they cannot override art(md).ini or ai(md).ini in any way. This means you can fiddle with the unit properties, or the ownership of buildings, but you can't add new cameos, nor can you tell it to load new voxels in place of existing units, unless that art is already defined in art(md).ini.

When you play a specific game mode in RA2, the game will load the rules(md).ini first, then it will load the game mode INI contents, changing existing values or adding new tags as specified. For example, in a game mode, 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, MPMW(md).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 except 'Free For All':

[MultiplayerDialogSettings]
AlliesAllowed=yes

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.

Notes

This needs testing
Defining a weapon in the rules(md).ini and then giving it to a unit in a game mode INI only, will cause an Internal Error. All weapons must be parsed by a unit in the main rules file.



To alleviate this, create a dummy unit with TechLevel=-1 in the rules(md).ini first and give the weapon to that unit, or give it to an existing dummy unit such as [XCOMET].

The Multiplayer Mode

The MPModes(md).ini file defines all the multiplayer game modes that are present in the game.

There are 5 multiplayer mode categories, that all game modes must fall into:

[Battle] This is a standard battle mode for multiplayer/skirmish maps.
[ManBattle] The human-only mode to be played in network and internet games. AI players are not allowed.
[FreeForAll] A mode where players may not ally with each other, and every AI is an enemy to each other.
[Unholy] The Unholy Alliance mode allowing all factions access to all Sides structures and units.
[Cooperative] The Cooperative mode for PvE 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' mode INI, but the 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.

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

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

It is the basic free-for-all mode, where everyone is everyone elses enemy, but otherwise has no special rules, and hence it is defined in the [FreeForAll] section.

The first parameter 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 is 2. Looking at the other modes defined in MPModes(md).ini, notice how the mode whose index number is 3, is the third one in the list of modes in game.

It is recommended to never leave out an index number. If you define a mode with an index of 15, you must have first defined a mode with an index of 14, skipping numbers will still be playable, but the selected mode will revert back to mode '1' after playing.

The second parameter defined is the name of the multiplayer mode. In the string table, 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 map selection window.

The third parameter 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 ra2(md).csf, the entry STT:ModeFreeForAll (in the STT section) will contain the description of the 'Free For All' mode.

The fourth parameter defined is the name of the INI defining all the specific changes to the base game in this mode. MPFreeForAll(md).ini contains the 'Free For All' rules, while MPMeat(md).ini will contain rules for 'Meat Grinder' mode.

The fifth parameter 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. Some modes like 'Free For All' may be used with any 'standard' map, since it doesn't alter the fundamental gameplay in ways suitable only for a map designed specifically for it. 'Mega Wealth' is one such mode that does require unique maps versions.

The final parameter decides whether this mode is applicable in the random map generator, either true (allowed) or false (disallowed).

Bugs/Side-Effects/Unexpected Limitations

There are a few strange bugs with game mode INI files that can cause some undesireable rules overrides. In many cases it is safer to add the entire object/section rules(md).ini code to the game mode INI, so that re-stating just a few tags will not reset others to defaults, but where it is safe to do so, like changing TechLevel, the bare minimum can be added.

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

[E1]
Strength=200

When 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 corrupted. And the same applies to any infantry unit modified this way. To fix this problem, the Pip and/or OccupyPip will have to be restated for every infantry unit mentioned in the game mode INI.

Example:

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

PrismSupportModifier=
When you add the [General] section to a map, in order to modify any of the tags under it, the PrismSupportModifier value gets reset. It causes a supported Prism Tower to do instant-kill damage to its target, unless the tag is also added along with the changes.

Example:

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

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

Image=
Using Image to override or replace TechnoType image in game mode file can come with couple of unwanted side effects, listed below.

  1. Any tags in the original art entry (the one referred to from main rules file) that are not not found and thus overwritten in the new replacement one, will be carried over. This is prone to cause display issues, for example when the two art entries have different amount of animations attached to them.
  2. Some tags do not get overridden even if they are specified in the new art entry.
This page is originally based on the Multiplayer Mode INI Tutorial by Marshall