![]() |
Hosting Stages
|
During hosting, things happen in a certain order: missions, production, movement, and so on. It is important for players to know this order. For example, mine laying happens before movement which means the minefield will appear at the place where you are, not where you go to. This document describes the complete order of actions of PHost. It also provides information on how to add your own processing stages to the host sequence.
PHost consists of three phases; the middle one is again split into stages. The order of these parts is fixed. Hosts can, however, disable some stages, or run add-ons at any place between two stages or phases.
(v3.4c:) Note that PHost versions up to 3.4b do alliance processing at the beginning of phase 2, and process remote control orders and rumors in whatever order they're coming in. In addition, these host versions send rumors in whatever order they come in and therefore do not guarantee anonymity.
Note on Cloaking: Ships that are ordered to cloak (using the mission cloak or super spy or one of its substitutes) start the turn cloaked if they fulfill the conditions for cloaking. Later on, they can only de-cloak; once they are de-cloaked, they stay uncloaked for the rest of the turn.
All places where cloaking can fail have been identified in this list. Note, however, that add-on programs may cancel cloaking as well. In addition, cloaking immediately fails whenever a ship has too little fuel or too much damage after an add-on invocation.
Injected Commands: (v4.0e:) Commands "injected" using auxcmds.txt are processed at the very beginning of phase 2.
Ownership Transfers | |
Stage name: TransferOwner |
All give commands and the gsX friendly code orders are validated, and then performed simultaneously. In particular, two players can exchange two ships and still fulfill the "partner must have ship at same position" requirement.
De-Cloak: (v4.0j:) Ships that change ownership must decloak.
Large Meteors | |
Stage name: LargeMeteors |
If LargeMeteorsImpacting is nonzero, do that many large meteors. Otherwise, do one large meteor at a chance of RandomMeteorRate.
Meteor Showers | |
Stage name: MeteorShowers |
For each planet, do a small meteor at a chance of MeteorShowerOdds.
Anti-Cloak | |
Stage name: AntiCloak_1 |
Anti-cloak ships decloak ships in range. The anti-cloak ships are processed in Id order. A ship in range of multiple Lokis will be decloaked by the one with the lowest Id.
De-Cloak: Ships affected by an anti-cloak ship must de-cloak at once.
Super Spy Deluxe | |
Stage name: DeluxeSuperSpy |
Does the friendly-code changing on all victim planets. Uses per-player Id order to pick the ship to define the new friendly code for each planet.
De-Cloak: When the ionic pulse triggers, ships must de-cloak at once.
New Natives Appear | |
Stage name: NewNativesAppear |
Picks a planet NewNativesPerTurn times, and gives it new natives if it doesn't already have some.
Privateer "Rob" mission | |
Stage name: RobMission |
Robbers act in per-player Id order. Each robber robs his victims in Id order (that is, if the Privs don't have enough cargo capacity to empty your fleet, the high-Id victim ships will keep cargo; if the victims have less than fits into the robbers' cargo room, the high-Id robbers will remain empty).
Gambling Ships | |
Stage name: GamblingShips |
Gambling ships generate credits, in Id order.
Cargo Dumps | cannot be skipped |
Stage name: CargoDump |
For each ship in Id order, drops cargo. This includes the standard ship/foreign-planet cargo transfer, as well as the bdm friendly code and the Beam Down Credits mission.
This stage cannot be skipped (cargo transporters must be empty during rest of host run).
Cargo Transfer | cannot be skipped |
Stage name: CargoTransfer |
For each ship in Id order, do transfers to other ships (ship/foreign ship transfers). If transfer fails, cargo is put back to original ship. Cargo transfers between ships of the same race are resolved client-side, and therefore not processed here. Cargo transfers using missions are resolved later.
This stage cannot be skipped (cargo transporters must be empty during rest of host run).
Cargo Trimming on Overloaded Ships | cannot be skipped |
Stage name: TrimShipCargo |
Ships might be overloaded for various reasons. In this stage, all ships' cargo is reduced to fit in the actual cargo hold.
This stage cannot be skipped (ships must not be overloaded during rest of host run).
Academy ship crew exchange | Since: PHost 4.0i |
Stage name: CrewExchange |
Academy ships give crew to other ships, in Id order, using the crew exchange mission.
Training | Since: PHost 4.0 |
Stage name: Training |
In Id order, ships perform the Training mission.
Beam Transfer Missions | |
Stage name: BeamTransfers |
In Id order, performs the following actions for each ship:
When a ship is using both a beam transfer mission and a friendly code, the mission is performed first, then the friendly code. (in PHost 3.4c and below, only the mission is performed).
Gather Missions | |
Stage name: GatherMission |
In Id order, performs the following actions for each ship:
Planets Beam Up Credits | |
Stage name: BeamUpCredits |
In Id order, processes the bum friendly code on planets. This also handles the con friendly code (the send config command is handled in phase 1, completely unrelated to this one).
De-Cloak: After this (and the previous) stages, ships may have lost enough fuel to be unable to cloak any longer. Ships lose fuel by Rob, but friends may immediately re-fuel you to keep your cloak (inter-race cargo transfer).
Minefields Decay | |
Stage name: MinefieldDecay |
Mine fields decay. Note that because mine decay is before mine laying and sweeping, ships that were inside a minefield before may end up outside after this.
Mine Laying | |
Stage name: MineLaying |
Ships lay mines. The actual order depends on the PHost version.
With AlternativeMinesDestroyMines enabled, mines from overlapping fields will explode here. This always happens in PHost 4.0a/3.4e and before.
Overlapping Minefields Explode | Since: PHost 4.0b/3.4f |
Stage name: MinesDestroyMines |
(v4.0b:) Overlapping hostile minefields explode.
This stage is not available in PHost 3.4e/4.0a and below; in these versions, overlapping minefields will only explode when someone attempts to enlarge one of them; see the previous stage.
Mine Sweeping | |
Stage name: MineSweeping |
Ships scan for mines and sweep them, in ship Id order.
Mine Scan Messages | |
Stage name: MinefieldScan |
This sends out the mine scan messages for minefields seen in the previous stage.
Wormhole Scanning | obsolete |
In PHost versions up to 4.0d, Wormhole scanning happens here. In 4.0e and later, it happens after terraforming.
Web Draining | |
Stage name: WebDraining |
Ships inside Crystalline web minefields lose fuel (multiple times if in multiple webs).
De-Cloak: After this stage, ships may have lost enough fuel to be unable to cloak any longer.
Ion Storms Move | Since: PHost 4.0j |
Stage name: MoveIonStorms |
If the number of ion storms exceeds IonStormActivity, the weakest storm dies.
Then, in Id order, storms...
Finally, storms merge if they fulfill the preconditions.
Ion Storms Affect Ships | Since: PHost 4.0j |
Stage name: IonStormEffects |
In storm Id order, storms decloak ships and affect then-uncloaked ships (drag them along, damage, crew loss). Ships within multiple storms are affected by all of them.
New Ion Storms form | Since: PHost 4.0j |
Stage name: NewIonStorms |
If the number of ion storms is less than IonStormActivity, creates new storms. The number of new storms is picked randomly between one and three.
Note that this can exceed the IonStormActivity limit. This is by intention; next turn, a weak storm will die in this case.
Ion Storm Reports | Since: PHost 4.0j |
Stage name: IonStormReports |
Sends out messages about all ion storms to every player.
Special Missions I | |
Stage name: SpecialMissions_1 |
First, in ship Id order, processes
Then, in ship Id order
Ships build Fighters | |
Stage name: BuildFighters |
Robot/Rebel/Colonial ships build fighters, in Id order. This handles the lfm friendly code, the Build Fighters and Gather-build Fighters missions, and the Rebels' fighter auto-build.
Ships build Torps | |
Stage name: BuildTorpedoes |
In Id order, does the mkt friendly code and the Build Torpedoes, and then Gather-build Torpedoes missions.
In PHost up to version 4.0h/3.4j, Gather-build
Torpedoes has precedence and prevents mkt from
happening.
Alchemy | |
Stage name: Alchemy |
The three alchemy functions.
Preparing Ship Build Queue | |
Stage name: ShipBuildOrders |
Iterates through all bases in Id order, starting with a random base, and places the build orders in the ship build queue.
Priority build friendly codes are processed here, too, if required by the build queue mode.
Ship Building | |
Stage name: ShipBuilding_1 |
Perform ship build orders, in queue order, as long as there are free ship slots.
Starbases Recycle Parts | |
Stage name: DumpOldBaseParts |
The dmp friendly code.
Starbase Tech Downgrades | cannot be skipped; cannot be modified |
Tech levels of starbases are downgraded here. A starbase owned by an unregistered player cannot have more than Tech 7 for engines, Tech 6 for other areas, unless it was built with the right natives. This check applies when a registered player slot is taken over by an unregistered player.
Starbase Missions I | |
Stage name: BaseMissions_1 |
In starbase Id order, does...
Supply Repair | |
Stage name: SupplyRepair_1 |
Ships repair themselves using supplies.
Boarding (Tow-Capture) | |
Stage name: BoardingParties |
Towing ships board their towee, in tower-Id order.
De-Cloak: (v4.0j:) Ships that change ownership must decloak.
Starbases build Free Fighters | |
Stage name: FreeFighters |
Starbases build free (no-money) fighters.
Tow Resolution | |
Stage name: TowResolution |
Cancels all tow missions which shall not succeed. See also Tow conflict resolution rules.
Movement | cannot be skipped |
Stage name: Movement |
Ships that move can run on mines and get damaged. Ships running on web mines lose fuel. This may cause their cloaking device to fail immediately. Ships can not run on mines during...
De-Cloak: After this stage, ships may have lost enough fuel to be unable to cloak any longer. Actually, ships de-cloak immediately when getting too badly damaged from a mine hit, or running out of fuel. Ships which travel through a wormhole de-cloak as well. (v4.0i/3.4k:) Ships which hyperjump must also decloak.
Glory Devices Pop | |
Stage name: GloryDevices |
Glory devices go off in Id order. If a Glory Device ships also has a working Anti-cloak device, it will perform its de-cloak operation immediately before detonating.
De-Cloak: Ships affected by an anti-cloak ship must de-cloak at once. After this phase, ships which got over the damage limit (by a Glory Device) must de-cloak, too.
Chunneling | |
Stage name: Chunneling |
Chunneling happens in order of initiator-Id.
De-Cloak: (v4.0i/3.4k:) Ships which initiate a chunnel or act as chunnel Mate must de-cloak.
Anti-Cloak | |
Stage name: AntiCloak_2 |
Loki ships decloak again, in Id order. This uses the new positions of the Lokis and of the cloakers. A cloaker going from A to B will not be decloaked by a Loki going from B to A (assuming B and A are more than 10 ly apart).
De-Cloak: Ships affected by an anti-cloak ship must de-cloak at once. After this phase, ships which got over the damage limit (by a Glory Device) must de-cloak, too.
Colonize Mission | |
Stage name: ColonizeMission |
The Colonize mission, in ship Id order.
Supply Repair | |
Stage name: SupplyRepair_2 |
Ships repair themselves, again.
Starbase Missions II | |
Stage name: BaseMissions_2 |
In starbase Id order, does...
Combat | |
Stage name: Combat |
Resolves each group of ships and planets according to the battle order rules.
De-Cloak: (v4.0j:) Ships that reach the DamageLevelForCloakFail or lose their fuel must decloak at once. Likewise, ships that change ownership must decloak.
Supply Repair | |
Stage name: SupplyRepair_3 |
Ships repair themselves, again.
Terraforming | |
Stage name: Terraforming |
Terraform ships operate in Id order.
De-Cloak: After this (and the previous) stages, ships may have lost enough fuel or got damaged to be unable to cloak any longer. Since ships now decloak immediately during combat, this stage doesn't have too much of an effect now, but it will be useful if you use a third-party combat system.
Wormhole Scanning | Since: PHost 4.0e |
Stage name: WormholeScan |
Ships scan for wormholes, in Id order.
In PHost up to version 4.0d, this stage is executed
just after mine
scanning.
Sensor Sweep | |
Stage name: SensorSweep |
Normal Sensor Sweep and Bioscanning, in Id order.
Note that when ExtendedSensorSweep is enabled, the mine scanning part of sensor sweep happens in MineSweeping, before movement. The wormhole scanning happens in WormholeScan.
Special Missions II | |
Stage name: SpecialMissions_2 |
First, does Pillage and Rebel Ground Attack in per-player Id order. Second, Dark Sense generates messages.
Planetary Production | |
Stage name: PlanetaryProduction |
Mines and factories produce, Bovinoid natives provide supplies. Afterwards, trans uranium decay forms new minerals in planet core (TransuraniumDecayRate).
Planetary Happiness | |
Stage name: PlanetaryHappiness |
Happiness changes according to the tax rates set by the client. When the happiness is below 30, the tax rate is set to zero (and happiness is computed using that value).
Planetary Taxation | |
Stage name: PlanetaryTaxation |
Tax revenue generated.
Planetary Growth | |
Stage name: PlanetaryGrowth |
Colonists and natives grow.
Planetary Limit Checks | |
Stage name: PlanetaryLosses |
For each planet:
Ship Building | |
Stage name: ShipBuilding_2 |
Perform remaining ship build orders, to fill up slots freed by combat.
Assimilation | |
Stage name: Assimilation |
Cyborgs assimilate natives.
Super Spy | |
Stage name: SuperSpyMission |
Super Spy ships generate their reports, in Id order.
Exploration | |
Stage name: ShipExploration |
Ships orbiting a foreign planet (and having fuel) generate exploration reports.
Experience upgrades | |
Stage name: Experience |
(v4.0:) Ships and planets gain experience corresponding to their actions this turn. PHost also sends out experience reports here.
There are two ways to manipulate the host sequence. Note that you can only add (and sometimes remove) actions, you can not re-order stages.
Whenever you add one of your programs into the sequence, PHost will save all its data to disk, close all files and so on, and run your program. It will then read back the host data, verify it, and continue.
Host 3.20 introduced the auxhost1.ini and auxhost2.ini hooks. Host 3.22.005 introduced auxbc.ini. PHost supports these hooks as well.
These .ini files are text files in the game directory, each line containing a command to be run.
PHost does not support auxbatt.ini (you can use the PControl method as mentioned below to achieve the same results), and it does not support file extensions other than .ini for these files (Tim's host will also run auxhost1.exe and auxhost1.bat and so on).
In pconfig.src, a section pcontrol configures the host sequence. For each stage, you can specify some actions to do.
Note again that you can not change the order of
the actions, no matter in what order names appear in that
section.
The pcontrol section can contain lines of the form
StageName = Action |
where the StageName is specified in the above description of the stages, and the Action is one of the following:
The action names can be abbreviated up to their first letter only.
Each command can be one of the following:
(v4.0c:) You can specify multiple actions by giving multiple assignments to the same stage name. The actions will be executed in order. The stage is skipped when at least one Skip or Replace is used, otherwise the stage will be executed. Therefore, the sequence of actions is:
In PHost version 3.4f/4.0b and older, you can have at most one action per stage.
(v4.0k:) Instead of making auxhost1.ini and auxhost2.ini files, you can specify the commands directly in pconfig.src.
Auxhost1 = Command Auxhost2 = Command |
The command is just a reference to another ini file or a shell command, as in Auxhost1 = *mfq %d. There is no point in specifying Before, Skip, etc.
(v4.0k:) Many add-ons are used again and again with the same set of PControl settings. To simplify setup, you can write these PControl settings in a separate file, and refer to that file from the PControl section.
Addon = filename |
PHost will look for that file in both the game and the root directory, so you can use the same file for many games. PHost will look for a %pcontrol section delimiter and read just that section. Therefore, if the add-on understands these section delimiters, you can directly place the instructions in the add-on configuration file.
Example: Here is an example to use with the Stargate add-on:
% pcontrol TowResolution = Execute *stargate 1 %d %r SensorSweep = Execute *stargate 2 %d %r |
You would refer to that file by using Addon = stargate.txt (unfortunately, Stargate doesn't support % section delimiters).
As mentioned above, there are two ways to specify commands to execute. You can place them in an .ini file, one per line, or you can specify them directly in pconfig.src.
Commands are handed to the operating system's command shell (i.e. command.com or cmd.exe under Microsoft operating systems, /bin/sh on Unix), one by one. Therefore, fancy things such as multi-line commands or goto are not permitted.
The following symbols are handled specially:
Here are all the stages of phase 2, in order of execution, with links to their descriptions:
Last updated 05 January 2007.