Table of Contents
1.08b source code .... stuff ...
Random Data Obtained from the C++ Source Code
I just need a place to plonk this stuff for the moment, it really needs to go somewhere else later. -Weaver
AI States 1.08b
This might be useful for debuggery? Also a full list of hardcoded controllers because the states vary per controller. From TSE/TSEShipControllersImpl.h
class CStandardShipAI : public CBaseShipAI enum StateTypes { 0 stateAttackingOnPatrol, // Attacking m_pTarget while on patrol 1 stateAttackingTarget, // Attacking m_pTarget 2 stateAttackingThreat, // Attacking m_pTarget to protect principal 3 stateDeterTarget, // Attack m_pTarget, but stop if target doesn't attack back 4 stateDeterTargetNoChase, // Attack m_pTarget, but don't chase it 5 stateEscorting, // Escorting m_pDest 6 stateHolding, // Doing nothing indefinitely 7 stateLookingForLoot, // Looking for loot in the system 8 stateLooting, // Looting stuff from station 9 stateLootingOnce, // Looting stuff from station 10 stateMaintainBearing, // Move in m_rDistance (angle) direction // until we run into enemies. 11 stateNone, // Ship needs to consult orders 12 stateOnCourseForDocking, // Heading for m_pDest to dock 13 stateOnCourseForStargate, // Heading for m_pDest to gate out 14 stateOnPatrolOrbit, // Orbiting m_pDest at m_rDistance 15 stateReturningFromThreat, // Dock with m_pDest 16 stateWaiting, // Waiting for countdown (m_iCountdown) 17 stateWaitingForThreat, // Waiting for a threat to m_pDest 18 stateWaitingUnarmed, // If threat shows up, we gate out 19 stateWaitForPlayerAtGate, // Waiting for player at gate 20 stateFollowing, 21 stateOnCourseForLootDocking, // Going to dock with loot 22 stateDeterTargetWhileLootDocking, // Attack the target, but continue towards loot 23 stateFollowNavPath, // Follow current nav path 24 stateReturningViaNavPath, // Follow current nav path 25 stateOnCourseForDockingViaNavPath, // Follow current nav path 26 stateOnCourseForPatrolViaNavPath, // Follow current nav path 27 stateOnCourseForPoint, // Going to a given point 28 stateWaitingForTarget, // Waiting for m_pTarget 29 stateWaitingForEnemy, // Waiting for an enemy 30 stateAttackingTargetAndAvoiding, // Attacking m_pTarget and avoiding enemy stations 31 stateAvoidingEnemyStation, // Attacking m_pTarget and avoiding m_pDest 32 stateOnCourseForPointViaNavPath, // Follow current nav path 33 stateBombarding, // Attacking m_pTarget while holding 34 stateApproaching, // Get within m_rDistance of m_pDest 35 stateAimingAtTarget, // Aiming at m_pTarget 36 stateOnCourseForOrbitViaNavPath, // Follow current nav path 37 stateOrbit, // Orbit m_pTarget 38 stateReturningToEscort, // Return to m_pDest from an attack 39 stateHoldingCourse, // Hold course 40 stateAttackingPrincipalThreat, // Attacking m_pTarget, which attacked principal 41 stateTurningTo, // Turning to angle 42 stateAttackingTargetAndHolding, // Attacking m_pTarget while holding position }; class CAutonAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateEscorting, 2 stateAttackingTarget, 3 stateOnCourseForStargate, 4 stateFollowing, 5 stateWaiting, }; class CFerianShipAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateOnCourseForMine, 2 stateMining, 3 stateAttackingThreat, 4 stateOnCourseForStargate, 5 stateAvoidThreat, 6 stateAttackingTarget, 7 stateWaitForPlayerAtGate, }; class CFleetCommandAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateAttackAtWill, 2 stateChargeInFormation, 3 stateFormAtRallyPoint, 4 stateAttackFromRallyPoint, 5 stateOnCourseForStargate, 6 stateWaiting, 7 stateWaitingForThreat, }; class CFleetShipAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateKeepFormation, 2 stateAttackAtWill, 3 stateAttackInFormation, 4 stateAttackTarget, 5 stateOnCourseForStargate, // Heading for m_pDest to gate out 6 stateOnCourseForDocking, // Heading for m_pDest to dock 7 stateWaitForPlayerAtGate, 8 stateOnPatrolOrbit, 9 stateAttackOnPatrol, 10 stateWaiting, }; class CGaianProcessorAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateLookingForWreck, 2 statePulverizingWreck, 3 stateConsumingWreck }; class CGladiatorAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateAttackingTarget, 2 stateOnCourseForDocking, 3 stateOnCourseForStargate, }; class CZoanthropeAI : public CBaseShipAI enum StateTypes { 0 stateNone, 1 stateAttackingThreat, 2 stateOnCourseForStargate, 3 stateReturningFromThreat, 4 stateWaitingForThreat, 5 stateOnPatrolOrbit, 6 stateAttackingOnPatrol, 7 stateOnEscortCourse, 8 stateWaiting, };
Distance
Having nothing to do with scale, but with positioning and travel distance.
From TSE/TSETypes.h
- Light_Speed = Light_Second = 299792.5 km
- Klicks_Per_Pixel = 12500.0
- Therefore 1 light_second = 23.9834 pixels (how did I get 18.3something last time?)
Devices
From TSE/CShip.h, I think
- Drive devices do replace both maxspeed and thrust, nothing is additive
Encounters
From TSE/CSystem.cpp
- A system spawns an encounter every 6000 to 9000 ticks
- There is a 10% chance of just reading from a level-based random encounter list
- Otherwise a list of all the encounter tables and events attached to objests in the system is collated based on raritys given, and one is picked from that list.
Rarity
From TSE/TSETypes.h
I think george may have said this already, but I looked it up in relation to the last exploration anyway
enum FrequencyTypes { ftCommon = 20, ftUncommon = 10, ftRare = 4, ftVeryRare = 1, ftNotRandom = 0 };
I believe this is generally used by the game by creating a list with [rarity] copies of each item, and then rolling against that list.
System Map Grid
The map grid is 100 ls per square:
TSE/CSystem.cpp:3216: PaintViewportGrid(Dest, rcView, Trans, CVector(), 100.0 * LIGHT_SECOND);
Shield Regen Rates
Shield regen in the xml seems to be based on hp per 6 seconds, but is broken down into different actual periods of no more than 3 seconds via a rather complicated wad of math in CShieldClas.cpp:
// Load regen value int iRegen; if (pDesc->FindAttributeInteger(REGEN_ATTRIB, &iRegen)) { // Regen specified in hp per 180 ticks. We need to convert that to RegenHP and RegenRate if ((iRegen % 12) == 0) pShield->m_iRegenRate = 15; else if ((iRegen % 10) == 0) pShield->m_iRegenRate = 18; else if ((iRegen % 9) == 0) pShield->m_iRegenRate = 20; else if ((iRegen % 6) == 0) pShield->m_iRegenRate = 30; else if ((iRegen % 5) == 0) pShield->m_iRegenRate = 36; else if ((iRegen % 4) == 0) pShield->m_iRegenRate = 45; else if ((iRegen % 3) == 0) pShield->m_iRegenRate = 60; else pShield->m_iRegenRate = 90; pShield->m_iRegenHP = iRegen * pShield->m_iRegenRate / 180; int iDepletion; if (pDesc->FindAttributeInteger(DEPLETION_DELAY_ATTRIB, &iDepletion)) pShield->m_iDepletionDelay = iDepletion / pShield->m_iRegenRate; else pShield->m_iDepletionDelay = 360 / pShield->m_iRegenRate; } else { pShield->m_iRegenHP = pDesc->GetAttributeInteger(REGEN_HP_ATTRIB); pShield->m_iRegenRate = (int)((pDesc->GetAttributeInteger(REGEN_TIME_ATTRIB) / STD_SECONDS_PER_UPDATE) + 0.5); pShield->m_iDepletionDelay = pDesc->GetAttributeInteger(DEPLETION_DELAY_ATTRIB); if (pShield->m_iRegenRate == 0) { pShield->m_iRegenRate = 15; pShield->m_iRegenHP = 0; } }
Enhancment
From TSE/TSEDesign.h … think this is more complete that the data we have in legend?
enum ItemEnhancementTypes { etNone = 0x0000, etBinaryEnhancement = 0x0001, etLoseEnhancement = 0x0002, // Lose enhancements etStrengthen = 0x0100, // +hp, data1 = %increase (10% increments) etRegenerate = 0x0200, // data1 = rate etReflect = 0x0300, // data2 = damage type reflected etRepairOnHit = 0x0400, // repair damage on hit, data2 = damage type of hit etResist = 0x0500, // -damage, data1 = %damage adj etResistEnergy = 0x0600, // -energy damage, data1 = %damage adj (90%, 80%, etc) etResistMatter = 0x0700, // -matter damage, data1 = %damage adj (90%, 80%, etc) etResistByLevel = 0x0800, // -damage, data1 = %damage adj, data2 = damage type etResistByDamage = 0x0900, // -damage, data1 = %damage adj, data2 = damage type etResistByDamage2 = 0x0a00, // -damage, data1 = %damage adj, data2 = damage type etSpecialDamage = 0x0b00, // Immunity to damage effects: // data2 = 0: immune to radiation // data2 = 1: immune to blinding // ... see SpecialDamageTypes etImmunityIonEffects = 0x0c00, // Immunity to ion effects (blinding, EMP, etc.) // (if disadvantage, interferes with shields) etPhotoRegenerate = 0x0d00, // regen near sun etPhotoRecharge = 0x0e00, // refuel near sun etPowerEfficiency = 0x0f00, // power usage decrease, 01 = 90%/110%, 02 = 80%/120% etSpeed = 0x1000, // decrease cycle time etTurret = 0x1100, // weapon turret, data1 is angle etMultiShot = 0x1200, // multiple shots, data2 = count, data1 = %weakening etData1Mask = 0x000f, // 4-bits of data (generally for damage adj) etData2Mask = 0x00f0, // 4-bits of data (generally for damage type) etTypeMask = 0x7f00, // Type etDisadvantage = 0x8000, // If set, this is a disadvantage };
DamageTypes
They're refrenced above, and this contains george's comments on them. TSE/TSEDesign.h
enum DamageTypes { damageError = -100, // invalid damage damageGeneric = -1, // generic damage damageLaser = 0, // standard lasers damageKinetic = 1, // mass drivers damageParticle = 2, // charged particle beam damageBlast = 3, // chemical explosives damageIonRadiation = 4, // ionizing radiation damageThermonuclear = 5, // hydrogen bomb damagePositron = 6, // anti-matter charged particles damagePlasma = 7, // fusion weapons damageAntiMatter = 8, // anti-matter torpedo damageNano = 9, // nano-machines damageGravitonBeam = 10, // graviton beam damageSingularity = 11, // spacetime weapons damageDarkAcid = 12, // exotics damageDarkSteel = 13, // exotics damageDarkLightning = 14, // exotics damageDarkFire = 15, // exotics damageCount = 16 };
SpecialDamageTypes
Wormhole? TSE/TSEDesign.h
enum SpecialDamageTypes { specialRadiation = 0, specialBlinding = 1, specialEMP = 2, specialDeviceDamage = 3, specialDisintegration = 4, specialMomentum = 5, specialShieldDisrupt = 6, specialWMD = 7, specialMining = 8, specialDeviceDisrupt= 9, specialWormhole = 10, specialFuel = 11, specialShatter = 12, // max 15 (because it is used in CItemEnhancement) };
Sovereigns and Alignment
Oh, RPC must have added this for me, cool. This is from TSE/CSoverign.cpp and TSE/TSEDesign.h … I think. soverign and some header file anyway.
enum DispositionClasses { alignNone = -1, alignConstructiveChaos = 0, alignConstructiveOrder = 1, alignNeutral = 2, alignDestructiveOrder = 3, alignDestructiveChaos = 4, }; class CSovereign : public CDesignType { public: enum Alignments { alignUnknown = -1, alignRepublic = 0, // constructive community knowledge evolution (constructive chaos) alignFederation = 1, // constructive community knowledge tradition (constructive order) alignUplifter = 2, // constructive community spirituality evolution (constructive chaos) alignFoundation = 3, // constructive community spirituality tradition (neutral) alignCompetitor = 4, // constructive independence knowledge evolution (neutral) alignArchivist = 5, // constructive independence knowledge tradition (constructive order) alignSeeker = 6, // constructive independence spirituality evolution (constructive chaos) alignHermit = 7, // constructive independence spirituality tradition (constructive order) alignCollective = 8, // destructive community knowledge evolution (destructive chaos) alignEmpire = 9, // destructive community knowledge tradition (destructive order) alignSterelizer = 10, // destructive community spirituality evolution (destructive chaos) alignCorrector = 11, // destructive community spirituality tradition (destructive order) alignMegalomaniac = 12, // destructive independence knowledge evolution (destructive chaos) alignCryptologue = 13, // destructive independence knowledge tradition (destructive order) alignPerversion = 14, // destructive independence spirituality evolution (destructive chaos) alignSolipsist = 15, // destructive independence spirituality tradition (destructive order) alignUnorganized = 16, // unorganized group of beings (neutral) alignSubsapient = 17, // animals, zoanthropes, cyberorgs, and other creatures (neutral) alignCount = 18, }; enum Disposition { dispEnemy = 0, dispNeutral = 1, dispFriend = 2, }; CSovereign (void); ~CSovereign (void); void DeleteRelationships (void); inline void FlushEnemyObjectCache (void) { m_pEnemyObjectsSystem = NULL; } Disposition GetDispositionTowards (CSovereign *pSovereign); inline const CSpaceObjectList &GetEnemyObjectList (CSystem *pSystem) { InitEnemyObjectList(pSystem); return m_EnemyObjects; } CString GetText (MessageTypes iMsg); inline bool IsEnemy (CSovereign *pSovereign) { return (m_bSelfRel || (pSovereign != this)) && (GetDispositionTowards(pSovereign) == dispEnemy); } inline bool IsFriend (CSovereign *pSovereign) { return (!m_bSelfRel && (pSovereign == this)) || (GetDispositionTowards(pSovereign) == dispFriend); } static Alignments ParseAlignment (const CString &sAlign); void SetDispositionTowards (CSovereign *pSovereign, Disposition iDisp); // CDesignType overrides static CSovereign *AsType (CDesignType *pType) { return ((pType && pType->GetType() == designSovereign) ? (CSovereign *)pType : NULL); } virtual bool FindDataField (const CString &sField, CString *retsValue); virtual DesignTypes GetType (void) { return designSovereign; } CSovereign::Disposition g_DispositionTable[5][5] = { // WE are constructive chaos... { CSovereign::dispFriend, // THEY are constructive chaos CSovereign::dispFriend, // THEY are constructive order CSovereign::dispNeutral, // THEY are neutral CSovereign::dispEnemy, // THEY are destructive order CSovereign::dispEnemy, // THEY are destructive chaos }, // WE are constructive order... { CSovereign::dispNeutral, // THEY are constructive chaos CSovereign::dispFriend, // THEY are constructive order CSovereign::dispNeutral, // THEY are neutral CSovereign::dispEnemy, // THEY are destructive order CSovereign::dispEnemy, // THEY are destructive chaos }, // WE are neutral... { CSovereign::dispNeutral, // THEY are constructive chaos CSovereign::dispNeutral, // THEY are constructive order CSovereign::dispNeutral, // THEY are neutral CSovereign::dispNeutral, // THEY are destructive order CSovereign::dispEnemy, // THEY are destructive chaos }, // WE are destructive order... { CSovereign::dispEnemy, // THEY are constructive chaos CSovereign::dispEnemy, // THEY are constructive order CSovereign::dispNeutral, // THEY are neutral CSovereign::dispNeutral, // THEY are destructive order CSovereign::dispEnemy, // THEY are destructive chaos }, // WE are destructive chaos... { CSovereign::dispEnemy, // THEY are constructive chaos CSovereign::dispEnemy, // THEY are constructive order CSovereign::dispEnemy, // THEY are neutral CSovereign::dispEnemy, // THEY are destructive order CSovereign::dispEnemy, // THEY are destructive chaos }, }; const DWORD ALIGN_FLAG_CONSTRUCTIVE = 0x00000001; const DWORD ALIGN_FLAG_DESTRUCTIVE = 0x00000002; const DWORD ALIGN_FLAG_COMMUNITY = 0x00000004; const DWORD ALIGN_FLAG_INDEPENDENCE = 0x00000008; const DWORD ALIGN_FLAG_KNOWLEDGE = 0x00000010; const DWORD ALIGN_FLAG_SPIRITUALITY = 0x00000020; const DWORD ALIGN_FLAG_EVOLUTION = 0x00000040; const DWORD ALIGN_FLAG_TRADITION = 0x00000080; struct SAlignData { int iNameLen; char pszName[32]; DispositionClasses iDispClass; DWORD dwFlags; }; static SAlignData ALIGN_DATA[CSovereign::alignCount] = { { CONSTDEF("republic"), alignConstructiveChaos, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("federation"), alignConstructiveOrder, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_TRADITION }, { CONSTDEF("uplifter"), alignConstructiveChaos, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("foundation"), alignNeutral, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_TRADITION }, { CONSTDEF("competitor"), alignNeutral, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("archivist"), alignConstructiveOrder, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_TRADITION }, { CONSTDEF("seeker"), alignConstructiveChaos, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("hermit"), alignConstructiveOrder, ALIGN_FLAG_CONSTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_TRADITION }, { CONSTDEF("collective"), alignDestructiveChaos, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("empire"), alignDestructiveOrder, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_TRADITION }, { CONSTDEF("sterilizer"), alignDestructiveChaos, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("corrector"), alignDestructiveOrder, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_COMMUNITY | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_TRADITION }, { CONSTDEF("megalomaniac"), alignDestructiveChaos, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("cryptologue"), alignDestructiveOrder, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_KNOWLEDGE | ALIGN_FLAG_TRADITION }, { CONSTDEF("perversion"), alignDestructiveChaos, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_EVOLUTION }, { CONSTDEF("solipsist"), alignDestructiveOrder, ALIGN_FLAG_DESTRUCTIVE | ALIGN_FLAG_INDEPENDENCE | ALIGN_FLAG_SPIRITUALITY | ALIGN_FLAG_TRADITION }, { CONSTDEF("unorganized"), alignNeutral, 0 }, { CONSTDEF("subsapient"), alignNeutral, 0 }, };