Citizens of the Imperium

Citizens of the Imperium (
-   Software Solutions (
-   -   .NET control for Traveller (

Hemdian October 18th, 2009 03:54 PM

.NET control for Traveller
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.

coliver988 November 17th, 2009 09:57 AM

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.

coliver988 November 20th, 2009 04:46 PM

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:

# 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 and for where that is at the moment if anyone is interested.

robject November 20th, 2009 05:31 PM

Clean and cute, Coliver!

coliver988 November 20th, 2009 05:57 PM


Originally Posted by robject (Post 335814)
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:

                // 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.TL.Contains(convertToHex( | tc.TL == "-"))

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!

coliver988 November 24th, 2009 10:50 AM

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):

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...

coliver988 November 25th, 2009 07:18 PM

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.

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.

coliver988 December 1st, 2009 05:27 PM

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.

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)

<?xml version="1.0" encoding="utf-8"?>
  <system version="T5">
    <sec>Knorbes      1807 E888787-2    Ag Ri              834 Im G3 V</sec>
    <Name>test ship</Name>
  <Cargo />
    <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="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>

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...

coliver988 December 3rd, 2009 04:22 PM

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!

coliver988 December 4th, 2009 03:34 PM

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.

and the note:

All times are GMT -4. The time now is 02:02 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) 2010-2013, Far Future Enterprises. All Rights Reserved.