I'm currently working on adding ship scripts which allows you to handle events such as ship being hit (it spawns explosion particles, as well as modifies the hitpoints), ship movement, etc.
I realized that in order to have each ship store its own copy of data/script, I'll have to separate the "Ship" class into three sections:
Ship Class - This contains the ship class, such as Class Name (Battlecruiser, Frigate, etc), script associated with that class (for now, all ships will use "BasicShip" script), cost of the base class, space available, etc. It's now possible to have two or more ship classes that are of the same size, but have different spaces, scripts, etc. For example, maybe if you research a new ship class that have more space? Or more hit points? Or you could have an space alien race that basically regenerates its hitpoints between turns.
Ship Design - This contains the equipment layout of a design, as well as which Ship Class it uses, this is what you see in the design window. It will also contain a "Design To Upgrade To", which if an value exists, allows you to upgrade any ships with that base design to the new design. This will be similar to MoO 2's refit, but instead of customizing each ship, you tell the game that all of ships with "Scout" design can be upgraded to "Scout II". If you have a bunch of "Scout" ships next to an owned system, you can open the Projects window and it'll show "Upgrade "Scout" to "Scout II"" as one of the possible project. You can modify which design a ship design upgrades to in the fleet window, which I will add after combat is done. The design that you want to upgrade to must have the same Ship Class as the current ship. You can't just refit a yacht to be a carrier :)
Ship Instance - This contains the base ship design, but with "Equipment Instance" which is different from the "Equipment" class in Ship Design. Each "Equipment Instance" have its own data stored. So it's possible to have damage from space combat to be persistent between combats, or missing equipments, etc. When you have a damaged ship next to an owned system, it will add "Repair Ship" project to list of available projects.
Since the old system uses one ship class, this will overhaul many parts of the game, such as race data loading, galaxy screen, fleet management, etc. But in the end, it will allow for refitting ships, damage from combat, and other special goodies that I will reveal later on! Right now, the game is not compiling because I've broken so many parts of it, but hopefully by end of this week I'll have everything sorted out!
No comments:
Post a Comment