Tuesday, October 9, 2012

Fighter Instantiation

I fix the issue with the faction manager.  In addition, I placed some preliminary asteroids around the waypoints to give the player a sense of perspective.  I had to enlarge the asteroids.  The smaller asteroids were just too small.  The average player just could not see the smaller asteroids at any significant range.  On average, I increased the asteroids' size by a factor of 100.  Also, I created a dwarf planet.  It's approximately 13 km in size.  It's alittle small for a dwarf planet, and it doesn't meet the actual definition for a dwarf planet.  An actual dwarf planet has cleared it area of asteroids.  However, it does represent a massive celestial object.  Despite this massive object taking up a significant portion of space, I still need to place more asteroids to avoid "void" areas; however, I am shifting my focus to the instantiation of NPC fighters.

Fighters are almost identical to generic objects.  The major difference is the existence of a fighter AI script.  This script has a number of additional variables that need definition.  The most notable is the firing arc and distance variables.  These variables not only affect weapon usage.  They also impact flight behavior.  In addition, fighters can have a waypoint variable and a mission target variable.  The waypoint variable points to a waypoint and indirectly a waypoint manager.  The mission target represents an enemy target, usually a capital ship, that is the primary target.  This target will outweigh other targets in the target selection AI routine. 

Waypoints are loaded before fighter instantiation.  This means that the fighter instantiation process can load waypoints without any issues.  However, mission targets are somewhat less predictable.  While capital ships are usually mission targets, this is not always the case.  Mission targets can be other fighters, asteroid stations or other space stations.  Consequently, this variable cannot be loaded within the normal routine.  The mission target variable needs to be loaded at the very end of initial load routine. 

I will not program this feature at this time. I want to have the capital ship instantiation process done before tackling this feature, and capital ships will happen after I get the first tutorial fully operational.  Mission targets is just not necessary for this. 


  1. Well, most of the procedure is done. However, I'm having an issue figuring out where to place the waypoint data for each fighter. I think I'll just add it to the fighter AI load routines. While I like to keep distinct scripts seperate as much as possible, it doesn't make sense to create another table to track one variable, the waypoint manager's name.

    By putting it in the fighter AI load routine, it saves some programming. I should be able to do it by adding three to five statements throughout the process.

  2. The patrol fighter now instantiates... However, it does get stuck in a certain flight pattern; I think this is a logic error due to the space station that I put into the game...