[PHost Logo]

Hosting Stages
The Portable Host
Version 4.0h

Index

Introduction

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.

Back to top


Host Order

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.

Phase 1 - Turn Processing

(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.

Phase 2 - Host Action

Note on Cloaking: All places where cloaking can fail have been identified in this listing. 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.

(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.

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. The new friendly code is defined by the lowest-Id spy at 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. 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).

Training
Stage name: Training

(v4.0:) In Id order, 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
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.

Special Missions I
Stage name: SpecialMissions_1

New v4.0h: If the refit command was used, all Super Refit orders using this command are processed first, in ship Id order.

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 Gather-build Torpedoes missions.

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 Missions I
Stage name: BaseMissions_1

In starbase Id order, does...

Supply Repair
Stage name: SupplyRepair_1

Ships repair themselves using supplies.

Tow-Capture
Stage name: BoardingParties

Tow-capture ships, in tower-Id order.

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.

Glory Devices Pop
Stage name: GloryDevices

Glory devices go off in Id order.

Chunneling
Stage name: Chunneling

Chunneling happens in order of initiator-Id.

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.

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.

Wormhole Scanning
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. 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.

Phase 3 - Result Generation

Back to top


Manipulating the Host Sequence

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.

The Auxhost Files

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).

The PControl Section

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.

Each line in the pcontrol section has 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.

INI Files

The .ini files specified with certain PControl actions, and the auxhost files, are normal text files containing shell commands to be executed, one per line. PHost will execute them line by line. Therefore, you can not have multi-line commands, goto and such fancy things in a .ini file. If you need that, make a real shell script/batch file and run that.

Back to top


Quick Overview

Here are all the stages of phase 2, in order of execution, with links to their descriptions:

Back to top


This document is maintained by The Portable Host Project (support@phost.de).

Last updated 11 July 2004.