Map Max

**Map max** is an event that sometimes occurs during the game; it occurs when 1700 units (including doodad units, spells and map revealers) exist concurrently. StarCraft can only process 1700 units at a time, so when map max occurs, all unit production is halted. Attempts to produce units yield the message "Cannot create more units." This limit was set by Blizzard to prevent map lag.

## Details

During map max, units may be queued, but they will not be produced until the map unmaxes. (This is not true for Zerg players; larva can still be morphed, though they will not be automatically produced.) Spells that take the form of units (such as Disruption Web and Dark Swarm) cannot be cast, though they will still consume energy if an attempt is made to use them. When Protoss and Terran worker units are ordered to construct buildings, the cost for the buildings will be paid, but no structures will be produced.

Terran add-ons behave strangely during map max. Attempts to construct add-ons during map max may result in the add-ons being built at large distances from their host buildings when the map unmaxes; they will still be considered connected, and their bridges will extend into thin air. The add-on is functionally normal despite the passable distance. Affected add-ons will not be interrupted if their host building lifts off while they are researching upgrades. (To reconnect the structures, however, the host building must land next to the add-on, just as it would in a normal situation.) Even this is unpredictable; in some cases, attempting to construct an add-on during map max yields the error message that "Something is in the way", and no structure is produced when the map unmaxes.

Map max ends when the unit count falls below 1700 for any reason.

It is worth minimising extraneous units on your map where possible if you may be at risk of map max: get rid of unneeded map revealers (consider sharing vision between players), critters, neutral buildings/units etc. Also consider if you have triggers that create units in order for other triggers to fire - if the first trigger fails due to map max, any subsequent triggers will likely also fail.

## Detecting map max using triggers

When attempting to detect map max with triggers, one cannot simply detect if All Players brings at least 1700 [any unit] to Anywhere. This fails for two reasons: Neutral (Player 12) is not included amongst All Players, and various units (such as Mineral Fields and Zerg Lurker Eggs) are not included in the [any unit] category, and map reavealers cannot be detected at locations (including 'anywhere'). The easiest way to detect map max is to attempt to create a unit in an isolated area under controlled circumstances; if no unit is produced, then the map is maxed.

However, simply creating a unit for a player may result in the player gaining vision of whatever isolated space is used for the trigger system. This is not a "clean" method. The trick is to create and detect Mineral Fields created for Neutral. The following system does just that. Hyper triggers are recommended.

Two locations are needed for unknown reasons (probably the 'Bring' condition bug?). Using just one location results in unit unplaceable errors. Two locations prevents this problem, even if the locations are identical in size and elevations. Ideally, these would be locations that players will rarely (or never) bring units to.

Details
During map max, units may be queued, but they will not be produced until the map unmaxes. (This is not true for Zerg players; larva can still be morphed, though they will not be automatically produced.) Spells that take the form of units (such as Disruption Web and Dark Swarm) cannot be cast, though they will still consume energy if an attempt is made to use them. When Protoss and Terran worker units are ordered to construct buildings, the cost for the buildings will be paid, but no structures will be produced.

Terran add-ons behave strangely during map max. Attempts to construct add-ons during map max may result in the add-ons being built at large distances from their host buildings when the map unmaxes; they will still be considered connected, and their bridges will extend into thin air. The add-on is functionally normal despite the passable distance. Affected add-ons will not be interrupted if their host building lifts off while they are researching upgrades. (To reconnect the structures, however, the host building must land next to the add-on, just as it would in a normal situation.) Even this is unpredictable; in some cases, attempting to construct an add-on during map max yields the error message that "Something is in the way", and no structure is produced when the map unmaxes.

Map max ends when the unit count falls below 1700 for any reason.

It is worth minimising extraneous units on your map where possible if you may be at risk of map max: get rid of unneeded map revealers (consider sharing vision between players), critters, neutral buildings/units etc. Also consider if you have triggers that create units in order for other triggers to fire - if the first trigger fails due to map max, any subsequent triggers will likely also fail.

Detecting map max using triggers
When attempting to detect map max with triggers, one cannot simply detect if All Players brings at least 1700 [any unit] to Anywhere. This fails for two reasons: Neutral (Player 12) is not included amongst All Players, and various units (such as Mineral Fields and Zerg Lurker Eggs) are not included in the [any unit] category, and map reavealers cannot be detected at locations (including 'anywhere'). The easiest way to detect map max is to attempt to create a unit in an isolated area under controlled circumstances; if no unit is produced, then the map is maxed.

However, simply creating a unit for a player may result in the player gaining vision of whatever isolated space is used for the trigger system. This is not a "clean" method. The trick is to create and detect Mineral Fields created for Neutral. The following system does just that. Hyper triggers are recommended.

Two locations are needed for unknown reasons (probably the 'Bring' condition bug?). Using just one location results in unit unplaceable errors. Two locations prevents this problem, even if the locations are identical in size and elevations. Ideally, these would be locations that players will rarely (or never) bring units to.

*StarCraft* Trigger [template]
Description
Start the check. Create a Mineral Field. (Note that Mineral Fields created for Players 1 through 8 are automatically given to Neutral.
Players

* [any player]

Conditions

* All Players brings exactly 0 [any unit] to Location 0.

Actions

* Create 1 Mineral Field (Type 1) for Current Player at Location 1.
* Preserve trigger.

*StarCraft* Trigger [template]
Description
Check if the unit creation succeeded. If this trigger fires, then map max is happening.
Players

* [any player]

Conditions

* All Players brings exactly 0 [any unit] to Location 0.
* Neutral brings exactly 0 Mineral Field (Type 1) to Location 1.

Actions

* Display for current player:Map max!
* Preserve trigger.

*StarCraft* Trigger [template]
Description
Cleanup. Remove the test Mineral Field if it was created, so that we may re-run the test in the next trigger cycle.
Players

* [any player]

Conditions

* Neutral brings exactly 1 Mineral Field (Type 1) to Location 1.

Actions

* Remove 1 Mineral Field (Type 1) at Location 1 for Neutral.
* Preserve trigger.

Possible actions to take during map max include the removal of Zerg larva from the map. Other extraneous units, such as Critters, can also be removed to free up space for more player-controlled units.