[PHost Logo]

Hosting Stages
The Portable Host
Version 4.0a

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.

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.

This file documents what the stages do, and how to set up a game where add-ons run between stages.

Back to top


Host Order

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.

Phase 2 - Host Action

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.

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 spier at each planet.

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 Dumpscannot 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 Transfercannot 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 Shipscannot 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

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

After this (and the previous) stages, ships may have lost enough fuel to be unable to cloak any longer.

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, in Id order, starting with a random ship. When the new minefield overlaps an enemy one, mines will explode here.

A well-known "misfeature" of PHost is that mines which overlap by any other means (laid by CPlayer? alliance dropped?) will not explode. This is considered a bug but no good fix is known.

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
Stage name: WormholeScan

Ships scan for wormholes, in Id order.

Web Draining
Stage name: WebDraining

Ships inside web minefields lose fuel (multiple times if in multiple webs).

After this stage, ships may have lost enough fuel to be unable to cloak any longer.

Special Missions I
Stage name: SpecialMissions_1

In ship Id order, does

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.

Movementcannot be skipped
Stage name: Movement

Ships that move can run on mines and get damaged. Ships running on web mines lose fuel. Ships can not run on mines during...

After this stage, ships may have lost enough fuel to be unable to cloak any longer.

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

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, the orders

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.

After this (and the previous) stages, ships may have lost enough fuel or get damaged to be unable to cloak any longer.

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. Likewise, 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 form 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

New 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 an action 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.

INI Files

The .ini files specified with Replace and Execute, and the auxhost files, are normal text files containing shell commands to be executed, one per line. PHost will execute them line by line (that is, you can not have multi-line commands, goto and such fancy things in a .ini file).

For the PControl method, you can also specify a section delimiter with the file name:

Stage = Execute file.ini%section

PHost will then run only the specified section; sections are delimited with % as in pconfig.src.

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[Remote] (support@phost.de).

Last updated 18 May 2003.