Post news RSS Progress Update April 2013

What's Inside: A summery of all of the work done during the April '13 development month

Posted by on

Hey everyone, looks like it is that time of the month again; yep time for another update. April was a pretty big month for SC due to the fact that there were some pretty big changes and much recoding had to be done since those changes affected a large amount of the code. So let us get into what I did this month.

Before we get into the actual code I want to make a note that I have made huge progress on the Wiki. As of a few weeks ago three pages are now complete as of the information that is available at this time:

Damage Types

There are still somethings that need to be added or completed but for the most part these pages are finished for now and have the most up to date information; so up to date in fact that I have to use it to update the actual game.

Now for the code changes:

There were some changes that required project-wide edits to take place. These were the removal of all using namespace declarations that were used inside of headers (these were replaced with their using [insert type here] equivalents) as well as the creation of the Entity class which now contains all entities within the game (Player, Wingmen, Hostiles, Talirath, Tech Merchants).

Battle Processing

There were some moderate changes made tot he battle loop during this programming cycle. I modified some parts of the battle loop and then went through and changed anything and everything related to the hTeam vector that was still interacting with it as if it was an array still. I also removed variable passes that were not needed because those variables are a part of the class and can be accessed by functions belonging to battle proc.

I then realized that much of the logic within the battle loop was either missing a check for something or was, in fact, entirely faulty and so an overhaul of all of the battle loop logic took place. Added a new variable called rkCode to store the rank code to be sent when creating new enemies. Another change to the battle loop was the start of programming the player action menu. This required the creation of some new variables: bFight, bResponse, and hDestroyed.

I did some major restructuring within the initHR1 function and started work on initHR2, which prompted some extensive work within the data system class. I also made a few changes to some code calling functions from damage to reflect the changes in that class.

Battle Entity

This class is a new class created out of the bAttacker and bTarget classes that were previously in Damage. I had to move them out because I could not get them to work and because doing it this way meant cutting down the amount of code used in half.

This class will obtain a pointer to the passed entity and then store it for use in the Damage class. Any and all changes made during this time will automatically be applied since a pointer directly accesses the pointed to class.

This also means that the only code required is the constructor and the code to delete the pointer once it is done being used. This class is very compact.


Move bAttacker and bTarget out of this class. Altered the code to reflect the change. Incorporated the EMP code into the process special damage function and removed their huge code blocks from the upper reaches of the file.

I added in the rest of the damage modifiers and turn definitions to the top of the file as well. Changed any and all hostile or player team calls to either bAttacker or bTarget and removed any vector passes that were created. The class only deals with one attacker and one target at a time; any attacks that deal damage to multiple targets will be processed individually through the class (although this has not yet been implemented).

Added the other weapon types to the queue processing code and fixed a small bug there in that would have caused problems later down the road because it was looking for the opposite value than was required.

Data System

Major cosmetic changes were made to the various databases by partitioning off the entries by ship class type. This makes it easier to determine where one block of ships or weapons begins and ends and will allow for easier conversion into the relevant wiki pages.

Changed ship class requirement elements to what they should have been; I had not noticed I had forgotten to change many of them from the default "frigate" requirement that I had added when I added that field to the matrix a while back.

Removed the following arrays: planet disposition, rank, race. This have now been turned into enumerations so that they can be used more efficiently in switch statements. To that end functions were added that take an int parameter and return the enumeration to the function call. When used with switches it allows for enum based switching to occur; much easier than dealing with raw integer values.

I also fixed several bugs in the ship and weapon matrices where elements were missing from specific arrays that I had missed when going through and adding in new elements.


This class is a combination of all of the code from the Player and Hostile classes. Anything that was not specific to each class was ripped out and placed into Entity and all of the code from the .cpp files was modified. Player, Hostile, Talirath, and Tech Merchant classes are now sub-classes of Entity.

Changed the ship reference from xShip to just Ship to promote a much easier method for dealing with any function calls needed to be made to the Ship class. This allows any and all entity ships to be called with the same line of code instead of having to make one for each (ex: hShip.getSName()/pShip.getSName() is now just Ship.getSName()).

Removed takeDamage from battle processing and moved it here. It now takes the damage total from the Damage class and applies it through the previously named takeXDamage functions within Entity. These were renamed to applyXDamage and take float. They then apply the damage to the specific interface they interact with and no longer process the damage or check for overflow; that is done by takeDamage.


Most of the code has been removed due to the creation of Entity. However there is still some code here and changes were made. First the second constructor was removed and I took the first constructor in a more compact direction so that it can be used for both instances, including what the second constructor was used for.

Heavily modified hSetup function so that enums from the Data System class were now used in the creation of the hostile entity.

Message Processing

Only a few changes were made here this time. First were changes required due to the creation of the Entity class and second I added in the move ship option to the battle menu; something I had forgotten to add before.


Same as with the Hostile class, most of the code has been removed from this class and placed into Entity.


For the Ship class there were a few things that had to be changed, added, and removed. First I added code for the other weapon damage type functions so that getting could take place. These functions only included lasers before now. I also removed the second constructor and merged it with the first one.
I modified the shield/armor/hull set functions to behave like other set functions for resources do so they now take the value and the operation to be carried out (set, add, subtract). Changed all functions and member variables having to deal with shield/armor/hull to floats.
Finally I added some extra member variables to deal with new damage/turn types and then added some extra comments for some of the member variables as well.

That is everything that was completed this month. Still not quite ready to self-test he battle system just yet, quite a bit of work still remains. I am hoping to get it done by the end of June or, if not, the end of August. Once it is done then only a few more systems remain to complete and test before I will have a functioning version 0.5A for people to test.

Space Crusade Developer's VLog Edition 5

Here is this dev cycle's development vlog video

Thanks for following the project, I will see you again at the end of July for the next update!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.