Sorry for the late update, more info on why this is the case in side.
Posted by Geowil on Jun 4th, 2012
Hey everyone, welcome to April's progress report update for 2012. Sorry that this is several days late, however a couple of things caused the need to push back the CI/SC release to today. One of them, the one relevant to this site, was that I built a new computer at the end of April and have needed most of May to get things back up and running. I required an extra couple of days in order to get the content for our Combine Insurrection update ready and so I decided to push the update back to today.
Anyway I was able to get quite a lot done for Space Crusade in April. As noted during the last update, I am just going to summarize/explain what was changed here. For the exact, and shorter, details see the change log here.
I made quite a few changes and additions for this update. The most notable of which were damage types. I created the class and several functions as part of that system. However it is fairly complex due to the way I currently have targeting working right now. Arrays are passed to certain functions where the damage type affects the target ship in some way other then damage; EMP damage, foe example, can deal more damage to shields but also disable the target ship for a certain number of turns. To do that currently an argument is passed so that the function can interact with the functions that control if the ship is disabled and for how long.
Most of the damage types have been added but not all of them have the implementation code yet. I may change how the damage and special affects are applied in later revisions to cut back on the amount and complexity of the code. I had to create several new damage variables to track secondary and tertiary damage.
I added various variables and functions that control both shield and ship disable time periods in response to the EMP damage type. Disabling the ship is very simple and it employs checks in the battle loop to see if the ship is disabled or in the damage calculation to check if the shields are disabled. I also created this system for weapons.
I cleaned up the Hostile class and moved any and all functions for weapons or ships to those respective classes. I also added some missing functions such as one to get the disposition of the hostile or to get the race of the hostile. Due to the re-realization of the ship initialization process I was able to remove 40 lines of code from the Hostile constructors.
Battle Processing had the most changes this update. As mentioned there are two new damage variables to handle special damage. I also started to recode how the modification of damage due to special damage types occurs to try and keep the size of the function down. Due to the changes to the ship class intilization I was able to remove at least 90% of the inilization code used prior for hostiles. Some function calls are still present but nearly all of the variables are gone. That was a change of 157 lines of code (not fully finished either) to 8 lines (so far).
I also did some work on the battleLoop by removing and variable declarations and placing them into the header file. Going along with this the initHR1 function is now very stream lined. All it does is grab an item code via random and passes it along to the respective classes to allow them to do the heavy lifting. For example it sends the ship code to the ship class which then sets up the enemy ship. I removed 99% of the code from this function with these changes. I added a few bool variables for use with the batleLoop regarding changes made with the other classes for ship disabling and other battle related events.
Another modification to the battleLoop was the addition of two bool overrides ship and planet to break the battleLoop into battle types. Before, in the previous version, a variable was passed to determine the battle type, now all there is a need to do is set one of these to true to enter that style of battle.
I fixed a problem with a battleProc function, hDCalc. The code would have claculated the player's damage instead of the hostiles damage. I also moved the findTarget function call to the top of both pDCalc (player damage calculation) and hPCalc.
I added a pRetreat function to battleProd to allow the player to try to escape from battle as well as related bool checks in the endBattle function so that if the player did successfully retreat there will be no rewards. I also added some more bool and int variables for various features.
Damage is now calculated as a float. It was an int before.
The ship to ship, singular, battle potion of the battleLoop has been pretty much completed. I have also got a good deal of the team ship battles done but since player teams have not yet been implemented it currently processes the battle as player vs hostile team. Planet battles are not started yet.
I have changed menuProc (menu processing) to msgProc (message processing) and changed all related references through out the code. Nearly every function in this class has been changed. Previously all it did was print out a menu and a prompt for the player to enter a choice then returned to the originating code lines and continued from there. Now each menu is self contained. The options are printed and the choice is made within that function and the player's choice is sent back to the originating position. This allowed me to remove 40 to 60 lines of code from each class dealing with menus.
This is also in preparation for future releases where rts style game play unit messages or objectives may be retrieved from a compendium of messages.
Along with these changes I also created the status pages for both the player and two for hostiles. The second hostile status page actually allows you to cycle through the statuses of all hostile team members. I also moved a declaration for 'i' to the header file for the for loops associated with these functions and the rest of the class.
I removed several functions from the player class and placed them where they belonged, in the ship class. I also changed the takeDamage from an int to a float and added a second damage variable for modified or special damage. I found a few places where I was using the depricated 'd' damage variable instead of damage so I fixed those as well.
I added an attack function in order to process and send damage totals back to battleProc when called as well as replacing the entire player creation function of 90 lines of code with just two function calls besides the msgProc calls for the player's choices. That function went from 90 lines of code to 5 or 6.
In the ship class I added a hostile bool variable in order to detect if a hostile ship was having its resources set and if so to apply a random to the calculation for resources. Player values are not changed in this manner. I added the functions and variables for ship disabling along with new code for weapon initialization. It goes along the lines as the ship init dose, all of the hard work is carried out by that specific class, the parent function just sends an item value for the init function to process. I also added the resource variables to the ship class.
Finally I added a few function calls to the msgProc class for obtaining menu choices and edited the code there previously to work with these new functions.
That was quite a bit of progress but we still have a long ways to go. I would estimate the 0.5 alpha version's completion at about 28%. There are a lot of things to deal with still, like station menus and stores, but we are making progress.
Thanks for taking the time to read this wall of text and for following the project!