Friday, January 31, 2014

Scan-Line Re-Render

CLICK HERE --> Deviant Art Screen Caps <-- CLICK HERE

Thought: Scan-Line re-render effect:
Rather than draw the entire pre-baked lighting map to the screen at once,
draw strips.

Variables:
1. movesHorizontal:Boolean //vertical or horizontal scan line
2. lineThickness:int //how thick is the scan-line bar?
3. pixelOffsetPerDrawCall:int //how fast does the scan-line bar move each draw call?

This could also be done with the tilemap.

I like this idea, because it could:
1. Be an effect that makes the game MORE efficient when applied. (Less is more approach)
2. Cause the lights in the game to NOT all flicker in sync.

I can also add this control to the lighting tool for Matt so he can alter these values.


In other news:
I made a tool for my artist that exports and imports .JSON file settings for the lighting.
It is a tool that allows my artist to edit the lighting while in game so we can start tweeking the lighting.

Other thought:
I want to be able to have a fractalize mode in the game so I can post screen shots of the game
as fractal art to get more views on deviant art.

CLICK HERE --> Deviant Art Screen Caps <-- CLICK HERE

Monday, January 27, 2014

Lighting Work and TODO

The lighting is a bit over-kill and distracting.
One of my marketing strategies is
"Make it shiny and people will play."

However, that shinyness cannot interfere with the gameplay.
The lighting is creating too much visual clutter.
One idea Matthew has is to put the tile-map in front of the lighting system.
And interesting idea building on Matt's idea:
What if the tiles were semi-transparent and on top of the lighting system?

On another note, thinking up mini-game ideas for the pre-loader.
My constraint:
The entire mini-game must be within it's own minigame folder in my code base.
The mini-game must NOT use code from any other [codebase / folder].
It has to all be encapsulated so we know exactly how big the minigame is.

Goal of the minigame:
1. To be distracting while the preloader runs.
2. To be somewhat unique.
3. To be scoped/planned out 100% BEFORE CODING.
Usually I would disagree with this non-scrum approach,
but the mini-game should be very small and scoped very small.
It is not there to be a piece of excellence.
4. Be able to sell the mini-game on ActiveDen.
Kind of like how this game is being sold: 
http://activeden.net/item/match-3-game-engine/5199380


My personal TODO for today:
1. Get game refactored and working again.
2. Implement [Indigo/Titanium] tile-set for Josh.
3. Start Planning out dimensions of mini-game.

Friday, January 24, 2014

Color Refactor progress

Our game works by linking different pixel values to different tiles values. Among other things.
package JM_LIB.graphics.color.constants 
{
 import flash.utils.Dictionary;
 import JM_LIB.graphics.color.constants.colorConstHelper.ColorConstHelper;
 import JM_LIB.graphics.color.UintRGBandBackConverter;
 
 /**
  * ...
  * 
  * Working out the patterns for what bit patterns will create what colors:
  * 
  * 3 bits.
  RGB
  FFF == white
  000 == black

  4 bits:
  RGB D == dark RGB pure-hue color.
  000 D == dark grey
  FFF D == light grey
  000 0 == black
  FFF 0 == white

  5 bits:---------------------------------------------------------------
  D = make it dark if bit is set.
  T = shift to tertiary if bit is set.
  RGB D S

  RGB D 0 == dark RGB pure-hue color.
  000 D 0 == dark grey
  FFF D 0 == light grey
  000 0 0 == black
  FFF 0 0 == white

  RGB D T == dark tertiary.

  000 D T == dark dark grey
  FFF D T == light light grey
  000 0 T == DARK middle-grey
  FFF 0 T == LIGHT middle-grey

  [W]   [LG]   [DG]   [B]

  * @author 
  */
 public class PNGColorConstants 
 {
  
  public function PNGColorConstants() { };
  
  
  //                               __RR____
  public static const RED:uint = 0xFFFF0000;
  //                                          __RRgg__
    public static const ORANGE:uint = 0xFFFF8000;   //more red than green.
  //                                      __RRGG__
   public static const YELLOW:uint = 0xFFFFFF00;
  //                                        __rrGG__
    public static const LIME:uint = 0xFF80FF00; //more green than red.
  //                                 ____GG__
  public static const GREEN:uint = 0xFF00FF00;
  //                                        ____GGbb
    public static const TEAL:uint = 0xFF00FF80;  //more green than blue. Use "TEAL" instead of "MINT".
  //                                    ____GGBB
   public static const CYAN:uint = 0xFF00FFFF;
  //                                       ____ggBB
    public static const SKY:uint = 0xFF0080FF;   //more blue than green
  //                                ______BB
  public static const BLUE:uint = 0xFF0000FF;
  //                                          __rr__BB
    public static const INDIGO:uint = 0xFF8000FF;  //more blue than red //Used to be called PURPLE
  //                                       __RR__BB
   public static const MAGENTA:uint = 0xFFFF00FF;
  //                                           __RR__bb
    public static const FUCHSIA:uint = 0xFFFF0080; //more red than blue //used to call this one FUSCHIA
                                                  //Having a hard time with this one. Decided to call it FUCHSIA again.
     
                 
  //                                   __RR____
  public static const DARKRED:uint = 0xFF800000;
  //                                              __RRgg__
    public static const DARKORANGE:uint = 0xFF804000;   //more red than green.
  //                                          __RRGG__
   public static const DARKYELLOW:uint = 0xFF808000;
  //                                            __rrGG__
    public static const DARKLIME:uint = 0xFF408000; //Lime == more yellow than green. more GREEN than RED.
  //                                     ____GG__
  public static const DARKGREEN:uint = 0xFF008000;
  //                                            ____GGbb
    public static const DARKTEAL:uint = 0xFF008040;  //more green than blue. Use "TEAL" instead of "MINT".
  //                                        ____GGBB
   public static const DARKCYAN:uint = 0xFF008080;
  //                                           ____ggBB
    public static const DARKSKY:uint = 0xFF004080;   //more blue than green
  //                                    ______BB
  public static const DARKBLUE:uint = 0xFF000080;
  //                                              __rr__BB
    public static const DARKINDIGO:uint = 0xFF400080;  //more blue than red //Used to be called PURPLE
  //                                           __RR__BB
   public static const DARKMAGENTA:uint = 0xFF800080;
  //                                              __RR__bb
    public static const DARKFUCHSIA:uint = 0xFF800040; //more red than blue //used to call this one FUSCHIA
                                                  //Having a hard time with this one. Decided to call it FUCHSIA again.
                 
                 
                 
                 
  //-----------------------------------------------------//
    public static const WHITE     :uint = 0xFFFFFFFF;
    public static const BLACK     :uint = 0xFF000000;
    public static const LIGHTGREY :uint = 0xFFC0C0C0; //0xC0 == 192 (128 + 64)
    
    public static const INVISIBLEMIDDLEGREY      :uint = 0xFF808080; //0x80 == 128
    
    public static const DARKGREY  :uint = 0xFF404040; //0x40 == 64  (128 - 64)
    
    /** Light-Light Grey **/
    public static const LLGREY    :uint = 0xFFE0E0E0; //0xE0 == 224 (192 + 32)
    
    /** Dark-Dark Grey **/
    public static const DDGREY    :uint = 0xFF202020; //0x20 == 32  ( 64 - 32)  AKA (64/2)
    
    
    public static const DARKMIDDLEGREY :uint = 0xFF606060; //0x60 == 96  (128 - 32)
    public static const LIGHTMIDDLEGREY:uint = 0xFFA0A0A0; //0xA0 == 160 (128 + 32)
  //-----------------------------------------------------//
  
  private static var _workingVec:Vector.;
  private static function append(inHexColor:uint, inColorIndex:int, inColorKey:String, inColorName:String):void
  {
   var cHelp:ColorConstHelper = ColorConstHelper.make(inHexColor, inColorIndex, inColorKey, inColorName);
  }
  
  /** 3 Bits. RGB one for each color channel that makes up a pixel **/
  private static function make3BitColorKey():Vector.
  {
   var out:Vector. = new Vector.();
   _workingVec = out;
   //BLACK
   append(BLACK, 0, "K", "BLACK");
   
   //PRIMARY:
   append(RED  , 1, "R", "RED");
   append(GREEN, 2, "G", "GREEN");
   append(BLUE , 3, "B", "BLUE" );
   
   //WHITE:
   append(WHITE, 4, "W", "WHITE");
   
   //SECONDARIES:
   append(CYAN   , 5, "C", "CYAN" );
   append(MAGENTA, 6, "M", "MAGENTA" );
   append(YELLOW , 7, "Y", "YELLOW" );
   
   return out;
  }//make3BitColorKey
  
  /** 4Bits: RGB-D D for bit flag to make the color dark or not. **/
  private static function make4BitColorKey():Vector.
  {
   var out:Vector. = make3BitColorKey();
   _workingVec = out;
   
   //greys:
   append(LIGHTGREY, 8, "E", "LIGHTGREY");
   append(DARKGREY , 9, "e", "DARKGREY" );
   
   //dark versions of primaries:
   append(DARKRED  , 10, "r", "DARKRED");
   append(DARKGREEN, 11, "g", "DARKGREEN");
   append(DARKBLUE , 12, "b", "DARKBLUE");
   
   //dark versions of secondaries:
   append(DARKCYAN   , 13, "c", "DARKCYAN");
   append(DARKMAGENTA, 14, "m", "DARKMAGENTA");
   append(DARKYELLOW , 15, "y", "DARKYELLOW");
   
   return out;
  }//make4BitColorKey
  
  private static function make5BitColorKey():Vector.
  {
   var out:Vector. = make4BitColorKey();
   _workingVec = out;
   
   //greys:
   append(LLGREY,          16, "w", "LLGREY"); //W==White. w==Light-Light Grey.
   append(DDGREY,          17, "k", "DDGREY"); //K==Black. K==Dark-Dark Grey.
   append(LIGHTMIDDLEGREY, 18, "X", "LIGHTMIDDLEGREY");
   append(DARKMIDDLEGREY , 19, "x", "DARKMIDDLEGREY");
   
   //tertiary colors:
   append(ORANGE , 20, "O", "ORANGE"); //Capitol "OWE".
   append(LIME   , 21, "L", "LIME");
   append(TEAL   , 22, "T", "TEAL");
   append(SKY    , 23, "S", "SKY" );
   append(INDIGO , 24, "I", "INDIGO");
   append(FUCHSIA, 25, "F", "FUCHSIA");
   
   //DARK tertiary colors:
   append(DARKORANGE , 26, "o", "DARKORANGE"); //letter OWE. NOT number zero.
   append(DARKLIME   , 27, "l", "DARKLIME");  //letter "lowercase L" not "1".
   append(DARKTEAL   , 28, "t", "DARKTEAL");
   append(DARKSKY    , 29, "s", "DARKSKY" );
   append(DARKINDIGO , 30, "i", "DARKINDIGO");
   append(DARKFUCHSIA, 31, "f", "DARKFUCHSIA");
   
   return out;
  }//make5BitColorKey
  
  public static function getMasterColorKeyList():Vector.
  {
   var out:Vector. = make5BitColorKey();
   colorListIntegrityCheck( out );
   return out;
  }
  
  /** Uses dictionarys to make sure all the values are UNIQUE **/
  private static function colorListIntegrityCheck(inLST:Vector.
  {
   //Checks to make sure your data starts at zero and is sequential.
   var lowestIndex:int = int.MAX_VALUE;
   var hightestIndex:int = int.MIN_VALUE;
   var numItems:int = 0;
   
   /** Dictionary of hex values. EX: 0xFFFF0000 **/
   var hexDict   :Dictionary = new Dictionary();
   
   /** Dictioanry of index values "1","2",3" **/
   var dexDict   :Dictionary  = new Dictionary();
   
   /** Dictioanry of character key values. EX: "O","B","R" **/
   var keyDict   :Dictionary = new Dictionary();
   
   /** Dictioanry of name values: EX: ORANGE, BLUE, RED **/
   var namDict   :Dictionary = new Dictionary();
   
   //Check to make sure we are not using duplicate values anywhere in our color key:
   var cch:ColorConstHelper;
   for (var i:int = 0; i < inLST.length; i++)
   {
    cch = inLST[i];
    
    if (cch.colorIndex != i)
    {//colorIndex same as vector position?
     //We are imposing this constraint so that PNGColorMapNoAlpha can use the inLST for
     //easy lookup of data based on the color index value. 
     throw new Error("The color index should match up with it's index within the vector");
    }//colorIndex same as vector position?
    
    numItems++;
    if (cch.colorIndex > hightestIndex) { hightestIndex = cch.colorIndex; }
    if (cch.colorIndex < lowestIndex  ) { lowestIndex   = cch.colorIndex; }
    
    //hex color check:
    if (hexDict[ cch.hexColor ] == true ) { doError("duplicate hex colors"); }
    hexDict[ cch.hexColor ] = true;
    
    //index value checK:
    if (dexDict[ cch.colorIndex ] == true ) { doError("duplicate color index values"); }
    dexDict[ cch.colorIndex ] = true;
    
    //key name check:
    if (keyDict[ cch.colorKey ] == true ) { doError("duplicate color key values"); }
    keyDict[ cch.colorKey ] = true;
    
    //color name check:
    if (namDict[ cch.colorName ] == true ) { doError("duplicate color name values"); }
    namDict[ cch.colorName ] = true;
   }
   
   if (lowestIndex != 0)
   {
    var er:String = "";
    er += "the lowest index should always be zero! Else plugg";
    er += "ing this info into a vector becomes problematic.";
    throw new Error( er);
   }//low check.
   
   if (hightestIndex != (numItems - 1) )
   {
    var e2:String = "";
    e2 += "the highest index should be number of items minus 1.";
    e2 += "otherwise, we probably have HOLES in the ordering of our indicies.";
    e2 += "holes makes it problematic to pack constants into a vector for quick lookup.";
    throw new Error(e2);
   }//high check.
   
   CONFIG::debug { trace("Success!");}
  }//colorListIntegrityCheck
  
  private static function doError(inErrorMessage:String):void
  {
   throw new Error( inErrorMessage );
  }
  
 }//class
}//package

Monday, January 20, 2014

Uint Color Converter Utility

This was long overdue to program, as I have this code inlined in many places. Where performance is not critical, it would be good to use this utility.
package JM_LIB.graphics.color 
{
	/**
	 * Basic color conversion that I do far too often. Tired of retyping all the time.
	 * Use this class when you do not require optimized color conversions.
	 * @author 
	 */
	public class UintRGBandBackConverter 
	{
		//Each time a function is called, all of these variables are set to properly correlate
		//to the correct color type.
		public static var color:uint;
		public static var colorNoAlphaChannel:uint;
		public static var alphaAsPercentage:Number;
		public static var a:int;
		public static var r:int;
		public static var g:int;
		public static var b:int;
		
		public function UintRGBandBackConverter() 
		{
			
		}
		
		public static function convertUintColor(inColor:uint):void
		{
			//extract each color:
			a = (inColor >> 24) & 0xFF;
			r = (inColor >> 16) & 0xFF;
			g = (inColor >> 8 ) & 0xFF;
			b = (inColor >> 0 ) & 0xFF;
			
			//So color and colorNoAlpha can be set:
			convertARGBColor(a, r, g, b);
			
		}
		
		/** Returns uint color WITH alpha channel **/
		public static function convertARGBColor(inA:int, inR:int, inG:int, inB:int):uint
		{
			a = inA;
			r = inR;
			g = inG;
			b = inB;
			color = ((a << 24) | (r << 16) | (g << 8) | (b << 0));
			colorNoAlphaChannel = ((0x00 << 24) | (r << 16) | (g << 8) | (b << 0));
			alphaAsPercentage = (a / 255);
			
			return color;
		}//convertARGBColor
		
		
	}//class
}//package

Tuesday, January 14, 2014

Auto-Generated Level Embedd Code in AS3

I finally finished it. My Development Version of the game now can output AS3 Code to a text file.
This AS3 Code corresponds to the necessary code-lines to embed the levels currently loaded into
the game into an AS3 "level pack" code file.

Here is the output from the current levels that are in the development version.
Seems Embedd is only spelled with one "D"? I am not refactoring that. That's how I've always spelled it.
NOTE: Though there isn't any complex logic to the code below, it would be a hell of a lot to type.
I think it was worth the 4 hours of coding.
------------------------------------------------------------------------------

///--/// Embedd Tags: ///--///
//Auto-Generated Embedd Tags Start:
//tags for level pack:
[Embed(source = 'levelMap00.PNG')]private static var levelMap00:Class;
[Embed(source = 'levelMap12.PNG')]private static var levelMap12:Class;
[Embed(source = 'levelMap13.PNG')]private static var levelMap13:Class;
[Embed(source = 'levelMap14.PNG')]private static var levelMap14:Class;
[Embed(source = 'levelMap15.PNG')]private static var levelMap15:Class;
[Embed(source = 'levelMap16.PNG')]private static var levelMap16:Class;
[Embed(source = 'levelMap17.PNG')]private static var levelMap17:Class;
[Embed(source = 'levelMap18.PNG')]private static var levelMap18:Class;
[Embed(source = 'levelMap19.PNG')]private static var levelMap19:Class;
[Embed(source = 'levelMap20.PNG')]private static var levelMap20:Class;
[Embed(source = 'levelMap21.PNG')]private static var levelMap21:Class;
[Embed(source = 'levelMap22.PNG')]private static var levelMap22:Class;
[Embed(source = 'levelMap23.PNG')]private static var levelMap23:Class;
[Embed(source = 'levelMap24.PNG')]private static var levelMap24:Class;
[Embed(source = 'levelMap25.PNG')]private static var levelMap25:Class;
[Embed(source = 'levelMap26.PNG')]private static var levelMap26:Class;
[Embed(source = 'levelMap27.PNG')]private static var levelMap27:Class;
[Embed(source = 'levelMap28.PNG')]private static var levelMap28:Class;
[Embed(source = 'levelMap29.PNG')]private static var levelMap29:Class;
[Embed(source = 'levelMap31.PNG')]private static var levelMap31:Class;
[Embed(source = 'levelMap32.PNG')]private static var levelMap32:Class;
[Embed(source = 'levelMap33.PNG')]private static var levelMap33:Class;
[Embed(source = 'levelMap34.PNG')]private static var levelMap34:Class;
[Embed(source = 'levelMap35.PNG')]private static var levelMap35:Class;
[Embed(source = 'levelMap36.PNG')]private static var levelMap36:Class;
[Embed(source = 'levelMap37.PNG')]private static var levelMap37:Class;
[Embed(source = 'levelMap38.PNG')]private static var levelMap38:Class;
[Embed(source = 'levelMap39.PNG')]private static var levelMap39:Class;
[Embed(source = 'levelMap40.PNG')]private static var levelMap40:Class;
[Embed(source = 'levelMap41.PNG')]private static var levelMap41:Class;
[Embed(source = 'levelMap42.PNG')]private static var levelMap42:Class;
[Embed(source = 'levelMap43.PNG')]private static var levelMap43:Class;
[Embed(source = 'levelMap44.PNG')]private static var levelMap44:Class;
[Embed(source = 'levelMap45.PNG')]private static var levelMap45:Class;
[Embed(source = 'levelMap49.PNG')]private static var levelMap49:Class;
[Embed(source = 'levelMap50.PNG')]private static var levelMap50:Class;
//tags for level pack: E
[Embed(source = 'levelMap00E.PNG')]private static var levelMap00E:Class;
[Embed(source = 'levelMap01E.PNG')]private static var levelMap01E:Class;
[Embed(source = 'levelMap02E.PNG')]private static var levelMap02E:Class;
[Embed(source = 'levelMap03E.PNG')]private static var levelMap03E:Class;
[Embed(source = 'levelMap04E.PNG')]private static var levelMap04E:Class;
[Embed(source = 'levelMap05E.PNG')]private static var levelMap05E:Class;
[Embed(source = 'levelMap08E.PNG')]private static var levelMap08E:Class;
[Embed(source = 'levelMap09E.PNG')]private static var levelMap09E:Class;
[Embed(source = 'levelMap10E.PNG')]private static var levelMap10E:Class;
[Embed(source = 'levelMap14E.PNG')]private static var levelMap14E:Class;
[Embed(source = 'levelMap15E.PNG')]private static var levelMap15E:Class;
[Embed(source = 'levelMap17E.PNG')]private static var levelMap17E:Class;
[Embed(source = 'levelMap18E.PNG')]private static var levelMap18E:Class;
//tags for level pack: P
[Embed(source = 'levelMap00P.PNG')]private static var levelMap00P:Class;
[Embed(source = 'levelMap01P.PNG')]private static var levelMap01P:Class;
[Embed(source = 'levelMap02P.PNG')]private static var levelMap02P:Class;
[Embed(source = 'levelMap03P.PNG')]private static var levelMap03P:Class;
[Embed(source = 'levelMap04P.PNG')]private static var levelMap04P:Class;
[Embed(source = 'levelMap05P.PNG')]private static var levelMap05P:Class;
[Embed(source = 'levelMap06P.PNG')]private static var levelMap06P:Class;
[Embed(source = 'levelMap07P.PNG')]private static var levelMap07P:Class;
[Embed(source = 'levelMap11P.PNG')]private static var levelMap11P:Class;
[Embed(source = 'levelMap12P.PNG')]private static var levelMap12P:Class;
[Embed(source = 'levelMap13P.PNG')]private static var levelMap13P:Class;
//tags for level pack: H
[Embed(source = 'levelMap00H.PNG')]private static var levelMap00H:Class;
[Embed(source = 'levelMap01H.PNG')]private static var levelMap01H:Class;
[Embed(source = 'levelMap02H.PNG')]private static var levelMap02H:Class;
[Embed(source = 'levelMap04H.PNG')]private static var levelMap04H:Class;
[Embed(source = 'levelMap05H.PNG')]private static var levelMap05H:Class;
[Embed(source = 'levelMap06H.PNG')]private static var levelMap06H:Class;
[Embed(source = 'levelMap08H.PNG')]private static var levelMap08H:Class;
[Embed(source = 'levelMap09H.PNG')]private static var levelMap09H:Class;
[Embed(source = 'levelMap10H.PNG')]private static var levelMap10H:Class;
[Embed(source = 'levelMap11H.PNG')]private static var levelMap11H:Class;
[Embed(source = 'levelMap12H.PNG')]private static var levelMap12H:Class;
[Embed(source = 'levelMap13H.PNG')]private static var levelMap13H:Class;
[Embed(source = 'levelMap14H.PNG')]private static var levelMap14H:Class;
[Embed(source = 'levelMap15H.PNG')]private static var levelMap15H:Class;
[Embed(source = 'levelMap17H.PNG')]private static var levelMap17H:Class;
[Embed(source = 'levelMap18H.PNG')]private static var levelMap18H:Class;
[Embed(source = 'levelMap19H.PNG')]private static var levelMap19H:Class;
//tags for level pack: T
[Embed(source = 'levelMap00T.PNG')]private static var levelMap00T:Class;
[Embed(source = 'levelMap01T.PNG')]private static var levelMap01T:Class;
[Embed(source = 'levelMap02T.PNG')]private static var levelMap02T:Class;
[Embed(source = 'levelMap03T.PNG')]private static var levelMap03T:Class;
[Embed(source = 'levelMap04T.PNG')]private static var levelMap04T:Class;
[Embed(source = 'levelMap05T.PNG')]private static var levelMap05T:Class;
[Embed(source = 'levelMap06T.PNG')]private static var levelMap06T:Class;
[Embed(source = 'levelMap07T.PNG')]private static var levelMap07T:Class;
[Embed(source = 'levelMap08T.PNG')]private static var levelMap08T:Class;
[Embed(source = 'levelMap09T.PNG')]private static var levelMap09T:Class;
[Embed(source = 'levelMap10T.PNG')]private static var levelMap10T:Class;
[Embed(source = 'levelMap11T.PNG')]private static var levelMap11T:Class;
[Embed(source = 'levelMap12T.PNG')]private static var levelMap12T:Class;
[Embed(source = 'levelMap13T.PNG')]private static var levelMap13T:Class;
[Embed(source = 'levelMap14T.PNG')]private static var levelMap14T:Class;
[Embed(source = 'levelMap16T.PNG')]private static var levelMap16T:Class;
[Embed(source = 'levelMap17T.PNG')]private static var levelMap17T:Class;

///--///Push Code: ///--///
//Auto-Generated Push-Level-Code Start:
//tags for level pack:
this.pushLevel("levelMap00", levelMap00);
this.pushLevel("levelMap12", levelMap12);
this.pushLevel("levelMap13", levelMap13);
this.pushLevel("levelMap14", levelMap14);
this.pushLevel("levelMap15", levelMap15);
this.pushLevel("levelMap16", levelMap16);
this.pushLevel("levelMap17", levelMap17);
this.pushLevel("levelMap18", levelMap18);
this.pushLevel("levelMap19", levelMap19);
this.pushLevel("levelMap20", levelMap20);
this.pushLevel("levelMap21", levelMap21);
this.pushLevel("levelMap22", levelMap22);
this.pushLevel("levelMap23", levelMap23);
this.pushLevel("levelMap24", levelMap24);
this.pushLevel("levelMap25", levelMap25);
this.pushLevel("levelMap26", levelMap26);
this.pushLevel("levelMap27", levelMap27);
this.pushLevel("levelMap28", levelMap28);
this.pushLevel("levelMap29", levelMap29);
this.pushLevel("levelMap31", levelMap31);
this.pushLevel("levelMap32", levelMap32);
this.pushLevel("levelMap33", levelMap33);
this.pushLevel("levelMap34", levelMap34);
this.pushLevel("levelMap35", levelMap35);
this.pushLevel("levelMap36", levelMap36);
this.pushLevel("levelMap37", levelMap37);
this.pushLevel("levelMap38", levelMap38);
this.pushLevel("levelMap39", levelMap39);
this.pushLevel("levelMap40", levelMap40);
this.pushLevel("levelMap41", levelMap41);
this.pushLevel("levelMap42", levelMap42);
this.pushLevel("levelMap43", levelMap43);
this.pushLevel("levelMap44", levelMap44);
this.pushLevel("levelMap45", levelMap45);
this.pushLevel("levelMap49", levelMap49);
this.pushLevel("levelMap50", levelMap50);
//tags for level pack: E
this.pushLevel("levelMap00E", levelMap00E);
this.pushLevel("levelMap01E", levelMap01E);
this.pushLevel("levelMap02E", levelMap02E);
this.pushLevel("levelMap03E", levelMap03E);
this.pushLevel("levelMap04E", levelMap04E);
this.pushLevel("levelMap05E", levelMap05E);
this.pushLevel("levelMap08E", levelMap08E);
this.pushLevel("levelMap09E", levelMap09E);
this.pushLevel("levelMap10E", levelMap10E);
this.pushLevel("levelMap14E", levelMap14E);
this.pushLevel("levelMap15E", levelMap15E);
this.pushLevel("levelMap17E", levelMap17E);
this.pushLevel("levelMap18E", levelMap18E);
//tags for level pack: P
this.pushLevel("levelMap00P", levelMap00P);
this.pushLevel("levelMap01P", levelMap01P);
this.pushLevel("levelMap02P", levelMap02P);
this.pushLevel("levelMap03P", levelMap03P);
this.pushLevel("levelMap04P", levelMap04P);
this.pushLevel("levelMap05P", levelMap05P);
this.pushLevel("levelMap06P", levelMap06P);
this.pushLevel("levelMap07P", levelMap07P);
this.pushLevel("levelMap11P", levelMap11P);
this.pushLevel("levelMap12P", levelMap12P);
this.pushLevel("levelMap13P", levelMap13P);
//tags for level pack: H
this.pushLevel("levelMap00H", levelMap00H);
this.pushLevel("levelMap01H", levelMap01H);
this.pushLevel("levelMap02H", levelMap02H);
this.pushLevel("levelMap04H", levelMap04H);
this.pushLevel("levelMap05H", levelMap05H);
this.pushLevel("levelMap06H", levelMap06H);
this.pushLevel("levelMap08H", levelMap08H);
this.pushLevel("levelMap09H", levelMap09H);
this.pushLevel("levelMap10H", levelMap10H);
this.pushLevel("levelMap11H", levelMap11H);
this.pushLevel("levelMap12H", levelMap12H);
this.pushLevel("levelMap13H", levelMap13H);
this.pushLevel("levelMap14H", levelMap14H);
this.pushLevel("levelMap15H", levelMap15H);
this.pushLevel("levelMap17H", levelMap17H);
this.pushLevel("levelMap18H", levelMap18H);
this.pushLevel("levelMap19H", levelMap19H);
//tags for level pack: T
this.pushLevel("levelMap00T", levelMap00T);
this.pushLevel("levelMap01T", levelMap01T);
this.pushLevel("levelMap02T", levelMap02T);
this.pushLevel("levelMap03T", levelMap03T);
this.pushLevel("levelMap04T", levelMap04T);
this.pushLevel("levelMap05T", levelMap05T);
this.pushLevel("levelMap06T", levelMap06T);
this.pushLevel("levelMap07T", levelMap07T);
this.pushLevel("levelMap08T", levelMap08T);
this.pushLevel("levelMap09T", levelMap09T);
this.pushLevel("levelMap10T", levelMap10T);
this.pushLevel("levelMap11T", levelMap11T);
this.pushLevel("levelMap12T", levelMap12T);
this.pushLevel("levelMap13T", levelMap13T);
this.pushLevel("levelMap14T", levelMap14T);
this.pushLevel("levelMap16T", levelMap16T); this.pushLevel("levelMap17T", levelMap17T);

Saturday, January 11, 2014

The new lighting is here:

How does it work?

Summary: It is 1 pre-baked lighting map that is quickly re-rendered when any given bucket become dirty.
This is done by slicing up images of lights into 16x16 chunks and placing each chunk into a cell on a grid
that is overlayed over the tilemap. When re-rendering of a light-source needs to be done, we only re-render
the cells that that light touches.

As an added efficiency bonus, each 16x16 image chunk has meta-data associated with it.
Including the highest and lowest RGB values. In this way I can additively blend together
stacks of lights in a given cell. Then when one light is deleted, I have TWO re-render options:


Option1: If no overflow is detected, SUBTRACT the bitmap you are deleting from the pre-baked lighting map.
Option2: If overflow exists, Re-Add all of the bitmap's with a given [cell/stack] on the grid.
         Then decide if the re-rendered stack is overflowing.

What do I mean by overflow?
If we have two pixels:
[200] AND [045]
And add them to get:
[245]
If we want to get back to [200], we can subtract [045]

HOWEVER, if we have two pixels:
[200] & [177]
And add them to get: [377]
Well.... RGB max value is 255... so it gets capped at 255. AKA. Overflow.
When overflow occurs, we cannot work backwards.
We cannot subtract [177] from [255] to get back to [200].

Monday, January 6, 2014

Sound Manager

I am trying not to code first and think later as of recent. A bit of planning is useful to avoiding easily foreseeable
complications in the future.


Should my Sound manager own the music tracks that are in the game?
Answer: Seems like a good idea.

Why should the sound manager own the music tracks, but not the soundFX?
Answer: This makes sense. As soundFX can be class/system specific.
For example, explosion SFX around bound to my explosion-grid system that manages
explosions in the game.


Where should music be derrived?
1. Add it to my assetRegistry, just like all the other assets.
Or
2. Add it to a special MP3 registry.

Arguments for 1:
PRO:
1: I already have the structure for this in place.
CON:
1: By coupling music with AssetRegistry, it may be tricky business to load all assets except the music,
   and then to delay music download until you need it. (Streaming Music or downloading more tracks while game plays)

Argument for 2:
PRO:
1: Can specially design the music registry to stream tracks of music.
2: Application re-skin can be done, without need of swapping music track references.
CON:
2: I have to do more coding to get this working.

I like #2 better.


SO...
1. The music manager WILL own the music tracks, but not the soundFX.
2. The music will go into a special musicRegistry that is separate from the assetRegistry so that
   music can be loaded AFTER you are already playing the game.
   A: How to I configure music loading so that at least one track is loaded during the pre-loader???

Monitoring Usage

Idea: Have paragraphs of text that are chained together. You must expand them one by one. This would force people to read the text in order. You could also monitor how many paragraphs the person read before they got bored and left your site. Other monitoring idea: My game should report back to a server and see what level people "quit" the game at. If I find any one level stand out, I will work on that level to make it more interesting or easier so more people get past that level. I could, optimize the game. People change their habits if they know they are being measured. Thus, to get the most accurate data, you need to find a way to measure behavior without them knowing.

Plasma Glow Blast Indicators Are Working

The blast indicators are now working in game. Only the bombs you are near in proximity to will have plasma-lights
emitted from them to help you visualize the blast area.

A quick summary on my own special termonology:
Lumen-Light : Basically, multiplicative blending to create lights that illuminate areas of the game.
Plasma-Light: Basically, additive blending to create white-hot glow on light sources.

Sunday, January 5, 2014

Callback Grid

Currently working on a "callback grid" that is basically a grid that overlays a tilemap.
We check to see when sprites occupy and exit the grid and call functions that take the tileX and tileY location of that
cell within the grid.

Intended usage:
A de-coupled system that can work with my lighting system to toggle on and off directional indicators around bombs in the game.

Design complication:
Should I keep track of which objects occupy certain grid space? Or should I simply know that the grid space is being
occupied by something?

Arguments:
Occupied by something:
1. Easier to program.
2. More straight forward with intended use. Any NPC or player can trigger helper indicators.

Occupied by specific object:
1. more complex
2. could use callbacks that take specific object as input.
3. How I would go about programming it is a bit more ambigious.
   What do I do when two objects occupy a cell, and the only ONE of them leaves that cell?

Thought:
I think I want to go with "Occupied by something" route.
It works for what I need NOW not what I MIGHT need in the future.
The design for it is more clear in my head (less abstract).
Overall... Just seems like less of a headache to code.

On another note: This game looks pretty cool. I should keep track of it.

http://playstarbound.com/media/

Thursday, January 2, 2014

Lighting Rendering Efficiencies

TODO: Debug function that lays a mine.
SO you can make sure glow around set mines is 
NOT being re-setup when destroying a light with your head.


Right now I am checking my lighting map for inefficiencies.
Everything looks correct, but I am suspicious that the lighting 
code may be re-rendering everything when one light breaks,
rather than only re-rendering the area affected by the broken light.