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!