Randomizing Control Point Owners

From Valve Developer Community
Jump to navigation Jump to search
Note.pngNote:This Wiki page is written for the game Team Fortress 2, but may be applicable in other Source games.

Randomizing control point owners is an option for control point map creators who would like to add unexpected elements to their styles of play.

How to

One way to factor random elements into a control point map is through the use of the logic_case entity and its PickRandom input.

To start, the map will need at least one capture point. Then add in the logic_case with an OnCase output set for each possible outcome. Under every OnCase output group, each targeted control point needs to receive two commands:

1) A SetOwner input, targeted at the team_control_point entity, to determine who the owner becomes in the chosen case.

Note.pngNote:In Team Fortress 2 the parameter override of an OnCase-SetOwner output has a key, where 0 sets the owner as neither team, 2 as red team, and 3 as blue team.

2) A Skin input, targeted at the prop_dynamic or the base entity, which tells that model to change its skin according to the new capture point owner.

Note.pngNote:For the Team Fortress 2 capture point base, 0 sets the color to gray, 1 sets the color to red, and 2 sets the color to blue. If you do not wish to have a base on your control point, then you can ignore this output completely and refer to (1) alone.
Output Example.jpg

Example (See image at right): If there are two teams to differentiate between, 1 and 2, there are four owner outcomes: 1-1, 2-2, 1-2, and 2-1. Thus there would be four OnCase outcome sets. Because there are then two control points to randomize, each OnCase group consists of four outcomes, two for SetOwner inputs and two for Skin inputs.

Note.pngNote:If there are more than sixteen possible outcomes for the control point system and therefore more than sixteen necessary OnCase outputs in the logic_case, then a solution is to create two or more logic_case entities until the requisite number of OnCase output spaces is acquired. The next step would be to connect the multiple logic_case entities via another logic_case, which would include an OnCase-PickRandom output for each of the other randomizing logic case entities.
Note.pngNote:One may minimize the chances of any outcome by copying and pasting other OnCase groups into the logic_case randomizer system, thus diluting the probabilities by adding in more opportunities for the same outcome to occur.

Plugging into the randomizer

Obviously the randomization system is not going to function if it does not have an external entity to instigate randomization. There are two possibilities for this:

1) Use the OnRoundStart output of the logic_timer entity to randomize a point's owner at the beginning of a game:

My output named OnRoundStart, target entities named <<name of randomizing logic_case>>, via this input PickRandom

Note.pngNote:The logic_timer entity is at times temperamental with its inputs and may not function as desired.

2) Use the OnCapTeam1 and OnCapTeam2 outputs of the trigger_capture_area of one of the control points to instigate randomization when a team captures a specific point:

My output named OnCapTeam1, target entities named <<name of randomizing [[logic_case]>>, via this input PickRandom

My output named OnCapTeam2, target entities named <<name of randomizing [[logic_case]>>, via this input PickRandom

Note.pngNote:The "fire once only" option for these outputs will prevent randomization from occurring throughout a given round.
Note.pngNote:If there are more than sixteen possible outcomes for the control point system and there is a principal randomizing entity for multiple other logic_case entities, then the designated target entity of the outputs should be that principal entity.

Advantages

Because this system adds an unexpected element into the CP-type gameplay, there are a number of benefits that come along with it.

First of all, the idea that a player has a chance of putting him or herself into an adverse situation through simply moving along with the game encourages hesitancy, which in turn demands more suspenseful gameplay.

Randomization also helps to balance teams without rearranging players according to skill level. In any given game, one team may be better or worse than the other, but because the tables can turn in any situation, skill differences are in large part negated.

Disadvantages

Unfortunately, the current version of the Source Engine cannot handle certain applications of this system (such as with the logic_timer in many cases) because many parts and entities are prone to glitches when combining entities in such a way as this tutorial proposes.

Examples

Currently, there aren't any maps that utilize this system, but it is easy enough to download a demo .vmf from this noted link: [1].