Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Wanderer on March 18, 2008, 10:46:07 am

Title: Tool to measure jump in/out distances
Post by: Wanderer on March 18, 2008, 10:46:07 am
So basically a small script that tracks the point where the ship enters the game and then waits until the defined timepoint before logging its 'stop position'. Then it starts tracing the ships jump out run and records the last position the game lists for the ship. So in the end you get the distance the ship needs for getting from jump to stationary position and also the distance needed for the ship to jump out. The data is saved to a text file named 'Distancetest.txt' which will be ruthlessly overridden every time script is run.

Script
Code: [Select]
#Conditional Hooks

$State: GS_STATE_GAME_PLAY

$On HUD Draw:

[

if arrayInit == nil then
   startPos = {}
   stopPos = {}
   endPos = {}
   names = {}
   arrayInit = 1
   triggerDone = 0
end

if mn.getMissionTime() ~= nil then

   integerShips = #mn.Ships
   mTime = mn.getMissionTime()

   for y = 1,integerShips do
      objectShip = mn.Ships[y]

      stringName = objectShip.Name

      if startPos[stringName] == nil then
         startPos[stringName] = objectShip.Position[3]
      end

      if stopPos[stringName] == nil and mTime >= 74 then
         stopPos[stringName] = objectShip.Position[3]
         names[y] = stringName
      end

      if mTime < 120 then
         endPos[stringName] = objectShip.Position[3]
      end

   end

   if mTime > 120 and fileWritten == nil then
      iofile = cf.openFile("Distancetest.txt", "w")
      iofile:write("Comma separate data output from distance checks\n\n")
      iofile:write("First value is Jump In distance, second Jump Out distance (both assuming 0 speed)\n\n\n")
      numberships = #names
      for g = 1,numberships do
         shipName = names[g]
         jumpIn = stopPos[shipName] - startPos[shipName]
         jumpOut = endPos[shipName] - stopPos[shipName]
         iofile:write(shipName .. ", " .. math.floor(jumpIn) .. ", " .. math.floor(jumpOut) .. "\n")
      end
      iofile:close()
      triggerDone = 1
      fileWritten = 1
   end

   if triggerDone == 1 and mTime < 135 then
      gr.setColor(255,255,0)
      gr.drawString("DONE",300,300)
   end

end

]

#End

Here are also the distances i got using the script for almost every freespace 2 ship and object (with 3.6.10 beta mediavps in use) as comma separate data (name, jump in run, jump out run).

Distances
Code: [Select]
GTF Ulysses, 29, 51
GTF Hercules, 47, 83
GTF Hercules Mark II, 47, 87
GTF Ares, 52, 109
GTF Erinyes, 48, 86
GTF Loki, 40, 68
GTF Pegasus, 51, 90
GTF Perseus, 46, 84
GTF Myrmidon, 46, 71
SF Mara Terran, 48, 111
GTB Artemis, 79, 118
GTB Artemis DH, 91, 133
GTB Medusa, 96, 156
GTB Ursa, 112, 203
GTB Zeus, 41, 110
GTB Boanerges, 93, 157
GTDR Amazon, 93, 186
GTDR Amazon Adv, 305, 675
GTS Hygeia, 38, 111
GTFR Triton, 894, 1211
TC-TRI, 275, 1058
GTFR Poseidon, 111, 271
TC 2, 35, 137
TSC 2, 35, 137
TAC 1, 61, 228
TTC 1, 26, 96
GTC Fenris, 848, 1009
GTM Hippocrates, 1501, 2010
GTC Leviathan, 1079, 1009
GTSC Faustus, 514, 713
GTG Zephyrus, 713, 1106
GTA Charybdis, 543, 827
GTD Orion, 5243, 3074
GTD Hecate, 5748, 3335
GTD Hades, 8301, 5317
GTI Arcadia, 1854, 3313
GTVA Colossus, 7123, 11346
GTCv Deimos, 1394, 2649
GTC Aeolus, 791, 1090
NTF Iceni, 2145, 2757
NTF Boadicea, 2835, 3857
GTT Elysium, 53, 126
GTT Argo, 269, 701
GTNB Pharos, 6, 30
GTI Ganymede, 1408, 2329
Knossos, 4183, 5748
Asteroid, 148, 611
GTSG Watchdog, 9, 32
GTSG Cerberus, 9, 32
GTSG Alastor, 11, 39
GTEP Hermes, 28, 49
TC-Meson Bomb, 391, 1316
GVF Seth, 39, 69
GVF Horus, 52, 90
GVF Thoth, 44, 76
GVF Serapis, 33, 91
GVF Tauret, 45, 79
GVB Sekhmet, 77, 119
GVB Osiris, 119, 199
GVB Bakha, 50, 75
GVF Ptah, 39, 63
GVS Nephthys, 41, 119
GVT Isis, 45, 97
PVFR Maat, 110, 221
GVFr Bes, 112, 212
VAC 5, 54, 207
VAC 4, 25, 93
GVFr Satis, 397, 468
GVG Anuket, 914, 1451
GVC Aten, 716, 1059
GVC Mentu, 886, 1329
GVCv Sobek, 1247, 2437
GVD Typhon, 5562, 3341
GVSG Ankh, 7, 29
GVSG Edjo, 10, 41
GVEP Ra, 45, 83
GVA Setekh, 557, 915
GVD Hatshepsut, 5197, 3656
SF Dragon, 24, 53
SF Basilisk, 59, 110
SF Manticore, 45, 78
SF Aeshma, 59, 116
SF Mara, 48, 112
SF Astaroth, 47, 82
SB Nephilim, 90, 158
SB Taurvi, 70, 103
SB Nahema, 90, 152
SB Seraphim, 175, 302
ST Azrael, 79, 166
SFr Dis, 552, 1204
SAC 3, 292, 1086
SFr Mephisto, 108, 204
SC 5, 14, 58
SFr Asmodeus, 241, 492
SAC 2, 28, 122
SC Lilith, 700, 770
SC Rakshasa, 1174, 1304
SC Cain, 1185, 770
SD Demon, 5779, 3221
SD Ravana, 5759, 5184
SD Lucifer, 6778, 4415
SSG Trident, 7, 32
SSG Belial, 16, 61
SSG Rahu, 589, 1048
SCv Moloch, 1826, 2290
SJ Sathanas, 6963, 9212
SJD Sathanas, 53, 18
GTSG Mjolnir, 101, 527
Shivan Comm Node, 557, 907

Should you want to use stick all ships to use non dynamic goals and place stay still flag on all the fighters and other such little ships. When placing ships make them point forward (judging from default fred start position, ie. along z axis). Make sure the time allowances for the ship jump in (i used 2 seconds) and jump out (i had 75 seconds) are adequate for your purpose. And also make sure the values in the script match the values in the mission file.
Title: Re: Tool to measure jump in/out distances
Post by: karajorma on March 18, 2008, 01:30:58 pm
Excellent. :yes: I've always had to measure those distances by trial and error so this is very useful.

That list you've got probably should go in the wiki too.
Title: Re: Tool to measure jump in/out distances
Post by: Shade on March 18, 2008, 01:44:46 pm
Nice! That's one potentially major headache removed from FREDding :)
Title: Re: Tool to measure jump in/out distances
Post by: Mobius on March 18, 2008, 02:59:53 pm
Wow...excellent work, Wanderer! That will be useful when designing cutscenes! :D

Can you please do the same wih ships?
Title: Re: Tool to measure jump in/out distances
Post by: Wanderer on March 18, 2008, 03:19:59 pm
Can you please do the same wih ships?
Eh?
Title: Re: Tool to measure jump in/out distances
Post by: Dark Hunter on March 18, 2008, 07:18:00 pm
I think he's requesting jumpin/jumpout distances with more ships.
Title: Re: Tool to measure jump in/out distances
Post by: Mobius on March 18, 2008, 07:20:17 pm
There are only fighters and bombers in that list. Having ships would be better(they're fast when jumping in/out, cutscene camera problems mostly involve ships of cruiser size and above).
Title: Re: Tool to measure jump in/out distances
Post by: Talon 1024 on March 18, 2008, 07:49:00 pm
Can you please do the same wih ships?

The GTD Orion is in the list of jump distances.  Scroll down a little, look closely and you'll see this.

Quote
GTD Orion, 5243, 3074
Title: Re: Tool to measure jump in/out distances
Post by: Mobius on March 18, 2008, 07:56:19 pm
Azz...

I don't feel ok today.