Saturday, November 9, 2013

The New FlightControl

FlightControl is up next.  I just wanted to make some quick points on the new direction of the script. 

First, FlightControl will become a universal script.  Every interactible object will have a flight control script attached to it.  This is to standardize the access of various types of game objects.

Second, this script will receive its inputs from PlayerControl, FighterControl or some other script.  While this script is in charge with the "physical" movement of a vehicle, it cannot move a vehicle without being told to do so by another script.  This means that I will have to move the player control elements from the old FlightControl into the new PlayerControl.  As a side note, FlightControl will end up being an "input" for most scripts attached to a vehicle.

Third, it will use an applied thrust and turn variable like the previous version.  These values will range from -1 to 1 and will be used like percentages.  The turn variable will be a Vector3 with each coordinate representing a different turn component.  X will represent yaw.  Y will represent pitch.  Z will represent roll.  Applied thrust, like the previous prototype, will be a float; however, I want to make significant changes to the thrusting system with this prototype.  There will not be a set maximum speed in this iteration; the maximum speed value stored in the Vehicle type will represent a speed increment.  The amount of applied thrust will be dependent on current speed of the craft.  This equation will be the basis for determining the amount of thrust to apply to the craft:

      applied thrust = (1/(2^(current speed / maximum speed)))thrust

As a vehicle travels faster, it will become more difficult to turn the craft.  On the flip side, craft can travel faster.

Fourth, setting whether a player is in charge of the script will be removed from FlightControl.  The existence of the PlayerControl script will be sufficient to designate a player controlled craft.  This "setting" will occur as part of the triggering process.

Fifth, FlightControl will continue to have the basic collider listeners from previous prototypes.  This will make DamageControl very dependent on FlightControl.  I'm just not prepared to make the alteration of separating the listeners from FlightControl at this point.  I will note that the FlightControl script, in itself, will not touch the structure values.  This will be left up to DamageControl.

Depsite these changes, I don't anticipate FlightControl going through a major coding rewrite.  Most code from the previous prototypes will be lifted straight out of the previous version.  Except for the thrusting rewrite, FlightControl will mostly see a cut in the amount of code in it.  Alot of the past code will be cut and pasted into other scripts.

2 comments:

  1. I finalized the Scorpion model. Well, I finalized the parts for a NPC version. I still need to add a cockpit for the player version. I should get to that soon...

    ReplyDelete
  2. I think the script is done...

    At this point, it is impossible to test the script. I want to create the DamageControl and PlayerControl scripts next to create a minimum number of scripts to allow some testing...

    After that, I will need to create the HUDControl to make sure that the script really works. HUDControl will output some key things like speed and other stuff...

    I will develop FireControl last... Testing that script should be easier since the other scripts will have been developed at this point. I will probably have to back to PlayerControl to add the fire control elements into the script, but that's unavoidable.

    ReplyDelete