Tuesday, July 31, 2012

Tutorial #1 Dialog

Well, I'm not the best writer when it comes to fiction, and dialog has always been one of my weakest facets.  However, each mission will require a certain amount of dialog.  So, here's the basic dialog for the first tutorial mission.  It's a rough draft and does not necessarily reflect the final product.  It does provide some key events in the first tutorial.  First (like all missions), there will be a Briefing section.  This will occur outside of the ship, and I am considering 3D human avatars to facilitate this section.  Basically, this section will be a cut scene or an interactive cut scene (and this might depend on the mission).  After the cut scene, the player ends up in his fighter in space. 

All of the dialog originates from the instructor in the first tutorial.  While I do want some dialog interaction for each mission, that will come much later in the development cycle.  Here's what I have right now:

Battlestar Tutorial #1: Transcript

Pre-Mission Briefing:


Welcome to the Colonial Fleet’s Basic Flight School.  I am Lieutenant Terrance Duck, your flight instructor.  I’m flown combat missions for the last four years before transferring to this job.  My job is to get you nuggets ready for Combat Flight School and to get you out to the fleet.  I also answer to God.  Until you graduate from this school, you will be answerable to me.  I tell you to do something; I expect it to done.

Before I put you in a fighter, I expect you to be familiar with the basic controls.  First, you turn the fighter with the mouse.  Your fighter will turn faster the further the mouse pointer is from the center of the screen.  Second, thrust is control by pressing the W or S keys.  W will apply forward thrust.  S will cut all thrust to your fighter.  In addition, you can use the mouse scroll to apply thrust.  Scrolling up will apply a small percentage of thrust and scrolling down will reduce a small percentage of thrust.  Keep in mind that there is no friction in space.  When you apply thrust, you will travel in that until thrust is applied in a different direction.  If you cut thrust, you will continue to move along that last vector.  You can turn the ship all you want, you’ll still be travelling along that vector.  Finally, you can stop your fighter by pressing the Space key.  The space key applies inertial thrusters which will stop your fighter. 

So remember, Mouse pointer to turn, W and S for thrust and Space to stop.  If you can remember those, you’re ready for the first mission. 


Your first mission will be in a Scorpion Class Fighter.  It is an older fighter model and does not have the turning power of the new Vipers.  However, it’s an excellent fighter to begin your training.  I will fly us to a waypoint and stop the ship.  At that time, I will turn controls over to you.  You will turn the ship in the directions I specify.  I will then instruct you to go to each waypoint programmed into your Nav computer.  Once those are completed, you will bring the fighter to a full stop.  I will take control and land the bird on the Destroyer. 


Okay, nugget.  We’re free and clear of objects.  You have control of the bird. 
First thing first.
I want you to practice turning. 
Turn left by moving the mouse pointer to the left part of the screen.
Try that again.

Turn right by moving the mouse pointer to the right part of the screen.
You can also turn up and down by moving the mouse pointer in that direction.
Try that again.

Now, I want you to find the first waypoint. 
It’s the red marker on your screen.
Keep turning until it is in the center of screen.
Try that again.

We’re going to apply thrust. 
Press the W key to apply full thrust.
Keep the waypoint in front of the ship.
Try that again.

I want to show you a key concept in space flight.
We are going to cut thrust.
Press S to cut thrust.
Try that again.

We’re still travelling the waypoint.
Now turn the ship and look around.
Try that again.

Now turn to the waypoint. 
Try that again.

We’re still closing in on the waypoint.

Okay, waypoint one reached. 
After reaching a waypoint, it turns blue and the next waypoint turns red.
Find waypoint two and head towards it.
Remember to apply thrust by pressing W.
Try that again.

Alright, I’m going to show you feature of the Scorpion: breaking.
Press the space bar to stop the ship.
Try that again.

The space bar applies inertial thrusters that stop your fighter.
Now instead of pressing W for thrust, use your mouse scroll to scroll up to incrementally apply thrust.
The mouse scroll only applies a portion of the thrust. 
Try that again.

As you continue to scroll, it applies more and more thrust until the maximum is reached.
If you only apply a small amount of thrust, you will accelerate slower and skid as you turn. 
Sometimes that’s a good thing.  It depends on the fight.

Now we’re going to reduce thrust with the mouse scroll.
Scroll down to reduce thrust. 
Continue to reduce thrust until there is no thrust.
Try that again.

Now turn the ship and look around.
Try that again.

Okay, enough fun and games, turn the ship back to the waypoint.
Try that again.

When we reach the next waypoint, I want you to turn the ship and head to the next waypoint.
I’m not going to prompt you…  Unless you take too long.

Alright final waypoint has been reached.
After reaching the final waypoint, another waypoint will activate at the location of the closest battlestar or other landing platform. 
I want you to fly to back to the battlestar.
I’ll take control once you get us close enough and land this bird.
Landing will be another tutorial.
If you want to continue to practice, keep flying.  Just don’t get too close to the battlestar.

Conclusion of tutorial dialog. 

Friday, July 13, 2012


This is an overview of the approach for completing the tutorials (and more importantly, the event manager).  Each tutorial will feature an independent event manager in these initial stages.  As the tutorials progress, I'll create a single generic event manager that handles the most common events in all missions.  Unusual events will be handled by an independent event manager.  Basically, the plan is to have two event managers in a mission (one for generic stuff; the other for unique mission objective stuff).  The event manager will handle the flow of each tutorial and will rely heavily on a resource manager. 

The resource manager will handle the actual operations (like retrieving data from a database).  Every mission will have a resource manager hidden in the background.  The event manager figures out what needs to be done, and the resource manager get the information so the event manager can complete the task. 

So, the first tutorial will be a straight forward mission.  The player's fighter will start in a relatively clear section of space at a full stop.  There will be a planet in the distance, a visible relay station (space station) and the Battlestar Minoa (a Hermes class destroyer).  I might add some asteroids; however, I want to avoid using asteroids as a crutch for reference material.  The mission will progress as follows:

Full stop (no player control)
Voice over describing the parameters of mission
Voice over for initial instructions (Turn Left)
Transfer control to player
Voice over confirmation (Turn Left)
Voice over instruction (Turn Right)
Voice over confirmation (Turn Right)
Voice over instruction (Find first waypoint)
Voice over confirmation (Found first waypoint)
Voice over description of thrusting controls
Voice over instruction (Forward Thurst)
Voice over confirmation (Forward Thrust)
Voice over instruction (Zero Thrust)
Voice over description of turning with existing momentum
Voice over instruction (Turn Any)
Voice over confirmation (Turn Any)
Trigger Changed Waypoint
Voice over instruction (Turn to waypoint)
Voice over confirmation (Turn towards waypoint)
Voice instruction (Forward Thrust)
Voice over confirmation (Forward Thrust)
Voice over instruction (Keep the waypoint in front)
Trigger failed to keep waypoint in front (Voice over admonishment)
Trigger Changed Waypoint
Voice over instruction (Turn to next waypoint)
Voice over confirmation (Turn towards next waypoint)
Voice description of stopping the fighter
Trigger Changed Waypoint
Voice over instruction (Full Stop)
Voice over confirmaton (Full Stop)

End Tutorial Mission

This will be the first tutorial mission.  I forsee that the voice overs will be in the generic event manager.  In addition, some (if not all) of the trigger events (like the changed waypoint) will be in the generic event manager. 

Future tutorials will get more in depth in the fighter's flight controls; however, is there anything else that should be added to the initial tutorial mission?

Tuesday, July 10, 2012

Incorporating the Waypoint Features

I just finished the waypoint manager and have come to the realization that the fighter AI will need significant reworking to function with the new waypoint manager.  It's not a complete rewrte; there are many key functions that will remain in place with minor changes.  The primary change is in the logic flow.

First the logic flow is not intuitive and is very disorganized on a design level.  Second, the intercept routines will become the primary driver.  Currently, there are any number of "intercept" routines.  These will be consolidated into a two intercept routines (one for turning; one for thrust) and two avoidance routines (one for turning; one for thrust).  Each of these routines will accept a Transform variable.  The waypoint manager will just pass the waypoint's Transform to facilitate movement.  In addition, other Transform variable can be passed to intercept routines. 

The new outline will be:

1.      Initialize global variables
a.      Add an avoidance Transform variable
b.      Add an avoidance flag with a default value of false
c.      Add an escape flag with a default value of false
2.      Target selection
a.      Iterate through all targets in the DradisList
                                                    i.     Check for collision zones
                                                   ii.     Catalogue eligible targets into a target list (limited to five targets) using range and direction parameters
b.      If the fighter is in a collision zone or if there is a collision alert via raycasting in front of the ship
                                                    i.     Calculate avoidance transform position
                                                   ii.     Set movement Transform variable to avoidance Transform calculated by this routine
                                                  iii.     Set the avoidance flag to true
c.      If fighter has sufficient fuel (less than 10% fuel), has ammo and is combat capable (greater than 25% structure remaining) execute maneuvering routines.
                                                    i.     Selecting a target from the target list
1.      If the target list is empty
a.      If there is a mission target
                                                                                                                i.     Set mission target as current target
                                                                                                               ii.     Set the escape flag to false
2.      If the target list is not empty
a.      Calculate probability baseline by adding an iteration of the targets in the target list (5+4+3+2+1 = 15).
b.      Generate a random number based on baseline number (1-15)
c.      Calculate number of item selected by iterating through the number of targets in the target list (1-5 = 1, 6-10 = 2, etc…)
d.      Make the target associate with calculated number the current target
e.      Set the escape flag to false
                                                   ii.     If the current target is null
1.      If there is a waypoint in the waypoint data script
a.      Set the current target to the waypoint’s Transform
2.      Otherwise
a.      Set the current target to the closest friendly carrier ship
b.      Set the escape flag to true
d.      Otherwise
                                                    i.     Set the current target to the closest friendly carrier ship’s approach point
                                                   ii.     Set the escape flag to true
e.      If there’s an avoidance flag
                                                    i.     If the escape flag is true
1.      If the avoidance target is equal to the root transform of the current target
a.      Set the avoidance target to null
b.      Set the avoidance flag to false
3.      Maneuver the ship
a.      If the avoidance flag is true
                                                    i.     Execute avoidance routine and pass the avoidance Transform variable
b.      Otherwise
                                                    i.     Execute the intercept routine and pass the current target
The current thrusting routines will not change; however, I do plan on making future changes to it.  Currently, the thrust routines just sets the thrust to maximum.  Future plans are to make the thrust setting more variable depending on situation.  This might entail another rewrite of the AI routines; I'll just have to tackle it when I'm ready to add this feature.

Sunday, July 8, 2012

Waypoint Manager Overview

The waypoint manager is next on the list for development.  It's a key feature in the game (and just about every flight simulator out there).  It does not need to be difficult; however, it needs to interact with multiple modules without any issues.  Many of these modules, like the HUD script and fighter AI script, are already written and need to incorporate the new waypoint system without interfering with the current scripts.  The waypoint system will consist of a waypoint manager and a series of physical waypoints. 

The waypoint manager will manage the waypoint system.  It will keep a list of fighters (and/or capital ships) that can use the system (to keep colonial forces from using cylon waypoints and vice versa).  Referencing the waypoint manager,will unlock access to the series of waypoints attached to the manager.

Each waypoint will be a physical sphere with a collider turned into a trigger.  As a fighter enters the waypoint, it triggers a waypoint update that affects other scripts (like the fighter AI script).  As a NPC fighter enters waypoint #1, the AI routines update to travel to waypoint #2.  In addition, the waypoint system needs to be robust enough to include non-waypoint positions into the system.  For example, the approach position for a landing bay associated with the Battlestar Galactica needs to be an acceptable parameter that can be passed to a fighter instead of an actual waypoint.  In addition, players like to skip waypoints at time.  If a player enters waypoint #2 (without triggering waypoint#1), the system needs to update to waypoint #3 without any issues.

The key scripts that will be affected by the waypoint system are the HUD script and fighter AI script.  In addition, the future event manager will rely on the waypoint system.  Integration into existing scripts should be a matter of addition (in case of the HUD) and replacement (in the case of the fighter AI).  The fighter AI is patched together and in need of redevelopment; this redevelopment will occur with the waypoint development. 

The basic variables need to create a waypoint system are:

List of fighters that can use the waypoints
List of waypoints

The basic methods and procedures are:

Add a fighter to the access list
Remove a fighter from the access list
Output a fighter from the access list

Add a waypoint
Remove a waypoint
Change a waypoint
Output (or find) a waypoint
  Output the curent waypoint
  Output the next waypoint

Waypoint entry trigger (which should output the next waypoint)

Beyond these parameters, I don't think much more will be needed for a decent waypoint sytem.  I might be wrong, and I may have to add variables and routines to the list.  However, I'll design the system based on these parameters.

Friday, July 6, 2012

Fighter AI Demo

This is a demo of the fighter AI in the Battlestar game.  It's a barebone AI, and I do plan on adding features to it in the future.  However, it should be sufficient for determining the needs for the upcoming event manager routines. 

I used Screenr, and it's not the best quality.  The video is choppier than the actual gameplay.  The basic mission parameters (not that this is an actual mission) is two Viper mk2 fighters against three Cylon mk2 Raiders.  These are relatively late game fighters and are much more responsive and agile than the early fighters (such as the Scorpion fighters that the player starts with). 


Overall, the game is progressing as expected despite a full class load.  The current plan is to finish the landing and escape routines for the fighter AI (these aren't in the demo).  After that, I will create a sound manager, a waypoint system and create the first tutorial mission in conjunction with creating the first event manager (and fleshing out the resource manager concurrently). 

Tuesday, July 3, 2012

Outline of Game Progression

Due to the recent playtest, I probably should cover the basics for game progression.  The game progression can be broken into to three distinct categories: the tutorial, the fighter progression and the rank progression.


The tutorial, at least it appears at this point, will be missions dedicated to the training of new pilots.  These missions will be relatively specialized and will probably not be reused later in the game.  I dislike the idea of non-reusuable code; however, it's a necessity.  The tutorials will be broken down into two categories: Basic Flight School and Combat Flight School. 

Basic Flight School will represent the training any pilot will receive to fly a spacecraft.  These mission will include: basic physics (turn, thrust and familiarity with the game physics), landing, utilizing the radar, basic weapon control (guns, missiles and countermeasures) and waypoint navigation.  These tutorials will be conducted in a Scorpion class fighter (Mark 1).  This fighter will have a relatively slow turning rate and less thrust than the Viper fighter craft currently represented in the game. 

Combat Flight School will represent training needed for combat pilots in the Colonial Fleet.  Like the Basic Flight School, these missions will involve flying a Scorpion Class Fighter (Mark 1).  Missions will include: evasive manuevering, special attack manuevers (strafing, zero thrust attacks and burst fire), multiple craft combat, battlestar engagements and advanced landing techniques (landing on a moving platform).  In addition, there will be a capstone tutorial mission.  This mission will involve a blown tutorial mission; the player will be forced into actual combat with Cylon Raiders. 

Upon completion of the tutorial missions, the player will be able to select his or her first real assignment from a list of battlestars (limited to smaller destroyer class vessels), assigned a Scorpion Class Fighter and awarded the rank of Ensign (maybe Lieutenant depending on the performance during the tutorials).

Fighter Progression

Fighters in the game will serve two purposes.  First, they represent a player's progression and achievement in the game.  With the acquisition of prestige, the player will be able to select more advanced fighters in the game and gain a sense of accomplishment.  Second, the fighter progression gradual increase the player's skills.  The Scorpion Class Fighter (Mark 1) is a relatively slow (both in turning power and overall thrust) to the more advanced Viper; consequently, it is an easier fighter to fly.  It does not require as much player skill as the more advanced fighters.

Here is the basic fighter progression:

Scorpion mk1 (slowest turn rate and thrust power)
Scorpion mk2 (slightly improved turn rate, thrust power and structure)
Viper mk1 (another improvement representing a significant increase in turning power and thrust)
Viper mk2 (most advanced fighter)
Viper mk3 (a tank version; slower turn and thrust; has a significant advantage in structure)

Each ship progression will push the player's skill to improve.  The Scorpions will be relatively easy to control due to their turn and thrust limitations.  The Vipers will be more challenging to players.  These fighters will be extremely responsive and will require more from the player to fly properly.

Rank Progression

Like fighter progression, rank progression has the same two purposes: give a player a sense of achievement and train the player for more difficult tasks.  As a player increases in rank, missions will become more difficult.  This difficulty will be achieved through a changing dynamic in mission goals and enemies.  Early ranks will involve missions with a great deal of support.  Player will fly missions involving defense of a mission target and will receive support from non-player fighters (either immediately or over a period of time).  Later ranks will involve more offensive mission objectives with diminishing support from non-player fighters. 

The current rank structure is:


In addition, there are two (at least) other ranks not available to players.  These are: