JS Help: Automatically point all external links to new tabs...

I was recently tasked with going through a site with around 50 pages to set a target of _blank to any external URL.  (one page had 240 external links)  Instead of going through the manual work of stepping through each CMS entry and CMS content part to find and change these, I added a short script to the foot of the site.  This is not a perfect duplicate, but its pretty close.

[Copy/Paste slows learning...]

This depends on JQuery and FontAwesome.  

Part 1: 
 - Waits for the document to complete.  (document ready)

Part 2: 
 - get the current URL that is constant to any links within this site.  

Part 3:
 - JQuery gets all the 'a' tags, and for each of them gets the 'href' tag.

Part 4:
 - if the href begins with "http" (an external link) and does not part of this site
 - - Then Add a target of _Blank to that link.  

Part 5: (optional)
 - w/FontAwesome, append an external icon to each link.


Lynda Course in Design: Unity 5 2D Procedural Terrain and Living AI

So I've recently been approved as an instructor for Lynda.com, and just had my initial course syllabus approved.  A 2D Infinite terrain AI.  I've worked with a variety of terrain systems, both 2D and 3D, limited to singular maps, and infinite expansions.  Back when I worked with XNA, I developed a terrain engine that requires very little work, no tileable textures, and develops rich terrains.

I did a few experiments to import the engine into Unity's 2D tile system, and had excellent results.  I'll be building the class around it.

The smooth infinite terrain is only the first 30-45 minutes.  Then we'll also cover biomes, cities, caves and building interiors.  We'll also cover techniques for balancing and managing the expense of saving vs the expense of AI processing.  I'm still working out some of the details now, but so far, I'm pleased with how easily everything is applying in Unity.

Anyway, this probably won't be ready to record for another month, and possibly another month of editing after that.  So hopefully by August it will be ready.


Unity3D - Swirl Demo

I'm working on a demo video, where I want to show how the lack of co-routine makes the web freeze up the game.  To do that, I just needed something smoothly moving around.

The code gives room for variation, to allow different angles, and the cubes use trail renderer.
using UnityEngine;
using System.Collections;

public class Orbit : MonoBehaviour {

 public GameObject Target;
 public Vector3 direction = Vector3.left;
 public float Speed = 0.1f;
 public bool Randomize = false;
 public float RandomizeMin = -0.5f;
 public float RandomizeMax = 0.5f;
 public float MaxDistance = 5;
 public float MinDistance = 1;
 void Update () {
  var shift = Vector3.zero;
  if (Randomize)
   shift = new Vector3(Random.Range (RandomizeMin, RandomizeMax),
        Random.Range (RandomizeMin, RandomizeMax) * Time.deltaTime,
        Random.Range (RandomizeMin, RandomizeMax));
  this.transform.Translate ((shift + direction) * Speed * Time.deltaTime);
  if (Vector3.Distance(Target.transform.position, transform.position) > MaxDistance)
   Debug.Log ("To Far");
   this.transform.position = this.Target.transform.position + Vector3.ClampMagnitude(
    this.transform.position - this.Target.transform.position,
  if (Vector3.Distance(Target.transform.position, transform.position) < MinDistance)
   Debug.Log ("To Close");
   this.transform.position = this.Target.transform.position + Vector3.ClampMagnitude(
    (this.transform.position - this.Target.transform.position) * 100,


Humming Bird AI

Hummingbird is an AI I've been working on that learns how to fly a ship on its own.  Starting with the engines, which try to determine a force to keep themselves afloat.  (at a particular altitude) Then it uses a stabilizer to manage the ship over all.  Then the stabilizer will reduce and strengthen the engines at various positions to tilt and move the ship to target locations.

Additionally, I felt inspired by http://BoxCar2D.com, which creates cars from random geometric shapes and attempts to drive them through random terrains.  Its travelling is simply based on spinning wheels that allow the vehicle to progress on a terrain.  A difference between our AI's, is that Box Car looks at the creation of the the vehicle, while Hummingbird looks at the control of the vehicle.  Here is an example of BoxCar2d:

I found Box Car almost mesmerizing, as you watch it randomly construct vehicles and try to get farther and farther with them.  I intend Hummingbird to also have this mesmerizing feel.  So far, its ship generation has been getting there, but it needs work still.

I've been working on raising community interest by running a kickstarter.  Keep in mind that this is still being shaped.  There are some basic pieces, but the end goal is not complete yet.  The kick starter has been 100% funded as of yet, and completes in 2 days from this posting.


At present, one of the difficulties I'm facing is aligning the parts of the ships, so my next test scenes will be focused on improving the ship construction dynamics, so the ships are less of blobs, and begin taking on more meaningful shapes.