home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / twppf006.zip / readme.txt < prev    next >
Text File  |  1999-03-14  |  22KB  |  581 lines

  1.              README for Tradewars 2002 port pair finder v0.06
  2.  
  3.  
  4.                   Contents ..........................  1
  5.  
  6.                I. Legal Stuff .......................  2
  7.  
  8.               II. Overview ..........................  2
  9.     
  10.              III. Getting Sector Data ...............  2
  11.  
  12.               IV. Running the Program ...............  3
  13.  
  14.                V. Output ............................  6
  15.  
  16.               VI. Limitations .......................  6
  17.  
  18.              VII. Performance .......................  6
  19.  
  20.             VIII. Notes on Program Behavior .........  7
  21.  
  22.               IX. How it Works ......................  7
  23.                                                        
  24.                X. Compiling the Program .............  7 
  25.  
  26.               XI. Author Information ................  8
  27.  
  28.              XII. History ...........................  8
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                                    Page 1
  59. I. Legal Stuff
  60.  
  61. This program is provided free of charge, and I'm not liable for any damage 
  62. it may do, nor do I guarantee any level of functionality.  You know the 
  63. drill.
  64.  
  65. The 32-bit DPMI executable is compiled with a GNU compiler, so it's 
  66. probably subject to the GNU public license, though I'm not particularly 
  67. inclined to wade through the documentation to find out the details.
  68.  
  69. If you make any modifications, I require that you make an effort to contact 
  70. me before distributing the modified form.  
  71.  
  72. ================================================================================
  73.  
  74. II. Overview
  75.  
  76. If you don't play the BBS online door game Tradewars 2002, then you'll find 
  77. this particular program quite useless indeed.
  78.  
  79. If you do play, however, you may still find it useless, as there are helper 
  80. programs, and other utilities, which do the same thing.
  81.  
  82. Most helpers, however, don't support 20,000 sectors, nor do the utilities.
  83.  
  84. This will be most useful to people who either don't use helpers, or don't 
  85. use them often, and have scripts for trading or stealing/robbing activity.
  86.  
  87. What this program does is read in sector and port information from CIM 
  88. captures, and figure out where the adjacent ports are, of the type you 
  89. specify on the command line.
  90.  
  91. You can specify multiple types on the same command line, and all matching 
  92. port pairs will be found.  Duplicate listings will not be made, should 
  93. there be pairs which match more than one type.
  94.  
  95. The types of port pairs currently supported:
  96.  
  97.    BBS - SSB  - Triple trading
  98.    BxS - SxB  - Equipment/Fuel Ore trading 
  99.    xBS - xSB  - Equipment/Organics trading
  100.    BBS - BSB  - Equipment/Organics trading, buying Fuel Ore
  101.    BSx - SBx  - Organics/Fuel Ore trading
  102.    xxB - xxB  - Steal/Sell/Move
  103.    xxS - xxS  - Rob/Move
  104.  
  105. Adding other types would be trivial, but I can't think of any others that 
  106. are particularly useful.
  107.  
  108. ================================================================================
  109.  
  110. III. Getting Sector and Port Data
  111.  
  112. The way this program gets the sector and port information is from a file 
  113. you create by capturing the computer CIM output in the game.  
  114.  
  115.  
  116.                                    Page 2
  117. How you do this will depend on the communications program you use.
  118.  
  119. TW Helper has an option to create TWVIEW and TWASSIST files, which for each 
  120. includes the CIM output.  Execute the /V command to write the *.SCT and 
  121. *.PRT files that contain sector and port data.  These files can be used as 
  122. is by the program.
  123.  
  124. If you're not using TW Helper, you can always get the information by 
  125. creating capture files in your communications program.  In the game, go to 
  126. the ship computer, and enter the following sequence, using your numeric 
  127. keypad:
  128.  
  129. ALT-200
  130. ALT-201
  131. ALT-202
  132. ALT-203
  133. ALT-204
  134. ALT-205
  135. ALT-206
  136.  
  137. That will put you into Computer Interrogation Mode, with a plain looking 
  138. ":" for a prompt.  At this point, turn on your sector information capture, 
  139. and press "I".
  140.  
  141. After the sector information has finished scrolling, end the capture.  This 
  142. capture file will be what you point the program to for sector data.
  143.  
  144. Then turn on your port information capture, and press "R".
  145.  
  146. After the port information has finished scrolling, end the capture.  This 
  147. capture file will be what you point the program to for port data.
  148.  
  149. The program is tolerant of junk in the file, but makes one important 
  150. assumption:  if the line begins with a valid sector number, it considers 
  151. the line full of pertinent data.  If it isn't, junk on that line will 
  152. cause an abort.  Other than that, lines which begin with non-numeric data 
  153. are ignored.
  154.  
  155. ================================================================================
  156.  
  157. IV. Running the Program
  158.  
  159. Once you've exported the sector and port data from the game, you're ready 
  160. to run the program. 
  161.  
  162. The options are available by simply running the program without parameters, 
  163. or with /h or /?, and are as follows:
  164.  
  165. /n# - number of sectors in universe (100 to 65535); default 1000
  166. /c# - minimum capacity of relevant products (0 to 65535); default 0
  167. /a - use capacities as reported - no calculations
  168. /p# - priority class (1 to 4); default=2
  169. /d# - priority delta (-31 to 31); default=0
  170. /z# - zap port in sector
  171. /b<filename> - binary port data file
  172. /s<filename> - sector data file
  173.  
  174.                                    Page 3
  175. /r<filename> - port data file
  176. /o<filename> - report file; default 'pairs.lst'
  177. /t<mask> - type of ports to find:
  178.  
  179.            BBS_SSB - Triple-trading pairs
  180.            BxS_SxB - Equipment/Fuel Ore trading
  181.            xBS_xSB - Equipment/Organics trading
  182.            BBS_BSB - Equipment/Organics trading, buying Fuel Ore
  183.            BSx_SBx - Organics/Fuel Ore trading
  184.            xxB_xxB - Sell/Steal/Move
  185.            xxS_xxS - Rob/Move
  186.  
  187. Detailed explanation of options:
  188.  
  189. Option /n#:  This specifies the number of sectors in the universe.  Here is 
  190. where the amount of storage set aside for sector information is determined.  
  191. If the CIM file contains information for a sector number greater than this 
  192. value, the program will abort.  The maximum value that the DOS version will 
  193. support is 5460.  The OS/2 and DPMI versions support up to 65535 sectors
  194. (currently, TW Gold supports only 20000 sectors).  The default value is 
  195. 1000 sectors.
  196.  
  197. Option /c#:  This specifies the minimum capacity of relevant products for 
  198. the port to be considered part of a pair.  For triple-trading pairs, all 
  199. products are relevant.  For equipment/organics trading, buying fuel ore, 
  200. organics and equipment are the relevant products.  For all other types, the 
  201. relevant products are those not represented by an 'x' in the mask.
  202.  
  203. Option /a:  This tells the program not to calculate full capacities based 
  204. on reported capacities and percentages, but to use the reported capacities 
  205. as is.  Using this with a recent port report will allow you to selectively 
  206. exclude drained ports with the /c parameter.
  207.  
  208. Option /p#:  This is specific to the OS/2 version, and specifies the 
  209. priority class that the program runs in while searching for port pairs.  
  210. Allowable values are integers from 1 to 4, where 1 denotes idle-class, 2 
  211. denotes standard class, 3 denotes time-critical class, and 4 denotes 
  212. foreground-server class.  The order of precedence, from lowest priority to 
  213. highest, is 1-2-4-3.  This is only put into effect after the sector 
  214. information has been loaded, and the bubble search has begun.  The idea 
  215. here was to be able to run the program at idle priority in the background 
  216. for a long search (for many port pairs), while doing other things.  If 
  217. you specify a value of 3, which is the highest priority, then a timeslice 
  218. will be forfeited every 100 sectors, to allow you the chance to abort it 
  219. (otherwise, keyboard input won't be processed in a timely fashion).  The 
  220. result is that the program will run somewhat slower at time-critical 
  221. priority than otherwise, unless there are other high-priority programs that 
  222. are being unfriendly to the CPU.  The default value is 2.
  223.  
  224. Option /d#:  This is specific to the OS/2 version, and specifies the 
  225. priority delta value.  This is a subdivision of the priority class, with 
  226. valid values from -31 to 31.  Giving a value below 0 will put the priority 
  227. slightly below other programs of the same class which have no delta, 
  228. thereby being more friendly without going down an entire class.  Giving a 
  229. value above 0 will put the priority slightly above other such programs, 
  230. making this program run somewhat faster if other CPU-intensive tasks are 
  231.  
  232.                                    Page 4
  233. running.  The default value is 0.
  234.  
  235. Option /z#:  This specifies that a port no longer exists (or is 
  236. inaccessible), so should be removed from the binary port data file.  
  237. This option may appear on the command line as many times as will fit in the 
  238. limitations of the maximum command length.  If this isn't used, ports which 
  239. no longer exist will continue to be reported in pairs, as long as the given 
  240. binary data file is used.
  241.  
  242. Option /b<filename>:  This specifies the binary data file where port 
  243. information is stored.  This is how you keep track of ports that no longer 
  244. show up in the CIM report due to deployed fighters.  The capacities stored 
  245. are those last reported in the CIM, whether actual or computed maximum.
  246. This file will be read if it exists, and created if it doesn't, after the 
  247. CIM data is read in.
  248.  
  249. Option /s<filename>:  This specifies the name of the file which contains 
  250. the CIM sector data capture.  There is no default, so this option must be 
  251. used.
  252.  
  253. Option /r<filename>:  This specifies the name of the file which contains 
  254. the CIM port data capture.  There is no default, so this option must be 
  255. used.
  256.  
  257. Option /o<filename>:  This specifies the name of the file which the found 
  258. port pairs will be written to.  The specified file will be overwritten if it 
  259. exists.  You may also use anything which the operating system can handle as 
  260. a file, such as a named pipe, communications port, network printer name, 
  261. etc.  The default is "pairs.lst".
  262.  
  263. Option /t<mask>:  This specifies a type of port pair to search for.  The 
  264. types of pairs possible are:
  265.  
  266.            BBS_SSB - Triple-trading pairs
  267.            BxS_SxB - Equipment/Fuel Ore trading
  268.            xBS_xSB - Equipment/Organics trading
  269.            BBS_BSB - Equipment/Organics trading, buying Fuel Ore
  270.            BSx_SBx - Organics/Fuel Ore trading
  271.            xxB_xxB - Sell/Steal/Move
  272.            xxS_xxS - Rob/Move
  273.  
  274. The mask is not case sensitive, and more than one mask may be provided on 
  275. the same command line.  If no masks are provided, then xBS_xSB is assumed, 
  276. as it is the most commonly sought port pair.  The 'x' in the mask means it 
  277. doesn't matter whether the port buys or sells in that area, for the 
  278. purposes of that type of port pair. 
  279.  
  280. There is no space between the switch and the option data, so assuming a 
  281. sector data file of "sectors.txt", you might do the following:
  282.  
  283. twppfind.exe /ssectors.txt /n5000 /rports.txt /tbsx_sbx /txxb_xxb
  284.  
  285. This would read sector data from 'sectors.txt', port dat afrom 'ports.txt', 
  286. for a 5000-sector universe, then search for port pairs that allow 
  287. organics/fuel ore cross-trading or sell/steal/move operations.  The output 
  288. is written to the default of 'pairs.lst'.
  289.  
  290.                                    Page 5
  291.  
  292. =============================================================================
  293.  
  294. V. Output
  295.  
  296. Since all output is accomplished via stream I/O, you can use anything that 
  297. the underlying operating system can open as a file for output.  This 
  298. includes I/O devices, such as LPT1, CON, etc.
  299.  
  300. The format of the output is this:
  301.  
  302.  1278 - SBB -  2080  1540  2280          1318 - SBB -  1607  2370  2000
  303. 15921 - SBB -  2410  1360   970         18717 - SBB -  2060  2390  1990
  304.  
  305.  1349 - BBB -  2210  1020   810          1351 - SBB -  2500  1270  1910
  306.  4883 - SBB -  2080  1640  1020          3345 - BSB -  1330  2980  1720
  307.  
  308. The pairs above are 1278-15921, 1318-18717, 1349-4883, and 1351-3345.
  309.  
  310. Next to the sector number is the port type, followed by the capacities for 
  311. fuel ore, organics, and equipment, respectively.
  312.  
  313. =============================================================================
  314.  
  315. VI. Limitations
  316.  
  317. The program was written to accommodate up to 65,535 sectors, since the Gold 
  318. version of TW currently allows up to 20,000.  In the unlikely event that the 
  319. game ever exceeds 65,535 sectors, it would not be very difficult to change 
  320. datatypes to long integers to increase capacity.  
  321.  
  322. The 16-bit DOS version is limited something between 5000 and 10000 sectors, 
  323. depending on the available memory, average number of warps per sector, and 
  324. port density of the universe.  For some reason, the Borland executable 
  325. crashes with an attempt at allocating too much memory for the sector array.  
  326. With OS/2, this meant a locked DOS session that needed to be killed.  On a 
  327. PC-DOS machine, the result was a spontaneous reboot.  This occurred at 
  328. around 15,800 or so sectors, so make sure to stay below 15,000 regardless 
  329. (the program won't handle that anyway).  It should reliably handle any 
  330. 5000-sector universe, however.
  331.  
  332. The DPMI and OS/2 executables will handle the program design limits.  As 
  333. soon as I get Linux installed, I'll build an executable for that as well, 
  334. which will of course not have any memory problems, either.
  335.  
  336. =============================================================================
  337.  
  338. VII. Performance
  339.  
  340. I make no pretensions about my skill as a programmer.  I'm strictly a 
  341. novice, but I'd like to think that the program is fairly efficient, for 
  342. what it's doing.  
  343.  
  344. The program is processor-bound, so your memory and disk subsystems are 
  345. insignificant.  Your video subsystem may also have an impact, especially if 
  346. running in a windowed session of whatever operating system you're using.  
  347.  
  348.                                    Page 6
  349. Time the execution with output redirected to nul, and you'll see the 
  350. difference.
  351.  
  352. On my Pentium II/266MHz system, looking for equipment/organics 
  353. cross-trading pairs in a completely explored 5000-sector universe, the 
  354. program takes about 3 seconds from start to finish.  The DOS version will 
  355. be slower than the OS/2 and DPMI versions.
  356.  
  357. The more types of ports to find, the longer the program will take to run, 
  358. of course.
  359.  
  360. ================================================================================
  361.  
  362. VIII. Notes on Program Behavior
  363.  
  364. 1)  The reported port capacity is the total capacity, not just what's in 
  365. the report.  If the port is at less than 100%, the value given is divided 
  366. by the percentage, itself divided by 100.  If the value given is greater 
  367. than 0, and the percentage is reported as 0 (a recently depleted port), the 
  368. percentage is assumed to be 1%; thus, the capacity reported may not be 
  369. terribly accurate.  Even with non-zero percentages, the calculations are 
  370. limited by the fact that the percentage has only two significant figures.
  371. This does not apply when using the /a option, to suppress capacity 
  372. calculations.
  373.  
  374. 2)  If the capacity is reported to be 0, that means the value given in the 
  375. port report was 0, so determining the actual capacity is impossible.  It 
  376. may also mean that the port in question is under construction, and has no 
  377. capacity yet.
  378.  
  379. 3)  At any time during the actual port search, you may hit the space bar
  380. to abort, and save the pairs found up to that point.
  381.  
  382. =============================================================================
  383.  
  384. IX. How it Works
  385.  
  386. Here's the basic logic of how it works:
  387.  
  388. 1)  For each sector, provided it has a port, determine if that port is the 
  389. first half of any of the desired port pair types.  If so, continue on.
  390.  
  391. 2)  Loop through the outwarps of the current sector, and if they are not 
  392. one-way, and the adjacent sector has a port, determine if it's the second 
  393. half of the type(s) of port pairs already half-matched by the first sector.  
  394. If so, add it to the results, if it's not already in there (if it matched a 
  395. previous port pair type as well).
  396.  
  397. That's it.  Really simple.
  398.  
  399. ================================================================================
  400.  
  401. X. Compiling the Program
  402.  
  403. The source for the program is included in the 'source.zip' archive.
  404.  
  405.  
  406.                                    Page 7
  407. The language is C++, and I've tried to make the program cross-platform, 
  408. though it may or may not be necessary to make some small modifications 
  409. before it will compile for you. 
  410.  
  411. There are a few defines in place that were necessary to make it compile 
  412. under the compilers I've been using.  These may or may not need to be 
  413. removed or altered to allow compilation on other compilers, for other 
  414. platforms.
  415.  
  416. There's nothing sneaky going on, so just compile each .cpp file, and link 
  417. all the objects together as one executable.  I keep separate sources for 
  418. ease of editing.  There are makefiles for all the compilers that I used 
  419. included.
  420.  
  421. The four included executables are:
  422.  
  423. twppos2.exe  - 32-bit OS/2 VIO executable 
  424. twppdpmi.exe - 32-bit DPMI executable
  425. twppdos.exe  - 16-bit DOS executable (8086 instruction set)
  426.  
  427. The first was compiled with IBM VisualAge C++ 3.08 for OS/2, the second 
  428. with the DJGPP package (a DOS port of GCC), and the third with an old copy 
  429. of Borland C++ 3.0 for DOS.
  430.  
  431. =============================================================================
  432.  
  433. XI. Author Information
  434.  
  435. The "I" all through the rest of this file refers to me, Mike Ruskai, and I 
  436. can be reached via e-mail to thanny@home.com, should you have a question, 
  437. suggestion, or problem report.
  438.  
  439. =============================================================================
  440.  
  441. XII. History
  442.  
  443. 01-09-99   Initial release of version 0.01.
  444.  
  445. 01-11-99   Changed port data collection completely, to accomodate the fact
  446.            that the dash to indicate that the port buys can be part of the
  447.            same word as the capacity, when it's 10000 or greater.  
  448.  
  449.            Added overflow protection, in case a rounding error makes the
  450.            calculated port capacity greater than the max of an unsigned
  451.            short integer.
  452.  
  453.            Added port type BBS - BSB, which restricts equipment/organics
  454.            pairs to ones that must buy fuel ore.  This type of pair is 
  455.            easier to use a trading script with, since no prompts to buy
  456.            fuel ore need to be skipped, allowing the scripts to be dumber.
  457.  
  458.            Altered the storage of sector data to give the DOS version a 
  459.            higher sector capacity, of something like 10000.  The Borland
  460.            executable crashes when overallocating the sector array, 
  461.            however, which I have no explanation for.  Running out of memory
  462.            during operation, however, produces a graceful failure.  Perhaps 
  463.  
  464.                                    Page 8
  465.            I can get a hold of a better 16-bit DOS compiler.
  466.  
  467.            Version 0.02 here.
  468.  
  469. 01-16-99   Added two new options:
  470.  
  471.                 /c# - minimum capacity of relevant products
  472.                 /a  - use capacities as is, no calculations
  473.  
  474.            The first specifies what a ports minimum capacity must be in
  475.            the relevant product areas (for that pair type), and the second
  476.            dictates that port capacities should be used as is, with no
  477.            calculations to determine full capacities.
  478.  
  479.            Version 0.03.
  480.  
  481. 01-29-99   Made some slight performance improvements by using memcpy() 
  482.            instead of iterative loops.
  483.  
  484.            Next on the list is the addition of a database, to report on
  485.            ports obscured by fighters, or destroyed.
  486.  
  487.            This is version 0.04.
  488.  
  489. 03-11-99   Added the ability to store binary port information in a file 
  490.            specified on the command line.  This allows the program to keep 
  491.            track of ports which no longer show up in the CIM report because 
  492.            of deployed fighters.  The type of the port along with its 
  493.            capacities are stored.  The capacities will be the last ones
  494.            reported in the CIM data, whether actual or computed maximums.
  495.  
  496.            The binary data is read first, so that CIM data will override 
  497.            anything in the binary file.
  498.  
  499.            Added the ability to zap ports from the binary data file, so 
  500.            that destroyed or permanently inaccessible ports won't be 
  501.            reported as part of a pair.  This zapping is done after both the 
  502.            binary port data and CIM port data is read in, so you can 
  503.            exclude any sectors even if they're accessible.
  504.  
  505.            This is version 0.05.
  506.  
  507. 03-14-99   Neglected to open the binary file with the ios::binary flag, so 
  508.            there may have been some spurious data here and there.  Also
  509.            change the writing to use a character instead of the default
  510.            enumeration variable size for the port type, so that the data
  511.            is 7 bytes per port.  
  512.  
  513.            Fixed the duplicate port checking.  I had switched the order of 
  514.            port loading at the last second, so that the CIM reading 
  515.            function would think port information read from the binary file 
  516.            was an indication of duplicate CIM data.  Changed the order back
  517.            to the way it was, since the binary port read doesn't override
  518.            the existent port information for the sector anyway.
  519.  
  520.            Changed the output to put an asterik to the left of any sectors
  521.  
  522.                                    Page 9
  523.            whose ports were read from the binary file, but not the CIM 
  524.            file.  This, of course, means sectors with an asterik indicate
  525.            either deployed fighters, or a destroyed port.
  526.  
  527.            This is version 0.05.
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.                                    Page 11
  581.