Capture The Flag (RO2 MOD)

From Tripwire Interactive Wiki
Revision as of 16:35, 28 November 2012 by -=THOR=- (talk | contribs) (→‎Packaging)
Jump to navigation Jump to search

Capture The Flag for Red Orchestra 2 is a MOD developed by -=THOR=-, with the collaboration of Mad_Fred and GrimReality. It introduces the classic CTF game type to RO2. Each team has a flag, generally located close to its initial spawn area. The objective is to take flag of the enemy, and bring it home to 'capture' it. A soldier can capture the enemy flag when his own flag is home. When the flag carier dies, the flag drops on the ground. If an enemy touches its flag, or after a server-customizable delay expires, the flag returns automatically to its stand. Before it that happens, a teammate of the dead flag carrier can pick it up and continue.

Features

  • Realistic flag, made of a static mesh for the pole, and skeletal mesh for the fabric. The skeletal mesh uses UDK cloth physics. The flag is attached to the back of the player when carried (like a shouldered rifle).
  • Spawn protected or other mapper-specified zones cannot be entered by flag carriers (else, the flag returns automatically after a delay expires).
  • A HUD widget at the bottom of the screen appears when a flag is not home, and indicates the status of the flags (home, taken or dropped). It is always visible in the tactical overlay. The icons change dynamically.
  • The location of the flag bays are indicated by moving icons on the tactical overlay. The icons change dynamically depending on the state of the flag.
  • Custom alerts are displayed in the middle of the screen, when a flag is taken, dropped, returned, expired or captured. The player name of the instigator is displayed on a second row, in smaller characters (when applicable).
  • The number of flags capped on each team is displayed to the left of the scoreboard, on the map, and in the tactical overlay.
  • Spawn locations can change dynamically as the teams move on the map and get control over areas. The user anually selects his spawn location.
  • Optional configurable anti-camping system. The system discourages carriers from camping in a dark corner, helping to resolve the situation where both flag carriers hide somewhere. After some time with both flags taken, a flag carrier who is not moving enough will be displayed on the HUD of the enemy, for a few seconds, every few minutes (all delays are configurable).
  • Arty can be used with a delay between strikes instead of a number of strikes per round.
  • 'Hot Zones' can be defined throughout the map, and have a team index. Those are used to define areas around the flag bays, into which players get bonus points for attacking/defending.
  • Bots have a CTF-specific AI logic. It will try to take/capture/return flags (as long as the mapper implements pathing correctly on his map).
  • Sounds are played for taking, returning and capping a flag, as well as the flag expiration.
  • Custom messages are displayed accordingly to the CTF points system.
  • The flag bays appear on the map with a dynamic icon, and instructions in the right panel change with states of the flags.
  • Dead Roaming and 1st/3rd persons spectating are disabled for dead players. These view modes are only available for spectators, or when the mapper forgets to define cameras. A camera can be team-specific, or shared.
  • The flag carrier will be displayed with a special icon on the map.
  • Morale is affected by the number of captures of each team.
  • Spawn on squad leader an commander force-respawn are supported.
  • In the scoreboard, the player name of the flag carrier is displayed with a lighter color, and a "(FC)" tag next to their name.
  • The classic compass is always used (independently from the game mode).
  • The round/match end screens have been customized with custom stats (flags capped last round, and total flags capped).
  • A round can be won by capping enough flags, or at the end of the time limit, by having more flags than the opponent.
  • A match can be won by winning more rounds, or capping more flags (total of the match) than the enemy.
  • Tied rounds are taken into consideration for the maximum number of rounds allowed.
  • When there are 60 seconds left, a timer appears at the top of the screen and turns red when 30 seconds are left. It is similar to Firefight.
  • A customizable 'credits' panel appears at the bottom-left of the 'Round Start' window. The mapper enters the information in the SDK (WorldInfo).
  • The scoreboard shows the name of the custom gametype at the top.
  • The round start screen is customized to display the CTF information.

Points System

  • Taking the enemy flag (flag bay): +5 team points.
  • Taking the enemy flag (dropped): +3 team points.
  • Killing an enemy who is near your flag bay: +2 team points.
  • Killing an enemy who is near the enemy flag bay: +3 team points.
  • Returning (touching) your flag after it has been dropped: +5 team points.
  • Flag carrier defending himself: +2 team points.
  • Killing the enemy flag carrier: +3 team points.
  • When a flag capture happens:
    • 10 points are awarded to the final flag carrier.
    • 15 points are split between the final and intermediate flag carriers (min 5 points/carrier).
    • 3 points are awarded to players of the capping team that got at least 1 kill while the flag was being carried.
    • The maximum number of cap points is clamped at 25 points per capture.

CTF Packaging

When a new version is ready, the following process is followed:

  • Delete the Published folder.
  • Delete previous versions of CTFAssets_x_y_z.upk under .\ROGame\Unpublished\CookedPC\Packages\.
  • Delete .\ROGame\Unpublished\CookedPC\Script\CustomGameTypes.u.
  • Cook the assets:
...\Win64\ROGame.exe CookPackages CTFAssets_x_y_z.upk -platform=PC -SkipMaps -UserMode -UpdateInisAuto
...\Win64\ROGame.exe CookPackages CTFAssets_x_y_z.upk -platform=PCServer -SkipMaps -UserMode -UpdateInisAuto
  • Build the code:
...\Win64\ROGame.exe Make
  • Cook the code:
...\Win64\ROGame.exe CookPackages CustomGameTypes.u -platform=PC -SkipMaps -UserMode -UpdateInisAuto
...\Win64\ROGame.exe CookPackages CustomGameTypes.u -platform=PCServer -SkipMaps -UserMode -UpdateInisAuto
  • Assemble the archives without the map.
  • Open the map and resave it.
  • Cook the map:
...\Win64\ROGame.exe CookPackages CTF-Prototype -platform=PC -AlwaysRecookMaps -UpdateInisAuto
...\Win64\ROGame.exe CookPackages CTF-Prototype -platform=PCServer -AlwaysRecookMaps -UpdateInisAuto
  • Add the map (without re-adding the CTF files) to the archives.

Server Files

.\Config\DefaultCustomGameTypes.ini
.\CookedPCServer\CTF-Prototype.upk
.\CookedPCServer\CTFAssets_x_y_z.upk
.\CookedPCServer\CustomGameTypes.u

Redirect Files

.\CTF-Prototype.upk
.\CTFAssets_x_y_z.upk
.\CustomGameTypes.u

Workshop Files

.\Config\DefaultCustomGameTypes.ini
.\Published\CookedPC\Maps\CTF-Prototype.roe
.\Published\CookedPC\Packages\CTFAssets_x_y_z.upk
.\Published\CookedPC\Script\CustomGameTypes.u

Modder Files

.\ROGame\InstallCTF.bat
.\ROGame\Src\SettingsMacros.uci
.\ROGame\Src\WebAdmin.uci
.\ROGame\Src\*.uc
.\ROGame\Unpublished\CookedPC\Maps\Prototype\CTF-Prototype.roe
.\ROGame\Unpublished\CookedPC\Packages\CTFAssets_x_y_z.upk
.\ROGame\Unpublished\CookedPC\Script\CustomGameTypes.u

Processes for Modders

Install

  • Unsubscribe from all RO2 Workshop CTF-related items.
  • Extract the CustomGameTypes archive to Documents\My Games\RedOrchestra2. When prompted to merge folders, click YES. Make sure you don't extract the ROGame folder inside ROGame.
  • Execute InstallCTF.bat located under Documents\My Games\RedOrchestra2\ROGame\InstallCTF.bat. The batch file will automatically do the following:
    • Delete traces of all previously downloaded CTF-related items.
    • In Documents\My Games\RedOrchestra2\ROGame\Config\ROEditor.ini, under [ModPackages], add ModPackages=CustomGameTypes to have something similar to this:
[ModPackages]
ModPackages=CustomGameTypes
ModPackagesInPath=..\..\ROGame\Src
ModOutputDir=..\..\ROGame\Unpublished\CookedPC\Script
    • Cook the code:
...\Win64\ROGame.exe CookPackages CustomGameTypes.u -platform=PC -SkipMaps -UserMode -UpdateInisAuto
...\Win64\ROGame.exe CookPackages CustomGameTypes.u -platform=PCServer -SkipMaps -UserMode -UpdateInisAuto
  • Launch the SDK and load the map CTF-Prototype, located under Documents\Unpublished\CookedPC\Maps\Prototype (optional).

Update

  • Backup the ROGame folder under Documents\My Games\RedOrchestra2.
  • Go through the Install process.
  • For each CTF map you have:
    • Open the map.
    • Clear the error message.
    • Play the map, make sure CTF works well.
    • Save the map.

Release

The map release process is critical, and must be followed carefully to ensure compatibility between maps.

Cooking

Open your map, and click the Cook button in the SDK.

Packaging

Some CTF files need to be added to your map release. DO NOT DISTRIBUTE THE CTF FILES THAT YOU HAVE COOKED, USE THOSE PROVIDED IN THE INITIAL ARCHIVE. FAILURE TO DO SO MIGHT RESULT IN OTHER MAPS BECOMING INCOMPATIBLE.

Client Files

In addition to the usual map files located under Documents\My Games\RedOrchestra2\ROGame\Published\CookedPC, include those CTF files (FROM THE ARCHIVE):

.\ROGame\Published\CookedPC\Script\CustomGameTypes.u
.\ROGame\Published\CookedPC\Packages\CTFAssets_x_y_z.upk
Server Files

In addition to the usual map files located under Documents\My Games\RedOrchestra2\ROGame\Published\CookedPCServer, include those CTF files (FROM THE ARCHIVE):

.\ROGame\Published\CookedPC\Script\CustomGameTypes.u
.\ROGame\Published\CookedPCServer\CTFAssets_x_y_z.upk

Custom Map Objects

Although the gametype is consituted of many classes, most of them are used internally, and not used by the mapper. This section describes only the objects used by the mapper to implement CTF on his map.

Placeable Actors

  • CGTAlliedFlag/CGTAxisFlag: Allied/Axis versions of the flag (and pole). The actor is attached to the back of the flag carrier when touched by him the first time and dropped on the ground when he dies. A new instance is created at the home location every time the flag is captured, dropped and expired/returned.
  • CGTFlagStand: Lower part of the flag pole. This actor is not attached to the flag carrier. It acts as a standard visual cue as to where the capture zone is.
  • CGTCameraActorViewpoint: Custom camera with team-index filters. When cycling through the list of viewpoints, the player will/won't be able to see through those cameras if the filter defined by the mapper allows him to.

Volumes

  • CGTAdvancedTriggerVolume: This volume is a ROTriggerVolume. It has Touch/Untouch events. This volume is used to define the hot zones, the flag capture zones, and the control zones for dynamic spawning areas.
  • CGTVolumeNoFlag: This volume is a CGTAdvancedTriggerVolume. If the flag carrier enters such a volume, the flag automatically returns after a delay expires.
  • CGTVolumePlayerStartGroup: This volume is a ROVolumePlayerStartGroup. It is used by spawn zone controllers.
  • CGTVolumeSpawnProtectionCTF: This volume is a ROVolumeSpawnProtection. If the flag carrier enters such a volume, the flag automatically returns after a delay expires.

Kismet

  • CGTSeqAct_GameManagerCTF: Used to assign the flags, flag zones, and hot zones to the internal game type controller. There should not be more than one instance of this object per map.
  • CGTSeqAct_SpawnZoneController: Used to dynamically control a spawn zone. Conditions can be defined, based on the number of enemy or friendly players (or their ratio) in a control zone, to define whether a spawn zone should be enabled or not.

Custom Map Info

For a CTF map, a Map Info of type CGTMapInfoCTF must be used.

  • Reinforcements are not used.
  • Since the duration of a CTF round is not defined by the mapper, the number of strikes per round cannot be used. Instead, the parameters <Allies/Axis><Mortar/Artillery/Rocket>StrikePeriod are used to define the period between strikes.
  • There are many fields under the credits category. The credits are displayed at the bottom-left of the round start screen.

Tutorial

Stock maps use level streaming. That means that most of the effects, sounds and art are located in independent files (e.g. FX-Apartments, SND-Apartments and ART-Apartments). If one change is made to these, any map that use them will have the changes. Top level files (e.g.: TE-Apartments, CD-Apartments and FF-Apartments) should only contain gametype-specific map data. Note that it might not be a good idea to use streaming for a custom map, since the streamed files may not be downloaded.

Before even thinking about CTF, you need a map that makes sense.

The first option is to build a map from scratch. It is the most flexible, but the slowest approach. You will have to build a terrain, add static or skeletal meshes, effects, sounds, everything. Once done, go to the Capture_the_flag#Basic Setup section.

The second option is to reuse stock sublevels, and stream them into a new top-level map. Although this approach takes much less time than creating a map from scratch, you will have to place all of the cover nodes, pathing actors, etc. You will build over a fixed art sublevel, which means you cannot move most of the static meshes, cannot modify them. However you can add any new content to your top-level map. Players will only download the top-level map, but any changes made by TWI to the sublevels will affect your final result.

The third option is to turn a stock map into a non-streamed map. The operation consists of a massive copy-paste operation. For instance, you could start with the art sublevel, and rename it to something else. You would then copy everything from the sound, effects, and top-level maps. The advantage of this approach is that you are independent from the sublevels, which can be modified anytime by TWI, and you can move content around, change the terrain, etc. The downside is that your map will be ~200 MBs, and will take time to download. Also, copy-pasting can take quite some time, since the SDK seems very sensitive to those operations, and crashes often.

The fourth option consists to copy a stock top-level map, and rename it. Then all you need to do is to delete unused content. The download size will be very small, but you are vulnerable to changes from TWI and the ART file cannot be modified. However, this approach is the fastest. It is also possible to turn the map into a non-streamed map later on.

Cleaning up a copied stock top-level map file

If you are streaming stock sublevels into a copy of an existing stock top-level file, you need to make some cleanup. Go to the Levels window. Hide and lock all of the stock streamed levels by toggling the visibility and lock button of each sublevel. Make sure you leave the top level visible and unlocked. If all groups are visible, and all visibility options are on, you should see everything that is contained in your top-level file only.

Cleanup Kismet

Open Kismet. If you are unfamiliar with Kismet, you should go through some Kismet tutorials, or play around with it until you understand how it works. You need to do some cleanup. Now, what to keep, and what not to keep, that is the question. I suggest the following scheme:

  • KEEP
    • Logic that triggers the recon planes;
    • Logic that enable radios;
    • One LevelLoaded block.
  • REMOVE
    • TE Objectives logic;
    • All CD/FF logic.

Cleanup Editor

Once the cleanup of Kismet complete, it is time to clean volumes, actors, and such. To quickly select multiple actors, open the Scene window, select PersistentLevel, enter the actor type in the Filter Text field and press enter. You can select multiple actors by clicking the first, holding shift, and clicking the last one. Then you can edit/delete multiple actors at a time. I suggest the following scheme:

  • KEEP
    • Actors:
      • Pylon;
      • ROCoverLink;
      • ROMantleMarker;
    • Volumes:
      • BlockingVolume;
      • LightMass;
      • NavMeshBoundsVolume;
      • PathBlockingVolume;
      • ROVolumeAmmoResuply;
      • ROVolumeMapBounds (Not to be confused with MapBoundary volumes, which define Out of combat zone areas.)
  • REMOVE
    • Actors:
      • Camera;
      • Note;
      • RallyNode;
      • ROCameraActorViewpoint;
      • ROObjective;
      • ROPlayerStart;
      • ROSpawnCameraActor.
    • Volumes:
      • ROPlaceableVolume;
      • ROVolumePlayerStartGroup;
      • ROVolumeSpawnProtection;
      • ROVolumeMapBoundary;
      • ROVolumeNoArtillery.

Basic Setup

Kismet - CTFManager

In Kismet, add a CTF Game Manager (right-click and look under New Actions/Custom Game Types). Link the output signal Reset of a LevelLoaded block to the input of the manager.

Position the flags

In the Actor Classes window, select CGTFlagStand under Actor. Right-click on the map, and click Add CGTFlagStand Here. The translation widget appears at the bottom of the flag stand. Open the properties window of the stand. Round each component of the location (XYZ). Otherwise, the flag may not reposition exactly at the correct location due to floating point rounding errors. Take note of the XYZ location of the stand. In the Actor Classes window, select CGTAlliedFlag (or CGTAxisFlag) under Actor/CGTFlag. The flag might appear underground, since the widget is positioned at the tip of the flag pole. Open the properties window of the flag. Set the same location coordinates as those of the stand for X and Y, but add 90 units the Z coordinate of the stand. Select the flag (not the stand). Open Kismet, right-click to open the context menu, and click New Object Var Using CGTAlliedFlag_X. Link the circle to the Flags variable of the CTF Game Manager. Repeat for the other stand/flag.

Define the capture zones

Using the builder brush, define a box with the Allied flag in the middle. A large box will make it very easy to capture the flag, while a smaller box will require that the flag carrier gets closer to his own flag. Once the builder brush is correctly positioned, add a volume of type CGTAdvancedTriggerVolume. Move the builder brush away, and select the volume you created. Open the Properties window, and assign the team index (0 for the Axis base, 1 for the Allied base). With the volume still selected, open Kismet. Right-click to open the context menu, and click New Object Var Using CGTAdvancedTriggerVolume_X. You might want to add a comment or variable name to that circle. Link the circle to the Flag Zones variable of the CTF Game Manager. Repeat for the other flag.

Define the initial spawn zones

I won't go in details here: define spawn zones like you would do on any TE/CD/FF map. The only difference, is that the volume that you will use, will be a CGTVolumePlayerStartGroup.

Setup the WorldInfo

Open the WorldInfo window. Under the WorldInfo category, go to Game Type for PIE. Select CGTGameInfoCTF. Now go under MyMapInfo. Click the blue arrow to the right, and select CGTMapInfoCTF. Under TerritoriesAllies/TerritoriesAxis, define the Allies/Axis squads as usual. Under ROMapInfo, define the Overhead Map Texture.

First launch

From what you have done so far, you should be able to launch PIE and play CTF. Before going any further, try it out. Here's the common bugs you may encounter:

  • Nothing happens when you touch the enemy flag because you didn't define the capture zones properly, or didn't link the flags and/or the zones to the CTF Game Manager.
  • The game launches, but after selecting a team, nothing happens: the PIE gametype is not defined properly.
  • The game ends abruptly after a round start: the TimeLimit is not defined properly in ROGame.ini.

External links

Offical Capture The Flag thread