jacquelin >> added on 2007-10-07 The following link point to the career management architecture items for reference. Career_management

jacquelin >> added on 2007-10-02 The following items and topics should be reorganised inside a global perspective over career management evolution and associated operations. Duncan is supposed to check the overall concept and sets proper aspects to get things in a logical/ more integrated way.

Factions

Factions represent the owner of the ships and stations. Factions have relationships to one another. Some factions are allies and others are enemies who will shoot on sight.

The EoC game allows 54 factions. Torn Stars cannot define new faction objects, but we can rename the original factions to create the factions we need for the Middle States.

The middle states has many more than 54 factions, so some careful reduction is made. We want a good mix of criminal, government, corporations, and civilians so that we can properly represent the wars and conflicts that are currently going on inside the middle states.

Faction Types

Factions fall into several major types like Governments or Major Criminals (pirates). The type of faction controls how that faction behaves.

The behavior of a faction is defined by the types of stations they can construct, and the kinds of fleet operations they can build.

Ms_mod_main/metagame_faction.ini defines the stations that each type of faction can construct.

Faction types are described in this web page, or in the comments of game files.

http://www.i-war2.com/forum/topic.asp?TOPIC_ID=2492

  • Independents (civilians essentially)

  • Governments

  • Mega corporations

  • Independent Criminals

  • Major Criminals (pirate clans)

Faction List

The faction list is read when the game is started to define the game factions. All the middle states factions are defined here.

Ms_mod_main/faction_info.ini

Faction Standing

EoC factions have relations with one another and the player, such as Hate, Like, Love. These faction standings determine if the factions ships attack one another on sight.

These standing levels are also used by the fleet objects to plan which factions they will attack, raid, or try to assist.

Ms_mod_main/faction_info.ini

After a faction is defined, there is a list of adjustments to the default “neutral” standing. Use these faction levels to setup conflicts between the games factions.

Faction Ships

Every faction has a “fleet style” definition. This fleet style is used to select the appropriate model when a new ship is created. For example, when the game needs to create a new patcom patrol ship, it will use the owning factions fleet style to look up the exact model of ship that should be used.

In this way, pirates and governments can use much different ships.

The lookup table between the fleet styles and the ship models is defined in this INI file:

Ms_mod_ships/faction_ships.ini

Stations

The Flux engine removes all Sim objects from the game when the player is not nearby except station. Stations are never destroyed, they are only hidden from player view. Also stations are never “created”, instead they are defined using MAP files before the game is started. (Lpoints are a special kind of station that are also permanent. Whenever station is used, Lpoint could also be used).

Because stations are the only permanent objects, stations make up the “playing board” of the meta game. All other meta game objects must be placed in orbit around a station.

EoC defines dozens of station types in iMapEntities.h Torn Stars only uses a few of these station types.

Station types control the kinds of cargo that are bought and sold. And the station type controls the kinds of fleets that a station can build. Not all stations can build fleets.

Stations support a limited number of fleet operations. This keeps the total number of fleets in Torn Stars to a reasonable number. If there was no limitations, the game would become overwhelmed.

Station Type List

Ms_mod_main/metagame_production.ini defines the fleet operations that are built by each station. Not all stations build fleets. Some stations can build more fleets than others.

This control file is one of the most important in the game, because it controls all the growth in the game. It controls the types of fleets that are spawned. It controls the speed that new fleets are spawned. And it controls how many fleets each station can support at any one time.

Station Status

Stations always exist in the game, so a special status value is needed to determine if the player can see the station, and what the station does.

Never Built

This station has never been built. Never built stations are brought into existence by building them. Never built stations do not appear on star maps. Mines start as Empty instead of never built.

Empty

An empty station has no owner and is abandoned. These stations can be claimed by a faction and repaired. Empty stations make good hiding placed because patrols don't tend to go here.

Building

Stations under construction are given the "building" status. The station itself is not yet visible, but environment objects can be used to put construction equipment around the station.

Normal

Stations that have been built and are operating normally are Normal. These are the stations that are well patrolled, have guards fleets, and buy and sell things.

Leaving

Leaving stations are in the process of being abandoned to empty. This state exists to allow special environment objects during this state, such as leaving transport ships. Perhaps the player can pick up cheap goods here.

This state was meant to handle the case when stations go bankrupt and close down due to piracy or other financial crisis.

Fleeing

Fleeing stations have just been destroyed, but not everyone has left the site of the destruction. This state exists to allow placing life pods, rescue ships, and valiant station defenders who need help.

Destroyed

This is the state of a station after it was once built, and then destroyed. It will still show on star maps. Environment objects can show the shattered remains of the station (if desired). Destroyed stations make good hiding placed.

Station Category

ESC_Mine

All mines are in this category. All mines must have a supporting asteroid.

ESC_Process

All refining or processing plants.

ESC_Manufacture

All manufacturing facilities.

ESC_Research

All research bases, corporate, or government.

ESC_Habitat

All habitats of any size.

ESC_Headquarters

Corporate headquarters.

ESC_Pirate

All pirate or rebel bases.

ESC_Transport

All transportation related stations like waystations, or repair yards.

ESC_Government

All government administration centers but not military bases.

ESC_Military

All military bases, government or corporate.

Fleet Operations

Fleet operations are abstract representations fleets of ships. A police patrol would be a fleet operation and also a fleet of pirate raiders.

The Flux engine (EoC) only allows a few ships to exist in the game at any one time. More than a few dozens ships will bring the games frame rates to a crawl. Fleet Operations are a method of putting hundreds or thousands of ships into the meta game, without having more than a few dozen “real” ships in the game at any one time.

Fleet operations are abstract. And they store the number of fleets as a single integer. Fleet operations fight with one another in the abstract, doing “fleet points” of damage, much like hit points.

If the player arrives at a the same station where a fleet operation is located, then the fleet operation is “instantiated” into real ships the player can see and fight. The instantiation is done by separate pog code called a POG Class Object. POG Class Objects are defined in another section.

Each abstract Fleet Operation supports several standardized function calls. These are

  • New

Called when an object is created to attach needed properties and do any initialization.

  • Save

Called to save any custom properties to globals when the player does a save game.

  • Restore

Called to restore any custom properties from globals when a saved game is restored.

  • Update

This is the fleets behavior function. It is the fleets AI. Every few days of game time the fleet Update function is called to let the fleet examine it’s current status and plan what it should do.

The Update function is used to attack other fleets at the same station. Or retreat if the fleet is damaged. It is used to heal a fleet. It is used to move the fleet to a new station so it can attack other fleets. The behavior is entirely up to the specific fleet operation. But every fleet operation has an Update function.

Fleet Movement

tLCenter.pog

Stations and Lpoints make up the meta game playing board. Fleets only exist in orbit around a station or lpoint. Moving fleets involves removing them from one station and moving them to another station. It is important to understand that fleets don't exist as ship models (or objects of class Sim) at this point. They only exist as a generic object in a list property attached to the station.

The reason is that objects that have not been "placed" into the game, use almost no game resources. This means that the 2000 fleets that would otherwise crush the frame rate to zero, have no impact on frame rates at all. But only if the fleets are represented as non-placed objects stored in list properties around the stations.

The tLCenter package was written to handle placing items on the meta game game board. When a fleet is moved from one location to another, it is just pulled out of one stations list of fleets and placed into another stations list of fleets.

The player watch task keeps track of where the player is located. When the player moves near a station, all the fleets at that station are "woken up" and turned into "real" ships with real behavior. This allows the illusion of a huge world with thousands of fleets, but really only ever a handful of ships in existence at any one time.

Customs Patrol

tsFoCustoms.pog is the abstract fleet operation behavior.

tPcCustomsToll.pog is the player visible behavior.

coded

The customs patrol collects taxes from the player on goods transported. Customs patrols move near lpoints or travel from production station to production station.

A customs patrol will retreat to its home station (where it was built) if it has more than half damage so it can repair. While repairing, it will stay home. If it is outnumbered by hostile ships it will retreat to any non-hostile station.

Every 1-7 days the customs patrol will move to a new lpoint or station. If there is an lpoint free (has no other customs patrols) it will move to the lpoint (lpoints have highest priority). Else it will move to a non-hostile production station (mining, refining, manufacturing) and patrol there.

Attack Fleet

tsFoFleetAttack.pog coded

Attack fleets patrol neutral or better stations of any type that are operating normally in the same system as the attack fleet. Attack fleets are like very well armed navy patrols.

Attack fleets will retreat home (building station) when they are down to 25% fleet points. Attack fleets will stay home and repair if damaged.

Every 1-7 days the attack fleet will move to a new neutral or better station.

Defense Fleet

tsFoFleetDefense.pog coded

Defense fleets patrol lpoints and neutral or better stations around the same planet as their home station. They prioritize lpoints that don't already have a defender or customs patrol. Defense fleets are well armed, but short ranged forces, like corporate security.

Defense fleets will retreat to home station when less than 25% of fleet points left. Defense fleets stay home repairing when damaged.

Every 1-7 days they move to a new lpoint or neutral or better station.

Patrol Fleet

tsFoPatrol.pog coded

Patrol fleets are local police or security patrols. Small in forces, they are like patrolling police cars. They flee if outgunned.

Patrols will retreat to home when 50% damaged. Patrols will stay home to repair if damaged.

Patrols will retreat to non-dislike station if out numbered by hostiles.

Every 1-7 days patrols will move to a new non-dislike station around the same planet as their home station.

Pirate Protection Racket

tsFoProtection.pog coded

The pirate protection racket charges the player a fee to not attack him.

A protection fleet will retreat home if 50% damaged. It will stay home and repair if wounded.

The protection fleet will flee if outnumbered by hostiles. They want to make profits, not die trying.

The protection racket parks on top of lpoint or production stations (mines, refineries, manufacturing) until it is chased away. If the protection racket is not wounded, and not at one of these locations, it will select a target to prey upon. It selects lpoints without any other operations first (lpoint tolls are best) in the system. If there are no lpoints it will select a non-dislike production station and go there.

Pirate Embezzler

tsFoEmbezzle.pog coded

The embezzler implements the pirate fence who will buy stolen cargo pods from the player. The fence tries to find a non-dislike production station and uses that station to launder stolen goods.

The Embezzler will retreat home if they have any damage. They will stay home if wounded.

The embezzler will flee to a different production station if there are any hostile ships nearby (cowardly).

Only if chased away will the embezzler leave a production station (why mess with a good thing). They will move to any non-dislike mine, refine, or manufacturing station and park there.

Pirate Raider

tsFoRaider.pog coded

The pirate raider preys on production stations the pirates don't like. They are not combat ships and avoid security stations and habitats. They will raid anywhere in the system.

If half damaged, they retreat home to repair. If wounded, they stay home to repair.

If they are outnumbered, they flee to a different station to raid. They are after profits, not suicide.

If they are not at a production station, they move to a random hostile or dislike production station. They only leave when chased away.

Pirate Thugs

tsFoThugs.pog coded

Pirate thugs are strong pirate defense fleets. They patrol near their home station attacking disliked and hostile fleets.

Pirate thugs retreat home when down to 25% of fleet points to repair. Pirate thugs stay home until repaired.

Pirate thugs flee to a non-dislike station when outnumbered. They will use empty stations to hide. Pirates are not duty driven like navy forces.

Every 1-7 days they will move to a different non-dislike station that is near the same planet as their home station.

Fleet Movement And Combat

Day Update

tEPlayerWatch.pog tEpicMain.pog

The player watch task checks the time and if a day has passed, it calls the day update function in tEpicMain.pog by the Task.Call mechansim. This function calls all other day update functions, including the fleet and station updates. As a side note, the POG linker does not support circular linking, which means that tEpicMain.pog calls out to other functions, but nothing can call tEpicMain directly. Instead the special indirect Task.Call mechanism must be used. This mechanism does not support parameters.

Station Update

tStationRules.pog MS_Mod_Main/metagame_production.ini

The tStationRules.UpdateAllStations function looks at every station in the game. Stations have timers for changing state. A station being constructed will be checked if the timer is up, and then it will be changed into a Normal station. Stations that are Leaving and Fleeing status also use the timer feature.

Stations have another timer for spawning operations. If a station is Normal status and the timer is up, it can spawn an operation if it has a free support slot. The number of support slots is in metagame_production.ini.

[HT_PirateCove]
max_ops=2
op_respawn_days=10
required_op[0]="HT_ThugsOp"
required_op[1]="HT_RaiderOp"
supported_op[0]="HT_EmbezzleOp"
supported_op[1]="HT_ProtectionOp"

This pirate cove can support 2 operations maximum, and will spawn a new operation every 10 days. Once the timer is up and the station has a free slot, the station rules code selects an operation from the required_op and supported_op lists. Required operations are the main purpose of the station, and supported operations are secondary. Required operations are built first, and if destroyed, replaced first, in the listed order. If any operation slots remain after the required ops are built, then the supported ops are selected from at random. This is explained in detail in the INI file and code.

Fleet Update

tsFleetOpUpdate.pog tsFleetOperation.pog tsFoPatrol.pog (as an example of a specific fleet Update function).

tEpicMain calls the tsFleetOpUpdate.UpdateAll() function to execute the fleets AI. Each fleet has a timer function that determines which day it gets to act next. This is to keep all 2000 - 5000 fleets from acting at the same time and crushing the frame rate.

tsFleetOpUpdate.UpdateAll pulls each operation out of the list, and if it has passed its run timer, calls tsFleetOperation.Update(operation). The tsFleetOperation branches based on the type of operation (we have no classes and methods which would be the real solution). Inside the specific update function for that specific operation type, the real work is done.

Fleet Combat

tsFleetOpCombat.pog

Operations can attack each other using a standard fleet operation combat package. This package just compares fleet strength and subtracts some fleets. This is abstract fighting between the fleets, it is done out of player view in this inexpensive manner. Attacks do damage to the attacker and defender both. Damage inflicted is a percentage of the size of each fleet. So a small attacker will do very little damage to a huge defender.

The abstract fleet to fleet combat is done as part of each operations update function. The design convention is that combat is resolved first in an update function. If the fleet survives, then it can choose to move. Then the fleet is moved to a new location.

The reason for this order is that it allows the player a chance to intercede in the fighting. If the fleets moved and then attacked, the fighting would be over before the player could get there to help out. With this order, the station can issue a distress call, and the player can fly over to see the whole battle. The player can then do damage "in the real game" and assist one side or the other.

Pog Classes

Pog object classes are a way of createing iSim.pog object constructions when the native POG language does not support defining new classes. These objects are typically used to create objects around stations that the player will see during the game, such as pirates, asteroid belts, rumor sellers, etc.

When a new object is created, an INI file is handed into the create function. This allows customizing the object. And it allows non-programmers a technique for modifying the game (such as placing unique asteroid belts etc.)

Asteroid Belt

tPcAsteroidBelt.pog

Cargo Ship

tPcCargoShip.pog

Customs Toll

tPcCustomsToll.pog

Embezzle Op

tPcEmbezzleOp.pog

Guards

tPcGuards.pog coded Guards are used to represent many of the attack and defense fleets. They have complex behavior.

Guards are created based on the number of fleet points in the fleet operation or station. Destroying guard ships subtracts the ships points from the station or operation. The player can hit and run destroy guards.

Guards fly a waypoint route around the station. If they see a dislike or hostile ship, they will attack.

Guards respond to nearby distress calls. Most ships will drop a distress event when attacked. Guards listen for these events. If the sender is close (200km) and is non-dislike then the guards will go after the attacker.

If a guard ship is attacked, they will all go after the attacker.

If the leader is killed, they keep fighting, but don't patrol. Guards don't attack friendly factions (to avoid stay shots starting wars).

Hired Ship

tPcHiredShip.pog

Pirate Toll

tPcPirateToll.pog coded

The pirate toll is created when the player moved near a pirate protection operation. Once the player is nearby it will charge the player a fee based on the amount of cargo carried. If they player refuses to pay, the pirates will attack. The pirates will also attack if the player is dislike or hostile standing.

The pirates will only charge the player once, but if the player does a save/restore, they will be charged again. If the player flees, the pirates will chase, but they will not jump to another system.

The number of pirates is determined by the number of fleet points in the operation. If ships are destroyed, they are deducted from the operations fleet points. If the number of fleet points goes to zero, the operation will be destroyed. The player can thus hit and run destroy a pirate toll over time.

Pod Scrapper

tPcPodScrapper.pog

Rumor Seller

tPcRumorSeller.pog

Fuel Tanker

tPcTankerShip.pog

Weapon Seller

tPcWeaponSeller.pog

Player Interaction

tsPilotSetup.pog tsEvent.pog tsDistress.pog

coded

A large set of utility routines has been coded to handle distress calls, events, reputation changes, and setting up ships. These routines allow the player to interact with the meta-game. When the player destroys ships, they will be subtracted from the owning station or operation. If all the ships in an operation are destroyed, the operation will be destroyed.

Environment System

tEPlayerWatch.pog

tLocationInit.pog

MS_Mod_Main/station_status_env.ini

The environment system is a large and complex part of Torn Stars. Almost everything the player sees in the game has been placed by the environment system. The system has a few major purposes

  • It allows non programmers to place objects around stations
  • It allows object placement based on the status of the station (destroyed can be different from normal).
  • It places objects when the player arrives at a station.
  • It facilitates removing objects when the player leaves a station.

Pog Layers

Pog has no way to define classes, so it does not support inheritance. It also does not support serializing classes. Pog Layers were created to work around these limitations by defining common methods and properties that can be attached to any game object.

Center Layer

tLCenter.pog

Objects in the Meta game can only be placed at stations. The stations form a chess board, and the objects move from station to station. (Some stations are just asteroids or empty points in space).

The center layer is a common way of recording where an object is located (which station it is currently orbiting). This location is called a “center”. Stations have themselves as their center.

Fleet Layer

tLFleet.pog

The fleet layer tracks the number of fleet points that a station or fleet object currently has. Abstract combat between fleets and stations deducts fleet points. Repairs and recruitement increase fleet points.

A ships “threat” level is the cost of that ship in fleet points. Bigger ships have higher threat levels and cost more fleet points.

Inventory Layer

tLInventory.pog

Production Layer

tLProduction.pog

Root Layer

tLRoot.pog

Trade Layer

tLTrade.pog