Thursday, July 12, 2012

Year 12 - Day 193

I continued some work on the colony Market screen today.  I added the market orders table to the database and have orders displaying on the screen.  I found I designed myself into a slight corner, so I'm going to have to rework a little bit of stuff around items, but it's nothing major.  I'm thinking by the end of the weekend most of the buy/sell functionality should be finished off.

Tuesday, July 10, 2012

Ship Upgrades

I finished off almost all of the Ship Upgrade functionality today.  When ships upgrade, they use the correct amount of Starship Structural Units that must be in the cargo hold of the ship that's being upgraded.  I changed this just to make my life easier on the code, plus it frees up warehouse space in your colony.

The only thing that's missing is the ability for ships belonging to another player to use your shipyard via Upgrade Authorizations.  To do this I need to create the Shipyard screen, but I got distracted by stubbing out the Market screen as well.

With Upgrade Authorizations, you'll be able to allow another player to use your shipyard to upgrade to a certain level at a certain price.  You'll also be able to make it an Open shipyard that anyone can use at a certain price.  Along with the maximum level, you'll also be able to set a limit on the number of times a player can use it.

The Friend or Foe lists will also come into play here with options to allow ships on your Defend/Support lists to upgrade and of course to prohibit ships on your Enemy list from using the shipyard.

Year 12 - Day 191

So obviously I shouldn't make game decisions late at night after starting at code too much.  Making the ship upgrades cost 100 Ship Structural Units per level meant a ridiculous amount of materials would be spent at higher levels just for the ability to add another module onto the ship.

So the way I've got it setup now is that it takes 10 SSUs to go to the next level, but if you're going up at new base level (i.e. 1.9 to 2.0) then it takes 30 SSUs.  This takes into account that the new base levels allow you to also add another Engine or Command module.

I'm going to do the same thing for how much time it takes to upgrade ships also.  There will be a built in 1 hour to take into account moving the ship in and out of the shipyard, then it will take about an hour for an upgrade that doesn't increase the base level, and three hours for one that does.

So going from 0.1 to 0.2 will take about two hours.  Going from 0.9 to 1.0 will take about four hours.  There will likely be skills for personnel at a colony that can modify this down a bit, so a colony that is more experienced at upgrading can get you in and out faster.  I may also have it so a colony can specialize in Building or Upgrading so that you're faster doing one over the other.

Saturday, July 7, 2012

Year 12 - Day 188

I took a break for the last week or so due to the holidays and a small amount of coding burnout, but I got back into it tonight.

First up I was trying to kill a bug where all the new ships I was creating was starting with Morale set to 0, when it should have been 10.  At first I thought it was a problem with my SQL insert, but I checked everything and an almost duplicate default value for Ship Class was working fine, so I tried not using the default value on the insert and it still came up 0.  After over an hour, I finally started thinking "oh, it must be a bug with MySQL", which is almost always NOT the case, but after a while you start getting desperate for answers.  I finally figured out it was because I wasn't initializing the time for when morale was last checked for the new ship, so the game though morale for the new ship hadn't been checked since Jan 1, 1970, which caused it to go to zero instantly.  Bleh.

After that I started giving some love to the Shipyard functionality when a ship is landed at a colony.  I've got it cleaned up a good bit, and now I just need to make it use resources, which will likely be Starship Structural Units.  Initially I'm going to set it to New Ship Class * 100 Structural Units, so to go from 0.1 to 0.2 it will take 20 units.  These units will either have to be in the ship's cargo hold, or in the colonies warehouse if your ship is at a colony you own.  I'll post a screenshot soon.