Programming

From PlanetsWiki

Jump to: navigation, search

This page is dedicated to the development of 3rd party applications for use with VGA Planets 4.

Contents

[edit] Overview

VGA Planets 4 is written in Power Basic by Tim Wisseman. Tim's site has some information on this topic here. He provides some sample code for Visual Basic 5.

When faced with the challenge of writing a tool for this software first you need to decide what programming language that you want to write it in. The simple approach would be to use the same language and version that Tim has to make sure that there are no incompatibilities or extra conversion steps that you will have to go through. You can program in other languages and hopefully you will find support for those here. Diplomat is written in Visual Basic 6. VGAP4Assistant is written in C.

[edit] V4Face2.DLL

This DLL gives you access to the ship and race files so that you can pull out their statistics and even their graphics.

For C++ programmers, there is a (non-official) example of how to interact with V4Face2.dll in order to extract race information from the various race and ship packs.

The VidiVici and ScriptZ0r source code include a PlanetsLib that is set up to allow reusable code in Visual Studio projects to interface with this DLL.

[edit] Race Data

To be able to retrieve race data from the RCE files, you will have to set up access to the DLL's subroutines then some variables to hold the results, then call the subroutine.

Here is an example in Visual Basic 6:

Type RaceFacetype
  version As Long
  racenum As Long
  FarmLow As Long      ' low farm climate
  FarmHigh As Long     ' high farm climate
  FavClimate As Long   ' climate this race likes the best
  PlanetStruct As Long ' structs that this race can build (bitfield)
     '// Bit 1 Training Center
     '// Bit 2 Factory
     '// Bit 3 Farm
     '// Bit 4 Smelter
     '// Bit 5 Mineral Mine
     '// Bit 6 City
     '// Bit 7 Pod Launch Pad
     '// Bit 8 Military Space Port
     '// Bit 9 Raid Shelter
     '// Bit 10 Public Space Port
     '// Bit 11 Med Lab
     '// Bit 12 Engine Plant
     '// Bit 13 Fighter Plant
     '// Bit 14 Ship Repair Shop
     '// Bit 15 Weapons Factory
     '// Bit 16 Ordnance Plant
     '// Bit 17 Government Center
     '// Bit 18 Terra Former
     '// Bit 19 Scanner
     '// Bit 20 Anti-Aircraft Gun
     '// Bit 21 Laser Cannon
     '// Bit 22 Air Attack Base
     '// Bit 23 Base Shield
     '// Bit 24 Assault Plant
     '// Bit 25 Ion Cannon
     '// Bit 26 Undercity
  ModMoney As Long
  ModMine As Long
  ModHappy As Long
  contraLikes(1 To 12) As Long
  combatCrew As Long
  combatColonist As Long
  combatTroop As Long
  combatGuard As Long
  pilotcrew As Long
  pilotTroop As Long
  pilotGuard As Long
  deltacolcrew As Long
  deltacrewtroop As Long
  deltatroophg As Long
  growthrate As Long
  forcedark As Long
  forcegood As Long
  pcfactor As Long
  spifactor As Long
  psifactor As Long
  leadership As Long
  lifeform As Long
     ' bit 0
     ' bit 1  Humanoid (ugly bags of mostly water)
     ' bit 2  Humanoid / Animal
     ' bit 3  Cyborg
     ' bit 4  Machine
     ' bit 5  Silicon based
     ' bit 6  Lizard / Humanoid
     ' bit 7  Transdimensional Energy Being
     ' bit 8  Lovecraftian
     ' bit 9  Living fire
     ' bit 10 Sentiel Plant
     ' bit 11 Consuming Darkness
     ' bit 12 Being of Light
     ' bit 13 Avian / Humanoid
     ' bit 14 Insectoid / Humanoid
  PR As Long
  law As Long             ' How lawful the race is
  resortE As Long         ' flag of what a resort does for race
  cantinaE As Long        ' flag of what a cantina does for the race
  shipB(1 To 40) As Long  ' the ship hulls that can be built
  PodSpeed As Long        ' How fast a cargo pod can travel under boost
  flag1 As Long           'Unused
  flag2 As Long
  flag3 As Long
  flag4 As Long
  flag5 As Long
  flag6 As Long
  flag7 As Long
  flag8 As Long
  flag9 As Long
  flag10 As Long
  nm1 As String * 44   ' Long Name
  nm2 As String * 20   ' Short name
  nm3 As String * 32   ' Leader name
  nmgov As String * 32 ' Governent Type
End Type
'Fighter Type FighterFaceType FighterSlot As Long '1 2 or 3 FighterRace As Long 'the racenum (race number) that built this beam As Long missile As Long oddsbeam As Long oddsmissile As Long maxEleOrd As Long maxfuel As Long MaxRange As Long Armor As Long SoftSpot As Long fuelburn As Long EvasiveMod As Long AttackMod As Long speed As Long cost As Long gen As Long 'recharge rate batt As Long 'max energy rangemissile As Long rangebeam As Long aMech As Long aTroop As Long aCity As Long aAir As Long dAir As Long dTroop As Long dMech As Long flag1 As Long 'Unused flag2 As Long flag3 As Long nm As String * 32 End Type
'Mech Unit Type MechFaceType mechslot As Long '1 2 or 3 mechrace As Long 'the racenum (race number) that built this aAir As Long aTroop As Long aCity As Long aMech As Long dAir As Long dTroop As Long dMech As Long cloak As Long speed As Long cost As Long special As Long ' bit 1 Spy ' bit 2 Mine ' bit 3 Farm ' bit 4 Covert Anti-Life ' bit 5 PSI Ops ' bit 6 Salvage Harvister ' bit 7 River Boat Royale ' bit 8 Cyborg Assimilator flag1 As Long 'Unused flag2 As Long flag3 As Long nm As String * 32 End Type
Declare Sub GETRACETEMPBMP Lib "v4face2.dll" (sRaceFile As String, sTempPath As String) Declare Sub LOADRACEDATA Lib "v4face2.dll" (sRaceFile As String, tRace As RaceFacetype, mech1 As MechFaceType, mech2 As MechFaceType, mech3 As MechFaceType, fighter1 As FighterFaceType, fighter2 As FighterFaceType, fighter3 As FighterFaceType)
Public filepath As String Public race As RaceFacetype Public mech1 As MechFaceType Public mech2 As MechFaceType Public mech3 As MechFaceType Public fighter1 As FighterFaceType Public fighter2 As FighterFaceType Public fighter3 As FighterFaceType Private X As Long
Dim racefile As String X = 101 ' Change the race number to the one that you want racefile = "race" & X & ".rce" filepath = "races\" & racefile LOADRACEDATA filepath, race, mech1, mech2, mech3, fighter1, fighter2, fighter3 GETRACETEMPBMP filepath, ".\"

When the LOADRACEDATA is complete, the race structure will contain all of the data for race 101 (Federation) from the type RaceFaceType, mech1 will contain all of the data for race 101 from the type MechFaceType, etc. With this information you can have your program make decisions, calculations, and output as necessary. The GETRACETEMPBMP creates a few temp files that are the BMP graphics, MIDI music file, and a text info file for race 101.

[edit] Hull Data

To be able to retrieve hull/ship data from the SPK files, you will have to set up access to the DLL's subroutines then some variables to hold the results, then call the subroutine.

Here is an example in Visual Basic 6:

Type HullFaceType
  hullname As String * 40 '  The name of the hull type
  HClass As Long          '  The hull type number
  Bays As Long            '  Max number of bays (0-20)
  BaySize As Long         '  The max mass that can dock in the bay
  Hugeweapon As Long      '  Bit flag Types HUGE weapons this ship can have (bit0-bit4)
                          '  Bit 0   Laser Cannon
                          '  Bit 1   Nemesis
                          '  Bit 2   World Crusher
                          '  Bit 3   Anti-Matter Maul
                          '  Bit 4   Proto-Matter Cannon
  LargeLimit As Long      '  The max weapon size that will fit in a large slot
  mass As Long            '  Mass of hull
  PointDefense As Long    '  Number of anti-fighter gun ports (0-10)
  LargeWeapons As Long    '  Number of large anti-ship weapons (0-20)
  SmallWeapons As Long    '  Number of small anti-ship weapons (0-30)
  Fueltank As Long        '  Amount of fuel ship can carry
  MaxSpeed As Long        '  Max cruising speed (0 - 400)
  MaxHypSpeed As Long     '  Max speed using a hyperdrive (0-5000)
  Engines As Long         '  Number of engines required
  gen As Long             '  Generator slots (0-5)
  PodBays As Long         '  Number of Pod bays (0-20)
  CrewSize As Long        '  Standard Number of crew members
  GuestSize As Long       '  Number of guest personal (Troops, Colonists, High Guard, Crew)
  Stealth As Long         '  Stealth rating of ship 100 = Norm ;  0 = invisible
  ScanRange As Long       '  Range that this ship can scan
  ArmorLimit As Long      '  The limit on the amount of armor reinforcement
  ShieldLimit As Long     '  The highest shield power this ship can have
  EvasiveMod As Long      '  The ability to dodge enemy fire
  AttackMod As Long       '  The ability to bring weapons to bare
  TechLevel As Long       '  Tech level required to build
  eleD As Long
  eleT As Long
  eleM As Long
  SoftSpot As Long        '  Size of "exhaust port hole"
  ModFuelBurn As Long     '  Modifier to the rate that fuel is used
  PowerLimit As Long      '  The size of the main weapons capacitor
  Sflag1 As Long          '  Add-on hull goody - see "CSV: Ship - Device List 1" below
  Sflag2 As Long          '  Add-on hull goody - see "CSV: Ship - Device List 2" below
  SFlag3 As Long          '  Add-on hull goody - see "CSV: Ship - Device List 3" below
  maxcargo As Long        '  Max cargo ship can have
  maxord As Long          '  Max ordance that ship can carry
  maxfix As Long
  newhullsize As Long     '  = size of new hull ship can build
  TractorBeam As Long     '  size of ship that can be towed
  cost As Long            '  Cost to build
  modparts As Long        '  Damage Mod for ship 100 = normal
  modsys As Long
  modeng As Long
  modlife As Long
  modhyp As Long
  cloakfuel As Long       '  Fuel needed to cloak
  U1 As Long              '  Unused
  U2 As Long
  U3 As Long
  U4 As Long
  U5 As Long
  U6 As Long
  U7 As Long
  U8 As Long
End Type
Declare Sub LOADHULLKEYS Lib "v4face2.dll" (sPath As String, vFirstLong As Long, sKey As String) Declare Sub FROMFILELOADHULLKEYS Lib "v4face2.dll" (sShipFile As String, vFirstLong As Long, sKey As String) Declare Sub LOADHULL Lib "v4face2.dll" (sPath As String, vHullID As Long, tHULL As HullFaceType, sKey As String) Declare Sub GETSHIPTEMPBMP Lib "v4face2.dll" (sPath As String, sTempPath As String, vHullID As Long, sKey As String)
Public g_vList(1 To 2000) As Long Public g_sKey As String Public hull As HullFaceType Public filepath As String Private X As Long
X = 44 ' Hull number (44 = Victorious Class Battleship) filepath = "ships\" g_vList(1) = X ' Assign the first position with the desired hull number LOADHULLKEYS filepath, g_vList(1), g_sKey ' The rest of the g_vList now contains a 1 if that value is a valid hull number If g_vList(X) Then ' Hull is in the returned list LOADHULL filepath, X, hull, g_sKey GETSHIPTEMPBMP filepath, ".\", X, g_sKey End If

The LOADHULLKEYS will provide you with a list of valid hulls and the key to be able to query the hull data with LOADHULL. FROMFILELOADHULLKEYS (not demonstrated in this code sample) is a way of doing the same thing as LOADHULLKEYS, but using the exact SPK file name. When LOADHULL is complete, hull will be populated with the HullFaceType data. GETSHIPTEMPBMP will create temp BMP files and an ICO file in the local path.

[edit] Bitfields

Some of the data that you get from the ship and race files as well as the exported CSV files from the Planets client contains condensed on/off data named bitfields. Any building structure that you can only have one of will be in a bitfield as well as whether or not a ship device is on or off.

Bitfield example using the Ship Devices by N/A from the newsgroup: Consider bit 0 to be the rightmost bit and bit 31 to be the leftmost bit. Like such:

000000000000000000000000000000­01 (binary) 
^ Bit 31                       ^ Bit 0 

If 'Sflag1' has bit 0 set (as above) then the hull has a Ram Scoop. So on for each bit in each of the fields.

Note that bits 30 and 31 aren't used in 'Sflag1' or 'Sflag2'

Bits 25-30 in 'Sflag3' are Wildcard devices (i.e. what they represent depends on which Hull you're looking at [or, maybe, it depends on the ship pack(?)- I never asked]).

Bit 31 in 'Sflag3' is currently not used (but, I presume, reserved as another 'Wildcard' device.

[edit] CSV: Base - Structures & Build Req

The Stuctures and Build Req values from the Base.CSV exported file contain the bitfield below, which I've displayed as a set of macros for C/C++.

#define STRUCT_POD        (1 << 0)  // Pod Launch Pad
#define STRUCT_AIRATTACK  (1 << 1)  // Air Attack Base
#define STRUCT_MILITARY   (1 << 2)  // Military Space Port
#define STRUCT_ENGINE     (1 << 3)  // Engine Factory
#define STRUCT_MECH       (1 << 4)  // Assault Plant
#define STRUCT_FIGHTER    (1 << 5)  // Fighter Plant
#define STRUCT_MED        (1 << 6)  // Med Lab
#define STRUCT_GOV        (1 << 7)  // Government Center
#define STRUCT_SHIELD     (1 << 8)  // Base Shield
#define STRUCT_ORD        (1 << 9)  // Ordnance Plant
#define STRUCT_WEAPONS    (1 << 10) // Weapons Factory
#define STRUCT_REPAIR     (1 << 11) // Ship Repair Shop

[edit] CSV: Base - Switches

This was pulled from the newsgroup. These bits are in the same order that the stuctures are listed on the Struct tab of the Base screen but offset by 1 bit:

#0x0000 000F 
#   0x0000 0001 -- Appears to be unused 
#   0x0000 0002 Training Center 
#   0x0000 0004 Factory 
#   0x0000 0008 Farm 
#0x0000 00F0 
#   0x0000 0010 Smelter 
#   0x0000 0020 Mineral Mine 
#   0x0000 0040 City 
#   0x0000 0080 Pod Launch Pad 
#0x0000 0F00 
#   0x0000 0100 Military Space Port 
#   0x0000 0200 Raid Shelter 
#   0x0000 0400 Public Space Port 
#   0x0000 0800 Med Lab 
#0x0000 F000 
#   0x0000 1000 Engine Plant 
#   0x0000 2000 Fighter Plant 
#   0x0000 4000 Ship Repair Shop 
#   0x0000 8000 Weapons Factory 
#0x000F 0000 
#   0x0001 0000 Ordnance Plant 
#   0x0002 0000 Government Center 
#   0x0004 0000 Terraformer 
#   0x0008 0000 Scanner 
#0x00F0 0000 
#   0x0010 0000 Anti-Aircraft Gun 
#   0x0020 0000 Laser Cannon 
#   0x0040 0000 Air Attack Base 
#   0x0080 0000 Base Shield 
#0x0F00 0000 
#   0x0100 0000 Assault Plant 
#   0x0200 0000 Ion Cannon 
#   0x0400 0000 Undercity 
#   0x0800 0000 Resort 
#0xF000 0000 
#   ?? - Always set to 0x70000000

This was sent to me from Tim on 12/19/2005.

switchFlag AS LONG ' On or off switches
'bit 0  Medlab ON
'bit 1  Gov Center Share money with G. Bank
'bit 2  Factories ON
'bit 3  Base Shield ON
'bit 4  //OLD!!! Resorts ON
'bit 5  Cities ON
'bit 6  Public Space Ports ON
'bit 7  Ion Cannon ON
'bit 8  Laser Cannon ON
'bit 9  Mines ON
'bit 10 Training Centers ON
'bit 11 Smelters ON
'bit 12 Anti-air ON
'bit 13 Terraformer ON
'bit 14 scanner ON
'bit 15 Undercity ON
'bit 16 Ord plant ON
'bit 17 Farms ON
'bit 18 //OLD!!! Labor Camp ON
'bit 19 //OLD!!! Labor Mine ON
'bit 20 //OLD!!! Cantina ON
'bit 21 Struct 1 ON
'bit 22 Struct 2 ON
'bit 23 Struct 3 ON
'bit 24 Struct 4 ON
'bit 29 *** Reserve Levels active ***

[edit] CSV: Ship - Fleet Switch

'  bit 0 = fleet leader
'  bit 1 = in a fleet
'  NO/// bit 2 = follow ship we are escorting ///
'  bit 3 = share fuel
'  bit 4 = share ord
'  bit 5 = share repair
'  bit 6 = AUTO PILOT
'  bit 7 = recycle ship

[edit] CSV: Ship - Attack Switch

'  bit 0 = Attack all enemy races
'  bit 1 = flee all enemy races
'  bit 2 = Auto intercept enemy ships
'  Bit 3 = Auto Intercept enemy pods

[edit] CSV: Ship - Mission N1

' 0 bit = Short Range Scanner
' 1 bit = Mid Range Scanner
' 2 bit = Long Range Scanner
' 3 bit = Planetary Scanner
' 4 bit = Running Lights
' 5 bit = Auto Unload Metal
' 6 bit = D only
' 7 bit = T only
' 8 bit = M only

[edit] CSV: Ship - Attack Plan

'   bit 0 = Stay At Standoff Range
'   bit 1 = Stand At All Costs
'   bit 2 = Target Soft
'   bit 3 = Target Dangerous
'   bit 4 = Strike Through
'   bit 5 = RAM!
'   bit 6 = Delay Ship (Second Wave)
'   bit 7 = Fire At Ground Targets
'   bit 8 = Do not fire at disabled ships
'   bit 9 = AVOID ground base!

[edit] CSV: Ship - Weapon Switches

'   bit 0 = fire ion cannon at ships with shields up
'   bit 1 = fire sand casters at enemy ships
'   bit 2 = fire sand casters at enemy fighters
'   bit 3 = hugeweapon ON

[edit] CSV: Ship - Switch1

[edit] CSV: Ship - Switch2

[edit] CSV: Ship - Switch3

[edit] CSV: Ship - Command Switch

'  0 Bit Lay Cloaked Mines
'  1 Bit Recover Mines
'  2 Bit Repeat Mine Lay
'  3 Bit Minefield Recharge

[edit] CSV: Ship - Device List 1

Most are stored as bits in these three longs:

Sflag1 As Long          '  Add-on hull goody 
Sflag2 As Long          '  Add-on hull goody 
SFlag3 As Long          '  Add-on hull goody 
'// sFlag1 
'Bit 0   Ram Scoop" 
'Bit 1   Particle Fountain" 
'Bit 2   Tachyon Emitter 
'Bit 3   Alchemy 
'Bit 4   Bioscanner 
'Bit 5   Gravitonic Mine Dropper 
'Bit 6   Barbitic Mine Dropper 
'Bit 7   Laser Mine Dropper 
'Bit 8   Web Mine Dropper 
'Bit 9   Mine Sweeper Array 
'Bit 10  Warp Chunneler 
'Bit 11  Gravitonic Accelerator 
'Bit 12  Ore Processing 
'Bit 13  Gravity Well Generator 
'Bit 14  Psi-Opps Hisser Unit 
'Bit 15  DTMS-N fuel converter 
'Bit 16  Siren HAARP 
'Bit 17  Mind Crusher 
'Bit 18  Reticulian Light Beam 
'Bit 19  Cloak 
'Bit 20  Laser Mining Drill 
'Bit 21  Global Warmer 
'Bit 22  Global Icer 
'Bit 23  Crystal Inferno Device 
'Bit 24  Spy Scanner 
'Bit 25  Glory Device 
'Bit 26  Boarding Laser 
'Bit 27  Assimilation Beam 
'Bit 28  Long Range Mine Detector 
'Bit 29  Mobile Ord Factory

[edit] CSV: Ship - Device List 2

'// sFlag2 
'Bit 0   Mobile Fighter(1) Factory 
'Bit 1   Mobile Fighter(2) Factory 
'Bit 2   Mobile Fighter(3) Factory 
'Bit 3   Scalar Wave Amp 
'Bit 4   "---" 
'Bit 5   Gambling Deck 
'Bit 6   Holodeck 
'Bit 7   Probe launcher 
'Bit 8   Clone Lab 
'Bit 9   Mobile Med Lab 
'Bit 10  Mobile Parts Plant 
'Bit 11  Agro-Dome 
'Bit 12  Soil Reformer 
'Bit 13  Scalar Wave Damper 
'Bit 14  Reticulian Med Lab 
'Bit 15  "---" 
'Bit 16  Food To Supply Converter 
'Bit 17  Fuel Robber 
'Bit 18  Cargo Grappler 
'Bit 19  Crew Abducter 
'Bit 20  Hacker Droid 
'Bit 21  Pyramid Lounge 
'Bit 22  Show Lounge 
'Bit 23  Minefield Destabilizer 
'Bit 24  Jumpgate Builder 
'Bit 25  Jumppoint Generator 
'Bit 26  Self Destruct 
'Bit 27  Ground Base Chunnel 
'Bit 28  Advanced Training 
'Bit 29  Ground Quake Trigger

[edit] CSV: Ship - Device List 3

The names of the wild card devices are now stored in the ship pack files (SPK). The 4 byte long at file location 201 points to the list of wildcard device names. The list of devices are in plain text, 6 records of 40 bytes each.

'// sFlag3 
'Bit 0   Soil Sterilizer 
'Bit 1   Recruting Center 
'Bit 2   Cloaking Field 
'Bit 3   Dust Off 
'Bit 4   Incarceration Beam 
'Bit 5   Holo Jamming Device 
'Bit 6   Warp Bubble Generater 
'Bit 7   Transport Inhibitor 
'Bit 8   Crystal X Field 
'Bit 9   Solar Gamma Ray 
'Bit 10  Nanovirus 
'Bit 11  Hull Plan Naper 
'Bit 12  Contraband Lockdown 
'Bit 13  Money Tap 
'Bit 14  Naive Dust Off 
'Bit 15  Contraband Dustoff 
'Bit 25  Wildcard 1 
 '// 111 Colonial Warrior Assault // 
 '    H111 
 '// 109 Robot Eye Of Madagon // 
 '// 110 Rebel Ground Assault // 
 '// 807 Mirvorari Gate Dial Out Device 
 '   H536 - H551 
 '// 808 Aczanny Security Device 
 '   H600 - H620 
 '// 806 Coal. Bio Computer 
 '   H516 - H525 
 '// 811 Solorian Stellar Targeter 
 '   H526 - H535   
'Bit 26  Wildcard 2 
 '// 111 Colonial Fuel Drill 
 '// H100 H101 
 '// 807 Mirvorari Parts Gate 
 '   H536 - H551 
 '// 808 Aczanny ECM Jammer 
 '   H600 - H620 
 '// 806 Coalition Rift Gen 
 '// H517 
 '// 811 Solorian Energy Transfer Beam 
 '   H526 - H535   
'Bit 27  Wildcard 3 
 '// 111 Colonial Unicom 
 '   H109   
 '// 807 Mirvorari Portable Gate 
 '   H536 - H551 
 '// 808 Aczanny Cargo Desk 
 '   H600 - H620 
 '// 811 Solorian Ragnarock Device 
 '   H526 - H535 
'Bit 28  Wildcard 4 
 '// 111 Colonial Light Speed // 
 '   H109 
 '// 807 Mirvorari Native Gate 
 '   H536 - H551 
'Bit 29  Wildcard 5 
 '// 111 Colonial GalBank // 
 '   H103 
 '// 807 Mirvorari Star Boiler 
 '   H536 - H551 
'Bit 30  Wildcard 6 
 '// 111 Colonial GalWithdraw // 
 '   H103 
 '// 807 Mirvorari Alchemy 
 '   H536 - H551

[edit] Ship: Repair / FlagFix

'  bit 0 = Damage to engines
'  bit 1 = Damage to HYPER Drive
'  bit 2 = Damage to hull
'  bit 3 = Damage to control systems
'  bit 4 = Damage to life support systems
'  bit 5 = Damage to shield generator
'  bit 6 = Damage to weapons systems
'  bit 7 = Repair Armor
'  bit 8 = Replenish Armor
'  bit 9 = Replemish Fighters

[edit] Ship: Transport Mode / transMode

'  bit 0 = hostal (Not(1) = friendly)
'  bit 1 = build fire base on planet
'  bit 2 = goto transTargetID before waypoint
'  bit 3 = Jettison cargo
'  bit 4 = Erase Plans
'  bit 5 = Transmit Plans
'  bit 6 = Receive Plans

[edit] Player: Exotic Tech A Switches

'Bit 0   +10 Pod Speed
'    1   +20 Pod Speed
'    2   +30 Pod Speed
'    3   20% less fuel burn
'    4   50% less fuel burn
'    5   +100 Shield Power
'    6   +300 Shield Power
'    7   +500 Shield Power
'    8   +100 Scan Range
'    9   +200 Scan Range
'    10  +300 Scan Range
'    11  +10 Attack Bonus
'    12  +20 Attack Bonus
'    13  +50 Attack Bonus
'    14  +10 Evasive Bonus
'    15  +20 Evasive Bonus
'    16  +2 Shield Drain
'    17  +5 Shield Drain
'    18  +2 Armor Drain
'    19  +5 Armor Drain
'    20  +10 Shield Drain
'    21  +25 Shield Drain
'    22  +5 Armor Drain
'    23  +10 Armor Drain

[edit] Player: Exotic Tech B Switches

' Bit 0  Ships Immune to Base Ion cannons
'     1  Self Repairing Ship Armor
'     2  Point Defense System Charge 50% Faster
'     3  World Crusher Missiles Pass Through Base Shields
'     4  10% Normal Fighter Wing Sensor Image
'     5  40% Normal Fighter Mine Sensor Image
'     6  Fighters Immune To Nemesis Torpedoes
'     7  Fighters Immune To Sand Casters
'     8  +10 Happy Your Natives (-10 Others)
'     9  Just Say No!"
'    10  Raid Colonists Homes
'    11  Poison Contraband Items
'    12  Hire Contraband Pirates
'    13  All Base Shields Fail On All Planets For 5 Turns
'    14  Zero Growth Rate All Planets
'    15  +20 Colonist Growth Rate
'    16  +50 Colonist Growth Rate
'    17  +70 Colonist Growth Rate
'    18  -5 Happiness All Planets
'    19  -10 Happiness All Planets
'    20  -20 Happiness All Planets
'    21  Super AntiFighter
'    22  Energized Sand
'    23  Fighter ECM Box

[edit] Other Data Interpretations

There are other pieces of data that are simply an index, such as 0 = No super weapon, 1 = Super Laser, 2 = Nemesis Torpedo, etc.

[edit] CSV: Base - Attack Mode

0 = Peaceful 
1 = Roaming defense 
2 = Deep Ground Patrols 
3 = Attack and Run 
4 = Crush, Kill, Destroy!
5 = Capture

[edit] CSV: Planet - state

0 = Planet
1 = Asteroid

[edit] CSV: Planet - star

1 = Brown Dwarf
2 = Neutron Star
3 = White Dwarf
4 = Blue Dwarf
5 = Binary Red
6 = Orange
7 = Orange Yellow
8 = Yellow
9 = Neutron Yellow Binary
10 = Red White
11 = Red Yellow Binary
12 = Yellow / Yellow Binary
13 = White
14 = White / Yellow Binary
15 = White / White Binary
16 = Yellow White
17 = Yellow Trinary
18 = Green
19 = Binary Green
20 = Red Giant
21 = Blue Giant

[edit] CSV: Ship - Huge Weapon

const char *super_weapon_names[] = {
  "Super Laser",           // 1
  "Nemesis Torpedo",       // 2
  "World Crusher Missile", // 3
  "Anti-Matter Maul",      // 4
  "Proto-Matter Cannon"    // 5
};

[edit] CSV: Ship - Hyper Switch

0 = OFF
1 = ON

[edit] CSV: Ship - Hyp Engine

const char *hyperdrive_names[] = {
  "Yoyodyne 88",   // 1
  "Microfold 200", // 2
  "Yoyodyne 300",  // 3
  "Keplan 450",    // 4
  "Keplan 505",    // 5
  "Keplan 660",    // 6
  "Yoyodyne 900",  // 7
  "Soleum H1000",  // 8
  "Warhop 2020",   // 9
  "Cydonia 3000"   // 10
};

[edit] CSV: Ship - Engine

const char *engine_names[] = {
  "N20 Fusion Drive",     // 1
  "N30 Fusion Drive",     // 2
  "Lasno-1 Ion Drive",    // 3
  "Lasno-2 Ion Drive",    // 4
  "R50 Mega-Fusion",      // 5
  "I-17 Impulse",         // 6
  "I-20 Impulse",         // 7
  "I-25 Impulse",         // 8
  "Electrogravitic",      // 9
  "Turbo Thruster",       // 10
  "Tylium Thruster",      // 11
  "Energy Conversion",    // 12
  "Scalar Wave Thruster", // 13
  "Lazar Drive",          // 14
  "FLT-1 Warp Drive",     // 15
  "FLT-2 Warp Drive",     // 16
  "FLT-3 Warp Drive",     // 17
  "FLT-4 Warp Drive",     // 18
  "FLT-5 Warp Drive",     // 19
  "Transwarp Drive"       // 20
};

[edit] CSV: Ship - Shield

const char *shield_names[] = {
  "Fleece-S30",      // 1
  "Crane X40",       // 2
  "Crane X80",       // 3
  "Corber 210",      // 4
  "Corber 350",      // 5
  "Corber 400",      // 6
  "Galefleck DT900", // 7
  "GS-SX 1000",      // 8
  "GX-LX 1500",      // 9
  "GS-BFS 3000"      // 10
};

[edit] CSV: Ship - Generator x

const char *generator_names[] = {
  "GF Prilldyne 10", // 1
  "GF Prilldyne 12", // 2
  "GF Prilldyne 14", // 3
  "Servodyne 600",   // 4
  "Servodyne 700",   // 5
  "Servodyne 800",   // 6
  "MicroQuad 950",   // 7
  "Firestorm 3000",  // 8
  "Tifuss KH4000",   // 9
  "GF Tokamak 8080"  // 10
};

[edit] Ship Groups File

Private Type GroupType
   nm As String40
   Log As String40
   count As Long
   flag1 As Long 'Unused
   flag2(1 To 200) As Long 'Unused 
   Item(1 To 500) As Long 'Object ID
   itemSerNum(1 To 500) As Long 'Object Serial number
End Type

Private m_group(1 To 12) As GroupType

Public Sub SaveGroupData()
Dim sDir As String
Dim i As Long
Dim sA As String
Dim f1 As Long
   sDir = exepath & "groups\s" & Trim$(Str$(fileList.GameSlot)) & "x" & Trim$(Str$(WAR.pNum)) & "\"
   For i = 1 To 12
      sA = sDir & "group" & Trim$(Str$(i)) & ".grp"
      If m_booActive(i) Then
         f1 = FreeFile
         Open sA For Binary As #f1
            Put #f1, 1, m_group(i)
         Close #f1
      End If
   Next i
End Sub

[edit] Source Code

Many VGAP programmers have released their source code to the public. This code contains a wealth of information about how to interact with game files. The code can also be a big time saver for new projects, since effective libraries for manipulating game data have already been developed and can be reused.

The following projects have made their source code available to the public:

  • Diplomat
    • Web Site: http://www.furfur.demon.co.uk/geop/diplomat.htm
    • Source Code: Request from author
    • Language: Visual Basic 6
    • Reusable Code: ?
    • Author's Notes: Diplomat is a combat simulator. It writes a script based on the user's choices, then runs Tim's programs Master.exe to create a customised mini-game with all the ships etc in one spot, runs Host.exe to resolve battles, and VCR.exe to show you the results. Inspecting the code would give you examples of how to use Tim's DLL's to extract race and hull info from files; how to call external programs like Master.exe; and probably how NOT to write VB! It's only the second program I ever wrote in VB, to teach myself, and people kept suggesting features. As a result it grew organically and is poorly structured spaghetti! The source code comprises about 20 forms, 4 modules, 3 classes, or to put it another way, almost 2MB. The code has been inspected and improved by several others already, notably Declan O'Connor. Most contributors change one to three modules and send them back to me. I control the master copy to avoid diverging threads, but I have deposited backup copies with a couple of folk lest I disappear. The code is heavily commented with tips from Tim and my own thoughts, and this could provide insights into how Tim's own code works. Diplomat updates are rare these days as it does everything I need now, but I am currently tinkering with a couple of minor things that no longer match the latest game rules, like the ground assault simulator.
  • ScriptZ0r
  • VidiVici
  • VGAP4Grp
Personal tools