Monday, March 10, 2014

7DRL 2014 day 3: Gotta go fast!

Today I added components to BOSWP. I actually didn't do it quite the way I planned - I'd originally intended to have separate classes and data files for each type of component (e.g. engine, weapon, shield), but I realized I could just make one generic component class which can have all the various component attributes. This way you can make a component that's both a weapon and an engine, for instance! (Thraddash afterburner from Star Control much?)

I am storing the component data in a JSON file, though. Components have a name, description, cost, mass, and max hitpoints, and then the optional abilities, which are currently limited to crew, thrust, and weapon, though I'll eventually add more like shields and scanners. I was going to have a "bridge" component which destroys the ship when lost, but that seemed a bit unfair, so I limited ship destruction to reduction of speed to zero (dead in space) or crew count below mass (drifting away aimlessly). Or of course loss of all components, but in pretty much all cases, one of the other scenarios will happen first!

It's interesting to note that as your ship (or an enemy ship) loses components other than engines, it will actually go faster, since its mass is reduced but the thrust stays the same.

Enemy ship designs are stored in a JSON file as named lists of components. (The player's starting ship is of course stored in its own file.) I replaced the generic red "J" for enemy ships with the first letter of the ship name, so scouts will appear as "S", destroyers as "D", etc. This should help with threat analysis! Of course they won't change to other letters as they lose components, so you'll have to keep track of them. Enemy shipyards will tend to save up for the most expensive ship possible (currently a battleship), though they have a small chance each turn of splurging on whatever they can afford on any given turn. (Might want to check that that's game turn, not player turn, now that I have a proper speed system!) They will also build immediately (if possible) to defend themselves when the player ship is present in their system.





No comments:

Post a Comment