Aug 31, 2012

Radar and Spawn

I have improve the targeting system with the following updates:

1. 3D Radar

 I have spent a short time to built a simple 3D pointing system 2-3 weeks back and now I have merged it under my targeting system. When the selected target is in view, the 2D lock system will work; if it is not in view, then the 3D pointing system will kick in to show the player where the target is. Standard stuff in jet combat game, there is nothing much to it.

I am thinking of using this system to warn player about incoming missiles or item/location of interest, but that is for another day in the coming future.
Target Selected

The radar will point to the target when it is not in view


2. Dynamic Target Addition and Marking

I am now able to add new target in run-time dynamically.

In AddTarget(), new target (which currently are of type Transform, this be will change soon) is added to the list in the targeting system; then a new marker is instantiated and attached to the target.


3. Spawn

To test the dynamic target addition and marking mentioned above, I have write a simple spawning script to spawn gameObject in the scene, the spawning mechanism then call AddTarget() using the new gameObject as parameter. As a result, the targeting system will recognize the spawned object as a active target and a new marker will be attached to it.

This spawning mechanism is so simple and effective, I think I will be using it in spawning enemies.
There are no active targets in scene.
Spawned targets are all marked properly.

Splash

 I will be working on the following for the weekend:

  • Completing the targeting system
    • Switch to 3D pointer when the selected target is out of view
    • Target management (flexible adding and removing list of targets)
    • Dynamic adding of markers when new target is listed in the system
  • Basic flight AI
Meanwhile, I have put up a quick screen splashing effect, this is to make player to avoid flying into debris field, this is still very basic, there is a whole list of improvements waiting to be implemented this visual feature:

Cube has not enter the splash zone (Spheres)

The cube entered the splash zone multiple time.

Aug 26, 2012

Updates: Missile & Raycast

Missile System
I have code in the limiter for the missile system. Now the missile system have limited amount of ammunition, and it has a reload time for each missile slot.
Bottom right is the missile display
I also use a texture and text to display how many missile I have and the status of the missile slot.

Raycast
I have built another function into my RayCheck class to check whether an object is in view and not behind any cover.

The Cube 'sees' the Sphere

The Cube does not 'sees' the Sphere.

Missiles, Speedometer, Patrol and Raycast

Missile System Integration

I have integrated the missile system and the targeting system into my jet. It is working fine, but I have yet to put a limiter on the missile firing; therefore I can fire unlimited amount of missiles, and I can fire them as fast as I can press my key, but this issue will be addressed later.
Targeting system in action.

Fire missiles at selected target


Speedometer
I created a floating speedometer to show the speed of the aircraft. I attached a empty object to my aircraft. I use codes to attached a GUITexture and GUIText to the empty object. The GUITexture's width and the GUIText's text is updated according to the current speed.

The aircraft is going at 30 unit / second!


Route & Patrol
I have referred to the patrol logic in the Unity demo: Angry Bot, and I have designed a more fluid patrol system.

Patrolling the checkpoints

  • Yellow : Checkpoint and checkpoint's radius
  • Blue : Connector between checkpoints
  • Green: The connector that link the last checkpoint back to the first checkpoint
  • Purple: The designated point for the subject
  • White: The forward-orientation of the subject
In the patrol logic that is used by the Angry Bots, the patrol path of the subject is more rigid. In my take of the patrol system, I uses the radius of the checkpoints to control how soon the subject will switch to next patrol point: Checkpoint with larger radius will make the subject switch to next checkpoint sooner.

Furthermore, I take it a step further by using a smooth rotation to make the subject to follow a smooth path when patrolling the route. At each Update(), the subject will try to rotate to its designated point ( in layman's term, aligning the white line with the purple line ), but I limit how far the subject can rotate, therefore the rotation to realignment is a smooth and slow process.

This system will be used for enemy AI craft in their idle state. I have think of some other possible application in this system, but I will not be looking into it for now.

Ray cast
Ray casting is a process of determining whether a ray intersects with any object in 3D space (further reading); Common applications of ray casting are:

  • FPS: Firing a gun will initiate a ray cast, if the ray intersects any enemy, damage calculation is then performed on the enemy
  • Enemy AI's vision: Enemy 'sees' the player by pointing a ray cast at the player, if the ray cast hit a object that is not the player, then the enemy does not 'sees' the player.

I have used a wrapper code to simplify the usage of Physics.Raycast in Unity:
RayCheck.js
The Check() is applicable in identifying obstacles and Within() is applicable in determining whether a object is within range of a specific weapon. I will be putting in enemy-vision + cover-system within 2 days.



  • Red: Where we are looking at (Field of vision)
  • Blue: Subject is within the range of  the Field of vision
I will not go into details on how ray-cast works and how my wrapper code works; but I want to say this wrapper code will simplify the ray-cast process and it will serve an important role in my enemy AI system.


Aug 21, 2012

Aim, Lock and Fire!



I am successful in combining both the ejection system and the targeting system. It will working well so far, but I will be testing it for another day or two. I take serious precautions on this as this system will form the basis for all the weapons in the game, I will make sure that these codes are working properly and they are both adaptable and reliable. 

For now, this is what I got:
Lock-on and fire away!

Step 1: Lock-on a new target;     Step 2: Fire;     Step 3: Repeat Step 1 and 2

Missiles fired will fly blind if no target is locked on (Idle missile have no ring-HUD attached to them)

Aug 20, 2012

Target Seeking Missile


I have built a proper missile that is capable of tracking and following a target (the tracking is limited, this will make sure that my missile is not some sort of super-missile that can strike from any angle); if no target is assigned to it, it will fly in a straight line.

Visual element are added to help player to see the missile better
Besides that, I have built a prototype on target markup system, this system will color the target-marker of viable target in red, and the remaining in white. The viability is decided by the distance of the marker from the center of the screen, but later I might used the orientation checking from my missile to make sure that if my missile fires, it will be able to track the target, this may increase/decrease the radius of the strike zone, but I will left it as it is for now.
Red targets are more susceptible to a strike 
I have built in a target selection system on top of the target markup system. The system allows me to lock on one of the visible targets in screen. If the target is not visible on the screen, the lock will stay (I will merge in a 3D target pointing system to point to out-of-screen target, this will make it more usable and practical) until another target is selected (but the previously-locked-on target will not be select-able as it is not visible anymore).
The yellow marker denotes which target is locked on.


Aug 19, 2012

After 10 days

My progress after 10 days
I have built the following:
  • Jet Control
    • Yaw, pitch, roll
    • Afterburner
  • Weapon
    • Cannon
  • HUD
    • Target Mark
    • Cannon Mark
  • Misc
    • Various Effects
      • Spark
      • Light Flares
      • Rocket Emission
    • Smooth Camera

I will be finishing the following features as my next step:
  • Missile System
  • Targeting System
    • Select target
    • Target in missile range checking
  • HUD
    • Speed Display
  • Upgrade afterburner
    • Limit afterburner time
    • Recharge afterburner


Picture Walkthrough
I have been using a simpler model for my earlier work in Blender in Unity. I built this whole new model yesterday and textured it today to fit the tone of the game.

The Jet
UV Unwrapping and Texturing of the Jet

These two are the test scene I have been using since the beginning of this project. The first scene is for testing the cannon and aiming system; while the second is for testing the jet controlling and maneuvering.
Fire!
The Afterburner!
I am now focusing on the missile system, which will include:

  • Ejection
  • Target Seeking
  • HUD Aim
  • HUD Target Picking

Visual representation of a missile's path

State machine for 3 phase of an active missile: Ejection, Seeking, Idle

Aug 11, 2012

Pilot

I am currently doing a project using Unity3D. This project will last about 10 - 12 weeks, as I will be presenting it before my study leave for my last semester.

I will be creating a space-jet-fighter game using the following tools:
  • Unity3D 3.5
  • Blender 2.62
  • Gimp 2.8
Things that I hope that I will be putting in the system:
  • General fighter-combat (dogfight)
  • Chasing mission
  • Escaping mission
  • Obstacle Course mission
  • Upgrades/Equipment
  • Weapon system
    • Gun
    • Missile
    • Flares
  • Select different jet
As I'm now still in prototyping and design phase, there is nothing much for me to say for now. I will try to publish new posts every few days. Most probably, I will not build it to be realistic (so my jet will have wings and they will be used to maneuver, even though it is impossible to do so in space).