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 codes...so 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: http://gitforwindows.org/

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) - https://github.com/COliver988/Traveller 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 - http://gitforwindows.org/ 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
        {
            Speculative,
            Major,
            Minor,
            Incidental,
            Mail
        }


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.



Sunday, November 26, 2017

Tracker - Starports!

A ship has to land somewhere.  I've added the initial starport list. I need to figure out how to do check boxes for the Boolean fields, and add a save button for any changes you make.  But now I can add additional info to the world info pages.  And I can use that to determine the refined & unrefined fuel rather than hard-coding in the A & B ports and all that.

Probably it for a while - this long weekend I had a lot of time to myself so I had a lot of time to work on this. During the week I've little time as family is more important.


Saturday, November 25, 2017

Tracker - world details

Starting on the world details.  I've added (but not implemented) a world log based on the ship. The world log will allow you to add notes specific to that world and that ship.  The logs will probably list all the ship notes for that world, but maybe I'll add a filter. This is more oriented towards a referee so the more data the better perhaps.

Eventually I do need to address the UI. I want to make it more science fiction like.

I also need to set the options to at least let me remove the sector & world data: I've just been resetting the DB so that next time I load a sector, it will add all the systems from the TravellerMap API into the DB so we've a local copy and I don't keep hitting that API. But my parsing has been a bit off despite it being a fixed width file.

I'll also add a way to save images so that you can stick in world maps and whatever. Maybe a fancy carousal if I can figure that out...


Friday, November 24, 2017

Tracker - Jump to a new system

This now works.  You jump and it will add a week to your ship's date, create a log record indicating the jump taken, subtract out the fuel required, and debark all your passengers.

I've added a couple more fields to a couple of tables to handle this.  I will also need to refresh the screen, or use the whole IObservable thing so that the screen layout updates automatically.



Thursday, November 23, 2017

Tracker - passengers

So I did end up adding the high, mid and low passenger by the class, and how many the of each the ship is carrying.  Loading will check to see if you have any capacity, and add in the passengers at the cost times the number of passengers adding to your credits.

The jump process will have to unload the passengers - I am going to go with the assumption they are going to the destination world.  This is also assuming you are going to the system where the passengers are listed.



Tracker - appropriate for Thanksgiving, your ship can now get refueled

If you have enough credits, that is.

It will check to see if you have enough, and if so, if you are at a class A or B starport, you will get prompted for refined or unrefined. Otherwise it defaults to unrefined.

It will then top you off (class fuel capacity - what you have left in your tanks) and reduce your credits appropriately.

I could put in an option for wilderness refueling, but you can go to the ship editor and just set the fuel to what you need (and I probably should add some validation to data entry).


Wednesday, November 22, 2017

Tracker - Bulk Cargo

OK, figured a way to do this: just list the number of lots available and have another screen if you want to pick them up.

Still need to get the UI cleaned up but making progress on things working.

And happy Thanksgiving! No more for tonight as I need to make the pumpkin roll...


Sunday, November 19, 2017

Traveller Tracker - picking up passengers

I've got the destination worlds now as I also have the worlds in jump range. I've hard-coded book 2 rules for the cargo and passengers - I may pull that out to be version specific as well, although I think the tables are similar enough in all the systems.

I'm having a bit of a hard time figuring out how to display the available bulk cargos: you can have a variable number of major, minor and incidental in various tonnages. I've got the calculations done and the data is there, just how to display it...

I've not done anything with the buttons next to the passengers, and I need to verify that the numbers are correct - the high passage looks off.  I may also have to check my d6 routine to make sure it is really giving back random numbers.


Saturday, November 18, 2017

Worlds within jump range

I have draft 1 of this working. It is a brute force approach and limited to the worlds within the current subsector. It is those literal edge cases I may have to figure a way around.

The code is very simple though:

       public List JumpRange(int jump)
        {
            Utilities util = new Utilities();
            List results = new List();
            foreach (World world in TravellerTracker.App.DB.Worlds.Where(x => x.SectorID == this.SectorID))
            {
                if (this.Hex != world.Hex)
                    if (util.calcDistance(this.Hex, world.Hex) <= jump)
                        results.Add(world);
            }

            return results;
        }

Just go through the list of the worlds in your subsector and if they are in range and not your planet, add them to the return list.  The jump range calculation is based on hex maps for calculating ranges. I've added this method to the world class. It was either there or the ship class.

I am also thinking we could shorten the list down a bit by limiting the set of worlds to search from the entire subsector to just those with +/- jump range for the hex pairs. So that a world at 1020 and a jump range of 3 would give us the range of 0717 to 1323. However - systems are fast enough to use the brute force approach so that works for me.

Still need to make the UI prettier, and add a button to allow the user to jump to that system (add 7 days, subtract the appropriate amount of fuel). I also need to do this on the cargo tab - each world would have the passenger and bulk cargo available going to that world. Add the buttons to accept and subtract from available tonnage or steerage (well, that's not there) and add the credits.


Wednesday, November 15, 2017

Alell World Map

Just so there is something that is not software related. I really need to start another game...


Monday, November 13, 2017

Traveller Tracker - another view

I may not have made this clear when I started this latest version of the ship tracking software: the idea behind this is to support at least 2, maybe 3 versions of Traveller. But, everything will be user-editable and hopefully extendable. For example, right now I've got the classic book 2 d66 cargo table built. I do have the cargo loading method returning something from that table if your ship is running Classic.  However, you can change the entries, and in theory, we could even extend the table, making it a D1010 table if you wanted a wide range of things. To do this, we'd have to allow you to put in a custom version you want to play, but it is based off of one of the 3 I am hoping to support. So for instance, you are basing your game off of Traveller, but really want a much wide range of cargos. So the version table will have to have information allowing you to customize things to your game.

That will probably be further off (although now I think I'll add the dice to roll for cargo in the versions table, so classic will be d66). I need to get the durn thing to work first...

Bottom line - I want this to (a) work and (b) be able to be customized.  Which is why pretty much everything is table-based, and I'll be giving the end user the ability to update these tables. 

And there will be an option to reset to seed to reset everything back to the initial state. Hmm, meaning I may want the ability to export ship classes and ships at least.  Drat - I do need to make a project board or something to track all this! It's become a larger project than expected.

And I really want to play Traveller again - maybe I can figure a way to do that. There's just so little time available outside of all the other things I need to do. Being an adult is not what is is cracked up to be sometimes.

Sunday, November 12, 2017

Tracker - Classic speculative trade

Got it to load a classic speculative trade item, compete with the tons and all that calculated via the cargo table.

What I realized while doing this is that the cargo and passengers are based on the destination world.  So my UI will be changing.  The load cargo routine passes in the ship object, which basically contains a pointer to the current world. What I need to do is also have the list of worlds available based on the ship's jump capacity also be available. I need this for the jump worlds list, and also for the cargo and passenger calculations. What I am going for is a list, with a row per world, something like:

World    Major Minor Incidental  High  Mid   Low
Trane    5 [ ] 2 [ ] 0 [ ]       1 [ ] 3 [ ] 12 [ ]
New Rome 6 [ ] 8 [ ] 1 [ ]       2 [ ] 2 [ ] 12 [ ]

(numbers are made up and do not represent what the tables may actually yield). Click the button and (1) you are credited with the credits due, (2) updates your available cargo, (3) updates cabin space. Err, huh, I've not added cabin space in the ships.  While the base ship class probably can have this, I do believe the ship may be able to adjust this. Or just not track it just yet. Maybe version 1.1...

Still needs work on the UI.  

And now the work week starts again, so probably no updates until next weekend.  Both child & wife were away this weekend so I had some time to work on this.  Honestly, 20 hours of work would probably make this ready to test publish if I had 3 straight days to keep in the groove. As it is, an hour or two here, and part of that is just remembering where I left off...




Traveller Tracker - cargo pt 2

Got the basic cargo editor in place. I also did a test deploy to my tablet - so I can run the software on a different machine, one that is much more touch-based.  Interestingly enough it actually works. I just need to play around a bit on the tablet to see how things play out.

I still need to actually get the speculative trade part done, then also look at the basic non-spec trade (major, minor and incidental cargos).  I am really thinking about somehow rolling those into the cargos as they are cargo, but they aren't as well seeing as you just get paid to move them along with little risk.

I may have to create the list of things to do with this. As I am starting on a project management degree in a couple of months (and so kiss free time goodbye for 2 years as I work on another master's degree) this could be a good test bed for project management.


Traveller Tracker - cargo v1

I've seeded the DB with the book 2 cargos, and have an initial draft not yet in place. Part of this is also having a cargo editor.  I've the cargo list going, but also realize I may have to end up putting in a search function as well - T5 has perhaps hundreds of cargos.

The cargo class itself is a blend of the various versions.  I'm concentrating on Classic at the moment until I get that working.

If there were interest, I'd actually open up a Trello board or something to allow potential users a voice in where this is going. And as previously mentioned the source code is on my GitHub account with an open source license.  If anyone is interested in running this locally (Windows 10 only, sorry!) let me know & I can add an entry on how to do all that (clone the repo, install the tools, run the thing).

I also had to reset the migrations again: I misnamed a column in the cargo table, and renaming columns is not supported for SQLite / Entity Framework. Darn.

Cargo definition at the moment:

   public class Cargo
    {
        public int CargoID { get; set; }
        public int dTons { get; set; }
        public int BasePurchasePrice { get; set; }
        public string CargoCode { get; set; }
        public string Description { get; set; }
        // FK to CargoType
        public int CargoTypeId { get; set; }
        public int TravellerVersionId { get; set; }  // which version of Traveller this belongs to; 0 = all
        // version specific items
        // classic d66 table
        public int D1 { get; set; }
        public int D2 { get; set; }
        public int QtyDie { get; set; }
        public int Multiplier { get; set; }
        public string GetCargoType()
        {
            if (CargoTypeId > 0)
                return TravellerTracker.App.DB.CargoTypes.Where(x => x.CargoTypeId == CargoTypeId).FirstOrDefault().Description;
            else
                return "n/a";
        }
        [NotMapped]
        public string ListDesc => string.Format("[{0} {1}] {2}", D1, D2, Description);
    }







Tuesday, November 07, 2017

Traveller Tracker - Trade Goods

I pulled in a previous version set of trade goods: book 2 goods list (a d66 list) and the T5 random goods table by trade codes. Oddly one is an XML file, the other CSV.  What I will do is update the seed to add those to the DB if not already added.  The seed function only adds things if they don't exist, the theory being that once you do have it installed, you don't want to overwrite anything anyone has added.  The options section will probably have a function to reset all back to the initial data. Probably.

Now I still have to figure out how to generate the goods available based on versions. I've stubbed out the methods based on version, and they all return a list of cargos (although I may have to make some changes to include tons, codes and other odds and ends. The cargo table itself does not include tons, just what the cargo is; another table will hold the mods by version for buy/sell.  I am making this far more complex than necessary...

I may move the Traveller versions to be an enumeration instead, but I am thinking the trade code modifiers may get added in there somehow as well.

public void SeedDB(TravellerContext db)
{
   if (db.TradeClassifications.Count() == 0)
   {
      TradeClassification tc = new TradeClassification();
      tc.Classification = "Ag";
      tc.Name = "Agriculteral";
      tc.Description = "The world has climate and conditions that promote farming and ranching. It is a producer of inexpensive food stuffs. It also is a source of unusual, exotic or strange delicacies";
       tc.Sizes = "";
       tc.Atmospheres = "4 5 6 7 8 9";
       tc.Hydro = "4 5 6 7 8";
       tc.Pop = "5 6 7";
       tc.Gov = "";
       tc.Law = "";
       db.Add(tc);
   }
   if (db.TravellerVersions.Count() == 0)
   {
       db.Add(new TravellerVersion() { Name = "Classic" });
       db.Add(new TravellerVersion() { Name = "Mongoose Traveller" });
       db.Add(new TravellerVersion() { Name = "T5" });
    }
    if (db.CargoTypes.Count() == 0)
    {
        db.Add(new CargoType() { Type = "Consumables", Description = "Consumables are food and drink, and may also include aromatics. Consumable foods are gourmet items, common flavorings or staples necessary on worlds where it cannot be produced." });
        db.Add(new CargoType() { Type = "Data", Description = "Data is information that can be consumed, reproduced or processed on the target workd. It includes books, tapes, wafers, software, creative works and scientific data." });
        db.Add(new CargoType() { Type = "Entertainments", Description = "Creative workss and diversionsa are always in demand." });
        db.Add(new CargoType() { Type = "Imbalances", Description = "When the cost of producing a trade item is very low, then it can be shipped between the stara and sold at a market for less than it can be produced locally. Worlds with low labor costs can often produce goods that can be sold elsewhere at a profit." });
        db.Add(new CargoType() { Type = "Manufactureds", Description = "Worlds with establisged factories export their products to worlds that cannot produce them." });
        db.Add(new CargoType() { Type = "Novelties", Description = "New products never before seen." });
        db.Add(new CargoType() { Type = "Pharma", Description = "Pharmaceuticals and medicine for treatment of all manner of illness or disability." });
        db.Add(new CargoType() { Type = "Rares", Description = "Many trade goods are in demand because of their rarity or relative scarcity." });
        db.Add(new CargoType() { Type = "Raws", Description = "One of the basic trade goos in interstellar trade is raw materials." });
        db.Add(new CargoType() { Type = "Red Tape", Description = "Because there are interstellar governments, the products of their bureacracy must be distributed throughout their area of authority." });
        db.Add(new CargoType() { Type = "Samples", Description = "Newly discovered, created or manufactured items may be distributed to other workds for analysis or evaluation." });
        db.Add(new CargoType() { Type = "Scrap/Waste", Description = "The trash of some worlds can be a valued commodity on other worlds." });
        db.Add(new CargoType() { Type = "Uniques", Description = "Some items cannot be reproduced, adding value to the product." });
        db.Add(new CargoType() { Type = "Valuta", Description = "Sometimes shipments between worlds consist of money itself." });
     }
     db.SaveChangesAsync();
    }

Saturday, November 04, 2017

Traveller Tracker - Jump map, trade class editor

Finished up the trade code editor, complete with a delete option. Although I will probably put all the basic codes into the seed class to have them out of the box.  I still need to add a matrix of how the trade codes affect trade (buy, sell, availability). This is pretty much version dependent so I need to figure a way to allow the eventual users the ability to edit this (huh, maybe I am designing an EHR all over again!)

I also finally got the jump map display to work (thanks TravellerMap!) The code is pretty straight forward - pass in the world object & the jump range and you get a URL back.  I do have to replace all spaces with %20.  Now that I am thinking about it, I could just return a proper Uri instead of a string...next commit!

        public string JumpMapURL(World w, int jump)
        {
            string sector = App.DB.Sectors.Where(x => x.SectorID == w.SectorID).FirstOrDefault().Name.Replace(" ", "%20");
            return  string.Format("Https://travellermap.com/api/jumpmap?sector={0}&hex={1}&jump={2}", sector, w.Hex, jump);
        }


I also return the trade code in alphabetical order based on the 2 character code.  

I can generate the list of worlds within jump range from the downloaded worlds (I cache all sectors & worlds you load in the local DB, and I've code to figure out the worlds based on the hex position).

Still need to plumb in the buttons for searching for cargo, but first I have to figure that part out. And a cargo editor.





Tuesday, October 31, 2017

Sunday, October 29, 2017

Traveller Tracker - Trade Classifications

I've added the trade classification table and an initial list.  I went through a few choices before settling on the code below. I was going to actually pull the various codes (size, atmosphere, etc) into another table, so that a trade code was a list of various things, but while this gives an immense flexibility and future proofs it to some extent, I also realized I am not writing an EHR system anymore and that sort of complexity, while making future updates a lot easier, does not apply to this. So I just stuck in the UWP attributes as a list. More choices - straight list, comma, space delimited...Ended up space delimited to make the UI simpler. Backend may be a bit more complicated.

So, how does this work?  I'll add a method that you pass in the world and it returns the various trade codes.  I need to update the cargo table a bit to have how the trade codes affect the price, but I may make that another table that also includes the Traveller version. Maybe - I've not added that anyplace, but may add that to the ship. That's what I did before I think.

I've also added a class to seed the DB. Currently it just as Ag so I could at least test the trade code listing. But I'll probably get around to adding all of them.  And some basic classic ship classes.

Trade classification class:

 public class TradeClassification
    {
        public int TradeClassificationID { get; set; }

        // 2 character code (Ag)
        public string Classification { get; set; }

        // spelled out name (Agrictulteral)
        public string Name { get; set; }

        // longer description (The world has the climate and conditions that promote...)
        public string Description { get; set; }

        public string Sizes { get; set; }           // list of sizes space delimited (0 1 2)
        public string Atmospheres { get; set; }     // list of atmospheres space delimited (0 1 2)
        public string Hydro { get; set; }           // list of Hydrographics space delimited (0 1 2)
        public string Pop { get; set; }             // list of Pop space delimited (0 1 2)
        public string Gov { get; set; }             // list of Gov space delimited (0 1 2)
        public string Law { get; set; }             // list of Law space delimited (0 1 2)

        [NotMapped]
        public string Codes {  get { return string.Format("Size: {0} Atm: {1} Hydro: {2} Pop: {3} Gov: {4} Law: {5}", Sizes, Atmospheres, Hydro, Pop, Gov, Law); } }

        [NotMapped]
        public string ShortDescription {  get { return string.Format("{0} {1} [{2}]", Classification, Name, Codes);  } }





Saturday, October 28, 2017

Traveller Tracker - I forgot to have fuel

While the class had fuel requirements, I forgot to put in how much fuel the ship actually had. SO that's been added, and I got a bit more work done on the tracking view as seen below. Also linked in the log, so my test on the ship model auto-filling a few things worked.

Slow progress, but better than no progress.

On source control: turns out the .gitignore file when you create a git repo fills in a lot of things you don't need to save off, such as the solution and project files. It was saving off some SQLite things so I've also added the .vs directory to be ignored. Those are studio-generated files and maintained by the IDE so no need to save them off. I think....


Thursday, October 26, 2017

Traveller Tracker - source code

I should probably mention that the software is hosted on Github, so you could clone the repo & run this yourself as all the tools are free. I'm using MS Visual Studio (latest version).

The current version for UWP is here: https://github.com/COliver988/Traveller/tree/master/TravellerTracker

Unfortunately I am also saving off settings and things that probably should not be saved off, but as this is just for me and I do not foresee any other developers working on this, that's okay.  If at some point others decide to jump in, I'll set up my .gitignore file to reflect just the code, not the various settings and binary files I really don't need to track but was too lazy to get around to setting up to ignore.

I just added the MIT license which is pretty permissive.

Sunday, October 22, 2017

Traveller Tracker - working on the actual view

I've made a few small updates to some of the classes to include non-DB mapped items. Basically similar to javascript's promises - load the data when you need it.  It allows me to include the ship class object, world object and interesting things like that in the class to make the UI a lot easier to deal with.

Also added the initial pivot table for the view, not that it actually does anything yet, but hey, I've got placeholders!

Monday, October 16, 2017

Nothing to post

Unfortunately I've been busy and unable to spend any time on any Traveller projects lately.  I do want to do a world write up for Seslshor as that's where the end of the last game was.  I do have some basic stuff for it, I just need to write it up and make a PDF for it.

The software side needs a lot of work still but the basics are there. I still have to figure out the cargo side of things, and that is also version dependent. T5 is straightforward but boring, and I've got the old classic & Mongoose versions.  I may expand out my world definition to include travel codes but those can be calculated on the fly as well.  I may add Traveller version to the ship to move with that as well.  I.e., Classic, Mongoose, T5. I could do GURPS and T20 as I do have those rule sets, but I'm not very conversant in them.

And today is World Cat Day!

Monday, October 09, 2017

Traveller Tracker - desiging the actual ship info screen

This is the view that is the actual ship tracker: from here you can buy / sell cargos, look for passengers, refuel and plot your next location.

As I currently see it, the top part is the basic ship info: name, class info, current date and location.  The current location is a clickable link to give you a world info view.  Buttons are Searching for Cargo which will add 7 days to your current date and give you a list of the available cargos and passengers (and I may need to see if we want to make this version specific). Refuel takes no time but will cost you based on your tonnage and type of fuel, and subtract from your current credits.

Below this is a pivot table - UWP's version of a tab.  So far I see 5 tabs:
  1. Log - display the ships log
  2. Cargo manifest - shows what you have on board, and allows you to sell the items.  It should also have a print manifest option.
  3. Jump Map - use TravellerMap to visually show your jump map based on your current location and jump drive
  4. Jump list - a list of worlds within your jump range with some info.  Clicking a world will show world details as above.
  5. Ship Info is a catch all for things I've not thought of: when the ship was built, crew listing, things we may have to add. Maybe add a notes section.
I may add additional things like world notes - allow you to add notes for the world.

No development today - just design stuff and thinking about it.




Sunday, October 08, 2017

Traveller Tracker - cosmetic updates, some under the hood updates

I've added the credits available to the editor, did a bit of bolding for the labels, and aligned things a bit more.

I've also expanded out the ship listing to give the ship class info, and may end up adding the current world and date.

I need to design the actual ship tracking view, which will give a different set of options such as setting the jump (find the list of worlds within jump range - I can either redo the math I had earlier or use the TravellerMap API. May be both - 1 to show an jump map, the other to list the systems); cargo handling (buy, sell) and whatnot.



Traveller Tracker - caching the data

Finally got the caching to work.  So, when you select a sector, if you've not used it before, we create a new sector record in the Sector table, then load all the worlds for that sector into the World table (linked by the sector ID).  This is done asynchronously as we've a fast in-memory list of the worlds we use for the display.

If you've already picked that sector before, and we have worlds in it, we load the world data from the local DB.

And I finally got the code for getting the selected items in the combo boxes to work without having to iterate through them all.

               if (App.tmUniverse.Sectors != null)
                {
                    comboSectors.ItemsSource = App.tmUniverse.Sectors.OrderBy(x => x.FirstName);
                    comboSectors.SelectedItem = App.tmUniverse.Sectors.Where(x => x.FirstName == sector.Name).First();
                }
                if (App.tmWorlds != null)
                {
                    comboWorlds.ItemsSource = App.tmWorlds.OrderBy(x => x.Name);
                    comboWorlds.SelectedItem = App.tmWorlds.Where(x => x.WorldID == ship.WorldID).First();
                }


Saturday, October 07, 2017

Traveller Tracker - reset all the migrations

I finally ended up in a hole with the migrations - as we can't delete columns currently in the code first DB migrations, I had a few things out there that should be in the classes (i.e. ship tonnage is based on the class, so no need to have it in the ship details). And it was getting mixed up about foreign keys getting added after the fact.

A lot of poking around and I finally found the solution.  And it turns out to be simpler than I hoped.

The entire code first migration stuff basically tracks your changes to the DB and creates a SQL script to do the column adds, table creates and all that.  But the SQLite version of Entity Framework still has a lot of issues as previously mentioned.

So the easiest thing to do, after more than an hour of poking around, is to simply delete the database, all the migrations, and then just add a new migration to get the DB to where the schema currently is.

So in the main app where normally we process the migrations, we can do:  db.Database.EnsureDeleted() and stop processing. This deletes the database.

Then, do the add-migration in the console, and voila, you now have 1 big migration at the current state of your schema.

So, when (and there is a when!) this goes to the App store, I'll do this process to have a single migration rather than a series of migrations.  Once it does get published then it is migrations all the way...

So I also took this time to add the Sector and World tables: what will happen is that I'll have this sector & milieu stored in the local DB when you access this. So once I've downloaded the TravellerMap info I also store it in the DB, and when changing sectors or worlds we see if it is there first. This will allow for off-line for some things at least. So the ship class now has a SectorID and a WorldID, although really, just  WorldID would really be enough as the World itself has a sector ID...hmm.

I also need to add to my list of options the ability to clear the Sector and World data in case you want to reload that from TravellerMap.

Thursday, October 05, 2017

Traveller Tracker - Select a World

I've had a bit of a time getting back to this - now that school has started my son Bryson has taken over my computer most of the time.

I did manage a bit of time this evening, and the user can now select a world for their ship to be at, based on the sector and era.  I've got the basic plumbing in place now for the actual tracker. The edit screen allows you to directly change a bunch of things. The tracker will be based on your location and jump for where you can go.

Still need to add in the ship cash and a few more things, but slow progress is better than no progress!


Saturday, September 16, 2017

Traveller Tracker - logging a bit better!

I've updated the ship log to allow for text wrapping and line feeds.  I've also got it so that the era (i.e., 1105) and the sector show up appropriately in the combo boxes. It is still doing something odd behind the scenes I need to figure out - it makes a call 3 times that, while not actually doing anything should still not be called.

But some progress!  I hope to get to the system API this weekend as well, so then we can pick a system. And once we have that, we can leverage the other TravellerMap APIs to get our jump maps.

Then I still have to do the whole cargo thing.


Friday, September 15, 2017

Deckplans

I am a sucker for deck plans.  I must have hundreds stashed away on my Traveller drives.  I even bought a large format printer (goes to 13x19) to print them out.  I have printed a few of them, and we've used them a bit in gaming.  I've also bought the GURPS CD #2 and it had cardboard heroes, so I bought some card stock, a cutting board and printed a sheet up. Not liking the folding aspect, I also bought some game stands that the pieces can fit into. These are 25mm scale images, although I suppose I could reduce the size and make them 15 mm scale for the plans I print out.  I do like a physical layout when we have battles just so we know where people are at.

But my favorite deck plans, of which I've managed to actually use at least 2 times in my sadly finished game, are poster-sized deck plans. I've been addicted to Kickstarter for far too long, but Ryan Wolfe is one of my automatically join campaigns.  Not only does he do the poster (2 sided with a variant if it is single sided) but also a mini as well as a well designed PDF that goers over the ship.  While the stats are somewhat generic, I can make up the Traveller stats as needed.

His latest is sort of an oddball ship which is the start of an alien series of designs.


Saturday, September 09, 2017

Traveller Tracker - Ship Classes with High Guard types

As it says on the tin - I've added a couple of text files that list the ship types from High Guard. Long term perhaps stick them into the DB for editing but for draft 1, the classic list works for me.

I also keep forgetting that I cannot delete columns in the DB, so there is a bit of duplicate data sadly.  I am hoping that eventually the SqlLite EF adds more DB handling.


Thursday, September 07, 2017

Traveller Tracker - Location

As a test I've set the API to pull the 1105 data, and that works.  Currently the API is called at the start of the program so I'll default to 1105 / OTU.  But I will add the era listing for the ship and allow you to reload the sectors for that era.  Not sure how that works later on when picking a system and all that, but I'll cross that bridge when I get there.


Monday, September 04, 2017

Traveller Tracker - Logs and Location

Got a little time over the Labor Day weekend to work on this. I've got basic ship log in place, and I've added the TravellerMap API to get a list of the sectors. It is a big list - I may have to add the Milieu to the ship data to restrict the list to a specific version (note the multiple copies below!)

So I'll add the Milieu to the ship data, restrict that API.  Then I need to track the sector & system within the sector.  I was planning on just text fields and hope that is enough - the TravellerMap APIs will work with that data so I should be good there.

Then I need to create the cargo generator as well as having it user friendly so users can enter their own cargos.

And the UI really needs help....

But I am making slow progress, but having the web API in there is nice.  Although I am running out of the year as I was hoping to get this out before the end of the year.  However - real life keeps getting in the way of actually playing sometimes.




Saturday, August 12, 2017

Traveller Tracker - adding ship logs

I've added the cargo table definition and the log definition.  Had to also add them to the TravellerContext to get added to the database. That took a bit of digging since it has been a few months since I looked at this sadly.

Anyway, I added an initial dialog box to get a new log entry in. It needs work, and I do believe I am going to abstract that a bit more to have a single class to handle the dialogs to centralize things a bit and minimize repeating code.  I know, a class for a class, so I need to think a bit more on it.

Getting my head wrapped back around C# after more than a year of Filemaker is interesting...

TravellerContext:
using Microsoft.EntityFrameworkCore;
using Traveller.Models;

namespace TravellerTracker.Models
{
    public class TravellerContext : DbContext
    {
        public DbSet Ships { get; set; }
        public DbSet ShipClasses { get; set; }
        public DbSet Cargoes { get; set; }
        public DbSet Logs { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            try
            {
                optionsBuilder.UseSqlite("Data Source=TravellerTracker.db");
            }
            catch (System.Exception ex)
            {
                var a = ex;
                throw;
            }
        }
    }
}





Thursday, August 10, 2017

Traveller Tracker - Ship Classes

So I managed to get a bit more done, and not only can we save off a ship class, we can now add it to a ship.  The UI still needs a LOT of work, but the ideas are there. So the basic ship stuff is there. Still to go is add the ship date and a model to handle the Imperial calendar, the ship log, location and all that.

I am thinking of adding the High Guard ship classes at least as a display or something when creating a ship class, so that you can put in the values from classic Traveller if you want.  I may expand out the ship class to actually include that info. Currently the name was for that, but I think we may need the Imperial Naval Coding System prefix codes.  So that the A1 class I have can be the Billy Bob class of jump 1 traders (low cost and hitting the low pop worlds mostly).