Skip to content

dracode/tw2002-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tw2002-client

This is a set of Python 3 scripts that are meant to assist while playing Trade Wars 2002. Developed and tested on Debian Linux, Python 3.5.3. This likely will NOT work under Windows without some modification.

twclient.py is a telnet-emulating client that you use to connect to the game server. It will read data from the game and use it to populate a SQLite database. It uses "twparser.py" to parse the data and do the actual databasing.

twparser.py is the main databasing engine. It will process a log file for you if launched directly, or will parse your session live when using "twclient.py". Things it parses, currently:

  • Computer Interrogation Mode (CIM) Warp Display -- lists all sectors you've explored and the warps leading out of each one (`C ^ I`)
  • Computer Interrogation Mode (CIM) Port Report -- lists all ports in sectors you've explored, and their current levels of each commodity. Sectors containing hostile fighters will NOT show in this report! (`C ^ R`)
  • Deployed Fighter Scan -- shows all your personal and corporate deployed fighters (`G`)
  • Planet Scan -- both personal and corporate; lists some basic stats about planets owned by you and your team (`C Y`)

portPairs.py will read the SQLite database and show you pairs of ports that are in adjacent sectors that Buy/Sell whatever commodity you want to trade. Also will give you recommendations on how to get there in the most turn-efficient manner, if you have a transwarp drive.

smartProbe.py will use the sector warp mapping data from the SQLite database to generate pathways for Ether Probes, with the goal of hitting as many Unexplored sectors as possible with each probe. Visiting the sectors with a probe will then allow you to retrieve the port data, greatly expanding your trading options.

twpath.py will use the data in the SQLite database to generate routes to/from: the nearest fighters; the nearest likely blind warps; the nearest port selling .

tw2002.db is my database from an actual game, provided so that you can try out the scripts without having to actually gather your own mapping data first.

Usage

Populating the database

You can either use the demo database as a starting point or create your own. If you use the demo database, it will not help you explore new sectors as it will believe they are already explored - currently only listing fighters will clear existing data.

To start fresh, move the existing tw2002.db out of the way and the app will create one fresh for you on next run.

To use the twclient.py to connect to a game:

python3 twclient.py example.com 23

Once you have connected and are at a standard Command [TL=00:00:00]:[1] (?=Help)? : prompt you can update the helper with your current known sectors, ports, fighters and planets by executing the commands listed above or issuing CTRL-T u

To initialize a new database with a set of additional warps from sector 1 ... 1000 and from each one of those sectors back to 1, issue CTRL-T z to start zero-turn mapping. This will take awhile, so grab a nice cold beverage of your choice.

Using the database

The database is saved continually if you are using the twclient.py above, so these commands work once you have done an update. Note, if you use an etherprobe, you should run CTRL-T u or type ^IRQ (^ not ctrl) again to update the database.

To find port pairs you know about: python3 portPairs.py (see python3 portPairs.py -h for more options)

To use smartProbe to help you use etherprobes to map optimal paths visiting as many unknown sectors as possible, run python3 smartProbe.py <starting sector> and paste the resulting stream of commands to set up your avoids. Then launch an etherprobe to the destination indicated by the command. A demonstration path computation will be run so you can ensure it's what you want before spending a probe. (see python3 smartProbe.py -h for more options)

To compute paths using more options than the game typically supports, see python3 twpath.py -h

Finally, if you are not using the twclient.py (if not, why not? ;)) you can parse play logs after the fact with twparser.py - see python3 twparser.py -h for more information.

Enabling Manual Settings

To enable auto-haggling:

sqlite3 tw2002.db "insert into settings (key, value) values('auto_haggle', '1')"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages