Saturday, December 30, 2017

Tracker - some general cleanup

Mostly under the hood updates. I've added the ability to remove the cargos and logs for a ship, as well as deleting a ship itself.  As I've updated the way the ship cargo works so that it is never actually deleted, even when unloaded, you may want to clean up things after a while.  I am setting an active flag for the cargo so we can have a cargo manifest based on what is currently loaded, or on some historical dates (i.e., what you were carrying 3 months ago. Pesky bureaucracies!)

Minor UI update to the ship list to make it a bit easier to read, and I've added the version and current planet as well as the delete button.  The number in [ ] is the ID of the ship.  I'll probably remove it but I thought it could be interesting to see how many ships you have added.

Tuesday, December 26, 2017

Tracker - buying and selling spec trade

Both the purchase and selling go through the same control now - the difference is which DMs are you using (purchase or resale) and whether you are adding it or removing it from your cargo.

Basic part is there (and spent way too much time rotating that text - as it is in a grid that caused the text to get truncated until I figured that out). You can add your DMs, click the roll, and it will calculate the price based on tonnage and the actual value table.

Now, I need to make it actually buy or sell when you click the button, but that part is already written. What I need to do is now abstract that out from the ship tracking view so that I can buy or sell cargo from a ship in other places.

It was interesting getting the actual value tables in place as well. They will default to 100% when loading the first time, but then you can set than as you wish.

Still need to let the user add new versions and a bunch of things like that. And I need to get the basic how to document done. But that will be mostly an iteration of:

  1. create a ship class. This is where the tonnage, jump, maneuver, power, cargo and passenger information is stored. If you want to modify a ship in terms of any of these things you will need to create a new ship class.
  2. create your ship: select the version, the milieu, the date, the ship class. Set your location and initialize ship funds
  3. create any cargo you want. currently I am sticking in the original d66 table from book 2 but it does not include the trade code DMs.  
  4. go to the ship tracking (ship list, then select track for the ship) where you can edit your ship logs, see what worlds are in jump range, load cargo and passengers, jump to any world within reach.
I've got a few things there I'm not actually using. I've set up the trade codes as a table you can edit so yo can set the trade codes based on the world stats, but at the moment I am using the remarks field from the TravellerMap API so I am not sure I'll keep that.  I've an options button that does nothing.

Tracker - selling spec trade - just about there!

I had to make a few more changes to the database: we need to track the price we purchased it at and sell it at. This way you can tell if you are making a profit or not. I plan on logging all this to the ship log, but also I may not actually delete cargos from the ship cargo manifest, but set them to a sold/not there anymore status.  This would allow us to generate the cargo manifest from any point to any point in time.  In case the custom's inspector wants to see what you were carrying the last time you came through this system 6 months ago.  So eventually the print cargo manifest will allow you to print what is currently on board, or what was on board for a specified date range. I do stress the eventually...

A few other changes, and I've (finally) got the trade code stuff working, and allowing the players' to have a DM on the actual value table. The roll button should add the number of days to your ship calendar as per the searching for cargo I think, and I've got to wire up the actual sell part (which is coded but not called).  But the resulting price is the base price * the tons * the percent value (which I now realize I need to divide by 100 - there is some major price gouging in that image!)

And I also have to revisit purchasing the spec cargo - it will end up being the same user control but in buy mode vs sell mode.This way we can keep the price you paid for it as well.

I've also added a UserBackground brush to my resource dictionary so that all the user controls can have the same color - change it one place & they all get the same color. Just need to update the other controls to use that.  The light blue is not a great choice...

Monday, December 25, 2017

Tracker - selling your spec trade

Getting closer.  I've added the actual value tables to be version specific, I've added trade code modifications to the Classic Traveller cargo, and I've got the basic sell your spec trade layout in place.  Now I have to figure out which DMs are available, so I will also be adding the current world's trade codes in a display at least, then cross-reference the two so we know which apply.

I'd almost rather have the DM based on cargo ID and trade code ID, but the data maintenance side of that would really bring back to mind the accountants in space trope for Traveller.  So I took the expedient way and will let the user just enter text.

And in re-reading the rules, the purchase price is also affected by trade I need to revisit that.

Sunday, December 24, 2017

Tracker - more version stuff

Adding the resale value table to the version.  Having some issues with this one, but making some progress.  But it does allow you to set the cargo code type as well as the actual value table.

However, for some reason this popover does not go away when you click outside of it.  Most strange!

Tracker - selling speculative trade

I've got the framework now in place - clicking on the remove button, if it is a speculative trade, will show the following pop up. The actual value table will show on the right, and I've yet to fill in some of the data. And this is another user control. And the UI needs work but it is the first draft.

However, I've decided to add the actual value table as a user-editable table to be attached to the version in play. Which means the simple version editor will get a bit more complicated, but it also solves, or rather bypasses, the issue I wasted way too much time on yesterday: getting an enumeration (the cargo codes) to be a combobox (list of choices) to display and work in a list of the versions.  So now there will be an 'other options' at the end of the version editor to allow you to enter the cargo code type and enter the true value lists.

I also need to work on the trade code part. I've got most of it in place, but the DMs are also version dependent or should be, so I may have to extend the trade codes table to also be linked to the version.
Doing this version-dependent thing, and not actually supplying the data, may allow this to get published without issue, but I will still be checking.

Saturday, December 23, 2017

Tracker - buying speculative trade items

Turned out to be a tad more complicated - a speculative trade does not have a destination world, so a few logic changes had to be made to handle that.  But you can now purchase spec trade.  I may or may not have mentioned it before, but the cargo code will be based on the Traveller version you are using.  For T5, it will show the T5 code (I need to look it back up, but basically it was the origin world trade codes, tech level and a few other things). Mongoose & Classic will use the BITS cargo code stuff, which is still a work in progress.  Strike that - I will add the cargo code as an option to the versions as well so you can do with it as you want.

Minor cosmetic change to the cargo manifest view - figured you may want to see what you actually bought...which also means I will also be filling in the bulk cargo with...something random?

And I still need to let you sell the spec trade - that is where this gets a bit more complicated.  But fun!

Thursday, December 21, 2017

Tracker - Traveller versions

A minor update to the versions - I've added the option to set the number of days it takes to search for cargo.  When you click the search for cargo and passengers, it will roll up a new speculative cargo as well as all the bulk cargo and passengers, as well as adding the specified number of days to the ship calendar. I may also add an automatic ship's log to that effect.

Still have to deal with the purchase and selling of the spec cargo - buying is straightforward, just add to the cargo tonnage carried, subtract the price from your credits (assuming you have enough!), and add a cargo record and log. Selling is more complicated due to the true value table (which may end up in the versions table as well somehow) and various DMs you may get based on version, as well as the potential for using a broker.  I may simplify by just allowing a manual entry for player DMs, as well as take into account any use of a broker.

UI is all over the place so that will have to get cleaned up at some point as well, but I want to get the basics in place.  Pretty sure, outside of Christmas, I'll have time to get to the spec trade part.

And if anyone has any ideas for things this should do, let me know.  So far I'm just doing this on m own with my own idea of what it needs to do. I may be missing something really important. Such as the ability to add your own version (can anyone say Cepheus Engine?).

And options: so far I think (with nothing actually done, just figure I'd write things down so I may remember them later):
  1. the ability to reset to the seed values
  2. the ability to clear sectors and worlds (when you select a sector, if it is not already in the DB, it will use the TravellerMap API to load all the worlds based on your milieu. You may want to 'refresh' that in case there have been updates)
  3. the ability to import your own sector file (it would have to be in the TravellerMap format)
  4. exporting data in some way
  5. use the TravellerMap to have a grand journey route picked out for you (Alell to Regina)
  6. instructions!
  7. open game license info

Monday, December 18, 2017

Installing a developer version of Traveller Tracker

Not for the faint of heart, but there is a way to run this before it gets published. You will need to download some large software and sign up for Github, so if that does not scare you off...

First, you will need to be running Windows 10.  As the end goal of this is a Windows App Store (otherwise known as a Universal Windows Program or UWP, or sometimes I think UA for Universal App [Microsoft has got to have the worse marketing and naming departments in the world]) it currently only runs on Win10.  As the .Net run time is becoming more platform independent, at some point in the future there could be another version that could run on a Mac, or Linux, as well as Windows. But first things first.

I also recommend getting Git For Windows - this will install the Git client on your system. Doing this means that it will be easier to keep up with updates to the source code. Otherwise you have to down load everything every time I make a change.  Git for windows:

Next, you may need a Github account. I am not 100% positive you do but it does make some things easier I think. 

Go to my Github Traveller repository (henceforth known as a repo) - and on the right hand side there is a button to clone or download the directory.  If you have Git installed on your computer, use the clone option.  I recommend making a Git directory in your Documents folder, but that's up to your personal preferences. Cloning a repo means that, with a single command at the Git bash shell on your Windows computer (assuming you've installed Git for Windows) you can get all the updates, and only the updates.  Save off this directory. Unfortunately this will also bring down a few dead end directories, but you can get rid of those.  The code in question is TravellerTracker.

So now you have a few dozen directories with a lot of files. To make sense of all this, you will need to download and install Visual Studio - Use the community version - it is free and very useful. If you are not a developer, it can be a bit daunting. It is also a very large program so be prepared to wait a while to get it installed. And it seems to be updated on a weekly basis which is also time consuming - not sure why all the tech companies have gone form a yearly update cycle to a let's release things a lot that are broken and fix it next week with a fix that breaks other things...but I digress.

So open VS2017 (Visual Studio 2017), and open a directory. Open the TravellerTracker directory.  I think it will ask if you want to make a solution, if it does, say yes. This will help speed up things next time.  Then hit F5, or click the green arrow that should say Local machine I think, and it will compile then run the program for you.

I have glossed over a few of the steps, so when there are questions, and yes there will be questions, just let me know and hopefully I'll be able to help.

What I am also hoping to happen is that if a few people manage to get this running locally, they can give me help on what it needs to do. I tend to look at things from a developer viewpoint and not a user viewpoint once I get started (and I've been writing code professionally for 30+ years, almost as long as I've been playing or at least playing with Traveller!)

I'll also have to document how to use the software a bit. Once you get started I think it makes sense, but until you get started it may seem a bit...empty.

Sunday, December 17, 2017

Tracker - we have jump...

Removing the cargo is the same thing as unloading it, just the world and the date is the same you are currently on.  So that method gets called when you click the delete button on a cargo item, or make the jump.

I've also added in the jump process to unload the cargo, and this also automatically adds ship logs for you.

So honestly this is really about 90% done - the UI and a few things need work, but the rest is basically fluff. The core stuff seems to work (of course I say that as the developer without any user testing whatsoever...)

Tracker - passengers as cargo

While not exactly what the High Passage clients think, having the cargo manifest include passengers will make unloading them at the proper world easier.  Plus I will customize the cargo manifest at some point to list the passengers in their own section.

Depending on where I end up today, I should have the jump process then unload all passengers and cargo if the world is the destination world.  I also need to add loading/unloading to the ships log as automatic entries.

Took a couple of tries, and I probably need to add a delete button in case yo want to offload unruly passengers or cargo before the jump.

Saturday, December 16, 2017

Tracker - World user control

I've added a world user control which is what the tab for the world info used to show. Doing this allows my now to add an event to the worlds in the jump list to load that world's information.  The advantage of this is that now I can display world info wherever I need to and it will be standardized.

I've also abstracted out the image processing so that I can handle it without repeating code - the while DRY (don't repeat yourself) mantra in developing software.  I'll be adding the image library, which may be ship or world based.  Which means eventually I'll probably add an image carousel to the ship page, and the world control.

So the World Info tab is no longer there, but you can click (or touch if touch screen) the world name and the control shows up.  So you could review the logs of any worlds if they exist.  I've also updated the logging a bit so that creating a log entry for the world is no longer tied to the ship. It is tied to the ship date so we know when it was put in, so to speak.  Still thinking about that - we may want to allow the logging to override the date.

Not sure about the color either, but by default it was the same color as everything else and looked confusing. So I stuck something in there.

Thursday, December 14, 2017

Tracker - basic DB schema

If interested, this is the rough schema for the tracker program. Essentially a Ship object is the primary thing - you can run multiple ships in different Traveller versions.  Ships have a ship class that determines the basic things like tonnage, jump and maneuver, cargo and passenger capacity.  A ship is on a world that has all the stuff from the TravellerMap API (I store everything in the SQLite DB - you set a ship sector and if it is not already in the system, I go out & get the info and store it locally. The idea is that this can still be useful even if not connected to the internet). A ship also has cargo (which is speculative cargo as well as bulk cargo, and passengers are basically treated as cargo but take no cargo space).

A few other support tables, and a few things still in flux.  Not all the tables are listed.

There is also a seed class that preloads a few classes, the Classic Traveller cargos and a few other things the first time you run the program. 

Sunday, December 10, 2017

Tracker - bulk cargo pt 3

Looks like we can now load the cargo on the ship. It will add to the ship cargo (thus reducing the available cargo space), add the appropriate amount of credits (based on the Traveller version cost per jump).

Next step is when jumping to a system, check to see if any of the ship cargos is going there and unload them - basically just add back to your cargo space.

As I do flag the cargo by an enumeration I can just check for anything that is non-speculative and adjust then.

public enum CargoTypes

Still need to work on the cargo codes themselves (i.e., T5 has a code, and I've the BITS stuff to work out still).  And I'm pretty sure we can't actually purchase the speculative trade yet, but that just means writing the stuff to get the costs. And I may have to add the purchase/sell adjustments to the versions table as well (although T5 maps 1:1 with Classic actual value table)

It did take me 3 times to get it all in there. I've also added a Cargo Available tab to list the available cargos, and made the Cargo manifest tab the actual ship's manifest. Probably need to add passengers as well (they can be set up as cargo - I'll just add enum values for high, mod & low passengers).

The list is the cargo type, tonnage, origin world & destination world.  And yes - I really need to get around to making the UI pretty...

Tracker - Traveller versions

I've expanded out the version stuff a bit, and added an editor.  I probably need to add an option to add versions so you can have a IMTU set of things.

I expanded this out because in doing the shipping costs, I did not want to hard code in Cr1000 - it should be the distance x the cost based on jump.  As there is...contention...with how this works, I'll leave it up to the user to set the cargo costs.

And now that I am thinking of it, probably should add the berthing and daily fees for staying at a starport. Or would that be in the world definition, or both - default to the version but allow the world to over-ride the values?

Saturday, December 09, 2017

Tracker - Bulk cargo pt 2

Finally got the UI to actually show things (there is a scroll that shows up when you use it.  and interestingly, on my touch screen PC this works surprisingly well).

Now to have the load button actually load the cargo into your ship!

Note that the cargo code is going to be the BITS cargo code, so there is a LOT of interesting tidbits in there, such as the cargo container type and size, what is in the container, and potential hazards. What I am planning on doing is for the bulk cargo is to create a random code (it will have to fit the tonnage but other than that...)  So you may end up carrying something toxic only to Aslan and not be aware of it.  There will be a decoder in there somewhere, perhaps on the cargo manifest itself.

Tracker - loading bulk cargo

After a few rabbit holes and interesting design choices, I think the bulk cargo loader will be a pop up when you click the inspect button on the cargo listing.  However - getting a pop up to work has proved to be more interesting than I thought.  Turns out that having it created dynamically with a user control would be ideal, but due to the way XAML handles the visual tree (how things get displayed), sticking it in a pivot table (that horizontal list of options, basically a tab control but with XAML...) does not work.

So I stuck one in the actual page, same level as the pivot, and that works. Except my list of cargos is not showing up.  That and I had to dust off my user control memories.  But (other than the color which is there just to see if it is there) progress is being made. At least the world name show up!  Of course, I still need to get all the cargo in the ship itself, and now I am really thinking cargo is cargo regardless if it is spec or not. Difference is you get paid for bulk up front, and you pay for spec up front and sell it later. So I need to get that figured out.

I also got the image thing finally working. I need to abstract that as I do plan on allowing the user to load images in other places. But as we say in development - premature optimization is the root of...well, trying to think too far ahead.

Sunday, December 03, 2017

Tracker - world image

Add a way to add an image to the world. Halfway there at least - I can let the user pick an image. Now to actually save the thing back to the database...should not take too long.

Saturday, December 02, 2017

Tracker - world logs

I've updated the world info a bit - and you can now add logs.  I think if the world is part of that I need to figure out if I want to include the world info on the ship log as well.  I may have to add some more info about if this is a general note or a ship specific one or something.

I've also updated the refuel process to use the port's fuel.  And then realized I've not added a way for you to add a new port or delete a port.

Maybe tomorrow I'll have time to figure out the image thing. Or not - we're off to see the Russian Ballet.  A little bit of real world culture.

Tracker - a bit more on the starports

Turns out the check boxes were just that, and it also turns out that having the 2-way bind seems to also automatically update the database. So I may have to look where I am doing some possible unnecessary trips to the DB.

I've also expanded out the ships log file to have a worldID and an image.  The ships log will be a general holding place for notes, so that we can add notes to the ship, or the world, or if we like, link it to both.  The image part allows me to add images to the log in case you want to do that (look at our full cargo bay!)

Which means I may need to go ahead and drop the WorldLog I had, and maybe another full migration. Or see if the remove-migration world log would work...

Hopefully tomorrow I'll get the image thing figured out. While I'd like drag & drop, we'll just have to see if I cam name that work.