• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.
  • We, the systems administration staff, apologize for this unexpected outage of the boards. We have resolved the root cause of the problem and there should be no further disruptions.

.NET control for Traveller

Hemdian

SOC-14 1K
Baron
While writing Universe2 (its not done yet) I had need of a .NET control for setting the Imperial date. Ie. "001-1105". So I created a user control that looks a bit like the standard MonthCalendar control and I thought I'd share it with other Traveller coders using .NET. You can download the DLL here ... Enjoy.
 
thanks. I've downloaded it but have done nothing else yet. I'm rewriting my trade program from scratch (trying to do better OOP, n-tier & seeing about using the free MS SQL server) and may use that to track dates of purchase & selling.
 
gave me an error when I tried to actually use it - I'll have to get around to posting that to you at some time. I was hoping to use it to help set up my little trade program date stuff, but no big deal.

I've started from scratch for that trade program: I've a Traveller class, and a world class in that for handling world stuff. It will be using user-editable text files only - I've normalized the trade codes for T5, CT & Mongoose into a standard format. It uses regular SEC files to load systems. I've decoupled the I/O from the UI, the back-end world class is passed the system to use & loads the appropriate trade table to figure out those codes, and I've added the check for additional codes (Cp, Cs, Ab) that may be in the SEC but cannot be codified into a trade table.

So for me, step 1 is working: select a version, select a system & it loads stuff up correctly.

The trade tables are formatted as:
Code:
# CT trade classifications

# 2 character code<space>description,size,Atm,Hyd,Pop,Gov,Law,TL,cost effect (purchase)
# to figure it out, just read through the list
# and and that match ('-' means not applicable)
# the criteria are valid

# if an additional field is given, it is tech

Ag agricultural,-,456789,45678,567,-,-,-,0
As Asteroid,0,-,-,-,-,-,-,0

See http://webpages.charter.net/coliver988/World1.png and http://webpages.charter.net/coliver988/World2.png for where that is at the moment if anyone is interested.
 
Clean and cute, Coliver!

yeah - after 20+ years of programming I'm finally figuring out OOP a lot better (my excuse being the language I've been using all these years, PL/B, is NOT object oriented and looks like a cross between COBOL & assembly! It's only been the last 3 or so years I've started using ASP.Net to rewrite old ASP sites, and write new ones from scratch, and only the last year or so when I felt I was really getting proficient. Then they lay me off!)

I'm still not entirely satisfied: when you create a new world object, you pass the SEC string & the trade table file name. I'm thinking I'll just pass the version (MT, T5, CT) and use those as prepends for the file name. That way I can also do the trade based on that info as each system does it different. But it would allow for a standard trade table naming convention as well:

CTTrade, MTTrade, T5Trade (although I've yet to figure out how to normalize those very disparate trade methods into a single format table).

I may end up having classes for each trade technique instead.

And yeah, sorry - this is Windows/.Net only. It's a fun framework to play in, and with the free express editions (I do have the Professional 2005 studio, but this one is being written in the 2008 C# Express version) anyone can play around. I may release the classes (source code) if anyone would want them. I'm trying to make them functional & easy to figure out.

heck - the Regex to extract the info from the SEC string was given on this site by someone, quite possibly you! Or else Joshua Bell - his web site is just incredibly awesome!

Edit: and it is a fairly simple technique to see if a trade code is valid for the world:
Code:
                // and see if the parameters match
                if ((tc.size.Contains(convertToHex(this.size)) | tc.size == "-") &
                    (tc.atm.Contains(convertToHex(this.atmo)) | tc.atm == "-") &
                    (tc.hyd.Contains(convertToHex(this.hydro)) | tc.hyd == "-") &
                    (tc.pop.Contains(convertToHex(this.pop)) | tc.pop == "-") &
                    (tc.gov.Contains(convertToHex(this.gov)) | tc.gov == "-") &
                    (tc.law.Contains(convertToHex(this.law)) | tc.law == "-") &
                    (tc.TL.Contains(convertToHex(this.tech)) | tc.TL == "-"))
                {
                    this.tradeclass.Add(tc);
                }

where 'tc' is a trade structure that gets created per line from the trade classification file. tc.size, for instance, has all the valid sizes (eg 0123) or '-' meaning anything goes. The convertToHex converts the integer value of the world object's UWP fields (this.size = world size) into the hex (well, Traveller hex - it goes to Z currently) so that the structure for trade codes can have hex values. The TL thing only applies to Mongoose & Classic, so in the classioc that field is always '-'.

And I was quite happy being able to do that - I may add another option for custom (CU?) so that users can make their own tables up rather than extending/modifying the 'by the book' tables.

Something to play with in between job searches & desperate house cleaning!
 
Last edited:
the issue with the Imperial calendar is a DLL dependency. The new version will correct that.

Also making progress on my trade program which is, of course, expanding. Everything is still file-based (plain old text files, although there will be some XML so I can play with LINQ as a data retrieval system).

Main system data is via regular SEC files, but I'll add a notes file (here is where the XML comes in) so you can add notes to specific systems. I've added an empty trade tab - still just thinking about how to handle the various editions for that (T5 & Mongoose just need the world you are on, LBB2 needs both origination & destination for purchasing IIRC, so that is a possible issue).

I'm thinking of adding additional tabs: NPCs, Locations, whatever. Not really decided.

The Regex seems to not see the bases on those systems that have bases. So I need to dig into that a bit.

Here's what I've got so far (and the atmosphere & government descriptions come from external tables as well, so that the user can modify them to their heart's content. I need to add an alliance table as well; Im just does not say enough in my opinion):
world3.png


edit: added the alliance table. If I ever released this, I would have to let the user enter their own tables so as to not cross any copyright type of issues. I'd give some examples but currently they are fairly straight-forward text/CSV files. Header gives the details. But doing it that way makes this program just a framework; the interpretation of a publicly available file format (SEC) with additional descriptions based on user-supplied tables. Not so sure about the trade mechanics, however...
 
Last edited:
well, it started as a .Net DLL thread...

I keep playing with the revised (new) trade program. I decided a travelogue would be a good thing to add - track the dates jumped, and when I get the trade stuff added, notes for what was bought/sold. Stuck it in the general notes.xml file, which also holds any notes you may want to add on a system, as well as NPC notes. That part has been added.

I figure this is working it's way into a stand-alone solo merchant game, so that you can buy & sell & keep track of it all. Yep, there have been a few programs that probably do the same thing, but this is an exercise in learning some new things (LINQ as it applies to XML) that may be useful job-wise. So I may as well have fun trying new things out.

BTW: this means this is Windows only,and requires .Net 3.5. The LINQ stuff is a pseudo SQL addition to C# and is considered first class - the IDE will now supply intellisense for auto-completion. If you have any idea about IDEs and such, this does make programming a LOT easier.

world4.png


Edit (again): added a travelogue editor so you can add notes, and updated it so that if you are in the same system & date it just adds a new note there. I'll add the trade stuff back in (I've done it once in my version 1, so this is mostly a copy/paste with updates to make it class-based instead), and once that is done, it will also post when you buy/sell stuff. I'll probably keep a modified version of my old XML cargo manifest, but update that to track some additional info (current credits, monthly maintenance, etc) so I can make the program a bit more complete. I also want to validate the new system is within jump limits of the ship. If I had a better grasp of graphics I'd do it graphically.
 
Last edited:
still playing, go the T5 trades switched to the new version (at least in snagging new goods). Still need to add passengers & regular cargo. But this part was mostly just copy/paste from the original version.

world5.png


I've moved a lot of the info from the notes file & settings file to the ship file (date, current location, Traveller version, etc) so that you could actually test out various cargo designs to see how profitable they may be. I added a monthly cost, so every 30 days that will get subtracted from your current credit. I.e., you can have multiple ship files (only 1 at a time) and play through that, then switch to another ship and play through that.

For those XML-oriented people, here's the XML as I'm testing. The notes are currently auto-generated with the exception of the 'looking...' note, added via the file->add travelogue menu option.

Lots to do still, but I'll be adding 1 day for each click on the check for cargo thing, and I need to add a bit more to the cost possibly (i.e., just sitting there versus jumping & fuel costs, stuff like that)
Code:
<?xml version="1.0" encoding="utf-8"?>
<ShipData>
  <system version="T5">
    <day>019</day>
    <year>1105</year>
    <sec>Knorbes       1807 E888787-2    Ag Ri              834 Im G3 V</sec>
  </system>
  <Ship>
    <Name>test ship</Name>
    <Manuever>2</Manuever>
    <Power>3</Power>
    <Jump>3</Jump>
    <Cargo>200</Cargo>
    <RemainingCapacity>150</RemainingCapacity>
    <credits>185000</credits>
    <Monthly>27000</Monthly>
  </Ship>
  <Cargo />
  <Travelogue>
    <system system="Alell         1706 B46789C-A    Ri                 410 Im M7 V M7 D" date="012 - 1105">
      <note>jumped to Alell</note>
      <note>Prepping for jumping from Alell</note>
      <note>Jumping from Alell to Knorbes</note>
    </system>
    <system system="Knorbes       1807 E888787-2    Ag Ri              834 Im G3 V" date="019 - 1105">
      <note>jumped to Knorbes</note>
      <note>looking for cargo in all the wrong places</note>
    </system>
  </Travelogue>
</ShipData>


And the offer is open if anyone want the source code/DLL. It uses .Net 3.5 (testing LINQ stuff which is pretty cool).

Edit - I still dislike the 1 price for everything when purchasing. I hope that draft 2 may make some adjustments on that...
 
Last edited:
T5 selling now basically working

got the T5 rules for selling in place. Still using all text (CSV or XML) files for data & control. Still tinkering with the underpinnings a bit but it is coming along nicely I think.

Not sure as I like the T5 trade rules: seems that you can make a LOT of credits if you pick the right worlds & go around a bit (sort of alluded to in GURPS:Far Trader in trade routes, but it really shows here with how origin/destination worlds trade classifications effect pricing. This selling price is 2.26 the purchase price; but that does not factor ship costs, so it still may work out (that and T5 speculative goods tend towards smaller lot sizes))

And yeah - same planet. I'm just testing.

The trade cargo is a standardized thing that all versions will share. But it contains all the info about purchase & selling, so you can audit your ship's manifest so we can all play accountants in spa-a-a-a-a-ce!

world7.png
 
T5 selling finalized

I've finalized the T5 buy/sell stuff. It will now update the ship data with credits (adding), tonnage (adding back the tonnage sold), and move the item from the ship's hold to the ship's sold log, as well as adding a note. Fairly modular: the selling uses the appropriate version based on the ship's version. Currently only T5 is in there, but eventually I'll get around to adding the Mongoose & Classic versions.

The ship got a lot of credits added while testing - took a few tries for some things, but as it is all object oriented, the forms worked, just needed a bit of tweaking in the class stuff. Best part (well, for me) is that the ship data file is a simple XML file, so it can be hand-edited. That and the ASP.Net/LINQ stuff is pretty sweet for reading/updating data in XML.

world8.png


and the note:
world9.png
 
Question: to release or not to release

Question: I can wrap this up & add it to the files stuff. And I could drop the Mongoose tables, just leaving the T5 tables in there. But - T5 is still under voluntary non-disclosure, and the T5 tables this would kinda release that part of the system.

So - should I stick it there for all to see (all being those that may be interested & thus a very small number of people)? And if so, would downloaders like to have the source code (as it stands so far, but it is a moving target) for the Traveller class? It does contain the rules for T5 trading, so again, this may be a question on disclosure.

The T5 buy/sell seems to be working for me (as a previous co-worked maintained, though, I *do* have a magic computer that runs my software flawlessly for me!) but more eyes would be useful. As long as it is kept in mind that this is a beta type of thing.

(note: windows only, and requires ASP.Net 3.5 [which most win systems probably already have if you keep up to date]. No installer - I'm using the freebie IDE which is a bit limited in having no way to make an installation project, but I did copy all the files to a test area & ran the prorgam directly & it seemed to work)

thanks
 
non-graphical J6 worlds

updated the world class to be able to return a list of systems within J6. More of a brute force approach as the SEC files are not large (essentially I get the min.max range of hex positions, read the entire file (File.ReadAllLines(filename) is a pretty cool thing!), then if the hex is within that box, use the distance utility to see if that hex is actually within J6). So I added the Jump 6 listing tab, and double-clicking one of those will show system data.

For those using C#, it just returns a listing of strings (SEC format), so we have:

List<string> systems = world.jumprange();

and voila - systems is a list of SEC formatted strings, where world is my world object. I'll probably overload the jumprange to allow jumprange(int jump) and use jump as the range, which is currently hardcoded to 6. Since the ship data has ship.jump, I could just do that:

List<string> systems = world.jumprange(ship.jump);

(BTW - I'm really enjoying object oriented programming! Much better than that COBOL-like language I've used for 20+ years)

I've got ideas about the graphical side of things, but unfortunately graphics just aren't my thing.

world10.png
 
initial reporting added

I hate working w/ .Net & printing. Previously all my earlier reporting was based on business software languages, so reporting was dead simple: PRINT LINE,*N to print a line & a line feed (and just track how many lines & do a form feed/header when necessary. Same basic thing in .Net, but you have to do more manually. More flexibility really, but more manual stuff). Oh well, there are plenty of classes people have built to deal with printing for free (and there are even more that cost $$ with lots of bells and whistles). I snagged a free one (source code and all plain C#, but as with graphics, I just have a hard time wrapping my head around some of it. Too narrowly focused on billing software the last, well, far too long!)

Anyway, ship's manifest shows what you've got:
manifest.png


and history shows what you had (and the profit; hmm - do I need to have a double-booking system so you can show the Imps the 'well, I barely made a profit on these sales, and even took a loss a few times' books versus the real books?) Anyway - apparently I am working on accountants in space...
history.png
 
added detail manifest print option

must...stop...writing...business...software...for...Traveller!

menu1.png


manifest2.png


Edit: also modified the print report class so that I can change the footers: originally it was hard-coded for 'Printed on <date>'. Now, when you create the report object, you can set the footer. So my history page says 'Confidential for <ship name>' and the manifests indicate the name & date (Imperial date, that is)

Edit 2: I also moved the reporting from the main form's code to the Ship's class. So to print a manifest it is ship.printManifest(detail) where detail is a bool indicating detail report (true) or summary (false). The detail just adds those additional lines & a blank between cargo lots. Destination code is where it is getting shipped - not sure if that applies to any spec cargo, but it does to regular cargo. No way to currently set that, but I plan big and inclusive as possible! I think I do need a way to add notes when you buy cargo.
 
Last edited:
Just keep writing business software for Traveller... it'll make a great tool to use with merchantcentric campaigns...

Let me know when it's ready for release; I want a copy. Also, I'll be happy to host it at Freelance Traveller...
 
Just keep writing business software for Traveller... it'll make a great tool to use with merchantcentric campaigns...

Let me know when it's ready for release; I want a copy. Also, I'll be happy to host it at Freelance Traveller...

I just need to actually start using it for a few world trips & see how it works or not. So far I've just been having fun testing & adding new features, and trying to figure out new programming techniques.

And there is that pesky issue about copyright: the program needs the data files (trade goods, trade classifications, etc) and I really don't think I can just release them out there legally, ethically or morally. I could release the program & the directions for users to set up those files (all CSV, and the directions are actually in the commented section) so that may be my loophole.

It is ready for some rough beta testing, however. PM me if you want the link for that. I always miss the obvious problems.
 
And there is that pesky issue about copyright: the program needs the data files (trade goods, trade classifications, etc) and I really don't think I can just release them out there legally, ethically or morally. I could release the program & the directions for users to set up those files (all CSV, and the directions are actually in the commented section) so that may be my loophole.

You can release the CT/MT side under the fair use rules. The MGT side is a little difficult, the loophole as you suggest is probbaly the way to go. T5 still hasn't been "officially" released so I would use the same loophole until it has been and people know where they stand on Fan based stuff.

Just MHO.

Regards,

Ewan
 
added T5 extensions

the processes are hard-coded into the program, although I am really trying to think through a way to make it also user-configurable.

I also plan on updating the notes, adding an extensions element (it's an XML file) and saving off the extension data so that if we already created those, we keep & use those rather than re-rolling.

And I found some bugs in the random trade goods generation (I was dropping the last 2 elements in each table, and I never got around to adding the missing page 2), as well as issues in selling. So there have been some further mods to the ship's XML file (adding cargo ID for each cargo item to uniquely ID it - I kept selling the same thing if it was bought at the same place and had the same tonnage. I think we get into trouble for that sort of thing! and it explains how my test ship made > MCr in a month...although I think there are still issues in the T5 trade system - I keep making a LOT of credits awfully fast, even factoring in ship costs, although I do need to check those figures out).

Err, and the WTN is GURPS World Trade Number. There's a cross-reference table in their Far Trader book that uses this to determine pretty much the same info as the T5 extensions. I liked it in the original system, but it is only another factoid about the system.

I guess if the SEC format gets extended to include the Importance, RLIB & HASS stuff I'll have to update the regex to handle that. At the moment it will just get dumped to that file and anyone with a text editor (notepad) could hand-edit it as required.

World11.png
 
more mutterings from the basement...

added the extensions to the notes file, then started to wonder if I should make the top-level notes (per system) have different versions. Meaning the same notes file could be used for a T5 merchant ship and have it's own unique notes, and the same notes file holds info for the Classic Traveller. So that you have a set of notes per version (and the version is controlled via the ship data file).

Currently it is set up this way:
Code:
  <system sec="Alell         1706 B46789C-A    Ri                 410 Im M7 V M7 D">
    <npcnote></npcnote>
    <note></note>
    <extensions>
      <version version="T5">
        <ex>Importance    : 4</ex>
        <ex>Resources     : 5</ex>
        <ex>Labor         : 8</ex>
        <ex>Infrastructure: 14</ex>
        <ex>Barriers      : 6</ex>
        <ex>Resource units: -160</ex>
      </version>
    </extensions>
  </system>

and I'm thinking maybe:
Code:
  <system sec="Alell         1706 B46789C-A    Ri                 410 Im M7 V M7 D">
    <version version="T5">
       <npcnote></npcnote>
       <note></note>
       <extensions>
        <ex>Importance    : 4</ex>
        <ex>Resources     : 5</ex>
        <ex>Labor         : 8</ex>
        <ex>Infrastructure: 14</ex>
        <ex>Barriers      : 6</ex>
        <ex>Resource units: -160</ex>
       </extensions>
  </system>

oh well - leave the extensions as version, I think the notes can be generic for now

edit: looking at that, guess I'll move the version as an attribute the extensions and drop the version node. No wonder programmers never finish their own software!
 
RSS feed for the travelogue

added an RSS feed generator for the ship's log. currently it just dumps the XML file to where you want it, so I suppose if you had an FTP drive you could directly post that. Needs a bit of work (I think a channel per system, rather than the current 1 channel, and an entry for each note (I took the fast way initially for testing) I think this could be something useful, particularly for on-line plays if it is single ship-based. You can add your own notes, so you could add game play in there or something.

see http://webpages.charter.net/coliver988/rssfeed1.xml for the current draft. As I said - needs work (it it loads differently according to your browser - oddly IE so far works the best)

I do need to make the table stubs & release the program at some point. Still messing with the ship's XML file - it has become the de facto configuration, so that you can load different ships to play different versions, different locations (i.e., I moved the SEC file definition from the general settings file to the ship data file, so that you can play in sectors specific to a ship w/o having to reload sectors). I need to add the LBB trade in (and that's 90% done from version 1, just need to make it more OO) and get around to doing the Mongoose version.

I'll also get around to generating the help file for the traveller class - I've some tools to automate that as I've used the standard XML documenting formats. Makes for some nice documentation in HTML. The Traveller class has classes for the worlds, ship, trade & utilities so far.
 
Last edited:
Back
Top